diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-06-04 18:09:08 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-04 18:09:08 +0000 |
commit | 0a9c02df1ed9b93a37cd0d1cc815355cfed55486 (patch) | |
tree | 1d0fa2b089a56e26bd797aaaf8901c40bbd0fe11 /packages/Keyguard | |
parent | 34f521e2af11b82b131b92a149ee30e23452a41e (diff) | |
parent | e42c72e1b27888035e0ee4455c0c90d63abe3c75 (diff) | |
download | frameworks_base-0a9c02df1ed9b93a37cd0d1cc815355cfed55486.zip frameworks_base-0a9c02df1ed9b93a37cd0d1cc815355cfed55486.tar.gz frameworks_base-0a9c02df1ed9b93a37cd0d1cc815355cfed55486.tar.bz2 |
am b733f632: Merge "Move owner info to main lockscreen." into lmp-preview-dev
* commit 'b733f6322870f06d75a020f0f9f0bbba634875e7':
Move owner info to main lockscreen.
Diffstat (limited to 'packages/Keyguard')
5 files changed, 46 insertions, 27 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_status_view.xml b/packages/Keyguard/res/layout/keyguard_status_view.xml index 112e371..2917faa 100644 --- a/packages/Keyguard/res/layout/keyguard_status_view.xml +++ b/packages/Keyguard/res/layout/keyguard_status_view.xml @@ -48,5 +48,18 @@ android:layout_marginBottom="@dimen/bottom_text_spacing_digital" /> <include layout="@layout/keyguard_status_area" /> + <TextView + android:id="@+id/owner_info" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/date_owner_info_margin" + android:layout_gravity="center_horizontal" + android:textColor="#99ffffff" + android:textSize="@dimen/widget_label_font_size" + android:ellipsize="marquee" + android:singleLine="true" /> + </LinearLayout> </com.android.keyguard.KeyguardStatusView> diff --git a/packages/Keyguard/res/values-sw600dp/dimens.xml b/packages/Keyguard/res/values-sw600dp/dimens.xml index b954792..e9e9b89 100644 --- a/packages/Keyguard/res/values-sw600dp/dimens.xml +++ b/packages/Keyguard/res/values-sw600dp/dimens.xml @@ -70,4 +70,7 @@ <!-- EmergencyCarrierArea overlap - amount to overlap the emergency button and carrier text. Should be 0 on devices with plenty of room (e.g. tablets) --> <dimen name="eca_overlap">0dip</dimen> + + <!-- The vertical margin between the date and the owner info. --> + <dimen name="date_owner_info_margin">4dp</dimen> </resources> diff --git a/packages/Keyguard/res/values/dimens.xml b/packages/Keyguard/res/values/dimens.xml index e9cdfcd..f971522 100644 --- a/packages/Keyguard/res/values/dimens.xml +++ b/packages/Keyguard/res/values/dimens.xml @@ -163,4 +163,7 @@ <!-- The y translation to apply at the start in appear animations. --> <dimen name="appear_y_translation_start">32dp</dimen> + + <!-- The vertical margin between the date and the owner info. --> + <dimen name="date_owner_info_margin">2dp</dimen> </resources> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java index d589283..9bc2a4d 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java @@ -186,42 +186,16 @@ class KeyguardMessageArea extends TextView { */ void update() { MutableInt icon = new MutableInt(0); - CharSequence status = concat(getOwnerInfo(), getCurrentMessage()); + CharSequence status = getCurrentMessage(); setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0); setText(status); } - private CharSequence concat(CharSequence... args) { - StringBuilder b = new StringBuilder(); - 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; } - String getOwnerInfo() { - ContentResolver res = getContext().getContentResolver(); - String info = null; - final boolean ownerInfoEnabled = mLockPatternUtils.isOwnerInfoEnabled(); - if (ownerInfoEnabled && !mShowingMessage) { - info = mLockPatternUtils.getOwnerInfo(mLockPatternUtils.getCurrentUser()); - } - return info; - } - private void hideMessage(int duration, boolean thenUpdate) { if (duration > 0) { Animator anim = ObjectAnimator.ofFloat(this, "alpha", 0f); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java index bef94fa..7918755 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java @@ -16,6 +16,7 @@ package com.android.keyguard; +import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; @@ -41,6 +42,7 @@ public class KeyguardStatusView extends GridLayout { private TextView mAlarmStatusView; private TextClock mDateView; private TextClock mClockView; + private TextView mOwnerInfo; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { @@ -54,6 +56,7 @@ public class KeyguardStatusView extends GridLayout { if (showing) { if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing); refresh(); + updateOwnerInfo(); } } @@ -83,6 +86,7 @@ public class KeyguardStatusView extends GridLayout { private void setEnableMarquee(boolean enabled) { if (DEBUG) Log.v(TAG, (enabled ? "Enable" : "Disable") + " transport text marquee"); if (mAlarmStatusView != null) mAlarmStatusView.setSelected(enabled); + mOwnerInfo.setSelected(enabled); } @Override @@ -91,10 +95,12 @@ public class KeyguardStatusView extends GridLayout { mAlarmStatusView = (TextView) findViewById(R.id.alarm_status); mDateView = (TextClock) findViewById(R.id.date_view); mClockView = (TextClock) findViewById(R.id.clock_view); + mOwnerInfo = (TextView) findViewById(R.id.owner_info); mLockPatternUtils = new LockPatternUtils(getContext()); final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn(); setEnableMarquee(screenOn); refresh(); + updateOwnerInfo(); // Disable elegant text height because our fancy colon makes the ymin value huge for no // reason. @@ -124,6 +130,16 @@ public class KeyguardStatusView extends GridLayout { } } + private void updateOwnerInfo() { + String ownerInfo = getOwnerInfo(); + if (!TextUtils.isEmpty(ownerInfo)) { + mOwnerInfo.setVisibility(View.VISIBLE); + mOwnerInfo.setText(ownerInfo); + } else { + mOwnerInfo.setVisibility(View.GONE); + } + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -140,6 +156,16 @@ public class KeyguardStatusView extends GridLayout { return LockPatternUtils.ID_DEFAULT_STATUS_WIDGET; } + private String getOwnerInfo() { + ContentResolver res = getContext().getContentResolver(); + String info = null; + final boolean ownerInfoEnabled = mLockPatternUtils.isOwnerInfoEnabled(); + if (ownerInfoEnabled) { + info = mLockPatternUtils.getOwnerInfo(mLockPatternUtils.getCurrentUser()); + } + return info; + } + // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often. // This is an optimization to ensure we only recompute the patterns when the inputs change. private static final class Patterns { |