Skip to content

Commit

Permalink
修复[自动获取更新]: 当前为最新版本时Toast显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera-Firefly committed Oct 24, 2024
1 parent afe5797 commit d50aebb
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void handleUpdateCheck(JSONObject releaseInfo, boolean ignore) {
if (remoteVersionCode > localVersionCode) {
handleCachedApk(releaseInfo, ignore, false);
} else {
if (!ignore) showToast(R.string.pgw_settings_updatelauncher_updated);
if (!ignore) showToast(R.string.pgw_settings_updatelauncher_updated, String.valueOf(localVersionCode));
handleCachedApk(releaseInfo, ignore, true);
}
} catch (IOException | JSONException e) {
Expand Down Expand Up @@ -285,6 +285,13 @@ private void showToast(int messageResId) {
Toast.makeText(context, context.getString(messageResId), Toast.LENGTH_SHORT).show());
}

private void showToast(int messageResId, Object... formatArgs) {
new Handler(Looper.getMainLooper()).post(() -> {
String message = context.getString(messageResId, formatArgs);
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
});
}

private void deleteFileIfExists(File file) {
if (file.exists()) file.delete();
}
Expand Down

0 comments on commit d50aebb

Please sign in to comment.