1.Bug fix

This commit is contained in:
ZaneYork 2020-06-23 10:27:17 +08:00
parent 41f0b8765f
commit b1514139d1
5 changed files with 55 additions and 17 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "com.zane.smapiinstaller" applicationId "com.zane.smapiinstaller"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 28 targetSdkVersion 28
versionCode 47 versionCode 48
versionName "1.5.6" versionName "1.5.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true multiDexEnabled true

View File

@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.zane.smapiinstaller.MobileNavigationDirections;
import com.zane.smapiinstaller.R; import com.zane.smapiinstaller.R;
import com.zane.smapiinstaller.constant.Constants; import com.zane.smapiinstaller.constant.Constants;
import com.zane.smapiinstaller.constant.DialogAction; import com.zane.smapiinstaller.constant.DialogAction;
@ -175,7 +176,7 @@ public class ModManifestAdapter extends RecyclerView.Adapter<ModManifestAdapter.
File file = new File(modPath, "config.json"); File file = new File(modPath, "config.json");
if(file.exists()) { if(file.exists()) {
NavController controller = Navigation.findNavController(itemView); NavController controller = Navigation.findNavController(itemView);
ConfigFragmentDirections.ActionNavConfigToConfigEditFragment action = ConfigFragmentDirections.actionNavConfigToConfigEditFragment(file.getAbsolutePath()); MobileNavigationDirections.ActionNavAnyToConfigEditFragment action = ConfigFragmentDirections.actionNavAnyToConfigEditFragment(file.getAbsolutePath());
controller.navigate(action); controller.navigate(action);
} }
} }

View File

@ -6,6 +6,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.zane.smapiinstaller.MobileNavigationDirections;
import com.zane.smapiinstaller.R; import com.zane.smapiinstaller.R;
import com.zane.smapiinstaller.constant.Constants; import com.zane.smapiinstaller.constant.Constants;
import com.zane.smapiinstaller.entity.HelpItemList; import com.zane.smapiinstaller.entity.HelpItemList;
@ -60,7 +61,7 @@ public class HelpFragment extends Fragment {
NavController controller = Navigation.findNavController(view); NavController controller = Navigation.findNavController(view);
File logFile = new File(Environment.getExternalStorageDirectory(), Constants.LOG_PATH); File logFile = new File(Environment.getExternalStorageDirectory(), Constants.LOG_PATH);
if(logFile.exists()) { if(logFile.exists()) {
HelpFragmentDirections.ActionNavHelpToConfigEditFragment action = HelpFragmentDirections.actionNavHelpToConfigEditFragment(logFile.getAbsolutePath()); MobileNavigationDirections.ActionNavAnyToConfigEditFragment action = HelpFragmentDirections.actionNavAnyToConfigEditFragment(logFile.getAbsolutePath());
action.setEditable(false); action.setEditable(false);
controller.navigate(action); controller.navigate(action);
} }

View File

@ -67,6 +67,13 @@ public class DialogUtils {
materialDialog.show(); materialDialog.show();
}); });
} }
public static void showAlertDialog(Activity context, int title, String message) {
CommonLogic.runOnUiThread(context, (activity) -> {
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; return reference;
} }
public static AtomicReference<ProgressDialog> showProgressDialog(Activity context, int title, String message) {
AtomicReference<ProgressDialog> 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);
}
}
});
}
}
/** /**
* 解散当前对话框 * 解散当前对话框
*/ */

View File

@ -31,24 +31,12 @@
android:name="com.zane.smapiinstaller.ui.config.ConfigFragment" android:name="com.zane.smapiinstaller.ui.config.ConfigFragment"
android:label="@string/menu_config" android:label="@string/menu_config"
tools:layout="@layout/fragment_config"> tools:layout="@layout/fragment_config">
<action
android:id="@+id/action_nav_config_to_config_edit_fragment"
app:destination="@id/config_edit_fragment">
<argument android:name="configPath" app:argType="string"/>
<argument android:name="editable" android:defaultValue="true" app:argType="boolean"/>
</action>
</fragment> </fragment>
<fragment <fragment
android:id="@+id/nav_help" android:id="@+id/nav_help"
android:name="com.zane.smapiinstaller.ui.help.HelpFragment" android:name="com.zane.smapiinstaller.ui.help.HelpFragment"
android:label="@string/menu_help" android:label="@string/menu_help"
tools:layout="@layout/fragment_help"> tools:layout="@layout/fragment_help">
<action
android:id="@+id/action_nav_help_to_config_edit_fragment"
app:destination="@id/config_edit_fragment" >
<argument android:name="configPath" app:argType="string"/>
<argument android:name="editable" android:defaultValue="true" app:argType="boolean"/>
</action>
</fragment> </fragment>
<fragment <fragment
android:id="@+id/nav_download" android:id="@+id/nav_download"
@ -60,7 +48,6 @@
android:name="com.zane.smapiinstaller.ui.about.AboutFragment" android:name="com.zane.smapiinstaller.ui.about.AboutFragment"
android:label="@string/menu_about" android:label="@string/menu_about"
tools:layout="@layout/fragment_about" /> tools:layout="@layout/fragment_about" />
<fragment <fragment
android:id="@+id/nav_mod_update" android:id="@+id/nav_mod_update"
android:name="com.zane.smapiinstaller.ui.update.ModUpdateFragment" android:name="com.zane.smapiinstaller.ui.update.ModUpdateFragment"
@ -71,6 +58,12 @@
android:defaultValue="{}" android:defaultValue="{}"
app:argType="string" /> app:argType="string" />
</fragment> </fragment>
<action
android:id="@+id/action_nav_any_to_config_edit_fragment"
app:destination="@id/config_edit_fragment">
<argument android:name="configPath" app:argType="string"/>
<argument android:name="editable" android:defaultValue="true" app:argType="boolean"/>
</action>
<action <action
android:id="@+id/action_nav_any_to_mod_update_fragment" android:id="@+id/action_nav_any_to_mod_update_fragment"
app:destination="@id/nav_mod_update" > app:destination="@id/nav_mod_update" >