KeyguardMessageAreapublic class KeyguardMessageArea extends android.widget.TextView Manages a number of views inside of the given layout. See below for a list of widgets. |
Fields Summary |
---|
private static final Object | ANNOUNCE_TOKENHandler token posted with accessibility announcement runnables. | private static final long | ANNOUNCEMENT_DELAYDelay before speaking an accessibility announcement. Used to prevent
lift-to-type from interrupting itself. | static final int | SECURITY_MESSAGE_DURATION | protected static final int | FADE_DURATION | private static final String | TAG | boolean | mShowingBouncer | KeyguardUpdateMonitor | mUpdateMonitor | long | mTimeout | private android.os.Handler | mHandler | CharSequence | mMessage | boolean | mShowingMessage | private CharSequence | mSeparator | private com.android.internal.widget.LockPatternUtils | mLockPatternUtils | Runnable | mClearMessageRunnable | private KeyguardUpdateMonitorCallback | mInfoCallback |
Constructors Summary |
---|
public KeyguardMessageArea(android.content.Context context)
this(context, null);
| public KeyguardMessageArea(android.content.Context context, android.util.AttributeSet attrs)
super(context, attrs);
setLayerType(LAYER_TYPE_HARDWARE, null); // work around nested unclipped SaveLayer bug
mLockPatternUtils = new LockPatternUtils(context);
// Registering this callback immediately updates the battery state, among other things.
mUpdateMonitor = KeyguardUpdateMonitor.getInstance(getContext());
mUpdateMonitor.registerCallback(mInfoCallback);
mHandler = new Handler(Looper.myLooper());
mSeparator = getResources().getString(
com.android.internal.R.string.kg_text_message_separator);
update();
|
Methods Summary |
---|
java.lang.CharSequence | getCurrentMessage()
return mShowingMessage ? mMessage : null;
| private void | hideMessage(int duration, boolean thenUpdate)
if (duration > 0) {
Animator anim = ObjectAnimator.ofFloat(this, "alpha", 0f);
anim.setDuration(duration);
if (thenUpdate) {
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
update();
}
});
}
anim.start();
} else {
setAlpha(0f);
if (thenUpdate) {
update();
}
}
| protected void | onFinishInflate()
final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
setSelected(screenOn); // This is required to ensure marquee works
| public void | securityMessageChanged()
setAlpha(1f);
mShowingMessage = true;
update();
mHandler.removeCallbacks(mClearMessageRunnable);
if (mTimeout > 0) {
mHandler.postDelayed(mClearMessageRunnable, mTimeout);
}
mHandler.removeCallbacksAndMessages(ANNOUNCE_TOKEN);
mHandler.postAtTime(new AnnounceRunnable(this, getText()), ANNOUNCE_TOKEN,
(SystemClock.uptimeMillis() + ANNOUNCEMENT_DELAY));
| private void | showMessage(int duration)
if (duration > 0) {
Animator anim = ObjectAnimator.ofFloat(this, "alpha", 1f);
anim.setDuration(duration);
anim.start();
} else {
setAlpha(1f);
}
| void | update()Update the status lines based on these rules:
AlarmStatus: Alarm state always gets it's own line.
Status1 is shared between help, battery status and generic unlock instructions,
prioritized in that order.
MutableInt icon = new MutableInt(0);
CharSequence status = getCurrentMessage();
setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
setText(status);
|
|