[app] don't report negative update scheduling times in settings

When the scheduling time is in the past, our job should have run already, but did not, because conditions we require weren't fulfilled. Times in the past are confusing for users, so we just report that the next run is waiting for conditions to be fulfilled.
This commit is contained in:
Torsten Grote
2024-08-01 16:25:34 -03:00
parent cc0a036a74
commit 263c61d8ad
2 changed files with 5 additions and 1 deletions

View File

@@ -266,7 +266,10 @@ public class PreferencesFragment extends PreferenceFragmentCompat
private String getUpdateIntervalSeekbarSummary(int position) {
StringBuilder sb = new StringBuilder();
sb.append(getString(UPDATE_INTERVAL_NAMES[position]));
if (nextUpdateCheck < Long.MAX_VALUE) {
if (nextUpdateCheck < 0) {
sb.append("\n");
sb.append(getString(R.string.auto_update_time_past));
} else if (nextUpdateCheck < Long.MAX_VALUE) {
sb.append("\n");
CharSequence nextUpdate = DateUtils.getRelativeTimeSpanString(nextUpdateCheck,
System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE);

View File

@@ -679,6 +679,7 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="interval_2w">Check for updates every 2 weeks</string>
<!-- "updates" as in software updates -->
<string name="auto_update_time">Earliest next update: %s</string>
<string name="auto_update_time_past">Next update when conditions are fulfilled</string>
<string name="keep_hour">1 Hour</string>
<string name="keep_day">1 Day</string>