mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Rewrite more plural handling of 'Minutes'
This commit is contained in:
@@ -679,7 +679,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
||||
if (minutes == 0) {
|
||||
value = LocaleController.getString("Disabled", R.string.Disabled);
|
||||
} else if (minutes < 60) {
|
||||
value = LocaleController.formatPluralString("Minutes", minutes);
|
||||
value = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, minutes, minutes);
|
||||
} else {
|
||||
value = LocaleController.formatPluralString("Hours", minutes / 60);
|
||||
}
|
||||
|
||||
@@ -371,9 +371,9 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
if (value == 0) {
|
||||
return LocaleController.getString("Disabled", R.string.Disabled);
|
||||
} else if (value == 1) {
|
||||
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", 1));
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 1, 1);
|
||||
} else if (value == 2) {
|
||||
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", 5));
|
||||
return ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, 5, 5);
|
||||
} else if (value == 3) {
|
||||
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Hours", 1));
|
||||
} else if (value == 4) {
|
||||
@@ -674,7 +674,7 @@ public class PasscodeActivity extends BaseFragment implements NotificationCenter
|
||||
if (UserConfig.autoLockIn == 0) {
|
||||
val = LocaleController.formatString("Disabled", R.string.Disabled);
|
||||
} else if (UserConfig.autoLockIn < 60 * 60) {
|
||||
val = LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", UserConfig.autoLockIn / 60));
|
||||
val = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, UserConfig.autoLockIn / 60, UserConfig.autoLockIn / 60);
|
||||
} else if (UserConfig.autoLockIn < 60 * 60 * 24) {
|
||||
val = LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Hours", (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60)));
|
||||
} else {
|
||||
|
||||
@@ -583,7 +583,8 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
if (delta <= 0) {
|
||||
val = LocaleController.getString("Enabled", R.string.Enabled);
|
||||
} else if (delta < 60 * 60) {
|
||||
val = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Minutes", delta / 60));
|
||||
// @TODO: Maybe this should be reworded a bit.
|
||||
val = mContext.getResources().getQuantityString(R.plurals.Minutes, delta / 60, delta / 60);
|
||||
} else if (delta < 60 * 60 * 24) {
|
||||
val = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Hours", (int) Math.ceil(delta / 60.0f / 60)));
|
||||
} else if (delta < 60 * 60 * 24 * 365) {
|
||||
@@ -629,7 +630,7 @@ public class ProfileNotificationsActivity extends BaseFragment implements Notifi
|
||||
textCell.setTextAndValue(LocaleController.getString("SmartNotifications", R.string.SmartNotifications), LocaleController.getString("Disabled", R.string.Disabled), true);
|
||||
} else {
|
||||
String times = LocaleController.formatPluralString("Times", notifyMaxCount);
|
||||
String minutes = LocaleController.formatPluralString("Minutes", notifyDelay / 60);
|
||||
String minutes = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.Minutes, notifyDelay / 60, notifyDelay / 60);
|
||||
textCell.setTextAndValue(LocaleController.getString("SmartNotifications", R.string.SmartNotifications), LocaleController.formatString("SmartNotificationsInfo", R.string.SmartNotificationsInfo, times, minutes), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user