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 ed55f30bc2
commit 8b6f6ecb9f
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();