Added new string for 'every x hours'

This commit is contained in:
ByteHamster 2021-01-23 14:24:30 +01:00
parent 03c71ee6c5
commit 37b5becd59
2 changed files with 8 additions and 5 deletions

View File

@ -71,13 +71,13 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
Context context = getActivity().getApplicationContext(); Context context = getActivity().getApplicationContext();
String val; String val;
long interval = UserPreferences.getUpdateInterval(); long interval = UserPreferences.getUpdateInterval();
if(interval > 0) { if (interval > 0) {
int hours = (int) TimeUnit.MILLISECONDS.toHours(interval); int hours = (int) TimeUnit.MILLISECONDS.toHours(interval);
String hoursStr = context.getResources().getQuantityString(R.plurals.time_hours_quantified, hours, hours); val = context.getResources().getQuantityString(
val = String.format(context.getString(R.string.pref_autoUpdateIntervallOrTime_every), hoursStr); R.plurals.pref_autoUpdateIntervallOrTime_every_hours, hours, hours);
} else { } else {
int[] timeOfDay = UserPreferences.getUpdateTimeOfDay(); int[] timeOfDay = UserPreferences.getUpdateTimeOfDay();
if(timeOfDay.length == 2) { if (timeOfDay.length == 2) {
Calendar cal = new GregorianCalendar(); Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, timeOfDay[0]); cal.set(Calendar.HOUR_OF_DAY, timeOfDay[0]);
cal.set(Calendar.MINUTE, timeOfDay[1]); cal.set(Calendar.MINUTE, timeOfDay[1]);

View File

@ -410,8 +410,11 @@
<string name="pref_autoUpdateIntervallOrTime_Disable">Disable</string> <string name="pref_autoUpdateIntervallOrTime_Disable">Disable</string>
<string name="pref_autoUpdateIntervallOrTime_Interval">Set Interval</string> <string name="pref_autoUpdateIntervallOrTime_Interval">Set Interval</string>
<string name="pref_autoUpdateIntervallOrTime_TimeOfDay">Set Time of Day</string> <string name="pref_autoUpdateIntervallOrTime_TimeOfDay">Set Time of Day</string>
<string name="pref_autoUpdateIntervallOrTime_every">every %1$s</string>
<string name="pref_autoUpdateIntervallOrTime_at">at %1$s</string> <string name="pref_autoUpdateIntervallOrTime_at">at %1$s</string>
<plurals name="pref_autoUpdateIntervallOrTime_every_hours">
<item quantity="one">Every hour</item>
<item quantity="other">Every %d hours</item>
</plurals>
<string name="pref_followQueue_title">Continuous Playback</string> <string name="pref_followQueue_title">Continuous Playback</string>
<string name="pref_pauseOnHeadsetDisconnect_title">Headphones or Bluetooth disconnect</string> <string name="pref_pauseOnHeadsetDisconnect_title">Headphones or Bluetooth disconnect</string>
<string name="pref_unpauseOnHeadsetReconnect_title">Headphones Reconnect</string> <string name="pref_unpauseOnHeadsetReconnect_title">Headphones Reconnect</string>