Commit 3726d381 authored by fallenstardust's avatar fallenstardust

从android传key和value到gframe

parent 1493624b
...@@ -222,7 +222,6 @@ public class AppsSettings { ...@@ -222,7 +222,6 @@ public class AppsSettings {
// //
} }
for (File file : cdbs) { for (File file : cdbs) {
Log.i("合法的数据库才会加载", "菜菜辛苦了");
//if (CardManager.checkDataBase(file)) { //if (CardManager.checkDataBase(file)) {
//合法数据库才会加载 //合法数据库才会加载
pathList.add(file.getAbsolutePath()); pathList.add(file.getAbsolutePath());
...@@ -510,36 +509,32 @@ public class AppsSettings { ...@@ -510,36 +509,32 @@ public class AppsSettings {
return; return;
} }
//保存最后卡组绝对路径 //保存最后卡组绝对路径
mSharedPreferences.putString(Constants.PREF_LAST_YDK, path); mSharedPreferences.putString(Constants.PREF_LAST_DECK_PATH, path);
//保存最后分类名 //保存最后分类名
mSharedPreferences.putString(Constants.PREF_DEF_LAST_CATEGORY, DeckUtil.getDeckTypeName(path)); mSharedPreferences.putString(Constants.PREF_DEF_LAST_CATEGORY, DeckUtil.getDeckTypeName(path));
//保存最后卡组名 //保存最后卡组名
File lastDeck = new File(path); File lastDeck = new File(path);
String lastDeckName = IOUtils.tirmName(lastDeck.getName(), Constants.YDK_FILE_EX); String lastDeckName = IOUtils.tirmName(lastDeck.getName(), Constants.YDK_FILE_EX);
mSharedPreferences.putString(Constants.PREF_DEF_LAST_YDK, lastDeckName); mSharedPreferences.putString(Constants.PREF_DEF_LAST_YDK, lastDeckName);
Log.i("我是最后卡组+最后分类+最后卡组名", path + "以及" + DeckUtil.getDeckTypeName(path) + "以及" + lastDeckName); Log.i("我是最后卡组路径+最后分类+最后卡组名",
getLastDeckPath() + "以及" +
getLastCategory() + "以及" +
getLastDeckName());
} }
//获得最后卡组绝对路径 //获得最后卡组绝对路径
public String getLastDeckPath() { public String getLastDeckPath() {
return mSharedPreferences.getString(Constants.PREF_LAST_YDK, Constants.PREF_DEF_LAST_YDK); return mSharedPreferences.getString(Constants.PREF_LAST_DECK_PATH, null);
} }
//获得最后分类名 //获得最后分类名
public String getLastCategory(String path) { public String getLastCategory() {
String lastCategoryName = DeckUtil.getDeckTypeName(path); return mSharedPreferences.getString(Constants.PREF_DEF_LAST_CATEGORY, null);
return mSharedPreferences.getString(Constants.PREF_DEF_LAST_CATEGORY, lastCategoryName);
} }
//获得最后卡组名 //获得最后卡组名
public String getLastDeckName(String path) { public String getLastDeckName() {
File lastDeck = new File(path); return mSharedPreferences.getString(Constants.PREF_DEF_LAST_YDK, null);
String lastDeckName = IOUtils.tirmName(lastDeck.getName(), Constants.YDK_FILE_EX);
return mSharedPreferences.getString(Constants.PREF_DEF_LAST_YDK, lastDeckName);
}
public String getCurLastCategory() {
return mSharedPreferences.getString(Constants.PREF_DEF_LAST_CATEGORY, null);
} }
public void saveIntSettings(String key, int value) { public void saveIntSettings(String key, int value) {
...@@ -607,33 +602,22 @@ public class AppsSettings { ...@@ -607,33 +602,22 @@ public class AppsSettings {
}*/ }*/
public void saveSettings(String key, String value) { public void saveSettings(String key, String value) {
Log.i("我是key+value", key + "+" + value); if ("lastdeck".equals(key)) {
if ("lastdeck".equals(key) || "lastcategory".equals(key)) { mSharedPreferences.putString(Constants.PREF_DEF_LAST_YDK, value);
setLastDeckPath(value); } else if ("lastcategory".equals(key)) {
mSharedPreferences.putString(Constants.PREF_DEF_LAST_CATEGORY, value);
} else { } else {
mSharedPreferences.putString(Constants.PREF_START + key, value); mSharedPreferences.putString(Constants.PREF_START + key, value);
} }
} }
public String getSettings(String key) { public String getSettings(String key) {
String val;
if ("lastdeck".equals(key)) { if ("lastdeck".equals(key)) {
String val = getLastDeckPath(); val = getLastDeckName();
return val; return val;
} } else if ("lastcategory".equals(key)) {
return mSharedPreferences.getString(Constants.PREF_START + key, null); val = getLastCategory();
}
public void saveCategorySettings(String key, String value) {
if ("lastcategory".equals(key)) {
setLastDeckPath(value);
} else {
mSharedPreferences.putString(Constants.PREF_START + key, value);
}
}
public String getCategorySettings(String key) {
if ("lastcategory".equals(key)) {
String val = getLastCategory(key);
return val; return val;
} }
return mSharedPreferences.getString(Constants.PREF_START + key, null); return mSharedPreferences.getString(Constants.PREF_START + key, null);
......
...@@ -7,9 +7,10 @@ import cn.garymb.ygomobile.lite.BuildConfig; ...@@ -7,9 +7,10 @@ import cn.garymb.ygomobile.lite.BuildConfig;
public interface Constants { public interface Constants {
boolean DEBUG = BuildConfig.DEBUG; boolean DEBUG = BuildConfig.DEBUG;
String PREF_START = "game_pref_"; String PREF_START = "game_pref_";
String PREF_LAST_DECK_PATH = "pref_last_deck_path";
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_LAST_CATEGORY = "pref_last_category";
String PREF_DEF_LAST_CATEGORY = "newcate"; 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";
......
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