Evolver: Add edge light customizations [2/2]

Signed-off-by: AnierinB <anierin@evolution-x.org>
This commit is contained in:
Pranav Vashi
2024-05-22 16:55:57 +09:00
committed by Joey Huab
parent dc8072ccf1
commit 1fbf60eddf
5 changed files with 158 additions and 0 deletions

View File

@@ -271,4 +271,19 @@
<item>3</item>
</string-array>
<!-- Notifications/Edge light -->
<string-array name="notifications_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="notifications_edge_light_color_mode_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>

View File

@@ -220,12 +220,23 @@
<string name="notifications_heads_up_title">Heads up</string>
<string name="notifications_heads_up_summary">Allow pop up notifications</string>
<string name="notifications_interface_category">Interface</string>
<string name="notifications_edge_light_title">Edge light</string>
<string name="notifications_edge_light_summary">Light up the side edges of the screen on notification pulse</string>
<string name="notifications_kill_app_button_title">Kill app</string>
<string name="notifications_kill_app_button_summary">Show a kill app button in the notification\'s longpress menu</string>
<string name="notifications_sounds_vibration_category">Sounds &amp; vibration</string>
<string name="notifications_alert_display_on_title">Alert while display on</string>
<string name="notifications_alert_display_on_summary">Play sound and vibration for notifications while the display is on</string>
<!-- Notifications/Edge light -->
<string name="notifications_edge_light_enable_ttile">Enable</string>
<string name="notifications_edge_light_always_trigger_on_pulse_title">Always trigger on pulse</string>
<string name="notifications_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="notifications_edge_light_repeat_animation_title">Repeat animation</string>
<string name="notifications_edge_light_repeat_animation_summary_on">Repeat until timeout</string>
<string name="notifications_edge_light_repeat_animation_summary_off">Show only once</string>
<string name="notifications_edge_light_color_mode_title">Edge light color mode</string>
<!-- Notifications/Less boring heads up -->
<string name="notifications_less_boring_heads_up_title">Less boring</string>
<string name="notifications_less_boring_heads_up_summary">Display popup notifications only for alarm, dialer and messaging app</string>
@@ -310,6 +321,10 @@
<string name="hex_hint" translatable="false">#ff000000</string>
<string name="set">Set</string>
<string name="color_default">Default</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>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Value: <xliff:g id="v">%s</xliff:g></string>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 crDroid Android 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"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/notifications_edge_light_title">
<org.evolution.settings.preferences.SystemSettingSwitchPreference
android:key="edge_light_enabled"
android:title="@string/notifications_edge_light_enable_ttile"
android:defaultValue="false" />
<org.evolution.settings.preferences.SystemSettingSwitchPreference
android:key="edge_light_always_trigger_on_pulse"
android:title="@string/notifications_edge_light_always_trigger_on_pulse_title"
android:summary="@string/notifications_edge_light_always_trigger_on_pulse_summary"
android:defaultValue="false"
android:dependency="edge_light_enabled" />
<org.evolution.settings.preferences.SystemSettingSwitchPreference
android:key="edge_light_repeat_animation"
android:title="@string/notifications_edge_light_repeat_animation_title"
android:summaryOn="@string/notifications_edge_light_repeat_animation_summary_on"
android:summaryOff="@string/notifications_edge_light_repeat_animation_summary_off"
android:defaultValue="false"
android:dependency="edge_light_enabled" />
<org.evolution.settings.preferences.SystemSettingListPreference
android:key="edge_light_color_mode"
android:title="@string/notifications_edge_light_color_mode_title"
android:entries="@array/notifications_edge_light_color_mode_entries"
android:entryValues="@array/notifications_edge_light_color_mode_values"
android:summary="%s"
android:defaultValue="0"
android:dependency="edge_light_enabled" />
<org.evolution.settings.preferences.colorpicker.SystemSettingColorPickerPreference
android:key="edge_light_custom_color"
android:title="@string/custom_color"
android:defaultValue="#FFFFFF"
android:dependency="edge_light_enabled" />
</PreferenceScreen>

View File

@@ -32,6 +32,13 @@
android:key="notifications_interface_category"
android:title="@string/notifications_interface_category">
<!-- Edge light -->
<Preference
android:key="edge_light_settings"
android:title="@string/notifications_edge_light_title"
android:summary="@string/notifications_edge_light_summary"
android:fragment="org.evolution.settings.fragments.notifications.EdgeLightSettings" />
<!-- Kill app button -->
<org.evolution.settings.preferences.SystemSettingSwitchPreference
android:key="notification_guts_kill_app_button"

View File

@@ -0,0 +1,65 @@
/*
* Copyright (C) 2019-2024 The Evolution X Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.evolution.settings.fragments.notifications;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settingslib.search.SearchIndexable;
import java.util.List;
@SearchIndexable
public class EdgeLightSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "EdgeLightSettings";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.edge_light_settings);
final Context context = getContext();
final ContentResolver resolver = context.getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
final Resources resources = context.getResources();
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final Context context = getContext();
final ContentResolver resolver = context.getContentResolver();
return false;
}
@Override
public int getMetricsCategory() {
return MetricsEvent.EVOLVER;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.edge_light_settings) {
@Override
public List<String> getNonIndexableKeys(Context context) {
List<String> keys = super.getNonIndexableKeys(context);
final Resources resources = context.getResources();
return keys;
}
};
}