Loading packages/Keyguard/res/layout/keyguard_status_view.xml +13 −0 Original line number Diff line number Diff line Loading @@ -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> packages/Keyguard/res/values-sw600dp/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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> packages/Keyguard/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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> packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java +1 −27 Original line number Diff line number Diff line Loading @@ -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); Loading packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +26 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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() { Loading @@ -54,6 +56,7 @@ public class KeyguardStatusView extends GridLayout { if (showing) { if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing); refresh(); updateOwnerInfo(); } } Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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(); Loading @@ -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 { Loading Loading
packages/Keyguard/res/layout/keyguard_status_view.xml +13 −0 Original line number Diff line number Diff line Loading @@ -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>
packages/Keyguard/res/values-sw600dp/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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>
packages/Keyguard/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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>
packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java +1 −27 Original line number Diff line number Diff line Loading @@ -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); Loading
packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +26 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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() { Loading @@ -54,6 +56,7 @@ public class KeyguardStatusView extends GridLayout { if (showing) { if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing); refresh(); updateOwnerInfo(); } } Loading Loading @@ -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 Loading @@ -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. Loading Loading @@ -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(); Loading @@ -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 { Loading