Merge "Add configurable em-dash separator for all concatenated keyguard strings" into jb-mr1-lockscreen-dev
This commit is contained in:
@@ -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 -->
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user