Search in sources :

Example 1 with SwitchPreferenceCompat

use of org.thoughtcrime.securesms.components.SwitchPreferenceCompat in project Signal-Android by signalapp.

the class AppProtectionPreferenceFragment method initializeVisibility.

private void initializeVisibility() {
    if (TextSecurePreferences.isPasswordDisabled(getContext())) {
        findPreference("pref_enable_passphrase_temporary").setVisible(false);
        findPreference(TextSecurePreferences.CHANGE_PASSPHRASE_PREF).setVisible(false);
        findPreference(TextSecurePreferences.PASSPHRASE_TIMEOUT_INTERVAL_PREF).setVisible(false);
        findPreference(TextSecurePreferences.PASSPHRASE_TIMEOUT_PREF).setVisible(false);
        KeyguardManager keyguardManager = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
        if (Build.VERSION.SDK_INT < 16 || !keyguardManager.isKeyguardSecure()) {
            ((SwitchPreferenceCompat) findPreference(TextSecurePreferences.SCREEN_LOCK)).setChecked(false);
            findPreference(TextSecurePreferences.SCREEN_LOCK).setEnabled(false);
        }
    } else {
        findPreference(TextSecurePreferences.SCREEN_LOCK).setVisible(false);
        findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT).setVisible(false);
    }
}
Also used : SwitchPreferenceCompat(org.thoughtcrime.securesms.components.SwitchPreferenceCompat) KeyguardManager(android.app.KeyguardManager)

Aggregations

KeyguardManager (android.app.KeyguardManager)1 SwitchPreferenceCompat (org.thoughtcrime.securesms.components.SwitchPreferenceCompat)1