UDFPS Settings: beautifications
Move all UDFPS Settings to separate menu for ease of removal for non-udfps devices Signed-off-by: SuperDroidBond <superdroidbond@yahoo.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
committed by
Hưng Phan
parent
90452d5dcc
commit
06a6ff5dc3
@@ -698,5 +698,9 @@
|
||||
<!-- Udfps icon picker -->
|
||||
<string name="udfps_icon_picker_title">Udfps icon picker</string>
|
||||
<string name="udfps_icon_picker_summary">Choose your favorite fingerprint icon</string>
|
||||
|
||||
<!-- Udfps Custom Options -->
|
||||
<string name="udfps_settings_title">Udfps Options</string>
|
||||
<string name="udfps_settings_summary">Different menus for customizing the udfps</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -94,30 +94,12 @@
|
||||
<PreferenceCategory
|
||||
android:key="udfps_category"
|
||||
android:title="@string/udfps_category">
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="udfps_haptic_feedback"
|
||||
android:title="@string/udfps_haptic_feedback_title"
|
||||
android:summary="@string/udfps_haptic_feedback_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="screen_off_fod"
|
||||
android:title="@string/screen_off_fod_title"
|
||||
android:summary="@string/screen_off_fod_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<Preference
|
||||
android:key="udfps_icon_picker"
|
||||
android:title="@string/udfps_icon_picker_title"
|
||||
android:summary="@string/udfps_icon_picker_summary"
|
||||
android:fragment="com.cherish.settings.fragments.UdfpsIconPicker" />
|
||||
|
||||
<Preference
|
||||
android:key="udfps_recognizing_animation_preview"
|
||||
android:title="@string/udfps_recog_animation_effect_title"
|
||||
android:summary="@string/udfps_recog_animation_effect_summary"
|
||||
android:fragment="com.cherish.settings.fragments.UdfpsAnimation"/>
|
||||
android:key="udfps_settings"
|
||||
android:title="@string/udfps_settings_title"
|
||||
android:summary="@string/udfps_settings_summary"
|
||||
android:fragment="com.cherish.settings.fragments.UdfpsSettings" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
48
res/xml/cherish_settings_udfps.xml
Normal file
48
res/xml/cherish_settings_udfps.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020-22 The CherishOS Projects
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/udfps_category">
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="udfps_haptic_feedback"
|
||||
android:title="@string/udfps_haptic_feedback_title"
|
||||
android:summary="@string/udfps_haptic_feedback_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="screen_off_fod"
|
||||
android:title="@string/screen_off_fod_title"
|
||||
android:summary="@string/screen_off_fod_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="udfps_customization"
|
||||
android:title="UDFPS Customization">
|
||||
|
||||
<Preference
|
||||
android:key="udfps_icon_picker"
|
||||
android:title="@string/udfps_icon_picker_title"
|
||||
android:summary="@string/udfps_icon_picker_summary"
|
||||
android:fragment="com.cherish.settings.fragments.UdfpsIconPicker" />
|
||||
|
||||
<Preference
|
||||
android:key="udfps_recognizing_animation_preview"
|
||||
android:title="@string/udfps_recog_animation_effect_title"
|
||||
android:summary="@string/udfps_recog_animation_effect_summary"
|
||||
android:fragment="com.cherish.settings.fragments.UdfpsAnimation"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -60,8 +60,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule";
|
||||
private static final String SCREEN_OFF_FOD_KEY = "screen_off_fod";
|
||||
private static final String UDFPS_HAPTIC_FEEDBACK = "udfps_haptic_feedback";
|
||||
|
||||
static final int MODE_DISABLED = 0;
|
||||
static final int MODE_NIGHT = 1;
|
||||
@@ -71,8 +69,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
Preference mAODPref;
|
||||
Preference mFODPref;
|
||||
private SystemSettingSwitchPreference mFODScreenOff;
|
||||
private SystemSettingSwitchPreference mUdfpsHapticFeedback;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -94,8 +90,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
|
||||
PreferenceCategory udfps = (PreferenceCategory) prefScreen.findPreference("udfps_category");
|
||||
mFODScreenOff = (SystemSettingSwitchPreference) findPreference(SCREEN_OFF_FOD_KEY);
|
||||
mUdfpsHapticFeedback = (SystemSettingSwitchPreference) findPreference(UDFPS_HAPTIC_FEEDBACK);
|
||||
if (!FodUtils.hasFodSupport(getContext())) {
|
||||
prefScreen.removePreference(udfps);
|
||||
}
|
||||
|
||||
78
src/com/cherish/settings/fragments/UdfpsSettings.java
Normal file
78
src/com/cherish/settings/fragments/UdfpsSettings.java
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2020-22 The CherishOS Projects
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cherish.settings.fragments;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContentResolver;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceFragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.provider.Settings;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
|
||||
import com.android.internal.util.cherish.fod.FodUtils;
|
||||
import com.android.internal.util.cherish.CherishUtils;
|
||||
|
||||
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||
|
||||
public class UdfpsSettings extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.cherish_settings_udfps);
|
||||
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
Resources resources = getResources();
|
||||
|
||||
boolean udfpsResPkgInstalled = CherishUtils.isPackageInstalled(getContext(),
|
||||
"com.cherish.udfps.resources");
|
||||
PreferenceCategory udfps_custom = (PreferenceCategory) prefScreen.findPreference("udfps_customization");
|
||||
if (!udfpsResPkgInstalled) {
|
||||
prefScreen.removePreference(udfps_custom);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user