Clean <plurals> in keyguard

Bug: 199230228
Test: make
Change-Id: I03723cfe18e5c948ca1896c5c2c389f46c48d891
This commit is contained in:
Calvin Pan
2022-01-17 12:00:22 +08:00
parent 67e780def4
commit bf4e15d017
4 changed files with 25 additions and 15 deletions

View File

@@ -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 -->

View File

@@ -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 -->

View File

@@ -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

View File

@@ -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