1. Update to SMAPI 3.7.3.2

2. Set patched APP name feature
This commit is contained in:
ZaneYork 2020-09-22 21:30:00 +08:00
parent 6d9020def2
commit 8b801247a4
32 changed files with 152 additions and 230 deletions

View File

@ -1,26 +1,31 @@
# SMAPI-Android-Installer
本软件可以提供安装SMAPI框架到安卓系统SMAPI是星露谷物语的MOD加载框架
本软件可以提供安装 SMAPI 框架到安卓系统SMAPI 是星露谷物语的 MOD 加载框架
## 使用方法
1. 在Release页下载最新的apk安装包安装
2. 安装完成后点击SMAPI安装器的安装按钮
3. 等待安装完成
4. 下载的Mod需要添加到 `StardewValley/Mods` 文件夹
5. 点击新生成从SMAPI开头的星露谷物语进入Mod版游戏
1. 在 Release 页下载最新的 apk 安装包安装
2. 安装完成后点击 SMAPI 安装器的安装按钮
3. 等待安装完成
4. 下载的 Mod 需要添加到 `StardewValley/Mods` 文件夹
5. 点击新生成从 SMAPI 开头的星露谷物语进入 Mod 版游戏
## 其它
### BUG反馈
1. 填写这个[数据收集表](https://docs.qq.com/form/edit/DWlJZc0paV2xxR2JL)
2. 加入QQ群 [860453392](https://jq.qq.com/?_wv=1027&k=55svbYs) 反馈
### BUG 反馈
1. 填写这个[数据收集表](https://docs.qq.com/form/edit/DWlJZc0paV2xxR2JL)
2. 加入 QQ 群 [860453392](https://jq.qq.com/?_wv=1027&k=55svbYs) 反馈
### 工作原理
1. 抽取游戏本体的安装包
2. 生成SMAPI依赖的文件
3. 修改安装包添加SMAPI的启动代码
4. 签名安装包并发起Mod版游戏的安装
1. 抽取游戏本体的安装包
2. 生成 SMAPI 依赖的文件
3. 修改安装包添加 SMAPI 的启动代码
4. 签名安装包并发起 Mod 版游戏的安装
### 下载地址
1. [GitHub](https://github.com/ZaneYork/SMAPI-Android-Installer/releases)
2. [Coolapk](https://www.coolapk.com/apk/256582)
3. ~~Google Play~~ 已下架,开发者账户被谷歌无理由关联封禁,从此谷歌一生黑
1. [GitHub](https://github.com/ZaneYork/SMAPI-Android-Installer/releases)
2. [Coolapk](https://www.coolapk.com/apk/256582)
3. ~~Google Play~~ 已下架,开发者账户被谷歌无理由关联封禁,从此谷歌一生黑

View File

@ -12,8 +12,8 @@ android {
applicationId "com.zane.smapiinstaller"
minSdkVersion 19
targetSdkVersion 28
versionCode 51
versionName "1.5.9"
versionCode 53
versionName "1.6.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

View File

@ -1,26 +0,0 @@
package com.zane.smapiinstaller;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.zane.smapiinstaller", appContext.getPackageName());
}
}

View File

@ -1,35 +1,35 @@
{
"version": 26,
"version": 27,
"contents": [
{
"type": "COMPAT",
"name": "SMAPI for 1.4.5.137",
"assetPath": "compat/137/",
"description": "SMAPI compat package for game 1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0",
"url": "http://zaneyork.cn/download/compat/smapi_137.zip",
"url": "http://zaneyork.cn/dl/compat/smapi_137.zip",
"hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
},
{
"type": "COMPAT",
"name": "SMAPI for Galaxy Store",
"assetPath": "compat/samsung_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a"
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
},
{
"type": "COMPAT",
"name": "SMAPI for Amazon Store",
"assetPath": "compat/amazon_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c"
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
},
{
"type": "LOCALE",
"name": "Chinese Locale v2.5.1",
"description": "Chinese simplified locale pack, thanks Wabi-Sabi",
"url": "http://zaneyork.cn/download/locale/locale_pack_zh_2.5.1.zip",
"url": "http://zaneyork.cn/dl/locale/locale_pack_zh_2.5.1.zip",
"hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
}
]

View File

@ -1,35 +1,35 @@
{
"version": 26,
"version": 27,
"contents": [
{
"type": "COMPAT",
"name": "SMAPI for 1.4.5.137",
"assetPath": "compat/137/",
"description": "SMAPI compat package for game 1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0",
"url": "http://zaneyork.cn/download/compat/smapi_137.zip",
"url": "http://zaneyork.cn/dl/compat/smapi_137.zip",
"hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
},
{
"type": "COMPAT",
"name": "SMAPI for Galaxy Store",
"assetPath": "compat/samsung_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a"
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
},
{
"type": "COMPAT",
"name": "SMAPI for Amazon Store",
"assetPath": "compat/amazon_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c"
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
},
{
"type": "LOCALE",
"name": "Chinese Locale v2.5.1",
"description": "Chinese simplified locale pack, thanks Wabi-Sabi",
"url": "http://zaneyork.cn/download/locale/locale_pack_zh_2.5.1.zip",
"url": "http://zaneyork.cn/dl/locale/locale_pack_zh_2.5.1.zip",
"hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
}
]

View File

@ -1,35 +1,35 @@
{
"version": 26,
"version": 27,
"contents": [
{
"type": "COMPAT",
"name": "SMAPI untuk 1.4.5.137",
"assetPath": "compat/137/",
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0",
"url": "http://zaneyork.cn/download/compat/smapi_137.zip",
"url": "http://zaneyork.cn/dl/compat/smapi_137.zip",
"hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
},
{
"type": "COMPAT",
"name": "SMAPI untuk Galaxy Store",
"assetPath": "compat/samsung_138/",
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.4.138 - terbaru, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a"
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.4.138 - terbaru, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
},
{
"type": "COMPAT",
"name": "SMAPI untuk Amazon Store",
"assetPath": "compat/amazon_138/",
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.4.138 - terbaru, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c"
"description": "Paket kompatibilitas SMAPI untuk versi 1.4.4.138 - terbaru, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
},
{
"type": "LOCAL",
"name": "Lokal Cina v2.5.1",
"description": "Paket lokal Cina yang disederhanakan, terima kasih buat Wabi-Sabi",
"url": "http://zaneyork.cn/download/locale/locale_pack_zh_2.5.1.zip",
"url": "http://zaneyork.cn/dl/locale/locale_pack_zh_2.5.1.zip",
"hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
}
]

View File

@ -1,35 +1,35 @@
{
"version": 26,
"version": 27,
"contents": [
{
"type": "COMPAT",
"name": "SMAPI สำหรับ 1.4.5.137",
"assetPath": "compat/137/",
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0",
"url": "http://zaneyork.cn/download/compat/smapi_137.zip",
"url": "http://zaneyork.cn/dl/compat/smapi_137.zip",
"hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
},
{
"type": "COMPAT",
"name": "SMAPI สำหรับ Galaxy Store",
"assetPath": "compat/samsung_138/",
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.4.138 - ล่าสุด, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a"
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.4.138 - ล่าสุด, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
},
{
"type": "COMPAT",
"name": "SMAPI สำหรับ Amazon Store",
"assetPath": "compat/amazon_138/",
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.4.138 - ล่าสุด, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c"
"description": "แพคเกจแอพลิเคชั่น SMAPI สำหรับเกม Stardew Valley เวอร์ชั่น 1.4.4.138 - ล่าสุด, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
},
{
"type": "LOCALE",
"name": "ภาษาจีนตัวย่อ เวอร์ชั่น v2.5.1",
"description": "แพคเกจภาษาจีนตัวย่อ โดย Wabi-Sabi",
"url": "http://zaneyork.cn/download/locale/locale_pack_zh_2.5.1.zip",
"url": "http://zaneyork.cn/dl/locale/locale_pack_zh_2.5.1.zip",
"hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
}
]

View File

@ -1,35 +1,35 @@
{
"version": 26,
"version": 27,
"contents": [
{
"type": "COMPAT",
"name": "SMAPI兼容包 1.4.5.137",
"assetPath": "compat/137/",
"description": "SMAPI兼容包, 适用版本1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0",
"url": "http://zaneyork.cn/download/compat/smapi_137.zip",
"url": "http://zaneyork.cn/dl/compat/smapi_137.zip",
"hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
},
{
"type": "COMPAT",
"name": "SMAPI三星商店兼容包",
"assetPath": "compat/samsung_138/",
"description": "SMAPI三星商店兼容包 适用版本1.4.4.138至今, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a"
"description": "SMAPI三星商店兼容包 适用版本1.4.4.138至今, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
},
{
"type": "COMPAT",
"name": "SMAPI亚马逊商店兼容包",
"assetPath": "compat/amazon_138/",
"description": "SMAPI亚马逊商店兼容包 适用版本1.4.4.138至今, SMAPI 3.7.3",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c"
"description": "SMAPI亚马逊商店兼容包 适用版本1.4.4.138至今, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
},
{
"type": "LOCALE",
"name": "中文汉化v2.5.1",
"description": "简体中文语言包感谢Wabi-Sabi提供",
"url": "http://zaneyork.cn/download/locale/locale_pack_zh_2.5.1.zip",
"url": "http://zaneyork.cn/dl/locale/locale_pack_zh_2.5.1.zip",
"hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
}
]

View File

@ -20,7 +20,7 @@ import com.lzy.okgo.model.Response;
import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;
import com.zane.smapiinstaller.constant.AppConfigKey;
import com.zane.smapiinstaller.constant.AppConfigKeyConstants;
import com.zane.smapiinstaller.constant.Constants;
import com.zane.smapiinstaller.constant.DialogAction;
import com.zane.smapiinstaller.dto.AppUpdateCheckResultDto;
@ -111,7 +111,7 @@ public class MainActivity extends AppCompatActivity {
instance = this;
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) this.getApplication(), AppConfigKey.PRIVACY_POLICY_CONFIRM, false);
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) this.getApplication(), AppConfigKeyConstants.PRIVACY_POLICY_CONFIRM, false);
if (Boolean.parseBoolean(appConfig.getValue())) {
requestPermissions();
} else {
@ -152,6 +152,8 @@ public class MainActivity extends AppCompatActivity {
buttonLaunch.setVisibility(View.VISIBLE);
}
});
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) this.getApplication(), AppConfigKeyConstants.IGNORE_UPDATE_VERSION_CODE, Constants.PATCHED_APP_NAME);
Constants.PATCHED_APP_NAME = appConfig.getValue();
checkAppUpdate();
}
@ -162,7 +164,7 @@ public class MainActivity extends AppCompatActivity {
public void onSuccess(Response<AppUpdateCheckResultDto> response) {
AppUpdateCheckResultDto dto = response.body();
if (dto != null && CommonLogic.getVersionCode(MainActivity.this) < dto.getVersionCode()) {
AppConfig appConfig = ConfigUtils.getConfig(application, AppConfigKey.IGNORE_UPDATE_VERSION_CODE, dto.getVersionCode());
AppConfig appConfig = ConfigUtils.getConfig(application, AppConfigKeyConstants.IGNORE_UPDATE_VERSION_CODE, dto.getVersionCode());
if (StringUtils.equals(appConfig.getValue(), String.valueOf(dto.getVersionCode()))) {
return;
}
@ -205,8 +207,8 @@ public class MainActivity extends AppCompatActivity {
}
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_in_parallel).setChecked(config.isRewriteInParallel());
menu.findItem(R.id.settings_advanced_mode).setChecked(Boolean.parseBoolean(ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKey.ADVANCED_MODE, "false").getValue()));
menu.findItem(R.id.settings_rewrite_missing).setChecked(config.isRewriteMissing());
menu.findItem(R.id.settings_advanced_mode).setChecked(Boolean.parseBoolean(ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKeyConstants.ADVANCED_MODE, "false").getValue()));
Constants.MOD_PATH = config.getModsPath();
return super.onPrepareOptionsMenu(menu);
}
@ -235,9 +237,18 @@ public class MainActivity extends AppCompatActivity {
case R.id.settings_disable_mono_mod:
config.setDisableMonoMod(item.isChecked());
break;
case R.id.settings_rewrite_in_parallel:
config.setRewriteInParallel(item.isChecked());
case R.id.settings_rewrite_missing:
config.setRewriteMissing(item.isChecked());
break;
case R.id.settings_set_app_name:
DialogUtils.showInputDialog(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(toolbar, R.string.input, R.string.input_mods_path, Constants.MOD_PATH, Constants.MOD_PATH, (dialog, input) -> {
if (StringUtils.isNoneBlank(input)) {
@ -253,22 +264,6 @@ public class MainActivity extends AppCompatActivity {
}
});
return true;
case R.id.settings_set_max_log_size:
DialogUtils.showInputDialog(toolbar, R.string.input, R.string.settings_set_max_log_size, String.valueOf(config.getMaxLogSize()), String.valueOf(config.getMaxLogSize()), (dialog, input) -> {
if (StringUtils.isNoneBlank(input)) {
try {
int size = Integer.parseInt(input.toString());
config.setMaxLogSize(size);
manager.flushConfig();
} catch (Exception ignored) {
}
} else {
config.setMaxLogSize(Integer.MAX_VALUE);
manager.flushConfig();
}
});
return true;
case R.id.settings_language:
selectLanguageLogic();
return true;
@ -279,7 +274,7 @@ public class MainActivity extends AppCompatActivity {
checkModUpdateLogic();
return true;
case R.id.settings_advanced_mode:
AppConfig appConfig = ConfigUtils.getConfig((MainApplication) getApplication(), AppConfigKey.ADVANCED_MODE, "false");
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));
@ -306,7 +301,7 @@ public class MainActivity extends AppCompatActivity {
private void selectTranslateServiceLogic() {
MainApplication application = (MainApplication) this.getApplication();
AppConfig activeTranslator = ConfigUtils.getConfig(application, AppConfigKey.ACTIVE_TRANSLATOR, TranslateUtil.NONE);
AppConfig activeTranslator = ConfigUtils.getConfig(application, AppConfigKeyConstants.ACTIVE_TRANSLATOR, TranslateUtil.NONE);
int index = getTranslateServiceIndex(activeTranslator);
DialogUtils.showSingleChoiceDialog(toolbar, R.string.settings_translation_service, R.array.translators, index, (dialog, position) -> {
switch (position) {

View File

@ -3,7 +3,7 @@ package com.zane.smapiinstaller.constant;
/**
* @author Zane
*/
public class AppConfigKey {
public class AppConfigKeyConstants {
public static final String ACTIVE_TRANSLATOR = "ActiveTranslator";
public static final String MOD_LIST_SORT_BY = "ModListSortBy";

View File

@ -69,6 +69,11 @@ public class Constants {
*/
public static final String SMAPI_VERSION = "3.7.2";
/**
* 应用名称
*/
public static String PATCHED_APP_NAME = null;
/**
* 平台
*/
@ -82,5 +87,5 @@ public class Constants {
/**
* 软件检查更新服务
*/
public static final String SELF_UPDATE_CHECK_SERVICE_URL = "http://zaneyork.cn/download/app_version.json";
public static final String SELF_UPDATE_CHECK_SERVICE_URL = "http://zaneyork.cn/dl/app_version.json";
}

View File

@ -3,7 +3,7 @@ package com.zane.smapiinstaller.constant;
/**
* @author Zane
*/
public class DownloadableContentTypes {
public class DownloadableContentTypeConstants {
public static final String LOCALE = "LOCALE";
public static final String COMPAT = "COMPAT";

View File

@ -38,16 +38,10 @@ public class FrameworkConfig {
private boolean DisableMonoMod = false;
/**
* 是否启用多线程重写
* 是否启用重写丢失的引用点
*/
@JsonProperty("RewriteInParallel")
private boolean RewriteInParallel = false;
/**
* 最大日志大小
*/
@JsonProperty("MaxLogSize")
private int MaxLogSize = Integer.MAX_VALUE;
@JsonProperty("RewriteMissing")
private boolean RewriteMissing = false;
/**
* Mod存放位置

View File

@ -279,7 +279,12 @@ public class ApkPatcher {
break;
case "label":
if (strObj.contains(ManifestPatchConstants.APP_NAME)) {
attr.obj = context.getString(R.string.smapi_game_name);
if(StringUtils.isBlank(Constants.PATCHED_APP_NAME)) {
attr.obj = context.getString(R.string.smapi_game_name);
}
else {
attr.obj = Constants.PATCHED_APP_NAME;
}
}
break;
case "authorities":

View File

@ -114,7 +114,7 @@ public class AboutFragment extends Fragment {
}
break;
case 4:
CommonLogic.openUrl(context, "http://zaneyork.cn/download/list.html");
CommonLogic.openUrl(context, "http://zaneyork.cn/dl/list.html");
break;
default:
break;

View File

@ -6,7 +6,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.hjq.language.LanguagesManager;
import com.zane.smapiinstaller.MainApplication;
import com.zane.smapiinstaller.constant.AppConfigKey;
import com.zane.smapiinstaller.constant.AppConfigKeyConstants;
import com.zane.smapiinstaller.entity.AppConfig;
import com.zane.smapiinstaller.entity.DaoSession;
import com.zane.smapiinstaller.entity.ModManifestEntry;
@ -53,7 +53,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
translateLogic(root);
MainApplication app = CommonLogic.getApplicationFromView(root);
if (null != app) {
AppConfig appConfig = ConfigUtils.getConfig(app, AppConfigKey.MOD_LIST_SORT_BY, sortBy);
AppConfig appConfig = ConfigUtils.getConfig(app, AppConfigKeyConstants.MOD_LIST_SORT_BY, sortBy);
sortBy = appConfig.getValue();
}
sortLogic(sortBy);
@ -65,7 +65,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
return;
}
this.sortBy = sortBy;
AppConfig appConfig = new AppConfig(null, AppConfigKey.MOD_LIST_SORT_BY, sortBy);
AppConfig appConfig = new AppConfig(null, AppConfigKeyConstants.MOD_LIST_SORT_BY, sortBy);
ConfigUtils.saveConfig(app, appConfig);
sortLogic(appConfig.getValue());
}
@ -110,7 +110,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
MainApplication app = CommonLogic.getApplicationFromView(root);
if (null != app) {
DaoSession daoSession = app.getDaoSession();
AppConfig activeTranslator = ConfigUtils.getConfig(app, AppConfigKey.ACTIVE_TRANSLATOR, TranslateUtil.NONE);
AppConfig activeTranslator = ConfigUtils.getConfig(app, AppConfigKeyConstants.ACTIVE_TRANSLATOR, TranslateUtil.NONE);
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());

View File

@ -15,7 +15,7 @@ import com.lzy.okgo.model.Response;
import com.microsoft.appcenter.crashes.Crashes;
import com.zane.smapiinstaller.R;
import com.zane.smapiinstaller.constant.DialogAction;
import com.zane.smapiinstaller.constant.DownloadableContentTypes;
import com.zane.smapiinstaller.constant.DownloadableContentTypeConstants;
import com.zane.smapiinstaller.entity.DownloadableContent;
import com.zane.smapiinstaller.entity.ModManifestEntry;
import com.zane.smapiinstaller.logic.ModAssetsManager;
@ -141,7 +141,7 @@ public class DownloadableContentAdapter extends RecyclerView.Adapter<Downloadabl
void downloadContent() {
Context context = itemView.getContext();
ModManifestEntry modManifestEntry = null;
if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypes.LOCALE)) {
if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypeConstants.LOCALE)) {
modManifestEntry = ModAssetsManager.findFirstModIf(mod -> StringUtils.equals(mod.getUniqueID(), "ZaneYork.CustomLocalization") || StringUtils.equals(mod.getUniqueID(), "SMAPI.CustomLocalization"));
if (modManifestEntry == null) {
DialogUtils.showAlertDialog(itemView, R.string.error, String.format(context.getString(R.string.error_depends_on_mod), context.getString(R.string.locale_pack), "ZaneYork.CustomLocalization"));
@ -204,7 +204,7 @@ public class DownloadableContentAdapter extends RecyclerView.Adapter<Downloadabl
private void unpackLogic(Context context, File downloadedFile, ModManifestEntry finalModManifestEntry) {
try {
if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypes.LOCALE)) {
if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypeConstants.LOCALE)) {
if (finalModManifestEntry != null) {
ZipUtil.unpack(downloadedFile, new File(finalModManifestEntry.getAssetPath()));
}

View File

@ -14,7 +14,7 @@ import android.widget.TextView;
import com.google.common.io.Files;
import com.zane.smapiinstaller.MainApplication;
import com.zane.smapiinstaller.R;
import com.zane.smapiinstaller.constant.AppConfigKey;
import com.zane.smapiinstaller.constant.AppConfigKeyConstants;
import com.zane.smapiinstaller.constant.Constants;
import com.zane.smapiinstaller.constant.DialogAction;
import com.zane.smapiinstaller.logic.ApkPatcher;
@ -65,7 +65,7 @@ public class InstallFragment extends Fragment {
root = inflater.inflate(R.layout.fragment_install, container, false);
ButterKnife.bind(this, root);
context = this.getActivity();
if (Boolean.parseBoolean(ConfigUtils.getConfig((MainApplication) context.getApplication(), AppConfigKey.ADVANCED_MODE, "false").getValue())) {
if (Boolean.parseBoolean(ConfigUtils.getConfig((MainApplication) context.getApplication(), AppConfigKeyConstants.ADVANCED_MODE, "false").getValue())) {
installButton.setVisibility(View.INVISIBLE);
layoutAdvInstall.setVisibility(View.VISIBLE);
}
@ -87,11 +87,11 @@ public class InstallFragment extends Fragment {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
DialogUtils.showConfirmDialog(root, R.string.confirm, R.string.android_version_confirm, ((dialog, which) -> {
if (which == DialogAction.POSITIVE) {
installLogic();
installLogic(false);
}
}));
} else {
installLogic();
installLogic(false);
}
}
@ -102,51 +102,7 @@ public class InstallFragment extends Fragment {
@OnClick(R.id.button_adv_install)
void advInstall() {
if (task != null) {
task.interrupt();
}
task = new Thread(() -> CommonLogic.showProgressDialog(root, context, (dialog)->{
ApkPatcher patcher = new ApkPatcher(context);
patcher.registerProgressListener((progress) -> DialogUtils.setProgressDialogState(root, dialog, null, progress));
DialogUtils.setProgressDialogState(root, dialog, R.string.extracting_package, null);
String path = patcher.extract(1);
if (path == null) {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.error_game_not_found)));
return;
}
DialogUtils.setProgressDialogState(root, dialog, R.string.unpacking_smapi_files, null);
if (!CommonLogic.unpackSmapiFiles(context, path, false)) {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_unpack_smapi_files)));
return;
}
ModAssetsManager modAssetsManager = new ModAssetsManager(root);
DialogUtils.setProgressDialogState(root, dialog, R.string.unpacking_smapi_files, 6);
modAssetsManager.installDefaultMods();
DialogUtils.setProgressDialogState(root, dialog, R.string.patching_package, 8);
if (!patcher.patch(path, true)) {
int target = patcher.getSwitchAction().getAndSet(0);
if (target == R.string.menu_download) {
DialogUtils.showConfirmDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_patch_game)), R.string.menu_download, R.string.cancel, (d, which) -> {
if (which == DialogAction.POSITIVE) {
NavController controller = Navigation.findNavController(installButton);
controller.navigate(MainTabsFragmentDirections.actionNavMainToNavDownload());
}
});
} else {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_patch_game)));
}
return;
}
DialogUtils.setProgressDialogState(root, dialog, R.string.signing_package, null);
String signPath = patcher.sign(path);
if (signPath == null) {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_sign_game)));
return;
}
DialogUtils.setProgressDialogState(root, dialog, R.string.installing_package, null);
patcher.install(signPath);
}));
task.start();
installLogic(true);
}
/**
@ -171,7 +127,7 @@ public class InstallFragment extends Fragment {
/**
* 安装逻辑
*/
private void installLogic() {
private void installLogic(boolean isAdv) {
if (task != null) {
task.interrupt();
}
@ -179,7 +135,7 @@ public class InstallFragment extends Fragment {
ApkPatcher patcher = new ApkPatcher(context);
patcher.registerProgressListener((progress) -> DialogUtils.setProgressDialogState(root, dialog, null, progress));
DialogUtils.setProgressDialogState(root, dialog, R.string.extracting_package, null);
String path = patcher.extract();
String path = patcher.extract(isAdv ? 1 : -1);
if (path == null) {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.error_game_not_found)));
return;
@ -193,7 +149,7 @@ public class InstallFragment extends Fragment {
DialogUtils.setProgressDialogState(root, dialog, R.string.unpacking_smapi_files, 6);
modAssetsManager.installDefaultMods();
DialogUtils.setProgressDialogState(root, dialog, R.string.patching_package, 8);
if (!patcher.patch(path)) {
if (!patcher.patch(path, isAdv)) {
int target = patcher.getSwitchAction().getAndSet(0);
if (target == R.string.menu_download) {
DialogUtils.showConfirmDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_patch_game)), R.string.menu_download, R.string.cancel, (d, which) -> {

View File

@ -14,7 +14,12 @@ public class ConfigUtils {
AppConfigDao appConfigDao = daoSession.getAppConfigDao();
AppConfig appConfig = appConfigDao.queryBuilder().where(AppConfigDao.Properties.Name.eq(key)).build().unique();
if(appConfig == null) {
appConfig = new AppConfig(null, key, String.valueOf(defaultValue));
if(defaultValue != null){
appConfig = new AppConfig(null, key, String.valueOf(defaultValue));
}
else {
appConfig = new AppConfig(null, key, null);
}
}
return appConfig;
}

View File

@ -107,17 +107,7 @@ public class DialogUtils {
* @param callback 回调
*/
public static void showConfirmDialog(View view, int title, int message, BiConsumer<MaterialDialog, DialogAction> callback) {
CommonLogic.runOnUiThread(CommonLogic.getActivityFromView(view), (activity) -> {
MaterialDialog materialDialog = new MaterialDialog(activity, MaterialDialog.getDEFAULT_BEHAVIOR()).title(title, null).message(message, null, null).positiveButton(R.string.confirm, null, dialog -> {
callback.accept(dialog, DialogAction.POSITIVE);
return null;
}).negativeButton(R.string.cancel, null, dialog -> {
callback.accept(dialog, DialogAction.NEGATIVE);
return null;
});
DialogUtils.setCurrentDialog(materialDialog);
materialDialog.show();
});
showConfirmDialog(CommonLogic.getActivityFromView(view), title, message, callback);
}
public static void showConfirmDialog(Activity context, int title, int message, BiConsumer<MaterialDialog, DialogAction> callback) {
CommonLogic.runOnUiThread(context, (activity) -> {
@ -309,11 +299,15 @@ public class DialogUtils {
* @param callback 回调
*/
public static void showInputDialog(View view, int title, int content, String hint, String prefill, BiConsumer<MaterialDialog, CharSequence> callback) {
showInputDialog(view, title, content, hint, prefill, false, callback);
}
public static void showInputDialog(View view, int title, int content, String hint, String prefill, boolean allowEmpty, BiConsumer<MaterialDialog, CharSequence> callback) {
CommonLogic.runOnUiThread(CommonLogic.getActivityFromView(view), (activity) -> {
MaterialDialog dialog = new MaterialDialog(activity, MaterialDialog.getDEFAULT_BEHAVIOR()).title(title, null).message(content, null, null);
dialog = DialogInputExtKt.input(dialog, hint, null, prefill, null,
InputType.TYPE_CLASS_TEXT,
null, true, false, (materialDialog, text) -> {
null, true, allowEmpty, (materialDialog, text) -> {
callback.accept(materialDialog, text);
return null;
});

View File

@ -30,9 +30,9 @@
android:title="@string/settings_disable_mono_mod"
app:showAsAction="never" />
<item
android:id="@+id/settings_rewrite_in_parallel"
android:id="@+id/settings_rewrite_missing"
android:orderInCategory="104"
android:title="@string/settings_rewrite_in_parallel"
android:title="@string/settings_rewrite_missing"
app:showAsAction="never" />
<item
android:id="@+id/settings_advanced_mode"
@ -46,9 +46,9 @@
android:title="@string/settings_set_mod_path"
app:showAsAction="never" />
<item
android:id="@+id/settings_set_max_log_size"
android:id="@+id/settings_set_app_name"
android:orderInCategory="111"
android:title="@string/settings_set_max_log_size"
android:title="@string/settings_set_app_name"
app:showAsAction="never" />
<item
android:id="@+id/settings_language"

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Registro detallado</string>
<string name="signing_package">Firmando paquete deinstalación</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">Versión SMAPI: 3.7.3</string>
<string name="smapi_version">Versión SMAPI: 3.7.3.2</string>
<string name="text_install_tip1">Nota: Requiere la versión del juego 1.4.5.138 o superior</string>
<string name="text_install_tip2">El cuerpo del juego debe instalarse durante la actualización o instalación</string>
<string name="unpacking_smapi_files">Desempacando</string>

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Journalisation détaillée</string>
<string name="signing_package">Signature</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">Version SMAPI: 3.7.3</string>
<string name="smapi_version">Version SMAPI: 3.7.3.2</string>
<string name="text_install_tip1">Remarques: La version du jeu 1.4.5.138 ou ultérieure est requise.</string>
<string name="text_install_tip2">Le jeu de base est requis lors de la mise à jour / installation.</string>
<string name="unpacking_smapi_files">Déballage</string>

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Catatan Terperinci</string>
<string name="signing_package">Menandatangani</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">Versi SMAPI: 3.7.3</string>
<string name="smapi_version">Versi SMAPI: 3.7.3.2</string>
<string name="text_install_tip1">Catatan: Dibutuhkan Stardew Valley versi 1.4.5.138 atau yang lebih baru.</string>
<string name="text_install_tip2">Permainan dasar diperlukan saat memperbarui/menginstal.</string>
<string name="unpacking_smapi_files">Membongkar</string>

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">자세한 로그</string>
<string name="signing_package">설치 패키지 서명</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">SMAPI버전: 3.7.3</string>
<string name="smapi_version">SMAPI버전: 3.7.3.2</string>
<string name="text_install_tip1">참고 : 게임 버전 1.4.5.138 이상이 필요합니다</string>
<string name="text_install_tip2">업데이트 또는 설치 중에 게임 본체를 설치해야합니다</string>
<string name="unpacking_smapi_files">포장 풀기</string>

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Log detalhado</string>
<string name="signing_package">Assinatura</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">Versão SMAPI: 3.7.3</string>
<string name="smapi_version">Versão SMAPI: 3.7.3.2</string>
<string name="text_install_tip1">Notas: É necessária a versão do jogo 1.4.5.138 ou posterior.</string>
<string name="text_install_tip2">O jogo base é necessário ao atualizar / instalar.</string>
<string name="unpacking_smapi_files">Desembalar</string>

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">บันทึกอย่างละเอียด</string>
<string name="signing_package">กำลังลงทะเบียนแอป</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">เวอร์ชั่น SMAPI: 3.7.3</string>
<string name="smapi_version">เวอร์ชั่น SMAPI: 3.7.3.2</string>
<string name="text_install_tip1">หมายเหตุ: ต้องการเกมเวอร์ชั่น 1.4.5.138 หรือใหม่กว่า</string>
<string name="text_install_tip2">ต้องการเกมหลักเมื่อทำการอัปเดต / ติดตั้ง</string>
<string name="unpacking_smapi_files">กำลังแกะกล่อง</string>

View File

@ -60,7 +60,7 @@
<string name="settings_verbose_logging">詳細日誌</string>
<string name="signing_package">正在簽名安裝包</string>
<string name="smapi_game_name">SMAPI 星露谷物語</string>
<string name="smapi_version">SMAPI版本: 3.7.3</string>
<string name="smapi_version">SMAPI版本: 3.7.3.2</string>
<string name="text_install_tip1">注意:需要 1.4.5.138 以上遊戲版本</string>
<string name="text_install_tip2">更新或安裝期間需要安裝遊戲</string>
<string name="unpacking_smapi_files">正在解包</string>
@ -82,4 +82,6 @@
<string name="error_patch_crc_incorrect">增量更新%1$s失敗: CRC (%2$s))</string>
<string name="settings_rewrite_in_parallel">多線程重寫</string>
<string name="request_unknown_source_permission">需要开启未知源权限以安装Mod框架是否前往设置开启</string>
<string name="settings_rewrite_missing">重寫增強</string>
<string name="settings_set_app_name">設定應用名稱</string>
</resources>

View File

@ -60,7 +60,7 @@
<string name="settings_verbose_logging">详细日志</string>
<string name="signing_package">正在签名安装包</string>
<string name="smapi_game_name">SMAPI星露谷物语</string>
<string name="smapi_version">SMAPI版本: 3.7.3</string>
<string name="smapi_version">SMAPI版本: 3.7.3.2</string>
<string name="text_install_tip1">注意需要不低于1.4.5.138版本的游戏本体</string>
<string name="text_install_tip2">更新或安装期间需要安装游戏本体</string>
<string name="unpacking_smapi_files">正在解包</string>
@ -82,4 +82,6 @@
<string name="error_patch_crc_incorrect">增量更新%1$s失败: CRC (%2$s))</string>
<string name="settings_rewrite_in_parallel">多线程重写</string>
<string name="request_unknown_source_permission">需要开启未知源权限以安装Mod框架是否前往设置开启</string>
<string name="settings_rewrite_missing">重写增强</string>
<string name="settings_set_app_name">设置应用名称</string>
</resources>

View File

@ -60,7 +60,7 @@
<string name="settings_verbose_logging">Verbose Logging</string>
<string name="signing_package">Signing</string>
<string name="smapi_game_name">SMAPI Stardew Valley</string>
<string name="smapi_version">SMAPI Version: 3.7.3</string>
<string name="smapi_version">SMAPI Version: 3.7.3.2</string>
<string name="text_install_tip1">Notes: Game version 1.4.5.138 or later is required.</string>
<string name="text_install_tip2">The base game is required when updating/installing.</string>
<string name="unpacking_smapi_files">Unpacking</string>
@ -86,4 +86,6 @@
<string name="error_patch_crc_incorrect">Patch %1$s failed: CRC (%2$s))</string>
<string name="settings_rewrite_in_parallel">Rewrite in Parallel</string>
<string name="request_unknown_source_permission">Needs to switch unknown source permission on to install mod framework, open settings?</string>
<string name="settings_rewrite_missing">Rewrite Missing</string>
<string name="settings_set_app_name">Patched App Name</string>
</resources>

View File

@ -1,17 +0,0 @@
package com.zane.smapiinstaller;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}