diff options
author | Jim Miller <jaggies@google.com> | 2012-11-01 18:17:51 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-11-01 18:17:51 -0700 |
commit | 324545d7c8e0084088ffdbceaf8d1deb6bc09be5 (patch) | |
tree | 01834b8f2f644cb2580bcbba3cfc2e7e311ca3d7 | |
parent | b1260af2f5aa2363b08267d35e6b08f95be1eccd (diff) | |
parent | e9be14077161b9c5dcaa521e9ce4d3e017c11ac6 (diff) | |
download | frameworks_base-324545d7c8e0084088ffdbceaf8d1deb6bc09be5.zip frameworks_base-324545d7c8e0084088ffdbceaf8d1deb6bc09be5.tar.gz frameworks_base-324545d7c8e0084088ffdbceaf8d1deb6bc09be5.tar.bz2 |
Merge "Add configurable em-dash separator for all concatenated keyguard strings" into jb-mr1-lockscreen-dev
4 files changed, 23 insertions, 13 deletions
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 51d6429..ada2644 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3976,6 +3976,9 @@ you will be asked to unlock your phone using an email account.\n\n Try again in <xliff:g id="number">%d</xliff:g> seconds. </string> + <!-- Sequence of characters used to separate message strings in keyguard. Typically just em-dash + with spaces on either side. [CHAR LIMIT=3] --> + <string name="kg_text_message_separator" product="default"> \u2014 </string> <!-- Message shown in dialog when user is attempting to set the music volume above the recommended maximum level for headphones --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 05edbcc..213d93b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1478,6 +1478,7 @@ <java-symbol type="string" name="kg_failed_attempts_almost_at_login" /> <java-symbol type="string" name="kg_enter_confirm_pin_hint" /> <java-symbol type="string" name="kg_invalid_confirm_pin_hint" /> + <java-symbol type="string" name="kg_text_message_separator" /> <!-- From services --> <java-symbol type="anim" name="screen_rotate_0_enter" /> diff --git a/policy/src/com/android/internal/policy/impl/keyguard/CarrierText.java b/policy/src/com/android/internal/policy/impl/keyguard/CarrierText.java index b031baf..f3ea992 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/CarrierText.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/CarrierText.java @@ -27,6 +27,8 @@ import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.widget.LockPatternUtils; public class CarrierText extends TextView { + private static CharSequence mSeparator; + private LockPatternUtils mLockPatternUtils; private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @@ -82,6 +84,7 @@ public class CarrierText extends TextView { @Override protected void onFinishInflate() { super.onFinishInflate(); + mSeparator = getResources().getString(R.string.kg_text_message_separator); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mCallback); setSelected(true); // Allow marquee to work. } @@ -202,7 +205,7 @@ public class CarrierText extends TextView { final boolean plmnValid = !TextUtils.isEmpty(plmn); final boolean spnValid = !TextUtils.isEmpty(spn); if (plmnValid && spnValid) { - return plmn + "|" + spn; + return new StringBuilder().append(plmn).append(mSeparator).append(spn).toString(); } else if (plmnValid) { return plmn; } else if (spnValid) { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMessageArea.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMessageArea.java index 5e331e1..f6f3fab 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMessageArea.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardMessageArea.java @@ -43,7 +43,6 @@ class KeyguardMessageArea extends TextView { static final int SECURITY_MESSAGE_DURATION = 5000; protected static final int FADE_DURATION = 750; - static final String SEPARATOR = " "; // are we showing battery information? boolean mShowingBatteryInfo = false; @@ -143,6 +142,8 @@ class KeyguardMessageArea extends TextView { } }; + private CharSequence mSeparator; + public KeyguardMessageArea(Context context) { this(context, null); } @@ -158,6 +159,8 @@ class KeyguardMessageArea extends TextView { mUpdateMonitor.registerCallback(mInfoCallback); mHandler = new Handler(Looper.myLooper()); + mSeparator = getResources().getString(R.string.kg_text_message_separator); + update(); } @@ -186,23 +189,23 @@ class KeyguardMessageArea extends TextView { setText(status); } - - private CharSequence concat(Object... args) { + private CharSequence concat(CharSequence... args) { StringBuilder b = new StringBuilder(); - for (int i = 0; i < args.length; i++) { - final Object arg = args[i]; - if (arg instanceof CharSequence) { - b.append((CharSequence)args[i]); - b.append(SEPARATOR); - } else if (arg instanceof String) { - b.append((String)args[i]); - b.append(SEPARATOR); + if (!TextUtils.isEmpty(args[0])) { + b.append(args[0]); + } + for (int i = 1; i < args.length; i++) { + CharSequence text = args[i]; + if (!TextUtils.isEmpty(text)) { + if (b.length() > 0) { + b.append(mSeparator); + } + b.append(text); } } return b.toString(); } - CharSequence getCurrentMessage() { return mShowingMessage ? mMessage : null; } |