Commit 2219108c authored by fallenstardust's avatar fallenstardust

从jni获取最后分类

parent 5908e795
...@@ -483,14 +483,14 @@ public class AppsSettings { ...@@ -483,14 +483,14 @@ public class AppsSettings {
} }
/*** /***
* 最后卡组名 * 获得最后卡组名
*/ */
public String getLastDeck() { public String getLastDeck() {
return mSharedPreferences.getString(Constants.PREF_LAST_YDK, Constants.PREF_DEF_LAST_YDK); return mSharedPreferences.getString(Constants.PREF_LAST_YDK, Constants.PREF_DEF_LAST_YDK);
} }
/*** /***
* 最后卡组名 * 保存最后卡组名
*/ */
public void setLastDeck(String name) { public void setLastDeck(String name) {
if (TextUtils.equals(name, getCurLastDeck())) { if (TextUtils.equals(name, getCurLastDeck())) {
...@@ -504,6 +504,28 @@ public class AppsSettings { ...@@ -504,6 +504,28 @@ public class AppsSettings {
return mSharedPreferences.getString(Constants.PREF_LAST_YDK, null); return mSharedPreferences.getString(Constants.PREF_LAST_YDK, null);
} }
/***
* 获得最后卡组分类名
*/
public String getLastCategory() {
return mSharedPreferences.getString(Constants.PREF_LAST_CATEGORY, Constants.PREF_DEF_LAST_CATEGORY);
}
/***
* 保存最后卡组分类名
*/
public void setLastCategory(String name) {
if (TextUtils.equals(name, getCurLastCategory())) {
//一样
return;
}
mSharedPreferences.putString(Constants.PREF_LAST_CATEGORY, name);
}
public String getCurLastCategory() {
return mSharedPreferences.getString(Constants.PREF_LAST_CATEGORY, null);
}
public void saveIntSettings(String key, int value) { public void saveIntSettings(String key, int value) {
mSharedPreferences.putInt(Constants.PREF_START + key, value); mSharedPreferences.putInt(Constants.PREF_START + key, value);
} }
...@@ -584,6 +606,22 @@ public class AppsSettings { ...@@ -584,6 +606,22 @@ public class AppsSettings {
return mSharedPreferences.getString(Constants.PREF_START + key, null); return mSharedPreferences.getString(Constants.PREF_START + key, null);
} }
public void saveCategorySettings(String key, String value) {
if ("lastcategory".equals(key)) {
setLastCategory(value);
} else {
mSharedPreferences.putString(Constants.PREF_START + key, value);
}
}
public String getCategorySettings(String key) {
if ("lastcategory".equals(key)) {
String val = getLastCategory();
return val;
}
return mSharedPreferences.getString(Constants.PREF_START + key, null);
}
public List<String> getLastRoomList() { public List<String> getLastRoomList() {
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
String json = mSharedPreferences.getString(Constants.PREF_LAST_ROOM_LIST, null); String json = mSharedPreferences.getString(Constants.PREF_LAST_ROOM_LIST, null);
......
...@@ -9,6 +9,8 @@ public interface Constants { ...@@ -9,6 +9,8 @@ public interface Constants {
String PREF_START = "game_pref_"; String PREF_START = "game_pref_";
String PREF_LAST_YDK = "pref_last_ydk"; String PREF_LAST_YDK = "pref_last_ydk";
String PREF_DEF_LAST_YDK = "new"; String PREF_DEF_LAST_YDK = "new";
String PREF_LAST_CATEGORY = "pre_last_category";
String PREF_DEF_LAST_CATEGORY = "newcate";
String PREF_GAME_PATH = "pref_key_game_res_path"; String PREF_GAME_PATH = "pref_key_game_res_path";
String PREF_DEF_GAME_DIR = "ygocore"; String PREF_DEF_GAME_DIR = "ygocore";
......
...@@ -241,6 +241,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -241,6 +241,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
if (file == null) { if (file == null) {
return new DeckInfo(); return new DeckInfo();
} }
Log.i("最后分类", mSettings.getLastCategory());
Log.i("kk", "load ydk " + file); Log.i("kk", "load ydk " + file);
if (mCardLoader.isOpen() && file.exists()) { if (mCardLoader.isOpen() && file.exists()) {
return mDeckAdapater.read(mCardLoader, file, mCardLoader.getLimitList()); return mDeckAdapater.read(mCardLoader, file, mCardLoader.getLimitList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment