use of android.support.v4.hardware.fingerprint.FingerprintManagerCompat in project MaxLock by Maxr1998.
the class FingerprintView method onWindowFocusChanged.
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (hasWindowFocus) {
FingerprintManagerCompat mFingerprintManager = FingerprintManagerCompat.from(getContext());
if (mFingerprintManager.isHardwareDetected() && mFingerprintManager.hasEnrolledFingerprints()) {
if (!mLockView.allowFingerprint()) {
handleFingerprintIndicator(R.drawable.lockscreen_fingerprint_fp_to_error_state_animation);
setOnClickListener(mNotAllowedToast);
return;
}
if (mCancelFingerprint.isCanceled()) {
mCancelFingerprint = new CancellationSignal();
}
mFingerprintManager.authenticate(null, 0, mCancelFingerprint, mFPAuthenticationCallback, null);
handleFingerprintIndicator(R.drawable.lockscreen_fingerprint_draw_on_animation);
} else {
setVisibility(GONE);
}
} else {
mCancelFingerprint.cancel();
}
}
use of android.support.v4.hardware.fingerprint.FingerprintManagerCompat in project MaxLock by Maxr1998.
the class MaxLockPreferenceFragment method onCreate.
@SuppressLint("WorldReadableFiles")
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
if (getArguments() != null) {
screen = Screen.valueOf(getArguments().getString(Screen.KEY, Screen.MAIN.toString()));
} else {
screen = Screen.MAIN;
}
prefs = MLPreferences.getPreferences(getActivity());
setTitle();
if (screen == Screen.IMOD) {
getPreferenceManager().setSharedPreferencesName(Common.PREFS_APPS);
}
if (SDK_INT < Build.VERSION_CODES.N)
getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE);
addPreferencesFromResource(screen.preferenceXML);
switch(screen) {
case MAIN:
updateImplementationStatus();
PreferenceCategory catAppUI = (PreferenceCategory) findPreference(Common.CATEGORY_APPLICATION_UI);
CheckBoxPreference useDark = (CheckBoxPreference) findPreference(Common.USE_DARK_STYLE);
if (!useDark.isChecked()) {
catAppUI.removePreference(findPreference(Common.USE_AMOLED_BLACK));
}
if (SDK_INT >= Build.VERSION_CODES.O) {
catAppUI.removePreference(findPreference(Common.NEW_APP_NOTIFICATION));
}
break;
case TYPE:
FingerprintManagerCompat fpm = FingerprintManagerCompat.from(getActivity());
if (!fpm.isHardwareDetected()) {
getPreferenceScreen().removePreference(findPreference(Common.SHADOW_FINGERPRINT));
getPreferenceScreen().removePreference(findPreference(Common.CATEGORY_FINGERPRINT));
} else {
CheckBoxPreference disableFP = (CheckBoxPreference) findPreference(Common.DISABLE_FINGERPRINT);
if (!fpm.hasEnrolledFingerprints() && !disableFP.isChecked()) {
disableFP.setSummary(disableFP.getSummary() + getResources().getString(R.string.pref_fingerprint_summary_non_enrolled));
}
}
break;
case UI:
ListPreference lp = (ListPreference) findPreference(Common.BACKGROUND);
findPreference(Common.BACKGROUND_COLOR).setEnabled(lp.getValue().equals("color"));
lp.setOnPreferenceChangeListener((preference, newValue) -> {
if (preference.getKey().equals(Common.BACKGROUND)) {
if (newValue.toString().equals("custom")) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, WALLPAPER_REQUEST_CODE);
} else {
FileUtils.deleteQuietly(new File(getActivity().getFilesDir(), "background"));
}
findPreference(Common.BACKGROUND_COLOR).setEnabled(newValue.toString().equals("color"));
}
return true;
});
break;
case OPTIONS:
Preference el = findPreference(Common.ENABLE_LOGGING);
el.setEnabled(prefs.getBoolean(Common.ENABLE_PRO, false));
if (!prefs.getBoolean(Common.ENABLE_PRO, false)) {
el.setSummary(R.string.toast_pro_required);
}
if (MLImplementation.getImplementation(prefs) != MLImplementation.DEFAULT) {
PreferenceCategory catOther = (PreferenceCategory) findPreference(Common.CATEGORY_OTHER);
catOther.removePreference(findPreference(Common.HIDE_RECENTS_THUMBNAILS));
}
break;
case IMOD:
// Intika I.Mod - Pro setup
Preference iModDelayGlobal = findPreference(Common.ENABLE_IMOD_DELAY_GLOBAL);
Preference iModDelayPerApp = findPreference(Common.ENABLE_IMOD_DELAY_APP);
iModDelayGlobal.setEnabled(prefs.getBoolean(Common.ENABLE_PRO, false));
iModDelayPerApp.setEnabled(prefs.getBoolean(Common.ENABLE_PRO, false));
if (!prefs.getBoolean(Common.ENABLE_PRO, false)) {
iModDelayGlobal.setTitle(R.string.pref_delay_needpro);
iModDelayPerApp.setTitle(R.string.pref_delay_needpro);
}
break;
}
}
Aggregations