FileDocCategorySizeDatePackage
KeyguardMessageArea.javaAPI DocAndroid 5.1 API8275Thu Mar 12 22:22:42 GMT 2015com.android.keyguard

KeyguardMessageArea

public 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_TOKEN
Handler token posted with accessibility announcement runnables.
private static final long
ANNOUNCEMENT_DELAY
Delay 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.CharSequencegetCurrentMessage()

        return mShowingMessage ? mMessage : null;
    
private voidhideMessage(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 voidonFinishInflate()

        final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
        setSelected(screenOn); // This is required to ensure marquee works
    
public voidsecurityMessageChanged()

        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 voidshowMessage(int duration)

        if (duration > 0) {
            Animator anim = ObjectAnimator.ofFloat(this, "alpha", 1f);
            anim.setDuration(duration);
            anim.start();
        } else {
            setAlpha(1f);
        }
    
voidupdate()
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.

param
showStatusLines status lines are shown if true

        MutableInt icon = new MutableInt(0);
        CharSequence status = getCurrentMessage();
        setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
        setText(status);