@Override
  protected void onFinishInflate() {
    mLockPatternUtils = new LockPatternUtils(mContext);

    mPasswordEntry = (TextView) findViewById(getPasswordTextViewId());
    mPasswordEntry.setOnEditorActionListener(this);
    mPasswordEntry.addTextChangedListener(this);

    // Set selected property on so the view can send accessibility events.
    mPasswordEntry.setSelected(true);

    // Poke the wakelock any time the text is selected or modified
    mPasswordEntry.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            mCallback.userActivity(0); // TODO: customize timeout for text?
          }
        });

    mQuickUnlock =
        (Settings.System.getInt(
                mContext.getContentResolver(), Settings.System.LOCKSCREEN_QUICK_UNLOCK_CONTROL, 0)
            == 1);

    mPasswordEntry.addTextChangedListener(
        new TextWatcher() {
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          public void afterTextChanged(Editable s) {
            if (mCallback != null) {
              mCallback.userActivity(0);
            }
            if (mQuickUnlock) {
              String entry = mPasswordEntry.getText().toString();
              if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT
                  && mLockPatternUtils.checkPassword(entry)) {
                mCallback.reportSuccessfulUnlockAttempt();
                mCallback.dismiss(true);
              }
            }
          }
        });
    mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
    mEcaView = findViewById(R.id.keyguard_selector_fade_container);
    View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
    if (bouncerFrameView != null) {
      mBouncerFrame =
          KeyguardSecurityViewHelper.colorizeFrame(mContext, bouncerFrameView.getBackground());
    }
  }
Ejemplo n.º 2
0
 @Override
 public void hideBouncer(int duration) {
   mIsBouncing = false;
   KeyguardSecurityViewHelper.hideBouncer(
       mSecurityMessageDisplay, mFadeView, mBouncerFrame, duration);
 }
 @Override
 public void hideBouncer(int duration) {
   KeyguardSecurityViewHelper.hideBouncer(
       mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
 }