summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/res/res/values/strings.xml5
-rw-r--r--packages/SystemUI/res-keyguard/values/strings.xml9
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java13
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java13
4 files changed, 25 insertions, 15 deletions
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 40fd12efe710..5242b955917b 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4557,11 +4557,6 @@
<string name="kg_wrong_password">Wrong Password</string>
<!-- Message shown when user enters wrong PIN -->
<string name="kg_wrong_pin">Wrong PIN</string>
- <!-- Countdown message shown after too many failed unlock attempts -->
- <plurals name="kg_too_many_failed_attempts_countdown">
- <item quantity="one">Try again in 1 second.</item>
- <item quantity="other">Try again in <xliff:g id="number">%d</xliff:g> seconds.</item>
- </plurals>
<!-- Instructions for using the pattern unlock screen -->
<string name="kg_pattern_instructions">Draw your pattern</string>
<!-- Instructions for using the SIM PIN unlock screen -->
diff --git a/packages/SystemUI/res-keyguard/values/strings.xml b/packages/SystemUI/res-keyguard/values/strings.xml
index 16010430df11..293c86e35f25 100644
--- a/packages/SystemUI/res-keyguard/values/strings.xml
+++ b/packages/SystemUI/res-keyguard/values/strings.xml
@@ -117,10 +117,11 @@
<!-- Message shown when user enters wrong PIN -->
<string name="kg_wrong_pin">Wrong PIN</string>
<!-- Countdown message shown after too many failed unlock attempts -->
- <plurals name="kg_too_many_failed_attempts_countdown">
- <item quantity="one">Try again in 1 second.</item>
- <item quantity="other">Try again in <xliff:g id="number">%d</xliff:g> seconds.</item>
- </plurals>
+ <string name="kg_too_many_failed_attempts_countdown">{count, plural,
+ =1 {Try again in # second.}
+ other {Try again in # seconds.}
+ }
+ </string>
<!-- Instructions for using the SIM PIN unlock screen -->
<string name="kg_sim_pin_instructions">Enter SIM PIN.</string>
<!-- Instructions for using the SIM PIN unlock screen when there's more than one SIM -->
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
index 1c4559eb0364..d5a0201d13e5 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
@@ -25,6 +25,7 @@ import android.content.res.ColorStateList;
import android.os.AsyncTask;
import android.os.CountDownTimer;
import android.os.SystemClock;
+import android.util.PluralsMessageFormatter;
import android.view.KeyEvent;
import com.android.internal.util.LatencyTracker;
@@ -38,6 +39,9 @@ import com.android.systemui.R;
import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;
+import java.util.HashMap;
+import java.util.Map;
+
public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView>
extends KeyguardInputViewController<T> {
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -153,9 +157,12 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
@Override
public void onTick(long millisUntilFinished) {
int secondsRemaining = (int) Math.round(millisUntilFinished / 1000.0);
- mMessageAreaController.setMessage(mView.getResources().getQuantityString(
- R.plurals.kg_too_many_failed_attempts_countdown,
- secondsRemaining, secondsRemaining));
+ Map<String, Object> arguments = new HashMap<>();
+ arguments.put("count", secondsRemaining);
+ mMessageAreaController.setMessage(PluralsMessageFormatter.format(
+ mView.getResources(),
+ arguments,
+ R.string.kg_too_many_failed_attempts_countdown));
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
index 94e07b713915..900f28213114 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
@@ -23,6 +23,7 @@ import android.content.res.ColorStateList;
import android.os.AsyncTask;
import android.os.CountDownTimer;
import android.os.SystemClock;
+import android.util.PluralsMessageFormatter;
import android.view.MotionEvent;
import android.view.View;
@@ -40,7 +41,9 @@ import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.statusbar.policy.DevicePostureController;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class KeyguardPatternViewController
extends KeyguardInputViewController<KeyguardPatternView> {
@@ -368,9 +371,13 @@ public class KeyguardPatternViewController
@Override
public void onTick(long millisUntilFinished) {
final int secondsRemaining = (int) Math.round(millisUntilFinished / 1000.0);
- mMessageAreaController.setMessage(mView.getResources().getQuantityString(
- R.plurals.kg_too_many_failed_attempts_countdown,
- secondsRemaining, secondsRemaining));
+ Map<String, Object> arguments = new HashMap<>();
+ arguments.put("count", secondsRemaining);
+
+ mMessageAreaController.setMessage(PluralsMessageFormatter.format(
+ mView.getResources(),
+ arguments,
+ R.string.kg_too_many_failed_attempts_countdown));
}
@Override