Show toast when no updates are available.

Co-authored-by: Stypox <stypox@pm.me>
This commit is contained in:
Isira Seneviratne 2022-07-20 09:01:12 +05:30 committed by Stypox
parent 1d53389ca9
commit f1b15a95a4
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
72 changed files with 142 additions and 204 deletions

View file

@ -16,25 +16,17 @@ public class UpdateSettingsFragment extends BasePreferenceFragment {
.apply();
if (checkForUpdates) {
checkNewVersionNow();
NewVersionWorker.enqueueNewVersionCheckingWork(requireContext(), true);
}
return true;
};
private final Preference.OnPreferenceClickListener manualUpdateClick = preference -> {
Toast.makeText(getContext(), R.string.checking_updates_toast, Toast.LENGTH_SHORT).show();
checkNewVersionNow();
NewVersionWorker.enqueueNewVersionCheckingWork(requireContext(), true);
return true;
};
private void checkNewVersionNow() {
// Search for updates immediately when update checks are enabled.
// Reset the expire time. This is necessary to check for an update immediately.
defaultPreferences.edit()
.putLong(getString(R.string.update_expiry_key), 0).apply();
NewVersionWorker.enqueueNewVersionCheckingWork(getContext());
}
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResourceRegistry();