summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/src/com/android
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2013-11-04 15:53:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-04 15:53:52 +0000
commitcd4919c0325f35a279e17019c9c3c66d80481d30 (patch)
treedd248cfe435d662cd65bc9eb31e2eba264cde5b0 /packages/Keyguard/src/com/android
parent3e7495b26058d1442c4ed4960818399728e6bc31 (diff)
parent1d80e977da89a660aff006e93470749b359c2393 (diff)
downloadframeworks_base-cd4919c0325f35a279e17019c9c3c66d80481d30.zip
frameworks_base-cd4919c0325f35a279e17019c9c3c66d80481d30.tar.gz
frameworks_base-cd4919c0325f35a279e17019c9c3c66d80481d30.tar.bz2
Merge "Compose singleLine & textAllCaps transforms" into klp-dev
Diffstat (limited to 'packages/Keyguard/src/com/android')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/CarrierText.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
index c33f174..88558cd 100644
--- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java
+++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
@@ -17,14 +17,18 @@
package com.android.keyguard;
import android.content.Context;
+import android.text.method.SingleLineTransformationMethod;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.view.View;
import android.widget.TextView;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.widget.LockPatternUtils;
+import java.util.Locale;
+
public class CarrierText extends TextView {
private static CharSequence mSeparator;
@@ -77,6 +81,8 @@ public class CarrierText extends TextView {
public CarrierText(Context context, AttributeSet attrs) {
super(context, attrs);
mLockPatternUtils = new LockPatternUtils(mContext);
+ boolean useAllCaps = mContext.getResources().getBoolean(R.bool.kg_use_all_caps);
+ setTransformationMethod(new CarrierTextTransformationMethod(mContext, useAllCaps));
}
protected void updateCarrierText(State simState, CharSequence plmn, CharSequence spn) {
@@ -258,4 +264,25 @@ public class CarrierText extends TextView {
return mContext.getText(carrierHelpTextId);
}
+
+ private class CarrierTextTransformationMethod extends SingleLineTransformationMethod {
+ private final Locale mLocale;
+ private final boolean mAllCaps;
+
+ public CarrierTextTransformationMethod(Context context, boolean allCaps) {
+ mLocale = context.getResources().getConfiguration().locale;
+ mAllCaps = allCaps;
+ }
+
+ @Override
+ public CharSequence getTransformation(CharSequence source, View view) {
+ source = super.getTransformation(source, view);
+
+ if (mAllCaps && source != null) {
+ source = source.toString().toUpperCase(mLocale);
+ }
+
+ return source;
+ }
+ }
}