Commit 4520aeba authored by fallenstardust's avatar fallenstardust

创建value拼接为绝对路径

同步saveSettings储存对应的key
parent 66789c18
...@@ -39,6 +39,7 @@ import static cn.garymb.ygomobile.Constants.PREF_NOTCH_HEIGHT; ...@@ -39,6 +39,7 @@ import static cn.garymb.ygomobile.Constants.PREF_NOTCH_HEIGHT;
import static cn.garymb.ygomobile.Constants.PREF_ONLY_GAME; import static cn.garymb.ygomobile.Constants.PREF_ONLY_GAME;
import static cn.garymb.ygomobile.Constants.PREF_READ_EX; import static cn.garymb.ygomobile.Constants.PREF_READ_EX;
import static cn.garymb.ygomobile.Constants.PREF_SENSOR_REFRESH; import static cn.garymb.ygomobile.Constants.PREF_SENSOR_REFRESH;
import static cn.garymb.ygomobile.Constants.YDK_FILE_EX;
public class AppsSettings { public class AppsSettings {
private static final String PREF_VERSION = "app_version"; private static final String PREF_VERSION = "app_version";
...@@ -514,7 +515,7 @@ public class AppsSettings { ...@@ -514,7 +515,7 @@ public class AppsSettings {
mSharedPreferences.putString(Constants.PREF_LAST_CATEGORY, DeckUtil.getDeckTypeName(path)); mSharedPreferences.putString(Constants.PREF_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(), YDK_FILE_EX);
mSharedPreferences.putString(Constants.PREF_LAST_YDK, lastDeckName); mSharedPreferences.putString(Constants.PREF_LAST_YDK, lastDeckName);
Log.i("我是最后卡组路径+最后分类+最后卡组名", Log.i("我是最后卡组路径+最后分类+最后卡组名",
getLastDeckPath() + "以及" + getLastDeckPath() + "以及" +
...@@ -537,6 +538,21 @@ public class AppsSettings { ...@@ -537,6 +538,21 @@ public class AppsSettings {
return mSharedPreferences.getString(Constants.PREF_LAST_YDK, Constants.PREF_DEF_LAST_YDK); return mSharedPreferences.getString(Constants.PREF_LAST_YDK, Constants.PREF_DEF_LAST_YDK);
} }
//从获得的key+value里拼接一个绝对路径
public String getCurLastDeckPath() {
String path;
if(TextUtils.equals(Constants.CORE_PACK_PATH, Constants.PREF_LAST_CATEGORY)) {
path = getResourcePath() + "/" + getLastCategory() + "/" + getLastDeckName() + YDK_FILE_EX;
} else if (TextUtils.equals(Constants.WINDBOT_DECK_PATH, Constants.PREF_LAST_CATEGORY)){
path = getResourcePath() + "/" + Constants.WINDBOT_PATH + "/" + getLastCategory() + "/" + getLastDeckName() + YDK_FILE_EX;
} else if(TextUtils.equals(Constants.PREF_LAST_CATEGORY,null)){
path = getResourcePath() + "/" + Constants.CORE_DECK_PATH + "/" + getLastDeckName() + YDK_FILE_EX;
} else {
path = getResourcePath() + "/" + Constants.CORE_DECK_PATH + "/" + getLastCategory() + "/" + getLastDeckName() + YDK_FILE_EX;
}
return path;
}
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);
} }
...@@ -603,9 +619,9 @@ public class AppsSettings { ...@@ -603,9 +619,9 @@ public class AppsSettings {
public void saveSettings(String key, String value) { public void saveSettings(String key, String value) {
if ("lastdeck".equals(key)) { if ("lastdeck".equals(key)) {
mSharedPreferences.putString(Constants.PREF_DEF_LAST_YDK, value); mSharedPreferences.putString(Constants.PREF_LAST_YDK, value);
} else if ("lastcategory".equals(key)) { } else if ("lastcategory".equals(key)) {
mSharedPreferences.putString(Constants.PREF_DEF_LAST_CATEGORY, value); mSharedPreferences.putString(Constants.PREF_LAST_CATEGORY, value);
} else { } else {
mSharedPreferences.putString(Constants.PREF_START + key, value); mSharedPreferences.putString(Constants.PREF_START + key, value);
} }
......
...@@ -59,6 +59,7 @@ public interface Constants { ...@@ -59,6 +59,7 @@ public interface Constants {
String DATABASE_NAME = "cards.cdb"; String DATABASE_NAME = "cards.cdb";
String BOT_CONF = "bot.conf"; String BOT_CONF = "bot.conf";
String WINDBOT_PATH = "windbot"; String WINDBOT_PATH = "windbot";
String WINDBOT_DECK_PATH = "Decks";
String FONT_DIRECTORY = "fonts"; String FONT_DIRECTORY = "fonts";
String CORE_STRING_PATH = "strings.conf"; String CORE_STRING_PATH = "strings.conf";
String CORE_LIMIT_PATH = "lflist.conf"; String CORE_LIMIT_PATH = "lflist.conf";
......
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