diff --git a/app/build.gradle b/app/build.gradle index d4db6e2..cebbdd7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.zane.smapiinstaller" minSdkVersion 19 targetSdkVersion 28 - versionCode 47 - versionName "1.5.6" + versionCode 48 + versionName "1.5.7" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true diff --git a/app/src/main/java/com/zane/smapiinstaller/ui/config/ModManifestAdapter.java b/app/src/main/java/com/zane/smapiinstaller/ui/config/ModManifestAdapter.java index b0b2391..5e4ae34 100644 --- a/app/src/main/java/com/zane/smapiinstaller/ui/config/ModManifestAdapter.java +++ b/app/src/main/java/com/zane/smapiinstaller/ui/config/ModManifestAdapter.java @@ -7,6 +7,7 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; +import com.zane.smapiinstaller.MobileNavigationDirections; import com.zane.smapiinstaller.R; import com.zane.smapiinstaller.constant.Constants; import com.zane.smapiinstaller.constant.DialogAction; @@ -175,7 +176,7 @@ public class ModManifestAdapter extends RecyclerView.Adapter { + MaterialDialog materialDialog = new MaterialDialog(activity, MaterialDialog.getDEFAULT_BEHAVIOR()).title(title, null).message(null, message, null).positiveButton(R.string.ok, null, null); + DialogUtils.setCurrentDialog(materialDialog); + materialDialog.show(); + }); + } /** * 显示警告对话框 @@ -83,6 +90,14 @@ public class DialogUtils { }); } + public static void showAlertDialog(Activity context, int title, int message) { + CommonLogic.runOnUiThread(context, (activity) -> { + MaterialDialog materialDialog = new MaterialDialog(activity, MaterialDialog.getDEFAULT_BEHAVIOR()).title(title, null).message(message, null, null).positiveButton(R.string.ok, null, null); + DialogUtils.setCurrentDialog(materialDialog); + materialDialog.show(); + }); + } + /** * 显示确认对话框 * @@ -191,6 +206,20 @@ public class DialogUtils { }); return reference; } + public static AtomicReference showProgressDialog(Activity context, int title, String message) { + AtomicReference reference = new AtomicReference<>(); + CommonLogic.runOnUiThread(context, (activity) -> { + ProgressDialog dialog = new ProgressDialog(activity); + DialogUtils.setCurrentDialog(dialog); + dialog.setMessage(message); + dialog.setCancelable(false); + dialog.setMax(100); + dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + dialog.show(); + reference.set(dialog); + }); + return reference; + } /** * 解散指定对话框 @@ -234,6 +263,20 @@ public class DialogUtils { } } + public static void dismissDialog(Activity activity, ProgressDialog dialog) { + if (activity != null && !activity.isFinishing()) { + activity.runOnUiThread(() -> { + if (dialog != null) { + try { + dialog.dismiss(); + } catch (Exception e) { + Crashes.trackError(e); + } + } + }); + } + } + /** * 解散当前对话框 */ diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index b3bbb7b..48e9ceb 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -31,24 +31,12 @@ android:name="com.zane.smapiinstaller.ui.config.ConfigFragment" android:label="@string/menu_config" tools:layout="@layout/fragment_config"> - - - - - - - - - + + + +