Cherish:add edge light customizations[2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -519,4 +519,19 @@
|
|||||||
<item>600000</item>
|
<item>600000</item>
|
||||||
<item>1800000</item>
|
<item>1800000</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Edge light color modes -->
|
||||||
|
<string-array name="edge_light_color_mode_entries" translatable="false">
|
||||||
|
<item>@string/accent_color</item>
|
||||||
|
<item>@string/notification_color</item>
|
||||||
|
<item>@string/wallpaper_color</item>
|
||||||
|
<item>@string/custom_color</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="edge_light_color_mode_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -692,6 +692,22 @@
|
|||||||
<string name="reticker_summary">Replace heads-up notification with slim and less invasive version of redesigned ticker</string>
|
<string name="reticker_summary">Replace heads-up notification with slim and less invasive version of redesigned ticker</string>
|
||||||
<string name="reticker_colored_title">Use app colored background</string>
|
<string name="reticker_colored_title">Use app colored background</string>
|
||||||
<string name="reticker_colored_summary">Replace reTicker background color using notification app main color</string>
|
<string name="reticker_colored_summary">Replace reTicker background color using notification app main color</string>
|
||||||
|
|
||||||
|
<!-- Edge light -->
|
||||||
|
<string name="edge_light_title">Edge light</string>
|
||||||
|
<string name="enable_edge_light">Enable Edge Light</string>
|
||||||
|
<string name="edge_light_intro_text">Display an animation along the edges of the screen when pulsing</string>
|
||||||
|
<string name="edge_light_always_trigger_on_pulse_title">Always trigger on pulse</string>
|
||||||
|
<string name="edge_light_always_trigger_on_pulse_summary">Whether to show edge light whenever ambient display is shown and not just for notifications</string>
|
||||||
|
<string name="edge_light_repeat_animation_title">Repeat animation</string>
|
||||||
|
<string name="edge_light_repeat_animation_summary_on">Repeat until timeout</string>
|
||||||
|
<string name="edge_light_repeat_animation_summary_off">Show only once</string>
|
||||||
|
<string name="edge_light_color_mode_title">Edge light color mode</string>
|
||||||
|
<string name="accent_color">Accent color (Default)</string>
|
||||||
|
<string name="notification_color">Notification color</string>
|
||||||
|
<string name="wallpaper_color">Wallpaper color</string>
|
||||||
|
<string name="custom_color">Custom color</string>
|
||||||
|
<string name="edge_light_custom_color_title">Custom color</string>
|
||||||
|
|
||||||
<!-- Power menu and dialogs opacity -->
|
<!-- Power menu and dialogs opacity -->
|
||||||
<string name="power_menu_transparency">Power/reboot menu opacity</string>
|
<string name="power_menu_transparency">Power/reboot menu opacity</string>
|
||||||
|
|||||||
54
res/xml/cherish_settings_edge_light.xml
Normal file
54
res/xml/cherish_settings_edge_light.xml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2022 FlamingoOS Project
|
||||||
|
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"
|
||||||
|
android:title="@string/edge_light_title">
|
||||||
|
|
||||||
|
<com.android.settingslib.widget.TopIntroPreference
|
||||||
|
android:key="edge_light_intro"
|
||||||
|
android:title="@string/edge_light_intro_text"
|
||||||
|
android:selectable="false"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingMainSwitchPreference
|
||||||
|
android:key="edge_light_enabled"
|
||||||
|
android:title="@string/enable_edge_light"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
|
android:key="edge_light_always_trigger_on_pulse"
|
||||||
|
android:title="@string/edge_light_always_trigger_on_pulse_title"
|
||||||
|
android:summary="@string/edge_light_always_trigger_on_pulse_summary"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
|
android:key="edge_light_repeat_animation"
|
||||||
|
android:title="@string/edge_light_repeat_animation_title"
|
||||||
|
android:summaryOn="@string/edge_light_repeat_animation_summary_on"
|
||||||
|
android:summaryOff="@string/edge_light_repeat_animation_summary_off"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||||
|
android:key="edge_light_color_mode"
|
||||||
|
android:title="@string/edge_light_color_mode_title"
|
||||||
|
android:entries="@array/edge_light_color_mode_entries"
|
||||||
|
android:entryValues="@array/edge_light_color_mode_values"
|
||||||
|
android:summary="%s"
|
||||||
|
android:defaultValue="0" />
|
||||||
|
|
||||||
|
<net.margaritov.preference.colorpicker.ColorPickerPreference
|
||||||
|
android:key="edge_light_custom_color"
|
||||||
|
android:title="@string/edge_light_custom_color_title"
|
||||||
|
android:defaultValue="0xffffff" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
||||||
@@ -33,6 +33,12 @@
|
|||||||
android:entries="@array/torch_power_button_gesture_entries"
|
android:entries="@array/torch_power_button_gesture_entries"
|
||||||
android:entryValues="@array/torch_power_button_gesture_values" />
|
android:entryValues="@array/torch_power_button_gesture_values" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="edge_light_enabled"
|
||||||
|
android:title="@string/edge_light_title"
|
||||||
|
android:summary="@string/edge_light_intro_text"
|
||||||
|
android:fragment="com.cherish.settings.fragments.EdgeLightSettings" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SecureSettingSwitchPreference
|
<com.cherish.settings.preferences.SecureSettingSwitchPreference
|
||||||
android:key="power_menu_hide_on_secure"
|
android:key="power_menu_hide_on_secure"
|
||||||
android:title="@string/power_menu_hide_on_secure_title"
|
android:title="@string/power_menu_hide_on_secure_title"
|
||||||
|
|||||||
71
src/com/cherish/settings/fragments/EdgeLightSettings.java
Normal file
71
src/com/cherish/settings/fragments/EdgeLightSettings.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019-2022 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.
|
||||||
|
*/
|
||||||
|
package com.cherish.settings.fragments;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.database.ContentObserver;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.preference.ListPreference;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceCategory;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||||
|
public class EdgeLightSettings extends SettingsPreferenceFragment implements
|
||||||
|
Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
addPreferencesFromResource(R.xml.cherish_settings_edge_light);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetricsCategory() {
|
||||||
|
return MetricsEvent.CHERISH_SETTINGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Search.
|
||||||
|
*/
|
||||||
|
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
new BaseSearchIndexProvider(R.xml.cherish_settings_edge_light);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user