Commit 1ccf21da authored by feihuaduo's avatar feihuaduo

默认数据库路径改为外置ygocore文件夹

去除进入软件时没有更新的提示
设置额外卡库时重新加载卡片数据库
parent e0094bd0
......@@ -20,6 +20,7 @@ import java.util.Locale;
import cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus;
import cn.garymb.ygomobile.utils.SystemUtils;
import ocgcore.CardManager;
import ocgcore.DataManager;
import static cn.garymb.ygomobile.Constants.CORE_EXPANSIONS;
import static cn.garymb.ygomobile.Constants.CORE_SYSTEM_PATH;
......@@ -302,7 +303,9 @@ public class AppsSettings {
if (isUseExtraCards()) {
return getResourcePath();
} else {
return getDataBaseDefault();
//返回游戏根目录,即ygocore文件夹
return getResourcePath();
// return getDataBaseDefault();
}
}
......@@ -323,7 +326,7 @@ public class AppsSettings {
}
/***
* 使用外置数据库文件夹
* 是否使用额外卡库
*/
public boolean isUseExtraCards() {
return mSharedPreferences.getBoolean(Constants.PREF_USE_EXTRA_CARD_CARDS, Constants.PREF_DEF_USE_EXTRA_CARD_CARDS);
......@@ -334,7 +337,7 @@ public class AppsSettings {
}
/***
* 使用外置数据库文件夹
* 设置是否使用额外卡库
*/
public void setUseExtraCards(boolean useExtraCards) {
mSharedPreferences.putBoolean(Constants.PREF_USE_EXTRA_CARD_CARDS, useExtraCards);
......
......@@ -111,7 +111,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
//trpay
TrPay.getInstance(HomeActivity.this).initPaySdk("e1014da420ea4405898c01273d6731b6", "YGOMobile");
//autoupadte checking
checkPgyerUpdateSilent(getContext());
checkPgyerUpdateSilent(getContext(),false);
//ServiceDuelAssistant
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
this.startForegroundService(new Intent(this, ServiceDuelAssistant.class));
......@@ -399,7 +399,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
mMenuIds.put(mMenuIds.size(), menuId);
}
public static void checkPgyerUpdateSilent(Context context) {
public static void checkPgyerUpdateSilent(Context context,boolean isToastNoUpdata) {
final DialogPlus builder = new DialogPlus(context);;
//蒲公英自动检查更新
new PgyUpdateManager.Builder()
......@@ -409,7 +409,9 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
.setUpdateManagerListener(new UpdateManagerListener() {
@Override
public void onNoUpdateAvailable() {
Toast.makeText(context, R.string.Already_Lastest, Toast.LENGTH_SHORT).show();
if (isToastNoUpdata) {
Toast.makeText(context, R.string.Already_Lastest, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onUpdateAvailable(AppBean appBean) {
......
......@@ -157,6 +157,11 @@ public class SettingFragment extends PreferenceFragmentPlus {
if (preference instanceof CheckBoxPreference) {
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
mSharedPreferences.edit().putBoolean(preference.getKey(), checkBoxPreference.isChecked()).apply();
//如果事设置额外卡库的选项
if (preference.getKey().equals(PREF_READ_EX)){
//设置使用额外卡库后重新加载卡片数据
DataManager.get().load(true);
}
return true;
}
boolean rs = super.onPreferenceChange(preference, value);
......@@ -181,7 +186,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
.show();
}
if (PREF_CHECK_UPDATE.equals(preference.getKey())) {
HomeActivity.checkPgyerUpdateSilent(getContext());
HomeActivity.checkPgyerUpdateSilent(getContext(),true);
}
if (PREF_PENDULUM_SCALE.equals(key)) {
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
......
......@@ -37,6 +37,7 @@ public class CardManager {
@WorkerThread
public void loadCards() {
cardDataHashMap.clear();
int count = readAllCards(AppsSettings.get().getDataBaseFile(), cardDataHashMap);
Log.i("Irrlicht", "load defualt cdb:" + count);
if (AppsSettings.get().isReadExpansions()) {
......
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