parent
5734a01260
commit
ebb36e9388
|
@ -10,8 +10,8 @@ android {
|
|||
applicationId "com.zane.smapiinstaller"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 28
|
||||
versionCode 23
|
||||
versionName "1.3.6"
|
||||
versionCode 24
|
||||
versionName "1.3.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": 6,
|
||||
"version": 7,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -14,8 +14,8 @@
|
|||
"name": "SMAPI for Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.4.0",
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138.zip",
|
||||
"hash": "4028512fb1ae048557b63495de6f76cc454510d488a76d35eb1330ef021ec4ec"
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_2.zip",
|
||||
"hash": "6302a881de93f45aebee8eadc44b69c3cd73cf957366ba8ef339b0d103e6ae64"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": 6,
|
||||
"version": 7,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -14,8 +14,8 @@
|
|||
"name": "SMAPI for Galaxy Store",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI compat package for game 1.4.4.138 - latest, SMAPI 3.4.0",
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138.zip",
|
||||
"hash": "4028512fb1ae048557b63495de6f76cc454510d488a76d35eb1330ef021ec4ec"
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_2.zip",
|
||||
"hash": "6302a881de93f45aebee8eadc44b69c3cd73cf957366ba8ef339b0d103e6ae64"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": 6,
|
||||
"version": 7,
|
||||
"contents": [
|
||||
{
|
||||
"type": "COMPAT",
|
||||
|
@ -14,8 +14,8 @@
|
|||
"name": "SMAPI三星商店兼容包",
|
||||
"assetPath": "compat/samsung_138/",
|
||||
"description": "SMAPI三星商店兼容包, 适用版本1.4.4.138至今, SMAPI 3.4.0",
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138.zip",
|
||||
"hash": "4028512fb1ae048557b63495de6f76cc454510d488a76d35eb1330ef021ec4ec"
|
||||
"url": "http://zaneyork.cn/download/compat/smapi_samsung_138_2.zip",
|
||||
"hash": "6302a881de93f45aebee8eadc44b69c3cd73cf957366ba8ef339b0d103e6ae64"
|
||||
},
|
||||
{
|
||||
"type": "LOCALE",
|
||||
|
|
Binary file not shown.
|
@ -40,6 +40,7 @@ import java.security.cert.X509Certificate;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.Deflater;
|
||||
|
@ -57,6 +58,8 @@ public class ApkPatcher {
|
|||
|
||||
private AtomicReference<String> errorMessage = new AtomicReference<>();
|
||||
|
||||
private AtomicInteger switchAction = new AtomicInteger();
|
||||
|
||||
public ApkPatcher(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
@ -119,6 +122,7 @@ public class ApkPatcher {
|
|||
byte[] modifiedManifest = modifyManifest(manifest, apkFilesManifests);
|
||||
if(apkFilesManifests.size() == 0) {
|
||||
errorMessage.set(context.getString(R.string.error_no_supported_game_version));
|
||||
switchAction.set(R.string.menu_download);
|
||||
return false;
|
||||
}
|
||||
if(modifiedManifest == null) {
|
||||
|
@ -291,4 +295,8 @@ public class ApkPatcher {
|
|||
public AtomicReference<String> getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public AtomicInteger getSwitchAction() {
|
||||
return switchAction;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.zane.smapiinstaller.logic;
|
|||
import android.view.View;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ClassToInstanceMap;
|
||||
import com.google.common.collect.MutableClassToInstanceMap;
|
||||
import com.hjq.language.LanguagesManager;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
|
@ -15,13 +17,14 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 在线列表更新管理器
|
||||
* @param <T> 列表类型
|
||||
*/
|
||||
public class UpdatableListManager<T extends UpdatableList> {
|
||||
private static boolean updateChecked = false;
|
||||
private static ConcurrentHashMap<Class<?>, Boolean> updateChecked = new ConcurrentHashMap<>();
|
||||
|
||||
private static UpdatableList updatableList = null;
|
||||
|
||||
|
@ -35,8 +38,9 @@ public class UpdatableListManager<T extends UpdatableList> {
|
|||
*/
|
||||
public UpdatableListManager(View root, String filename, Class<T> tClass, String updateUrl) {
|
||||
updatableList = FileUtils.getLocaledAssetJson(root.getContext(), filename, tClass);
|
||||
if(!updateChecked) {
|
||||
updateChecked = true;
|
||||
Boolean updated = updateChecked.get(tClass);
|
||||
if(updated == null || !updated) {
|
||||
updateChecked.put(tClass, true);
|
||||
String languageSuffix = '.' + LanguagesManager.getAppLanguage(root.getContext()).getLanguage();
|
||||
updateList(root, tClass, updateUrl, filename, languageSuffix);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.Navigation;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
|
@ -88,7 +90,18 @@ public class InstallFragment extends Fragment {
|
|||
modAssetsManager.installDefaultMods();
|
||||
DialogUtils.setProgressDialogState(root, dialog, R.string.patching_package, 25);
|
||||
if (!patcher.patch(path)) {
|
||||
DialogUtils.showAlertDialog(root, R.string.error, StringUtils.firstNonBlank(patcher.getErrorMessage().get(), context.getString(R.string.failed_to_patch_game)));
|
||||
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(root);
|
||||
controller.navigate(InstallFragmentDirections.actionNavInstallToNavDownload());
|
||||
}
|
||||
});
|
||||
}
|
||||
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, 55);
|
||||
|
@ -100,7 +113,6 @@ public class InstallFragment extends Fragment {
|
|||
DialogUtils.setProgressDialogState(root, dialog, R.string.installing_package, 99);
|
||||
patcher.install(signPath);
|
||||
dialog.incrementProgress(1);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
Crashes.trackError(e);
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
android:name="com.zane.smapiinstaller.ui.install.InstallFragment"
|
||||
android:label="@string/menu_install"
|
||||
tools:layout="@layout/fragment_install">
|
||||
<action
|
||||
android:id="@+id/action_nav_install_to_nav_download"
|
||||
app:destination="@id/nav_download" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/config_edit_fragment"
|
||||
|
|
Loading…
Reference in New Issue