Updater: Add welcome message with instructions

Make it clear for everyone before even clicking anything that updates
are not incremental and old ones can be deleted

Change-Id: Ifcc31958d9324899a267741141ff66b10f62edc1
This commit is contained in:
Michael W
2025-01-11 17:19:34 +01:00
committed by Nolen Johnson
parent ec85854518
commit a9d7673d1d
3 changed files with 21 additions and 0 deletions

View File

@@ -230,6 +230,8 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
findViewById(R.id.refresh).setOnClickListener(v -> downloadUpdatesList(true)); findViewById(R.id.refresh).setOnClickListener(v -> downloadUpdatesList(true));
findViewById(R.id.preferences).setOnClickListener(v -> showPreferencesDialog()); findViewById(R.id.preferences).setOnClickListener(v -> showPreferencesDialog());
} }
maybeShowWelcomeMessage();
} }
@Override @Override
@@ -665,4 +667,19 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
}) })
.show(); .show();
} }
private void maybeShowWelcomeMessage() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean alreadySeen = preferences.getBoolean(Constants.HAS_SEEN_WELCOME_MESSAGE, false);
if (alreadySeen) {
return;
}
new AlertDialog.Builder(this)
.setTitle(R.string.welcome_title)
.setMessage(R.string.welcome_message)
.setPositiveButton(R.string.info_dialog_ok, (dialog, which) -> preferences.edit()
.putBoolean(Constants.HAS_SEEN_WELCOME_MESSAGE, true)
.apply())
.show();
}
} }

View File

@@ -59,4 +59,5 @@ public final class Constants {
public static final String UPDATE_RECOVERY_PROPERTY = "persist.vendor.recovery_update"; public static final String UPDATE_RECOVERY_PROPERTY = "persist.vendor.recovery_update";
public static final String HAS_SEEN_INFO_DIALOG = "has_seen_info_dialog"; public static final String HAS_SEEN_INFO_DIALOG = "has_seen_info_dialog";
public static final String HAS_SEEN_WELCOME_MESSAGE = "has_seen_welcome_message";
} }

View File

@@ -173,4 +173,7 @@
<string name="local_update_import_failure">Failed to import local update</string> <string name="local_update_import_failure">Failed to import local update</string>
<string name="local_update_import_install">Install</string> <string name="local_update_import_install">Install</string>
<string name="local_update_name">Local update</string> <string name="local_update_name">Local update</string>
<string name="welcome_title">Welcome</string>
<string name="welcome_message">Please note that when multiple updates are available, there is no need to go update-by-update, you can always install the latest one directly, and then safely delete old updates to free up storage space.</string>
</resources> </resources>