1. Fix backward compatibility
2. Fix OOM crash problem 3. Bump version
This commit is contained in:
parent
30b63b496b
commit
cf9ceb67fb
|
@ -12,8 +12,8 @@ android {
|
|||
applicationId "com.zane.smapiinstaller"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 68
|
||||
versionName "3.7.6.6"
|
||||
versionCode 69
|
||||
versionName "3.7.6.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
|
@ -78,28 +78,28 @@ dependencies {
|
|||
implementation 'com.lmntrx.android.library.livin.missme:missme:0.1.5'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
// https://mvnrepository.com/artifact/com.google.guava/guava
|
||||
implementation group: 'com.google.guava', name: 'guava', version: '28.2-android'
|
||||
implementation group: 'com.google.guava', name: 'guava', version: '30.1-android'
|
||||
// https://mvnrepository.com/artifact/org.zeroturnaround/zt-zip
|
||||
implementation group: 'org.zeroturnaround', name: 'zt-zip', version: '1.14'
|
||||
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
|
||||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
|
||||
// https://mvnrepository.com/artifact/commons-io/commons-io
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
|
||||
implementation 'com.lzy.net:okgo:3.0.4'
|
||||
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.0'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.0'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.1'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.1'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.12.1'
|
||||
// https://mvnrepository.com/artifact/org.lz4/lz4-pure-java
|
||||
implementation group: 'org.lz4', name: 'lz4-pure-java', version: '1.7.0'
|
||||
|
||||
implementation 'com.github.didikee:AndroidDonate:0.1.0'
|
||||
implementation 'com.hjq:language:3.0'
|
||||
implementation 'com.hjq:language:6.0'
|
||||
|
||||
api 'org.greenrobot:greendao:3.3.0'
|
||||
api 'org.greenrobot:greendao-generator:3.3.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
|
|
@ -10,7 +10,14 @@
|
|||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
<queries>
|
||||
<package android:name="com.chucklefish.stardewvalley"/>
|
||||
<package android:name="com.zane.stardewvalley"/>
|
||||
<package android:name="com.chucklefish.stardewvalleysamsung"/>
|
||||
<package android:name="com.zane.stardewvalleysamsung"/>
|
||||
<package android:name="com.martyrpher.stardewvalley"/>
|
||||
</queries>
|
||||
<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />-->
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
|
@ -24,7 +31,8 @@
|
|||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:theme="@style/AppTheme"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
tools:ignore="UnusedAttribute">
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:largeHeap="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"version": 33,
|
||||
"version": 34,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for 1.4.5.145",
|
||||
"assetPath": "compat/145/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210128.zip",
|
||||
"hash": "821117db34a78ed955d4f24cb0ed4da9d3c5c9eafd4774d4fadec209505277c9"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210201.zip",
|
||||
"hash": "d9f6e3e5161a1236163df8dfe56859cb2701d1847ff2ed04742c925e20c19ed9"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -22,16 +22,16 @@
|
|||
"name": "SMAPI for Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210128.zip",
|
||||
"hash": "30df6cbabb000034f44eac4bc7489344d1a7f3cc4724f8be0ca61a94a7502825"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210201.zip",
|
||||
"hash": "b2a99924b2a6842168df1df4c2c0d934c63bb0010e34dfdc6f4037d4bc091c7a"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for Amazon Store",
|
||||
"assetPath": "compat/amazon_138/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210128.zip",
|
||||
"hash": "7540a006cfa262dd2fca4f2e51b2fffff8b6e045602b3cc11a2f9061dcdabddd"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210201.zip",
|
||||
"hash": "3f0ef36b139750e27ccab165b8fed6cbf58c10cadbf4b5a34436891740ae1f89"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"version": 33,
|
||||
"version": 34,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for 1.4.5.145",
|
||||
"assetPath": "compat/145/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210128.zip",
|
||||
"hash": "821117db34a78ed955d4f24cb0ed4da9d3c5c9eafd4774d4fadec209505277c9"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210201.zip",
|
||||
"hash": "d9f6e3e5161a1236163df8dfe56859cb2701d1847ff2ed04742c925e20c19ed9"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -22,16 +22,16 @@
|
|||
"name": "SMAPI for Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210128.zip",
|
||||
"hash": "30df6cbabb000034f44eac4bc7489344d1a7f3cc4724f8be0ca61a94a7502825"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210201.zip",
|
||||
"hash": "b2a99924b2a6842168df1df4c2c0d934c63bb0010e34dfdc6f4037d4bc091c7a"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for Amazon Store",
|
||||
"assetPath": "compat/amazon_138/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210128.zip",
|
||||
"hash": "7540a006cfa262dd2fca4f2e51b2fffff8b6e045602b3cc11a2f9061dcdabddd"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210201.zip",
|
||||
"hash": "3f0ef36b139750e27ccab165b8fed6cbf58c10cadbf4b5a34436891740ae1f89"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"version": 33,
|
||||
"version": 34,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for 1.4.5.145",
|
||||
"assetPath": "compat/145/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210128.zip",
|
||||
"hash": "821117db34a78ed955d4f24cb0ed4da9d3c5c9eafd4774d4fadec209505277c9"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210201.zip",
|
||||
"hash": "d9f6e3e5161a1236163df8dfe56859cb2701d1847ff2ed04742c925e20c19ed9"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -22,16 +22,16 @@
|
|||
"name": "SMAPI untuk Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210128.zip",
|
||||
"hash": "30df6cbabb000034f44eac4bc7489344d1a7f3cc4724f8be0ca61a94a7502825"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210201.zip",
|
||||
"hash": "b2a99924b2a6842168df1df4c2c0d934c63bb0010e34dfdc6f4037d4bc091c7a"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI untuk Amazon Store",
|
||||
"assetPath": "compat/amazon_138/",
|
||||
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210128.zip",
|
||||
"hash": "7540a006cfa262dd2fca4f2e51b2fffff8b6e045602b3cc11a2f9061dcdabddd"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210201.zip",
|
||||
"hash": "3f0ef36b139750e27ccab165b8fed6cbf58c10cadbf4b5a34436891740ae1f89"
|
||||
},
|
||||
{
|
||||
"type": "LOCAL",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"version": 33,
|
||||
"version": 34,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI for 1.4.5.145",
|
||||
"assetPath": "compat/145/",
|
||||
"description": "SMAPI compat package for game 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210128.zip",
|
||||
"hash": "821117db34a78ed955d4f24cb0ed4da9d3c5c9eafd4774d4fadec209505277c9"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210201.zip",
|
||||
"hash": "d9f6e3e5161a1236163df8dfe56859cb2701d1847ff2ed04742c925e20c19ed9"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -22,16 +22,16 @@
|
|||
"name": "SMAPI สำหรับ Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210128.zip",
|
||||
"hash": "30df6cbabb000034f44eac4bc7489344d1a7f3cc4724f8be0ca61a94a7502825"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210201.zip",
|
||||
"hash": "b2a99924b2a6842168df1df4c2c0d934c63bb0010e34dfdc6f4037d4bc091c7a"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI สำหรับ Amazon Store",
|
||||
"assetPath": "compat/amazon_138/",
|
||||
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210128.zip",
|
||||
"hash": "7540a006cfa262dd2fca4f2e51b2fffff8b6e045602b3cc11a2f9061dcdabddd"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210201.zip",
|
||||
"hash": "3f0ef36b139750e27ccab165b8fed6cbf58c10cadbf4b5a34436891740ae1f89"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"version": 33,
|
||||
"version": 34,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI兼容包 1.4.5.145",
|
||||
"assetPath": "compat/145/",
|
||||
"description": "SMAPI兼容包, 适用版本1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210128.zip",
|
||||
"hash": "821117db34a78ed955d4f24cb0ed4da9d3c5c9eafd4774d4fadec209505277c9"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_145_210201.zip",
|
||||
"hash": "d9f6e3e5161a1236163df8dfe56859cb2701d1847ff2ed04742c925e20c19ed9"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -22,16 +22,16 @@
|
|||
"name": "SMAPI三星商店兼容包",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI三星商店兼容包, 适用版本1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210128.zip",
|
||||
"hash": "30df6cbabb000034f44eac4bc7489344d1a7f3cc4724f8be0ca61a94a7502825"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_145_210201.zip",
|
||||
"hash": "b2a99924b2a6842168df1df4c2c0d934c63bb0010e34dfdc6f4037d4bc091c7a"
|
||||
},
|
||||
{
|
||||
"type": "COMPAT",
|
||||
"name": "SMAPI亚马逊商店兼容包",
|
||||
"assetPath": "compat/amazon_138/",
|
||||
"description": "SMAPI亚马逊商店兼容包, 适用版本1.4.5.138 - 1.4.5.147, SMAPI 3.7.5",
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210128.zip",
|
||||
"hash": "7540a006cfa262dd2fca4f2e51b2fffff8b6e045602b3cc11a2f9061dcdabddd"
|
||||
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_145_210201.zip",
|
||||
"hash": "3f0ef36b139750e27ccab165b8fed6cbf58c10cadbf4b5a34436891740ae1f89"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
import com.lmntrx.android.library.livin.missme.ProgressDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
@ -80,8 +80,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
startActivityForResult(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION), ActivityResultHandler.REQUEST_CODE_ALL_FILES_ACCESS_PERMISSION);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.finish();
|
||||
}
|
||||
}));
|
||||
|
@ -150,14 +149,14 @@ public class MainActivity extends AppCompatActivity {
|
|||
navController.addOnDestinationChangedListener((controller, destination, arguments) -> {
|
||||
currentFragment = destination.getId();
|
||||
this.invalidateOptionsMenu();
|
||||
switch (currentFragment) {
|
||||
case R.id.nav_about:
|
||||
case R.id.nav_help:
|
||||
case R.id.config_edit_fragment:
|
||||
binding.appBarMain.launch.setVisibility(View.INVISIBLE);
|
||||
break;
|
||||
default:
|
||||
binding.appBarMain.launch.setVisibility(View.VISIBLE);
|
||||
if (currentFragment == R.id.nav_about
|
||||
|| currentFragment == R.id.nav_help
|
||||
|| currentFragment == R.id.config_edit_fragment
|
||||
) {
|
||||
binding.appBarMain.launch.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
else {
|
||||
binding.appBarMain.launch.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) this.getApplication(), AppConfigKeyConstants.IGNORE_UPDATE_VERSION_CODE, Constants.PATCHED_APP_NAME);
|
||||
|
@ -206,11 +205,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
FrameworkConfig config = manager.getConfig();
|
||||
menu.findItem(R.id.settings_verbose_logging).setChecked(config.isVerboseLogging());
|
||||
menu.findItem(R.id.settings_check_for_updates).setChecked(config.isCheckForUpdates());
|
||||
if (currentFragment != R.id.nav_config) {
|
||||
menu.findItem(R.id.toolbar_update_check).setVisible(false);
|
||||
} else {
|
||||
menu.findItem(R.id.toolbar_update_check).setVisible(true);
|
||||
}
|
||||
menu.findItem(R.id.toolbar_update_check).setVisible(currentFragment == R.id.nav_config);
|
||||
menu.findItem(R.id.settings_developer_mode).setChecked(config.isDeveloperMode());
|
||||
menu.findItem(R.id.settings_disable_mono_mod).setChecked(config.isDisableMonoMod());
|
||||
menu.findItem(R.id.settings_rewrite_missing).setChecked(config.isRewriteMissing());
|
||||
|
@ -222,73 +217,62 @@ public class MainActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.isCheckable()) {
|
||||
if (item.isChecked()) {
|
||||
item.setChecked(false);
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
}
|
||||
item.setChecked(!item.isChecked());
|
||||
}
|
||||
ConfigManager manager = new ConfigManager();
|
||||
FrameworkConfig config = manager.getConfig();
|
||||
switch (item.getItemId()) {
|
||||
case R.id.settings_verbose_logging:
|
||||
config.setVerboseLogging(item.isChecked());
|
||||
break;
|
||||
case R.id.settings_check_for_updates:
|
||||
config.setCheckForUpdates(item.isChecked());
|
||||
break;
|
||||
case R.id.settings_developer_mode:
|
||||
config.setDeveloperMode(item.isChecked());
|
||||
break;
|
||||
case R.id.settings_disable_mono_mod:
|
||||
config.setDisableMonoMod(item.isChecked());
|
||||
break;
|
||||
case R.id.settings_rewrite_missing:
|
||||
config.setRewriteMissing(item.isChecked());
|
||||
break;
|
||||
case R.id.settings_set_app_name:
|
||||
DialogUtils.showInputDialog(binding.appBarMain.toolbar, R.string.input, R.string.settings_set_app_name, Constants.PATCHED_APP_NAME, Constants.PATCHED_APP_NAME, true, (dialog, input) -> {
|
||||
String appName = input.toString();
|
||||
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKeyConstants.IGNORE_UPDATE_VERSION_CODE, appName);
|
||||
appConfig.setValue(appName);
|
||||
ConfigUtils.saveConfig((MainApplication) getApplication(), appConfig);
|
||||
Constants.PATCHED_APP_NAME = appName;
|
||||
});
|
||||
return true;
|
||||
case R.id.settings_set_mod_path:
|
||||
DialogUtils.showInputDialog(binding.appBarMain.toolbar, R.string.input, R.string.input_mods_path, Constants.MOD_PATH, Constants.MOD_PATH, (dialog, input) -> {
|
||||
if (StringUtils.isNoneBlank(input)) {
|
||||
String pathString = input.toString();
|
||||
File file = new File(FileUtils.getStadewValleyBasePath(), pathString);
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
Constants.MOD_PATH = pathString;
|
||||
config.setModsPath(pathString);
|
||||
manager.flushConfig();
|
||||
} else {
|
||||
DialogUtils.showAlertDialog(binding.drawerLayout, R.string.error, R.string.error_illegal_path);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
case R.id.settings_language:
|
||||
selectLanguageLogic();
|
||||
return true;
|
||||
case R.id.settings_translation_service:
|
||||
selectTranslateServiceLogic();
|
||||
return true;
|
||||
case R.id.toolbar_update_check:
|
||||
checkModUpdateLogic();
|
||||
return true;
|
||||
case R.id.settings_advanced_mode:
|
||||
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKeyConstants.ADVANCED_MODE, "false");
|
||||
appConfig.setValue(String.valueOf(item.isChecked()));
|
||||
if (item.getItemId() == R.id.settings_verbose_logging) {
|
||||
config.setVerboseLogging(item.isChecked());
|
||||
} else if (item.getItemId() == R.id.settings_check_for_updates) {
|
||||
config.setCheckForUpdates(item.isChecked());
|
||||
} else if (item.getItemId() == R.id.settings_developer_mode) {
|
||||
config.setDeveloperMode(item.isChecked());
|
||||
} else if (item.getItemId() == R.id.settings_disable_mono_mod) {
|
||||
config.setDisableMonoMod(item.isChecked());
|
||||
} else if (item.getItemId() == R.id.settings_rewrite_missing) {
|
||||
config.setRewriteMissing(item.isChecked());
|
||||
} else if (item.getItemId() == R.id.settings_set_app_name) {
|
||||
DialogUtils.showInputDialog(binding.appBarMain.toolbar, R.string.input, R.string.settings_set_app_name, Constants.PATCHED_APP_NAME, Constants.PATCHED_APP_NAME, true, (dialog, input) -> {
|
||||
String appName = input.toString();
|
||||
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKeyConstants.IGNORE_UPDATE_VERSION_CODE, appName);
|
||||
appConfig.setValue(appName);
|
||||
ConfigUtils.saveConfig((MainApplication) getApplication(), appConfig);
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
overridePendingTransition(R.anim.fragment_fade_enter, R.anim.fragment_fade_exit);
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
Constants.PATCHED_APP_NAME = appName;
|
||||
});
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.settings_set_mod_path) {
|
||||
DialogUtils.showInputDialog(binding.appBarMain.toolbar, R.string.input, R.string.input_mods_path, Constants.MOD_PATH, Constants.MOD_PATH, (dialog, input) -> {
|
||||
if (StringUtils.isNoneBlank(input)) {
|
||||
String pathString = input.toString();
|
||||
File file = new File(FileUtils.getStadewValleyBasePath(), pathString);
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
Constants.MOD_PATH = pathString;
|
||||
config.setModsPath(pathString);
|
||||
manager.flushConfig();
|
||||
} else {
|
||||
DialogUtils.showAlertDialog(binding.drawerLayout, R.string.error, R.string.error_illegal_path);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.settings_language) {
|
||||
selectLanguageLogic();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.settings_translation_service) {
|
||||
selectTranslateServiceLogic();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.toolbar_update_check) {
|
||||
checkModUpdateLogic();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.settings_advanced_mode) {
|
||||
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKeyConstants.ADVANCED_MODE, "false");
|
||||
appConfig.setValue(String.valueOf(item.isChecked()));
|
||||
ConfigUtils.saveConfig((MainApplication) getApplication(), appConfig);
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
overridePendingTransition(R.anim.fragment_fade_enter, R.anim.fragment_fade_exit);
|
||||
finish();
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
manager.flushConfig();
|
||||
return true;
|
||||
|
@ -333,34 +317,34 @@ public class MainActivity extends AppCompatActivity {
|
|||
boolean restart;
|
||||
switch (position) {
|
||||
case 0:
|
||||
restart = LanguagesManager.setSystemLanguage(this);
|
||||
restart = MultiLanguages.setSystemLanguage(this);
|
||||
break;
|
||||
case 1:
|
||||
restart = LanguagesManager.setAppLanguage(this, Locale.ENGLISH);
|
||||
restart = MultiLanguages.setAppLanguage(this, Locale.ENGLISH);
|
||||
break;
|
||||
case 2:
|
||||
restart = LanguagesManager.setAppLanguage(this, Locale.SIMPLIFIED_CHINESE);
|
||||
restart = MultiLanguages.setAppLanguage(this, Locale.SIMPLIFIED_CHINESE);
|
||||
break;
|
||||
case 3:
|
||||
restart = LanguagesManager.setAppLanguage(this, Locale.TRADITIONAL_CHINESE);
|
||||
restart = MultiLanguages.setAppLanguage(this, Locale.TRADITIONAL_CHINESE);
|
||||
break;
|
||||
case 4:
|
||||
restart = LanguagesManager.setAppLanguage(this, Locale.KOREA);
|
||||
restart = MultiLanguages.setAppLanguage(this, Locale.KOREA);
|
||||
break;
|
||||
case 5:
|
||||
restart = LanguagesManager.setAppLanguage(this, new Locale("th", ""));
|
||||
restart = MultiLanguages.setAppLanguage(this, new Locale("th", ""));
|
||||
break;
|
||||
case 6:
|
||||
restart = LanguagesManager.setAppLanguage(this, new Locale("es", ""));
|
||||
restart = MultiLanguages.setAppLanguage(this, new Locale("es", ""));
|
||||
break;
|
||||
case 7:
|
||||
restart = LanguagesManager.setAppLanguage(this, Locale.FRENCH);
|
||||
restart = MultiLanguages.setAppLanguage(this, Locale.FRENCH);
|
||||
break;
|
||||
case 8:
|
||||
restart = LanguagesManager.setAppLanguage(this, new Locale("pt", ""));
|
||||
restart = MultiLanguages.setAppLanguage(this, new Locale("pt", ""));
|
||||
break;
|
||||
case 9:
|
||||
restart = LanguagesManager.setAppLanguage(this, new Locale("in", ""));
|
||||
restart = MultiLanguages.setAppLanguage(this, new Locale("in", ""));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -414,7 +398,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
// 国际化适配(绑定语种)
|
||||
super.attachBaseContext(LanguagesManager.attach(newBase));
|
||||
super.attachBaseContext(MultiLanguages.attach(newBase));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.zane.smapiinstaller;
|
|||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.zane.smapiinstaller.entity.DaoMaster;
|
||||
import com.zane.smapiinstaller.entity.DaoSession;
|
||||
|
@ -29,7 +29,7 @@ public class MainApplication extends Application {
|
|||
// .addInterceptor(new GzipRequestInterceptor())
|
||||
.build();
|
||||
OkGo.getInstance().setOkHttpClient(okHttpClient).init(this);
|
||||
LanguagesManager.init(this);
|
||||
MultiLanguages.init(this);
|
||||
// note: DevOpenHelper is for dev only, use a OpenHelper subclass instead
|
||||
DbOpenHelper helper = new DbOpenHelper(this, "installer-db");
|
||||
Database db = helper.getWritableDb();
|
||||
|
@ -39,7 +39,7 @@ public class MainApplication extends Application {
|
|||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
// 国际化适配(绑定语种)
|
||||
super.attachBaseContext(LanguagesManager.attach(base));
|
||||
super.attachBaseContext(MultiLanguages.attach(base));
|
||||
MultiDex.install(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class ApkPatcher {
|
|||
try {
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
|
||||
String sourceDir = packageInfo.applicationInfo.publicSourceDir;
|
||||
gamePackageName.set(packageName);
|
||||
gamePackageName.set(CommonLogic.computePackageName(packageInfo));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
gameVersionCode.set(packageInfo.getLongVersionCode());
|
||||
} else {
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.microsoft.appcenter.crashes.Crashes;
|
|||
import com.zane.smapiinstaller.MainApplication;
|
||||
import com.zane.smapiinstaller.R;
|
||||
import com.zane.smapiinstaller.constant.DialogAction;
|
||||
import com.zane.smapiinstaller.constant.ManifestPatchConstants;
|
||||
import com.zane.smapiinstaller.entity.ApkFilesManifest;
|
||||
import com.zane.smapiinstaller.entity.ManifestEntry;
|
||||
import com.zane.smapiinstaller.utils.DialogUtils;
|
||||
|
@ -189,6 +190,14 @@ public class CommonLogic {
|
|||
return apkFilesManifests;
|
||||
}
|
||||
|
||||
public static String computePackageName(PackageInfo packageInfo){
|
||||
String packageName = packageInfo.packageName;
|
||||
if (StringUtils.endsWith(packageInfo.versionName, ManifestPatchConstants.PATTERN_VERSION_AMAZON)) {
|
||||
packageName = ManifestPatchConstants.APP_PACKAGE_NAME + ManifestPatchConstants.PATTERN_VERSION_AMAZON;
|
||||
}
|
||||
return packageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取SMAPI环境文件到内部存储对应位置
|
||||
*
|
||||
|
|
|
@ -10,7 +10,9 @@ import android.view.View;
|
|||
import com.microsoft.appcenter.crashes.Crashes;
|
||||
import com.zane.smapiinstaller.R;
|
||||
import com.zane.smapiinstaller.constant.Constants;
|
||||
import com.zane.smapiinstaller.constant.ManifestPatchConstants;
|
||||
import com.zane.smapiinstaller.utils.DialogUtils;
|
||||
import com.zane.smapiinstaller.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 游戏启动器
|
||||
|
@ -63,7 +65,7 @@ public class GameLauncher {
|
|||
else {
|
||||
versionCode = packageInfo.versionCode;
|
||||
}
|
||||
if(!CommonLogic.unpackSmapiFiles(context, packageInfo.applicationInfo.publicSourceDir, true, packageInfo.packageName, versionCode)) {
|
||||
if(!CommonLogic.unpackSmapiFiles(context, packageInfo.applicationInfo.publicSourceDir, true, CommonLogic.computePackageName(packageInfo), versionCode)) {
|
||||
DialogUtils.showAlertDialog(root, R.string.error, R.string.error_failed_to_repair);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.zane.smapiinstaller.logic;
|
|||
|
||||
import android.view.View;
|
||||
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
@ -41,7 +41,7 @@ public class UpdatableListManager<T extends UpdatableList> implements Listenable
|
|||
Boolean updated = updateChecked.get(tClass);
|
||||
if(updated == null || !updated) {
|
||||
updateChecked.put(tClass, true);
|
||||
String languageSuffix = '.' + LanguagesManager.getAppLanguage(root.getContext()).getLanguage();
|
||||
String languageSuffix = '.' + MultiLanguages.getAppLanguage().getLanguage();
|
||||
updateList(root, tClass, updateUrl, filename, languageSuffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.webkit.WebViewClient;
|
|||
|
||||
import androidx.webkit.WebViewAssetLoader;
|
||||
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
import com.zane.smapiinstaller.BuildConfig;
|
||||
import com.zane.smapiinstaller.R;
|
||||
import com.zane.smapiinstaller.constant.Constants;
|
||||
|
@ -106,7 +106,7 @@ public class ConfigEditFragment extends Fragment {
|
|||
private void onScrollViewRendered(File file, Context context) {
|
||||
String fileText = FileUtils.getFileText(file);
|
||||
if (fileText != null) {
|
||||
String lang = LanguagesManager.getAppLanguage(context).getLanguage();
|
||||
String lang = MultiLanguages.getAppLanguage().getLanguage();
|
||||
switch (lang) {
|
||||
case "zh":
|
||||
lang = "zh-CN";
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.view.View;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
import com.zane.smapiinstaller.MainApplication;
|
||||
import com.zane.smapiinstaller.constant.AppConfigKeyConstants;
|
||||
import com.zane.smapiinstaller.entity.AppConfig;
|
||||
|
@ -114,7 +114,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
|
|||
if (!StringUtils.equals(activeTranslator.getValue(), TranslateUtil.NONE)) {
|
||||
String translator = activeTranslator.getValue();
|
||||
List<String> descriptions = this.modList.stream().map(ModManifestEntry::getDescription).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
String language = LanguagesManager.getAppLanguage(app).getLanguage();
|
||||
String language = MultiLanguages.getAppLanguage().getLanguage();
|
||||
Query<TranslationResult> query = daoSession.getTranslationResultDao().queryBuilder().where(
|
||||
TranslationResultDao.Properties.Origin.in(descriptions),
|
||||
TranslationResultDao.Properties.Locale.eq(language),
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.google.common.hash.Hashing;
|
|||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.google.common.io.Files;
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.hjq.language.MultiLanguages;
|
||||
|
||||
import org.apache.commons.io.input.BOMInputStream;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -78,7 +78,7 @@ public class FileUtils extends org.zeroturnaround.zip.commons.FileUtils {
|
|||
*/
|
||||
public static InputStream getLocaledLocalAsset(Context context, String filename) throws IOException {
|
||||
try {
|
||||
String language = LanguagesManager.getAppLanguage(context).getLanguage();
|
||||
String language = MultiLanguages.getAppLanguage().getLanguage();
|
||||
String localedFilename = filename + '.' + language;
|
||||
File file = new File(context.getFilesDir(), localedFilename);
|
||||
if (file.exists()) {
|
||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.2'
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
|
||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.1"
|
||||
classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#Wed Aug 05 15:43:33 CST 2020
|
||||
#Mon Feb 01 14:39:47 CST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
|
|
Loading…
Reference in New Issue