parent
5cec14c4cb
commit
bcb17bb3cc
|
@ -12,8 +12,8 @@ android {
|
||||||
applicationId "com.zane.smapiinstaller"
|
applicationId "com.zane.smapiinstaller"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 28
|
versionCode 29
|
||||||
versionName "1.3.11"
|
versionName "1.4.0"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
|
@ -121,21 +121,19 @@ 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()) {
|
||||||
if(appConfig != null && StringUtils.equals(appConfig.getValue(), String.valueOf(dto.getVersionCode()))) {
|
if (appConfig != null && StringUtils.equals(appConfig.getValue(), String.valueOf(dto.getVersionCode()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DialogUtils.showConfirmDialog(toolbar, R.string.settings_check_for_updates,
|
DialogUtils.showConfirmDialog(toolbar, R.string.settings_check_for_updates,
|
||||||
MainActivity.this.getString(R.string.app_update_detected, dto.getVersionName()), (dialog, which) -> {
|
MainActivity.this.getString(R.string.app_update_detected, dto.getVersionName()), (dialog, which) -> {
|
||||||
if (which == DialogAction.POSITIVE) {
|
if (which == DialogAction.POSITIVE) {
|
||||||
CommonLogic.openInPlayStore(MainActivity.this);
|
CommonLogic.openInPlayStore(MainActivity.this);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
AppConfig config;
|
AppConfig config;
|
||||||
if(appConfig != null) {
|
if (appConfig != null) {
|
||||||
config = appConfig;
|
config = appConfig;
|
||||||
config.setValue(String.valueOf(dto.getVersionCode()));
|
config.setValue(String.valueOf(dto.getVersionCode()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
config = new AppConfig(null, AppConfigKey.IGNORE_UPDATE_VERSION_CODE, String.valueOf(dto.getVersionCode()));
|
config = new AppConfig(null, AppConfigKey.IGNORE_UPDATE_VERSION_CODE, String.valueOf(dto.getVersionCode()));
|
||||||
}
|
}
|
||||||
appConfigDao.insertOrReplace(config);
|
appConfigDao.insertOrReplace(config);
|
||||||
|
@ -319,6 +317,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
modAssetsManager.checkModUpdate((list) -> {
|
modAssetsManager.checkModUpdate((list) -> {
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
CommonLogic.runOnUiThread(this, (activity) -> Toast.makeText(activity, R.string.no_update_text, Toast.LENGTH_SHORT).show());
|
CommonLogic.runOnUiThread(this, (activity) -> Toast.makeText(activity, R.string.no_update_text, Toast.LENGTH_SHORT).show());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
NavController controller = Navigation.findNavController(this, R.id.nav_host_fragment);
|
NavController controller = Navigation.findNavController(this, R.id.nav_host_fragment);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.pm.PackageInfo;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
@ -295,7 +296,7 @@ public class ModAssetsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkModUpdate(Consumer<List<ModUpdateCheckResponseDto>> callback) {
|
public void checkModUpdate(Consumer<List<ModUpdateCheckResponseDto>> callback) {
|
||||||
if(checkUpdating.get()) {
|
if (checkUpdating.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ModUpdateCheckRequestDto.ModInfo> list = StreamSupport.stream(findAllInstalledMods(false))
|
List<ModUpdateCheckRequestDto.ModInfo> list = StreamSupport.stream(findAllInstalledMods(false))
|
||||||
|
@ -309,6 +310,7 @@ public class ModAssetsManager {
|
||||||
if (gamePackageInfo == null) {
|
if (gamePackageInfo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
context.runOnUiThread(() -> Toast.makeText(context, R.string.mod_version_update_checking, Toast.LENGTH_SHORT).show());
|
||||||
checkUpdating.set(true);
|
checkUpdating.set(true);
|
||||||
try {
|
try {
|
||||||
ModUpdateCheckRequestDto requestDto = new ModUpdateCheckRequestDto(list, new ModUpdateCheckRequestDto.SemanticVersion(gamePackageInfo.versionName));
|
ModUpdateCheckRequestDto requestDto = new ModUpdateCheckRequestDto(list, new ModUpdateCheckRequestDto.SemanticVersion(gamePackageInfo.versionName));
|
||||||
|
|
|
@ -43,6 +43,8 @@ public class ConfigEditFragment extends Fragment {
|
||||||
Button buttonConfigSave;
|
Button buttonConfigSave;
|
||||||
@BindView(R.id.button_config_cancel)
|
@BindView(R.id.button_config_cancel)
|
||||||
Button buttonConfigCancel;
|
Button buttonConfigCancel;
|
||||||
|
@BindView(R.id.button_log_parser)
|
||||||
|
Button buttonLogParser;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
|
@ -56,6 +58,7 @@ public class ConfigEditFragment extends Fragment {
|
||||||
editText.setKeyListener(null);
|
editText.setKeyListener(null);
|
||||||
buttonConfigSave.setVisibility(View.INVISIBLE);
|
buttonConfigSave.setVisibility(View.INVISIBLE);
|
||||||
buttonConfigCancel.setVisibility(View.INVISIBLE);
|
buttonConfigCancel.setVisibility(View.INVISIBLE);
|
||||||
|
buttonLogParser.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
configPath = args.getConfigPath();
|
configPath = args.getConfigPath();
|
||||||
File file = new File(configPath);
|
File file = new File(configPath);
|
||||||
|
@ -108,4 +111,9 @@ public class ConfigEditFragment extends Fragment {
|
||||||
void onConfigCancel() {
|
void onConfigCancel() {
|
||||||
CommonLogic.doOnNonNull(getView(), view -> Navigation.findNavController(view).popBackStack());
|
CommonLogic.doOnNonNull(getView(), view -> Navigation.findNavController(view).popBackStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.button_log_parser)
|
||||||
|
void onLogParser() {
|
||||||
|
CommonLogic.doOnNonNull(getContext(), context -> CommonLogic.openUrl(context, "https://smapi.io/log"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,15 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_log_parser"
|
||||||
|
android:text="@string/parser"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/guideline_v1"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/guideline_h2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_config_cancel"
|
android:id="@+id/button_config_cancel"
|
||||||
android:text="@string/cancel"
|
android:text="@string/cancel"
|
||||||
|
|
|
@ -69,4 +69,6 @@
|
||||||
<string name="open_with">打開為</string>
|
<string name="open_with">打開為</string>
|
||||||
<string name="no_update_text">所有MOD已是最新狀態</string>
|
<string name="no_update_text">所有MOD已是最新狀態</string>
|
||||||
<string name="app_update_detected">檢測到新版本: %1$s</string>
|
<string name="app_update_detected">檢測到新版本: %1$s</string>
|
||||||
|
<string name="parser">格式化</string>
|
||||||
|
<string name="mod_version_update_checking">正在檢查MOD更新</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -69,4 +69,6 @@
|
||||||
<string name="open_with">打开为</string>
|
<string name="open_with">打开为</string>
|
||||||
<string name="no_update_text">所有MOD已是最新状态</string>
|
<string name="no_update_text">所有MOD已是最新状态</string>
|
||||||
<string name="app_update_detected">检测到新版本: %1$s</string>
|
<string name="app_update_detected">检测到新版本: %1$s</string>
|
||||||
|
<string name="parser">格式化</string>
|
||||||
|
<string name="mod_version_update_checking">正在检查MOD更新</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -73,4 +73,6 @@
|
||||||
<string name="open_with">Open With</string>
|
<string name="open_with">Open With</string>
|
||||||
<string name="no_update_text">All mods are up to date</string>
|
<string name="no_update_text">All mods are up to date</string>
|
||||||
<string name="app_update_detected">New version detected: %1$s</string>
|
<string name="app_update_detected">New version detected: %1$s</string>
|
||||||
|
<string name="parser">Parser</string>
|
||||||
|
<string name="mod_version_update_checking">Checking for mod updates</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue