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,23 +1,28 @@
# SMAPI-Android-Installer # SMAPI-Android-Installer
本软件可以提供安装SMAPI框架到安卓系统SMAPI是星露谷物语的MOD加载框架
本软件可以提供安装 SMAPI 框架到安卓系统SMAPI 是星露谷物语的 MOD 加载框架
## 使用方法 ## 使用方法
1. 在Release页下载最新的apk安装包安装
2. 安装完成后点击SMAPI安装器的安装按钮 1. 在 Release 页下载最新的 apk 安装包安装
2. 安装完成后点击 SMAPI 安装器的安装按钮
3. 等待安装完成 3. 等待安装完成
4. 下载的Mod需要添加到 `StardewValley/Mods` 文件夹 4. 下载的 Mod 需要添加到 `StardewValley/Mods` 文件夹
5. 点击新生成从SMAPI开头的星露谷物语进入Mod版游戏 5. 点击新生成从 SMAPI 开头的星露谷物语进入 Mod 版游戏
## 其它 ## 其它
### BUG反馈
### BUG 反馈
1. 填写这个[数据收集表](https://docs.qq.com/form/edit/DWlJZc0paV2xxR2JL) 1. 填写这个[数据收集表](https://docs.qq.com/form/edit/DWlJZc0paV2xxR2JL)
2. 加入QQ群 [860453392](https://jq.qq.com/?_wv=1027&k=55svbYs) 反馈 2. 加入 QQ 群 [860453392](https://jq.qq.com/?_wv=1027&k=55svbYs) 反馈
### 工作原理 ### 工作原理
1. 抽取游戏本体的安装包 1. 抽取游戏本体的安装包
2. 生成SMAPI依赖的文件 2. 生成 SMAPI 依赖的文件
3. 修改安装包添加SMAPI的启动代码 3. 修改安装包添加 SMAPI 的启动代码
4. 签名安装包并发起Mod版游戏的安装 4. 签名安装包并发起 Mod 版游戏的安装
### 下载地址 ### 下载地址

View File

@ -12,8 +12,8 @@ android {
applicationId "com.zane.smapiinstaller" applicationId "com.zane.smapiinstaller"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 28 targetSdkVersion 28
versionCode 51 versionCode 53
versionName "1.5.9" versionName "1.6.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true 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": [ "contents": [
{ {
"type": "COMPAT", "type": "COMPAT",
"name": "SMAPI for 1.4.5.137", "name": "SMAPI for 1.4.5.137",
"assetPath": "compat/137/", "assetPath": "compat/137/",
"description": "SMAPI compat package for game 1.4.4.128 - 1.4.5.137, SMAPI 3.3.2.0", "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" "hash": "bd16e8e4cb52d636e24c6a2d2309b66a60e492d2b97c1b8f6a519c04ac42ebdc"
}, },
{ {
"type": "COMPAT", "type": "COMPAT",
"name": "SMAPI for Galaxy Store", "name": "SMAPI for Galaxy Store",
"assetPath": "compat/samsung_138/", "assetPath": "compat/samsung_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3", "description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_20.zip", "url": "http://zaneyork.cn/dl/compat/smapi_samsung_138_21.zip",
"hash": "9c7853457db5d15bae69453d283eddb5aef835c5548f2db4b7ab170a6a32362a" "hash": "a77e8d35e0d1118bd03acda038ba00c4e13adc5eb73ebf8c200dfacdf85ef0a1"
}, },
{ {
"type": "COMPAT", "type": "COMPAT",
"name": "SMAPI for Amazon Store", "name": "SMAPI for Amazon Store",
"assetPath": "compat/amazon_138/", "assetPath": "compat/amazon_138/",
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3", "description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.7.3.2",
"url": "http://zaneyork.cn/download/compat/smapi_amazon_138_10.zip", "url": "http://zaneyork.cn/dl/compat/smapi_amazon_138_11.zip",
"hash": "8f79648f6727711ae8bfc74231348ad24df96be65ea21e1c35beeb92db9fdb1c" "hash": "f792ea943d2892b9c6c1116eec05916577f5f0385730a61a3d80d5d5b65b6c7d"
}, },
{ {
"type": "LOCALE", "type": "LOCALE",
"name": "Chinese Locale v2.5.1", "name": "Chinese Locale v2.5.1",
"description": "Chinese simplified locale pack, thanks Wabi-Sabi", "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" "hash": "4924ba7022c5604e7bc46ee2aad27d4f285c299a3939f3d2817afc10e2e73d77"
} }
] ]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ package com.zane.smapiinstaller.constant;
/** /**
* @author Zane * @author Zane
*/ */
public class AppConfigKey { public class AppConfigKeyConstants {
public static final String ACTIVE_TRANSLATOR = "ActiveTranslator"; public static final String ACTIVE_TRANSLATOR = "ActiveTranslator";
public static final String MOD_LIST_SORT_BY = "ModListSortBy"; 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 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 * @author Zane
*/ */
public class DownloadableContentTypes { public class DownloadableContentTypeConstants {
public static final String LOCALE = "LOCALE"; public static final String LOCALE = "LOCALE";
public static final String COMPAT = "COMPAT"; public static final String COMPAT = "COMPAT";

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.hjq.language.LanguagesManager; import com.hjq.language.LanguagesManager;
import com.zane.smapiinstaller.MainApplication; 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.AppConfig;
import com.zane.smapiinstaller.entity.DaoSession; import com.zane.smapiinstaller.entity.DaoSession;
import com.zane.smapiinstaller.entity.ModManifestEntry; import com.zane.smapiinstaller.entity.ModManifestEntry;
@ -53,7 +53,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
translateLogic(root); translateLogic(root);
MainApplication app = CommonLogic.getApplicationFromView(root); MainApplication app = CommonLogic.getApplicationFromView(root);
if (null != app) { 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(); sortBy = appConfig.getValue();
} }
sortLogic(sortBy); sortLogic(sortBy);
@ -65,7 +65,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
return; return;
} }
this.sortBy = sortBy; 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); ConfigUtils.saveConfig(app, appConfig);
sortLogic(appConfig.getValue()); sortLogic(appConfig.getValue());
} }
@ -110,7 +110,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
MainApplication app = CommonLogic.getApplicationFromView(root); MainApplication app = CommonLogic.getApplicationFromView(root);
if (null != app) { if (null != app) {
DaoSession daoSession = app.getDaoSession(); 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)) { if (!StringUtils.equals(activeTranslator.getValue(), TranslateUtil.NONE)) {
String translator = activeTranslator.getValue(); String translator = activeTranslator.getValue();
List<String> descriptions = this.modList.stream().map(ModManifestEntry::getDescription).filter(Objects::nonNull).collect(Collectors.toList()); 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.microsoft.appcenter.crashes.Crashes;
import com.zane.smapiinstaller.R; import com.zane.smapiinstaller.R;
import com.zane.smapiinstaller.constant.DialogAction; 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.DownloadableContent;
import com.zane.smapiinstaller.entity.ModManifestEntry; import com.zane.smapiinstaller.entity.ModManifestEntry;
import com.zane.smapiinstaller.logic.ModAssetsManager; import com.zane.smapiinstaller.logic.ModAssetsManager;
@ -141,7 +141,7 @@ public class DownloadableContentAdapter extends RecyclerView.Adapter<Downloadabl
void downloadContent() { void downloadContent() {
Context context = itemView.getContext(); Context context = itemView.getContext();
ModManifestEntry modManifestEntry = null; 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")); modManifestEntry = ModAssetsManager.findFirstModIf(mod -> StringUtils.equals(mod.getUniqueID(), "ZaneYork.CustomLocalization") || StringUtils.equals(mod.getUniqueID(), "SMAPI.CustomLocalization"));
if (modManifestEntry == null) { 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")); 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) { private void unpackLogic(Context context, File downloadedFile, ModManifestEntry finalModManifestEntry) {
try { try {
if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypes.LOCALE)) { if (StringUtils.equals(downloadableContent.getType(), DownloadableContentTypeConstants.LOCALE)) {
if (finalModManifestEntry != null) { if (finalModManifestEntry != null) {
ZipUtil.unpack(downloadedFile, new File(finalModManifestEntry.getAssetPath())); 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.google.common.io.Files;
import com.zane.smapiinstaller.MainApplication; import com.zane.smapiinstaller.MainApplication;
import com.zane.smapiinstaller.R; 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.Constants;
import com.zane.smapiinstaller.constant.DialogAction; import com.zane.smapiinstaller.constant.DialogAction;
import com.zane.smapiinstaller.logic.ApkPatcher; import com.zane.smapiinstaller.logic.ApkPatcher;
@ -65,7 +65,7 @@ public class InstallFragment extends Fragment {
root = inflater.inflate(R.layout.fragment_install, container, false); root = inflater.inflate(R.layout.fragment_install, container, false);
ButterKnife.bind(this, root); ButterKnife.bind(this, root);
context = this.getActivity(); 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); installButton.setVisibility(View.INVISIBLE);
layoutAdvInstall.setVisibility(View.VISIBLE); layoutAdvInstall.setVisibility(View.VISIBLE);
} }
@ -87,11 +87,11 @@ public class InstallFragment extends Fragment {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
DialogUtils.showConfirmDialog(root, R.string.confirm, R.string.android_version_confirm, ((dialog, which) -> { DialogUtils.showConfirmDialog(root, R.string.confirm, R.string.android_version_confirm, ((dialog, which) -> {
if (which == DialogAction.POSITIVE) { if (which == DialogAction.POSITIVE) {
installLogic(); installLogic(false);
} }
})); }));
} else { } else {
installLogic(); installLogic(false);
} }
} }
@ -102,51 +102,7 @@ public class InstallFragment extends Fragment {
@OnClick(R.id.button_adv_install) @OnClick(R.id.button_adv_install)
void advInstall() { void advInstall() {
if (task != null) { installLogic(true);
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();
} }
/** /**
@ -171,7 +127,7 @@ public class InstallFragment extends Fragment {
/** /**
* 安装逻辑 * 安装逻辑
*/ */
private void installLogic() { private void installLogic(boolean isAdv) {
if (task != null) { if (task != null) {
task.interrupt(); task.interrupt();
} }
@ -179,7 +135,7 @@ public class InstallFragment extends Fragment {
ApkPatcher patcher = new ApkPatcher(context); ApkPatcher patcher = new ApkPatcher(context);
patcher.registerProgressListener((progress) -> DialogUtils.setProgressDialogState(root, dialog, null, progress)); patcher.registerProgressListener((progress) -> DialogUtils.setProgressDialogState(root, dialog, null, progress));
DialogUtils.setProgressDialogState(root, dialog, R.string.extracting_package, null); DialogUtils.setProgressDialogState(root, dialog, R.string.extracting_package, null);
String path = patcher.extract(); String path = patcher.extract(isAdv ? 1 : -1);
if (path == null) { if (path == null) {
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.error_game_not_found))); DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.error_game_not_found)));
return; return;
@ -193,7 +149,7 @@ public class InstallFragment extends Fragment {
DialogUtils.setProgressDialogState(root, dialog, R.string.unpacking_smapi_files, 6); DialogUtils.setProgressDialogState(root, dialog, R.string.unpacking_smapi_files, 6);
modAssetsManager.installDefaultMods(); modAssetsManager.installDefaultMods();
DialogUtils.setProgressDialogState(root, dialog, R.string.patching_package, 8); DialogUtils.setProgressDialogState(root, dialog, R.string.patching_package, 8);
if (!patcher.patch(path)) { if (!patcher.patch(path, isAdv)) {
int target = patcher.getSwitchAction().getAndSet(0); int target = patcher.getSwitchAction().getAndSet(0);
if (target == R.string.menu_download) { 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) -> { 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,8 +14,13 @@ public class ConfigUtils {
AppConfigDao appConfigDao = daoSession.getAppConfigDao(); AppConfigDao appConfigDao = daoSession.getAppConfigDao();
AppConfig appConfig = appConfigDao.queryBuilder().where(AppConfigDao.Properties.Name.eq(key)).build().unique(); AppConfig appConfig = appConfigDao.queryBuilder().where(AppConfigDao.Properties.Name.eq(key)).build().unique();
if(appConfig == null) { if(appConfig == null) {
if(defaultValue != null){
appConfig = new AppConfig(null, key, String.valueOf(defaultValue)); appConfig = new AppConfig(null, key, String.valueOf(defaultValue));
} }
else {
appConfig = new AppConfig(null, key, null);
}
}
return appConfig; return appConfig;
} }
public static void saveConfig(MainApplication application, AppConfig config){ public static void saveConfig(MainApplication application, AppConfig config){

View File

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

View File

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

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Registro detallado</string> <string name="settings_verbose_logging">Registro detallado</string>
<string name="signing_package">Firmando paquete deinstalación</string> <string name="signing_package">Firmando paquete deinstalación</string>
<string name="smapi_game_name">SMAPI Stardew Valley</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_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="text_install_tip2">El cuerpo del juego debe instalarse durante la actualización o instalación</string>
<string name="unpacking_smapi_files">Desempacando</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="settings_verbose_logging">Journalisation détaillée</string>
<string name="signing_package">Signature</string> <string name="signing_package">Signature</string>
<string name="smapi_game_name">SMAPI Stardew Valley</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_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="text_install_tip2">Le jeu de base est requis lors de la mise à jour / installation.</string>
<string name="unpacking_smapi_files">Déballage</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="settings_verbose_logging">Catatan Terperinci</string>
<string name="signing_package">Menandatangani</string> <string name="signing_package">Menandatangani</string>
<string name="smapi_game_name">SMAPI Stardew Valley</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_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="text_install_tip2">Permainan dasar diperlukan saat memperbarui/menginstal.</string>
<string name="unpacking_smapi_files">Membongkar</string> <string name="unpacking_smapi_files">Membongkar</string>

View File

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

View File

@ -61,7 +61,7 @@
<string name="settings_verbose_logging">Log detalhado</string> <string name="settings_verbose_logging">Log detalhado</string>
<string name="signing_package">Assinatura</string> <string name="signing_package">Assinatura</string>
<string name="smapi_game_name">SMAPI Stardew Valley</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_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="text_install_tip2">O jogo base é necessário ao atualizar / instalar.</string>
<string name="unpacking_smapi_files">Desembalar</string> <string name="unpacking_smapi_files">Desembalar</string>

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@
<string name="settings_verbose_logging">Verbose Logging</string> <string name="settings_verbose_logging">Verbose Logging</string>
<string name="signing_package">Signing</string> <string name="signing_package">Signing</string>
<string name="smapi_game_name">SMAPI Stardew Valley</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_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="text_install_tip2">The base game is required when updating/installing.</string>
<string name="unpacking_smapi_files">Unpacking</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="error_patch_crc_incorrect">Patch %1$s failed: CRC (%2$s))</string>
<string name="settings_rewrite_in_parallel">Rewrite in Parallel</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="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> </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);
}
}