Commit eee58a5f authored by fallenstardust's avatar fallenstardust

设置内添加删除expansions下文件

parent 4bcf5d73
......@@ -39,6 +39,7 @@ public interface Constants {
boolean PREF_DEF_SENSOR_REFRESH = true;
String PREF_CHANGE_LOG = "pref_key_change_log";
String PREF_CHECK_UPDATE = "pref_key_about_check_update";
String PREF_DEL_EX = "pref_key_settings_delete_ex";
String PREF_LAST_ROOM_LIST = "pref_key_lastroom_list";
String PERF_TEST_REPLACE_KERNEL = "pref_key_test_replace_kernel";
int LAST_ROOM_MAX = 10;
......
......@@ -23,6 +23,7 @@ import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.signature.StringSignature;
import com.ourygo.assistant.service.DuelAssistantService;
import com.tencent.bugly.beta.Beta;
import java.io.DataOutputStream;
......@@ -37,13 +38,11 @@ import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import com.ourygo.assistant.service.DuelAssistantService;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.SystemUtils;
import ocgcore.ConfigManager;
import ocgcore.DataManager;
import static cn.garymb.ygomobile.Constants.ACTION_RELOAD;
......@@ -55,6 +54,7 @@ import static cn.garymb.ygomobile.Constants.PREF_CHANGE_LOG;
import static cn.garymb.ygomobile.Constants.PREF_CHECK_UPDATE;
import static cn.garymb.ygomobile.Constants.PREF_DECK_DELETE_DILAOG;
import static cn.garymb.ygomobile.Constants.PREF_DECK_MANAGER_V2;
import static cn.garymb.ygomobile.Constants.PREF_DEL_EX;
import static cn.garymb.ygomobile.Constants.PREF_FONT_ANTIALIAS;
import static cn.garymb.ygomobile.Constants.PREF_FONT_SIZE;
import static cn.garymb.ygomobile.Constants.PREF_GAME_FONT;
......@@ -132,6 +132,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
bind(PREF_IMAGE_QUALITY, mSettings.getCardQuality());
bind(PREF_GAME_FONT, mSettings.getFontPath());
bind(PREF_READ_EX, mSettings.isReadExpansions());
bind(PREF_DEL_EX, getString(R.string.about_delete_ex));
bind(PREF_DECK_MANAGER_V2, mSettings.isUseDeckManagerV2());
bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用");
Preference preference = findPreference(PREF_READ_EX);
......@@ -209,7 +210,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey();
if (PREF_CHANGE_LOG.equals(preference.getKey())) {
if (PREF_CHANGE_LOG.equals(key)) {
new DialogPlus(getActivity())
.setTitleText(getString(R.string.settings_about_change_log))
.loadUrl("file:///android_asset/changelog.html", Color.TRANSPARENT)
......@@ -218,6 +219,10 @@ public class SettingFragment extends PreferenceFragmentPlus {
if (PREF_CHECK_UPDATE.equals(key)) {
Beta.checkUpgrade();
}
if (PREF_DEL_EX.equals(key)) {
FileUtils.delFile(mSettings.getExpansionsPath().getAbsolutePath());
Toast.makeText(getContext(), R.string.done, Toast.LENGTH_LONG).show();
}
if (PREF_PENDULUM_SCALE.equals(key)) {
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
setPendlumScale(checkBoxPreference.isChecked());
......
......@@ -303,4 +303,6 @@
\n更多决斗模式密码请参考软件使用教程</string>
<string name="guide_button_search">点击编辑搜索条件</string>
<string name="guide_search_result_count">这里显示搜索结果卡片数量</string>
<string name="title_delete_ex">清空扩展卡包</string>
<string name="about_delete_ex">如果遇到拓展卡包问题时删除是个不错的办法</string>
</resources>
......@@ -5,7 +5,7 @@
<string name="action_game">Single Game</string>
<string name="action_about">About</string>
<string name="action_add_server">Add Server</string>
<string name="dont_start_game">don\'t start game</string>
<string name="dont_start_game">unable to start game</string>
<!-- check -->
<string name="check_res">Check Resources</string>
<string name="check_things">Check %s ...</string>
......@@ -306,4 +306,6 @@
\n more duel model password you can see the tortuial.</string>
<string name="guide_button_search">click search buttton to edit search criteria</string>
<string name="guide_search_result_count">here shows search result count</string>
<string name="title_delete_ex">delete expansions</string>
<string name="about_delete_ex">if you need to delte all expansion cards</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/settings_game">
<!--Preference
android:key="pref_key_game_res_path"
android:persistent="true"
android:title="@string/settings_game_res_path" /-->
<PreferenceCategory android:title="@string/settings_about">
<Preference
android:key="pref_key_about_check_update"
android:persistent="true"
......@@ -13,12 +8,25 @@
<Preference
android:key="pref_key_change_log"
android:title="@string/settings_about_change_log" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_game">
<!--Preference
android:key="pref_key_game_res_path"
android:persistent="true"
android:title="@string/settings_game_res_path" /-->
<CheckBoxPreference
android:key="pref_settings_read_ex"
android:persistent="true"
android:title="@string/title_use_ex" />
<Preference
android:key="pref_key_settings_delete_ex"
android:persistent="true"
android:summary="@string/about_delete_ex"
android:title="@string/title_delete_ex" />
<CheckBoxPreference
android:key="pref_key_start_serviceduelassistant"
android:persistent="true"
......@@ -28,7 +36,7 @@
<CheckBoxPreference
android:key="pref_settings_keep_scale"
android:persistent="false"
android:title="@string/about_pref_settings_keep_scale"/>
android:title="@string/about_pref_settings_keep_scale" />
<ListPreference
android:entries="@array/opengl_version"
......
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