Source:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals("passSetting")) { ListPreference itemList = (ListPreference) findPreference("passSetting"); final ListPreference patternMaxTry = (ListPreference) findPreference("patternMax"); final CheckBoxPreference stealthMode = (CheckBoxPreference) findPreference("stealthMode"); stealthMode.setEnabled(false); patternMaxTry.setEnabled(false); switch (itemList.getValue()) { case "p0": confirmResetPasswords(itemList); break; case "p1": showPasswordActivity(itemList); break; case "p2": showPatternActivity(); break; } if(FingerprintUtil.isAndroidSupport()){ checkFingerprintDeviceSupport(); }else{ if(itemList != null) { itemList.setValueIndex(0); } Api.toast(globalContext, getString(R.string.your_android_version_not_support_fingerprint)); } } if (key.equals("enableAdmin")) { boolean value = G.enableAdmin(); if (value) { Log.d("Device Admin Active ?", mDPM.isAdminActive(deviceAdmin) + ""); if (!mDPM.isAdminActive(deviceAdmin)) { Intent intent = new Intent( DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdmin); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, getString(R.string.device_admin_desc)); startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN); } } else { if (mDPM.isAdminActive(deviceAdmin)) { mDPM.removeActiveAdmin(deviceAdmin); Api.toast(this.getActivity().getApplicationContext(), getString(R.string.device_admin_disabled), Toast.LENGTH_LONG); } } } if (key.equals("enableStealthPattern")) { AlpSettings.Display.setStealthMode(this.getActivity().getApplicationContext(), G.enableStealthPattern()); } }

Target:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals("passSetting")) { ListPreference itemList = (ListPreference) findPreference("passSetting"); final ListPreference patternMaxTry = (ListPreference) findPreference("patternMax"); final CheckBoxPreference stealthMode = (CheckBoxPreference) findPreference("stealthMode"); stealthMode.setEnabled(false); patternMaxTry.setEnabled(false); switch (itemList.getValue()) { case "p0": confirmResetPasswords(itemList); break; case "p1": showPasswordActivity(itemList); break; case "p2": showPatternActivity(); break; } if(FingerprintUtil.isAndroidSupport()){ checkFingerprintDeviceSupport(); } } if (key.equals("enableAdmin")) { boolean value = G.enableAdmin(); if (value) { Log.d("Device Admin Active ?", mDPM.isAdminActive(deviceAdmin) + ""); if (!mDPM.isAdminActive(deviceAdmin)) { Intent intent = new Intent( DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdmin); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, getString(R.string.device_admin_desc)); startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN); } } else { if (mDPM.isAdminActive(deviceAdmin)) { mDPM.removeActiveAdmin(deviceAdmin); Api.toast(this.getActivity().getApplicationContext(), getString(R.string.device_admin_disabled), Toast.LENGTH_LONG); } } } if (key.equals("enableStealthPattern")) { AlpSettings.Display.setStealthMode(this.getActivity().getApplicationContext(), G.enableStealthPattern()); } }