Search in sources :

Example 1 with LockPatternView

use of com.android.internal.widget.LockPatternView in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class CryptKeeper method passwordEntryInit.

private void passwordEntryInit() {
    // Password/pin case
    mPasswordEntry = (EditText) findViewById(R.id.passwordEntry);
    if (mPasswordEntry != null) {
        mPasswordEntry.setOnEditorActionListener(this);
        mPasswordEntry.requestFocus();
        // Become quiet when the user interacts with the Edit text screen.
        mPasswordEntry.setOnKeyListener(this);
        mPasswordEntry.setOnTouchListener(this);
        mPasswordEntry.addTextChangedListener(this);
    }
    mLockPatternButtons.clear();
    // Pattern case
    mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
    if (mLockPatternView != null) {
        mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
        for (int id : LOCK_BUTTON_IDS) {
            Button btn = (Button) findViewById(id);
            if (btn != null) {
                btn.setOnClickListener(this);
                mLockPatternButtons.add(btn);
            }
        }
    }
    // Disable the Emergency call button if the device has no voice telephone capability
    if (!getTelephonyManager().isVoiceCapable()) {
        final View emergencyCall = findViewById(R.id.emergencyCallButton);
        if (emergencyCall != null) {
            Log.d(TAG, "Removing the emergency Call button");
            emergencyCall.setVisibility(View.GONE);
        }
    }
    final View imeSwitcher = findViewById(R.id.switch_ime_button);
    final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imeSwitcher != null && hasMultipleEnabledIMEsOrSubtypes(imm, false)) {
        imeSwitcher.setVisibility(View.VISIBLE);
        imeSwitcher.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                imm.showInputMethodPicker(false);
            }
        });
    }
    // password.
    if (mWakeLock == null) {
        Log.d(TAG, "Acquiring wakelock.");
        final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        if (pm != null) {
            mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
            mWakeLock.acquire();
            // Keep awake for 10 minutes - if the user hasn't been alerted by then
            // best not to just drain their battery
            // 96 * 5 secs per click + 120 secs before we show this = 600
            mReleaseWakeLockCountdown = 96;
        }
    }
    // immediately.
    if (mLockPatternView == null && !mCooldown) {
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        mHandler.postDelayed(new Runnable() {

            @Override
            public void run() {
                imm.showSoftInputUnchecked(0, null);
            }
        }, 0);
    }
    updateEmergencyCallButtonState();
    // Notify the user in 120 seconds that we are waiting for him to enter the password.
    mHandler.removeMessages(MESSAGE_NOTIFY);
    mHandler.sendEmptyMessageDelayed(MESSAGE_NOTIFY, 120 * 1000);
    // Dismiss secure & non-secure keyguards while this screen is showing.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
Also used : PowerManager(android.os.PowerManager) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) InputMethodManager(android.view.inputmethod.InputMethodManager) View(android.view.View) TextView(android.widget.TextView) LockPatternView(com.android.internal.widget.LockPatternView)

Example 2 with LockPatternView

use of com.android.internal.widget.LockPatternView in project android_frameworks_base by ParanoidAndroid.

the class KeyguardPatternView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mLockPatternUtils = mLockPatternUtils == null ? new LockPatternUtils(mContext) : mLockPatternUtils;
    mLockPatternView = (LockPatternView) findViewById(R.id.lockPatternView);
    mLockPatternView.setSaveEnabled(false);
    mLockPatternView.setFocusable(false);
    mLockPatternView.setOnPatternListener(new UnlockPatternListener());
    // stealth mode will be the same for the life of this screen
    mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled());
    // vibrate mode will be the same for the life of this screen
    mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
    mForgotPatternButton = (Button) findViewById(R.id.forgot_password_button);
    // note: some configurations don't have an emergency call area
    if (mForgotPatternButton != null) {
        mForgotPatternButton.setText(R.string.kg_forgot_pattern_button_text);
        mForgotPatternButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                mCallback.showBackupSecurity();
            }
        });
    }
    setFocusableInTouchMode(true);
    maybeEnableFallback(mContext);
    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 = bouncerFrameView.getBackground();
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) LockPatternView(com.android.internal.widget.LockPatternView) View(android.view.View)

Aggregations

View (android.view.View)2 LockPatternView (com.android.internal.widget.LockPatternView)2 PowerManager (android.os.PowerManager)1 OnClickListener (android.view.View.OnClickListener)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 LockPatternUtils (com.android.internal.widget.LockPatternUtils)1