Compare commits
2 Commits
bka
...
evolution-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3624ad7d44 | ||
|
|
ce896fdb79 |
@@ -11,13 +11,13 @@
|
||||
|
||||
<!-- Categories -->
|
||||
<string name="themes_title">Themes</string>
|
||||
<string name="themes_summary">Monet engine, fonts, icons, animations</string>
|
||||
<string name="themes_summary">Lock sounds, fonts, animations</string>
|
||||
<string name="lock_screen_title">Lock screen</string>
|
||||
<string name="lock_screen_summary">Interface, fingerprint</string>
|
||||
<string name="status_bar_title">Status bar</string>
|
||||
<string name="status_bar_summary">Gestures, icons, logo</string>
|
||||
<string name="status_bar_summary">Gestures, icons</string>
|
||||
<string name="quick_settings_title">Quick settings</string>
|
||||
<string name="quick_settings_summary">Interface, brightness slider, layout</string>
|
||||
<string name="quick_settings_summary">Interface, miscellaneous</string>
|
||||
<string name="notifications_title">Notifications</string>
|
||||
<string name="notifications_summary">Heads up, interface, sounds</string>
|
||||
<string name="power_menu_title">Power menu</string>
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
android:title="@string/evolver_dashboard_title">
|
||||
|
||||
<!-- About -->
|
||||
<PreferenceCategory
|
||||
android:key="category_about"
|
||||
android:layout="@layout/settingslib_preference_category_no_title">
|
||||
|
||||
<Preference
|
||||
android:key="about"
|
||||
android:title="@string/about_title"
|
||||
android:summary="@string/about_summary"
|
||||
android:icon="@drawable/ic_evolver_about"
|
||||
android:fragment="org.evolution.settings.fragments.about.About" />
|
||||
</PreferenceCategory>
|
||||
<Preference
|
||||
android:key="about"
|
||||
android:title="@string/about_title"
|
||||
android:summary="@string/about_summary"
|
||||
android:icon="@drawable/ic_evolver_about"
|
||||
android:fragment="org.evolution.settings.fragments.about.About" />
|
||||
|
||||
<!-- Themes -->
|
||||
<Preference
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
android:title="@string/lock_screen_interface_category">
|
||||
|
||||
<!-- Ambient Wallpaper -->
|
||||
<org.evolution.settings.preferences.SecureSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SecureSettingSwitchPreference
|
||||
android:key="doze_always_on_wallpaper_enabled"
|
||||
android:title="@string/doze_always_on_wallpaper_title"
|
||||
android:summary="@string/doze_always_on_wallpaper_summary"
|
||||
android:defaultValue="@*android:bool/config_dozeSupportsAodWallpaper" />
|
||||
android:defaultValue="@*android:bool/config_dozeSupportsAodWallpaper" />-->
|
||||
|
||||
<!-- Lockscreen Clock Font and styles -->
|
||||
<!--<Preference
|
||||
@@ -69,11 +69,11 @@
|
||||
android:fragment="org.evolution.settings.fragments.lockscreen.MediaArtSettings" />
|
||||
|
||||
<!-- Charging stats -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="lockscreen_battery_info"
|
||||
android:title="@string/lock_screen_charging_stats_title"
|
||||
android:summary="@string/lock_screen_charging_stats_summary"
|
||||
android:defaultValue="true" />
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<!-- Lockscreen remaining charging time -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023-2024 the risingOS 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/weather_settings_title">
|
||||
|
||||
<Preference
|
||||
android:title="@string/weather_settings_title"
|
||||
android:summary="@string/weather_settings_summary">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetPackage="org.omnirom.omnijaws"
|
||||
android:targetClass="org.omnirom.omnijaws.SettingsActivity" />
|
||||
</Preference>
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="lockscreen_weather_enabled"
|
||||
android:title="@string/lockscreen_weather_title"
|
||||
android:summary="@string/lockscreen_weather_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="lockscreen_weather_location"
|
||||
android:title="@string/lockscreen_weather_location_title"
|
||||
android:summary="@string/lockscreen_weather_location_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="lockscreen_weather_enabled" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="lockscreen_weather_text"
|
||||
android:title="@string/lockscreen_weather_text_title"
|
||||
android:summary="@string/lockscreen_weather_text_summary"
|
||||
android:defaultValue="true"
|
||||
android:dependency="lockscreen_weather_enabled" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -20,12 +20,12 @@
|
||||
android:summary="@string/heads_up_notifications_enabled_summary" />
|
||||
|
||||
<!-- Compact Heads up -->
|
||||
<org.evolution.settings.preferences.SystemPropertySwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemPropertySwitchPreference
|
||||
android:key="persist.sys.compact_heads_up_notification.always_show"
|
||||
android:title="@string/compact_heads_up_notifications_enabled_title"
|
||||
android:summary="@string/compact_heads_up_notifications_enabled_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="heads_up_notifications_enabled" />
|
||||
android:dependency="heads_up_notifications_enabled" />-->
|
||||
|
||||
<!-- Less boring heads up -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
@@ -40,8 +40,15 @@
|
||||
android:key="notifications_interface_category"
|
||||
android:title="@string/notifications_interface_category">
|
||||
|
||||
<!-- Edge light -->
|
||||
<Preference
|
||||
android:key="edge_light_settings"
|
||||
android:title="@string/edge_light_title"
|
||||
android:summary="@string/edge_light_summary"
|
||||
android:fragment="org.evolution.settings.fragments.notifications.EdgeLightSettings" />
|
||||
|
||||
<!-- Notification row transparency -->
|
||||
<org.evolution.settings.preferences.SecureSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SecureSettingSwitchPreference
|
||||
android:key="notification_row_transparency"
|
||||
android:title="@string/notification_row_transparency_title"
|
||||
android:summary="@string/notification_row_transparency_summary"
|
||||
@@ -51,7 +58,7 @@
|
||||
android:key="notification_row_transparency_lockscreen"
|
||||
android:title="@string/notification_row_transparency_lockscreen_title"
|
||||
android:summary="@string/notification_row_transparency_lockscreen_summary"
|
||||
android:defaultValue="true" />
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<!-- Squiggle animation for media notification -->
|
||||
<org.evolution.settings.preferences.SecureSettingSwitchPreference
|
||||
@@ -61,13 +68,13 @@
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Small landscape notifications -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="small_landscape_notification"
|
||||
android:title="@string/small_landscape_notification_title"
|
||||
android:summary="@string/small_landscape_notification_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="max_visible_notification_icons"
|
||||
android:title="@string/max_visible_notification_icons_title"
|
||||
android:summary="@string/max_visible_notification_icons_summary"
|
||||
@@ -83,13 +90,6 @@
|
||||
android:summary="@string/alert_slider_notifications_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Edge light -->
|
||||
<Preference
|
||||
android:key="edge_light_settings"
|
||||
android:title="@string/edge_light_title"
|
||||
android:summary="@string/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"
|
||||
|
||||
@@ -25,18 +25,18 @@
|
||||
android:min="1" />-->
|
||||
|
||||
<!-- Data usage -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="qs_show_data_usage"
|
||||
android:title="@string/quick_settings_data_usage_title"
|
||||
android:summary="@string/quick_settings_data_usage_summary"
|
||||
android:defaultValue="false" />
|
||||
android:defaultValue="false" />-->
|
||||
|
||||
<!-- QS Header -->
|
||||
<Preference
|
||||
<!--<Preference
|
||||
android:key="qs_header_image"
|
||||
android:title="@string/quick_settings_header_image_title"
|
||||
android:summary="@string/quick_settings_header_image_summary"
|
||||
android:fragment="org.evolution.settings.fragments.quicksettings.QsHeaderImageSettings" />
|
||||
android:fragment="org.evolution.settings.fragments.quicksettings.QsHeaderImageSettings" />-->
|
||||
|
||||
<!-- QS Media Player -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
@@ -54,20 +54,20 @@
|
||||
android:defaultValue="0" />-->
|
||||
|
||||
<!-- Battery styles -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="qs_battery_style"
|
||||
android:title="@string/status_bar_battery_style_title"
|
||||
android:entries="@array/qs_battery_style_entries"
|
||||
android:entryValues="@array/qs_battery_style_values"
|
||||
android:defaultValue="-1" />
|
||||
android:defaultValue="-1" />-->
|
||||
|
||||
<!-- Battery percent -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="qs_show_battery_percent"
|
||||
android:title="@string/status_bar_battery_percent_title"
|
||||
android:entries="@array/status_bar_battery_percent_entries"
|
||||
android:entryValues="@array/status_bar_battery_percent_values"
|
||||
android:defaultValue="2" />
|
||||
android:defaultValue="2" />-->
|
||||
|
||||
<!-- QS widgets -->
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
@@ -97,11 +97,10 @@
|
||||
android:defaultValue="false" />-->
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
<!--<PreferenceCategory
|
||||
android:key="qs_brightness_slider_category"
|
||||
android:title="@string/quick_settings_brightness_slider_category">
|
||||
|
||||
<!-- Brightness slider -->
|
||||
<lineageos.preference.LineageSecureSettingListPreference
|
||||
android:key="qs_show_brightness_slider"
|
||||
android:title="@string/quick_settings_show_brightness_slider_title"
|
||||
@@ -109,7 +108,6 @@
|
||||
android:entryValues="@array/quick_settings_show_brightness_slider_values"
|
||||
android:defaultValue="1" />
|
||||
|
||||
<!-- Brightness Slider Style -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="qs_brightness_slider_shape"
|
||||
android:title="@string/qs_brightness_slider_shape_title"
|
||||
@@ -117,7 +115,6 @@
|
||||
android:entryValues="@array/qs_brightness_slider_shape_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- Brightness slider position -->
|
||||
<lineageos.preference.LineageSecureSettingListPreference
|
||||
android:key="qs_brightness_slider_position"
|
||||
android:title="@string/quick_settings_brightness_slider_position_title"
|
||||
@@ -125,26 +122,23 @@
|
||||
android:entryValues="@array/quick_settings_brightness_slider_position_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- Haptic feedback on brightness slider -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="qs_brightness_slider_haptic"
|
||||
android:title="@string/quick_settings_brightness_slider_haptic_title"
|
||||
android:summary="@string/quick_settings_brightness_slider_haptic_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<!-- Auto brightness icon -->
|
||||
<lineageos.preference.LineageSecureSettingSwitchPreference
|
||||
android:key="qs_show_auto_brightness"
|
||||
android:title="@string/quick_settings_auto_brightness_icon_title"
|
||||
android:summary="@string/quick_settings_auto_brightness_icon_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Brightness slider percentage -->
|
||||
<!--<lineageos.preference.LineageSecureSettingSwitchPreference
|
||||
<lineageos.preference.LineageSecureSettingSwitchPreference
|
||||
android:key="qs_show_brightness_percentage"
|
||||
android:title="@string/quick_settings_show_brightness_percentage_title"
|
||||
android:summary="@string/quick_settings_show_brightness_percentage_summary"
|
||||
android:defaultValue="false" />-->
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@@ -158,7 +152,7 @@
|
||||
android:entryValues="@array/quick_settings_tile_shape_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="qs_tile_label_hide"
|
||||
android:title="@string/quick_settings_tile_label_hide_title"
|
||||
android:summary="@string/quick_settings_tile_label_hide_summary"
|
||||
@@ -177,7 +171,7 @@
|
||||
android:key="qs_tile_vertical_layout"
|
||||
android:title="@string/quick_settings_tile_layout_title"
|
||||
android:summary="@string/quick_settings_tile_layout_summary"
|
||||
android:defaultValue="false" />-->
|
||||
android:defaultValue="false" />
|
||||
|
||||
<Preference
|
||||
android:key="qs_layout_columns_rows"
|
||||
@@ -192,7 +186,7 @@
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<!--<PreferenceCategory
|
||||
<PreferenceCategory
|
||||
android:key="quick_settings_animations_category"
|
||||
android:title="@string/quick_settings_animations_category">
|
||||
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
</Preference>
|
||||
|
||||
<!-- Clock & date -->
|
||||
<Preference
|
||||
<!--<Preference
|
||||
android:key="clock"
|
||||
android:title="@string/status_bar_clock_and_date_title"
|
||||
android:summary="@string/status_bar_clock_and_date_summary"
|
||||
android:fragment="org.evolution.settings.fragments.statusbar.Clock" />
|
||||
android:fragment="org.evolution.settings.fragments.statusbar.Clock" />-->
|
||||
|
||||
<!-- Statusbar lyric -->
|
||||
<!--<Preference
|
||||
@@ -76,27 +76,27 @@
|
||||
android:fragment="org.evolution.settings.fragments.statusbar.BatteryBar" />
|
||||
|
||||
<!-- Battery styles -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_battery_style"
|
||||
android:title="@string/status_bar_battery_style_title"
|
||||
android:entries="@array/status_bar_battery_style_entries"
|
||||
android:entryValues="@array/status_bar_battery_style_values"
|
||||
android:defaultValue="0" />
|
||||
android:defaultValue="0" />-->
|
||||
|
||||
<!-- Battery percent -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_show_battery_percent"
|
||||
android:title="@string/status_bar_battery_percent_title"
|
||||
android:entries="@array/status_bar_battery_percent_entries"
|
||||
android:entryValues="@array/status_bar_battery_percent_values"
|
||||
android:defaultValue="0" />
|
||||
android:defaultValue="0" />-->
|
||||
|
||||
<!-- Battery percentage when charging -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="status_bar_battery_text_charging"
|
||||
android:title="@string/status_bar_battery_text_charging_title"
|
||||
android:summary="@string/status_bar_battery_text_charging_summary"
|
||||
android:defaultValue="true" />
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<!-- Data disabled icon -->
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
@@ -141,18 +141,16 @@
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
<!--<PreferenceCategory
|
||||
android:key="status_bar_logo_category"
|
||||
android:title="@string/status_bar_logo_title">
|
||||
|
||||
<!-- Logo -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="status_bar_logo"
|
||||
android:title="@string/status_bar_logo_title"
|
||||
android:summary="@string/status_bar_logo_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<!-- Logo position -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_logo_position"
|
||||
android:title="@string/status_bar_logo_position_title"
|
||||
@@ -161,7 +159,6 @@
|
||||
android:defaultValue="0"
|
||||
android:dependency="status_bar_logo" />
|
||||
|
||||
<!-- Logo style -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_logo_style"
|
||||
android:title="@string/status_bar_logo_style_title"
|
||||
@@ -169,7 +166,7 @@
|
||||
android:entryValues="@array/status_bar_logo_style_values"
|
||||
android:defaultValue="0"
|
||||
android:dependency="status_bar_logo" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceCategory>-->
|
||||
|
||||
<!--<PreferenceCategory
|
||||
android:key="status_bar_privacy_indicators_category"
|
||||
|
||||
@@ -9,71 +9,16 @@
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/themes_title">
|
||||
|
||||
<PreferenceCategory
|
||||
<!--<PreferenceCategory
|
||||
android:key="themes_monet_category"
|
||||
android:title="@string/themes_monet_category">
|
||||
|
||||
<!-- Monet engine -->
|
||||
<Preference
|
||||
android:key="monet_engine"
|
||||
android:title="@string/themes_monet_title"
|
||||
android:summary="@string/themes_monet_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.MonetSettings" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="themes_general_category"
|
||||
android:title="@string/themes_general_category">
|
||||
|
||||
<!-- Wallpaper Settings -->
|
||||
<!--<Preference
|
||||
android:key="wallpaper_settings"
|
||||
android:title="@string/wallpaper_settings_title"
|
||||
android:summary="@string/wallpaper_settings_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.Wallpaper" />
|
||||
|
||||
<Preference
|
||||
android:key="android.theme.customization.brightness_slider"
|
||||
android:title="@string/themes_brightness_slider_title"
|
||||
android:summary="@string/themes_brightness_slider_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.BrightnessSlider" />-->
|
||||
|
||||
<!-- Notification styles -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="notification_style"
|
||||
android:title="@string/notif_style_title"
|
||||
android:entries="@array/notif_style_entries"
|
||||
android:entryValues="@array/notif_style_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- Power menu styles -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="powermenu_style"
|
||||
android:title="@string/powermenu_style_title"
|
||||
android:entries="@array/powermenu_style_entries"
|
||||
android:entryValues="@array/powermenu_style_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- Progress bar styles -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="progress_bar_style"
|
||||
android:title="@string/progress_bar_style_title"
|
||||
android:entries="@array/progress_bar_style_entries"
|
||||
android:entryValues="@array/progress_bar_style_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- Volume Styles -->
|
||||
<!--<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="custom_volume_styles"
|
||||
android:title="@string/volume_style_title"
|
||||
android:entries="@array/volume_styles_entries"
|
||||
android:entryValues="@array/volume_styles_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />-->
|
||||
</PreferenceCategory>
|
||||
</PreferenceCategory>-->
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="themes_audio_category"
|
||||
@@ -112,12 +57,6 @@
|
||||
android:key="themes_launcher_category"
|
||||
android:title="@string/themes_launcher_category">
|
||||
|
||||
<!--<org.evolution.settings.preferences.OverlaySwitchPreference
|
||||
android:key="com.google.android.apps.nexuslauncher.blur.overlay"
|
||||
android:title="@string/themes_launcher_background_blur_title"
|
||||
android:summary="@string/themes_launcher_background_blur_summary"
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<org.evolution.settings.preferences.OverlaySwitchPreference
|
||||
android:key="com.google.android.apps.nexuslauncher.icons.overlay"
|
||||
android:title="@string/themes_launcher_more_themed_icons_title"
|
||||
@@ -129,34 +68,6 @@
|
||||
android:key="themes_icons_category"
|
||||
android:title="@string/themes_icons_category">
|
||||
|
||||
<!-- System icons -->
|
||||
<Preference
|
||||
android:key="android.theme.customization.icon_pack"
|
||||
android:title="@string/themes_system_icons_title"
|
||||
android:summary="@string/themes_system_icons_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.SystemIcons"/>
|
||||
|
||||
<!-- Icon shape -->
|
||||
<Preference
|
||||
android:key="android.theme.customization.adaptive_icon_shape"
|
||||
android:title="@string/themes_icon_shape_title"
|
||||
android:summary="@string/themes_icon_shape_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.IconShapes"/>
|
||||
|
||||
<!-- Signal icon -->
|
||||
<Preference
|
||||
android:key="android.theme.customization.signal_icon"
|
||||
android:title="@string/themes_signal_icon_title"
|
||||
android:summary="@string/themes_signal_icon_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.SignalIcons"/>
|
||||
|
||||
<!-- Wifi icon -->
|
||||
<Preference
|
||||
android:key="android.theme.customization.wifi_icon"
|
||||
android:title="@string/themes_wifi_icon_title"
|
||||
android:summary="@string/themes_wifi_icon_summary"
|
||||
android:fragment="org.evolution.settings.fragments.themes.WifiIcons"/>
|
||||
|
||||
<!-- Navigation bar icons -->
|
||||
<Preference
|
||||
android:key="android.theme.customization.navbar"
|
||||
@@ -184,18 +95,18 @@
|
||||
android:fragment="org.evolution.settings.fragments.themes.BootAnimation" />
|
||||
|
||||
<!-- Charging animation -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="charging_animation"
|
||||
android:title="@string/themes_charging_animation_title"
|
||||
android:summary="@string/themes_charging_animation_summary"
|
||||
android:defaultValue="true" />
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<!-- Dynamic charging animation -->
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="wireless_charging_dynamic_color"
|
||||
android:title="@string/wireless_charging_dynamic_color_title"
|
||||
android:summary="@string/wireless_charging_dynamic_color_summary"
|
||||
android:defaultValue="true" />
|
||||
android:defaultValue="true" />-->
|
||||
|
||||
<!-- Screen Off animation -->
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023-2024 the risingOS 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/wallpaper_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="wallpaper_blur"
|
||||
android:title="@string/wallpaper_blur_title">
|
||||
|
||||
<org.evolution.settings.preferences.SystemPropertyListPreference
|
||||
android:key="persist.sys.wallpaper.blur_enabled"
|
||||
android:title="@string/wallpaper_blur_title"
|
||||
android:entries="@array/wallpaper_blur_entries"
|
||||
android:entryValues="@array/wallpaper_blur_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemPropertyListPreference
|
||||
android:key="persist.sys.wallpaper.blur_type"
|
||||
android:title="@string/wallpaper_blur_filter"
|
||||
android:entries="@array/wallpaper_blur_filter_entries"
|
||||
android:entryValues="@array/wallpaper_blur_filter_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="wallpaper_dim"
|
||||
android:title="@string/wallpaper_dim_title">
|
||||
|
||||
<org.evolution.settings.preferences.SystemPropertyListPreference
|
||||
android:key="persist.sys.wallpaper.dim_enabled"
|
||||
android:title="@string/wallpaper_dim_title"
|
||||
android:entries="@array/wallpaper_blur_entries"
|
||||
android:entryValues="@array/wallpaper_blur_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="persist.sys.wallpaper.dim_level"
|
||||
android:title="@string/wallpaper_dim_level_title"
|
||||
android:summary="@string/wallpaper_dim_level_summary"
|
||||
android:defaultValue="10"
|
||||
settings:interval="1"
|
||||
settings:units="%"
|
||||
android:max="100"
|
||||
android:min="1" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<com.android.settingslib.widget.FooterPreference
|
||||
android:key="wallpaper_styles_footer"
|
||||
android:title="@string/wallpaper_styles_footer"
|
||||
android:selectable="false"
|
||||
settings:searchable="false" />
|
||||
</PreferenceScreen>
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2021-2024 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:key="monet_settings"
|
||||
android:title="@string/themes_monet_title">
|
||||
|
||||
<ListPreference
|
||||
android:key="theme_style"
|
||||
android:title="@string/monet_engine_style_title"
|
||||
android:entries="@array/monet_engine_style_entries"
|
||||
android:entryValues="@array/monet_engine_style_values"
|
||||
android:defaultValue="TONAL_SPOT" />
|
||||
|
||||
<ListPreference
|
||||
android:key="color_source"
|
||||
android:title="@string/monet_engine_color_source_title"
|
||||
android:entries="@array/monet_engine_color_source_entries"
|
||||
android:entryValues="@array/monet_engine_color_source_values"
|
||||
android:defaultValue="both" />
|
||||
|
||||
<org.evolution.settings.preferences.colorpicker.ColorPickerPreference
|
||||
android:key="accent_color"
|
||||
android:title="@string/monet_engine_custom_color_title"
|
||||
android:summary="@string/monet_engine_custom_color_summary"
|
||||
android:defaultValue="0xFF1b6ef3" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="accent_background"
|
||||
android:title="@string/monet_engine_custom_bgcolor_title"
|
||||
android:summary="@string/monet_engine_custom_bgcolor_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<org.evolution.settings.preferences.colorpicker.ColorPickerPreference
|
||||
android:key="bg_color"
|
||||
android:title="@string/monet_engine_color_override_title"
|
||||
android:dependency="accent_background"
|
||||
android:defaultValue="0xFF1b6ef3" />
|
||||
|
||||
<org.evolution.settings.preferences.CustomSeekBarPreference
|
||||
android:key="luminance_factor"
|
||||
android:title="@string/monet_engine_luminance_factor_title"
|
||||
android:summary="@string/monet_engine_luminance_factor_summary"
|
||||
android:defaultValue="0"
|
||||
android:max="30"
|
||||
settings:min="-95"
|
||||
settings:interval="5"
|
||||
settings:units="%"
|
||||
settings:showSign="true" />
|
||||
|
||||
<org.evolution.settings.preferences.CustomSeekBarPreference
|
||||
android:key="chroma_factor"
|
||||
android:title="@string/monet_engine_chroma_factor_title"
|
||||
android:summary="@string/monet_engine_chroma_factor_summary"
|
||||
android:defaultValue="0"
|
||||
android:max="150"
|
||||
settings:min="-95"
|
||||
settings:interval="5"
|
||||
settings:units="%"
|
||||
settings:showSign="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="whole_palette"
|
||||
android:title="@string/monet_engine_whole_palette_title"
|
||||
android:summary="@string/monet_engine_whole_palette_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="tint_background"
|
||||
android:title="@string/monet_engine_tint_background_title"
|
||||
android:summary="@string/monet_engine_tint_background_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -1,82 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2024 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/quick_settings_layout_columns_rows_title">
|
||||
|
||||
<!-- Columns (portrait) -->
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qs_tiles_columns"
|
||||
android:title="@string/quick_settings_columns_portrait_title"
|
||||
android:max="6"
|
||||
settings:min="2"
|
||||
settings:interval="1"
|
||||
android:defaultValue="4" />
|
||||
|
||||
<!-- Columns (landscape) -->
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qs_tiles_columns_landscape"
|
||||
android:title="@string/quick_settings_columns_landscape_title"
|
||||
android:max="6"
|
||||
settings:min="2"
|
||||
settings:interval="1"
|
||||
android:defaultValue="4" />
|
||||
|
||||
<!-- Rows (portrait) -->
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qs_tiles_rows"
|
||||
android:title="@string/quick_settings_rows_portrait_title"
|
||||
android:max="5"
|
||||
settings:min="2"
|
||||
settings:interval="1"
|
||||
android:defaultValue="4" />
|
||||
|
||||
<!-- Rows (landscape) -->
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qs_tiles_rows_landscape"
|
||||
android:title="@string/quick_settings_rows_landscape_title"
|
||||
android:max="3"
|
||||
settings:min="1"
|
||||
settings:interval="1"
|
||||
android:defaultValue="2" />
|
||||
|
||||
<!-- Quick QS rows (portrait) -->
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qqs_layout_rows"
|
||||
android:title="@string/quick_settings_qqs_rows_portrait_title"
|
||||
android:max="3"
|
||||
settings:min="1"
|
||||
settings:interval="1"
|
||||
android:defaultValue="2" />
|
||||
|
||||
<!-- Quick QS rows (landscape) -->
|
||||
<!--<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qqs_layout_rows_landscape"
|
||||
android:title="@string/quick_settings_qqs_rows_landscape_title"
|
||||
android:max="3"
|
||||
settings:min="1"
|
||||
settings:interval="1"
|
||||
android:defaultValue="1" />
|
||||
|
||||
<com.android.settingslib.widget.FooterPreference
|
||||
android:key="qs_layout_columns_rows_footer"
|
||||
android:title="@string/quick_settings_layout_columns_rows_footer_text"
|
||||
android:selectable="false"
|
||||
settings:searchable="false" />-->
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018-2024 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/status_bar_clock_and_date_title" >
|
||||
|
||||
<lineageos.preference.LineageSystemSettingListPreference
|
||||
android:key="status_bar_clock"
|
||||
android:title="@string/status_bar_clock_position_title"
|
||||
android:summary="%s"
|
||||
android:dialogTitle="@string/status_bar_clock_position_title"
|
||||
android:entries="@array/status_bar_clock_position_entries"
|
||||
android:entryValues="@array/status_bar_clock_position_values"
|
||||
android:defaultValue="2" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="status_bar_clock_auto_hide"
|
||||
android:title="@string/status_bar_clock_auto_hide_intervals_title"
|
||||
android:summary="@string/status_bar_clock_auto_hide_intervals_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="status_bar_clock_auto_hide_hduration"
|
||||
android:title="@string/status_bar_clock_auto_hide_hdur_title"
|
||||
android:summary="@string/status_bar_clock_auto_hide_hdur_summary"
|
||||
android:dependency="status_bar_clock_auto_hide"
|
||||
android:max="300"
|
||||
settings:min="5"
|
||||
settings:interval="5"
|
||||
android:defaultValue="60"
|
||||
settings:units="@string/unit_seconds" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="status_bar_clock_auto_hide_sduration"
|
||||
android:title="@string/status_bar_clock_auto_hide_sdur_title"
|
||||
android:summary="@string/status_bar_clock_auto_hide_sdur_summary"
|
||||
android:dependency="status_bar_clock_auto_hide"
|
||||
android:max="300"
|
||||
settings:min="5"
|
||||
settings:interval="5"
|
||||
android:defaultValue="5"
|
||||
settings:units="@string/unit_seconds" />
|
||||
|
||||
<lineageos.preference.LineageSystemSettingSwitchPreference
|
||||
android:key="status_bar_clock_auto_hide"
|
||||
android:title="@string/status_bar_clock_auto_hide_launcher_title"
|
||||
android:summary="@string/status_bar_clock_auto_hide_launcher_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="status_bar_clock_seconds"
|
||||
android:title="@string/status_bar_clock_seconds_title"
|
||||
android:summary="@string/status_bar_clock_seconds_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="statusbar_clock_chip"
|
||||
android:title="@string/status_bar_clock_chip_title"
|
||||
android:summary="@string/status_bar_clock_chip_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<lineageos.preference.LineageSystemSettingListPreference
|
||||
android:key="status_bar_am_pm"
|
||||
android:title="@string/status_bar_am_pm_title"
|
||||
android:summary="%s"
|
||||
android:dialogTitle="@string/status_bar_am_pm_title"
|
||||
android:entries="@array/status_bar_am_pm_entries"
|
||||
android:entryValues="@array/status_bar_am_pm_values"
|
||||
android:defaultValue="2" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_clock_date_display"
|
||||
android:title="@string/status_bar_date_title"
|
||||
android:entries="@array/status_bar_date_entries"
|
||||
android:entryValues="@array/status_bar_date_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_clock_date_position"
|
||||
android:title="@string/status_bar_clock_date_position"
|
||||
android:entries="@array/clock_date_position_entries"
|
||||
android:entryValues="@array/clock_date_position_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<org.evolution.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_clock_date_style"
|
||||
android:title="@string/status_bar_date_style"
|
||||
android:entries="@array/status_bar_date_style_entries"
|
||||
android:entryValues="@array/status_bar_date_style_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<ListPreference
|
||||
android:key="status_bar_clock_date_format"
|
||||
android:title="@string/status_bar_date_format_title"
|
||||
android:entries="@array/status_bar_date_format_entries_values"
|
||||
android:entryValues="@array/status_bar_date_format_entries_values" />
|
||||
</PreferenceScreen>
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.evolution.settings.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
@@ -216,4 +217,20 @@ abstract class OptimizedSettingsFragment : SettingsPreferenceFragment() {
|
||||
protected fun removeCallbacks() {
|
||||
mHandler?.removeCallbacksAndMessages(null)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix crash: RecyclerView is sometimes null when setDivider() is called.
|
||||
* We retry after view is attached instead of crashing.
|
||||
*/
|
||||
override fun setDivider(divider: Drawable?) {
|
||||
val list = listView
|
||||
if (list == null) {
|
||||
view?.post {
|
||||
if (isAdded) setDivider(divider)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
super.setDivider(divider)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2025 Evolution X
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.lockscreen;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
public class LockScreenWeather extends SettingsPreferenceFragment {
|
||||
|
||||
public static final String TAG = "LockScreenWeather";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.evolution_settings_lock_screen_weather);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* For search
|
||||
*/
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.evolution_settings_lock_screen_weather) {
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
|
||||
@@ -36,11 +36,11 @@ public class Notifications extends SettingsPreferenceFragment implements
|
||||
|
||||
private static final String KEY_ALERT_SLIDER_PREF = "alert_slider_notifications";
|
||||
private static final String KEY_INTERFACE_CATEGORY = "notifications_interface_category";
|
||||
private static final String KEY_COMPACT_HUN = "persist.sys.compact_heads_up_notification.always_show";
|
||||
// private static final String KEY_COMPACT_HUN = "persist.sys.compact_heads_up_notification.always_show";
|
||||
|
||||
private PreferenceCategory mInterfaceCategory;
|
||||
private Preference mAlertSlider;
|
||||
private SystemPropertySwitchPreference mCompactHUN;
|
||||
// private SystemPropertySwitchPreference mCompactHUN;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -60,18 +60,18 @@ public class Notifications extends SettingsPreferenceFragment implements
|
||||
mInterfaceCategory.removePreference(mAlertSlider);
|
||||
}
|
||||
|
||||
mCompactHUN = (SystemPropertySwitchPreference) findPreference(KEY_COMPACT_HUN);
|
||||
mCompactHUN.setOnPreferenceChangeListener(this);
|
||||
// mCompactHUN = (SystemPropertySwitchPreference) findPreference(KEY_COMPACT_HUN);
|
||||
// mCompactHUN.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final Context context = getContext();
|
||||
final ContentResolver resolver = context.getContentResolver();
|
||||
if (preference == mCompactHUN) {
|
||||
SystemUtils.showSystemUiRestartDialog(context);
|
||||
return true;
|
||||
}
|
||||
// if (preference == mCompactHUN) {
|
||||
// SystemUtils.showSystemUiRestartDialog(context);
|
||||
// return true;
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 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.
|
||||
*/
|
||||
package org.evolution.settings.fragments.quicksettings;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
public class LayoutSettings extends SettingsPreferenceFragment {
|
||||
|
||||
public static final String TAG = "LayoutSettings";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.qs_layout_settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* For search
|
||||
*/
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.qs_layout_settings) {
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 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.
|
||||
*/
|
||||
package org.evolution.settings.fragments.quicksettings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.provider.Settings;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SearchIndexable
|
||||
public class QsHeaderImageSettings extends SettingsPreferenceFragment implements
|
||||
OnPreferenceChangeListener {
|
||||
|
||||
private static final String CUSTOM_HEADER_BROWSE = "custom_header_browse";
|
||||
private static final String DAYLIGHT_HEADER_PACK = "daylight_header_pack";
|
||||
private static final String CUSTOM_HEADER_PROVIDER = "qs_header_provider";
|
||||
private static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header";
|
||||
private static final String FILE_HEADER_SELECT = "file_header_select";
|
||||
private static final int REQUEST_PICK_IMAGE = 10001;
|
||||
|
||||
private Preference mHeaderBrowse;
|
||||
private ListPreference mDaylightHeaderPack;
|
||||
private ListPreference mHeaderProvider;
|
||||
private String mDaylightHeaderProvider;
|
||||
private Preference mFileHeader;
|
||||
private String mFileHeaderProvider;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
addPreferencesFromResource(R.xml.qs_header_image_settings);
|
||||
|
||||
ContentResolver resolver = getContext().getContentResolver();
|
||||
|
||||
mHeaderBrowse = findPreference(CUSTOM_HEADER_BROWSE);
|
||||
mHeaderBrowse.setEnabled(isBrowseHeaderAvailable());
|
||||
|
||||
mDaylightHeaderPack = (ListPreference) findPreference(DAYLIGHT_HEADER_PACK);
|
||||
|
||||
List<String> entries = new ArrayList<String>();
|
||||
List<String> values = new ArrayList<String>();
|
||||
getAvailableHeaderPacks(entries, values);
|
||||
mDaylightHeaderPack.setEntries(entries.toArray(new String[entries.size()]));
|
||||
mDaylightHeaderPack.setEntryValues(values.toArray(new String[values.size()]));
|
||||
updateHeaderProviderSummary();
|
||||
mDaylightHeaderPack.setOnPreferenceChangeListener(this);
|
||||
|
||||
mDaylightHeaderProvider = "daylight";
|
||||
mFileHeaderProvider = "file";
|
||||
String providerName = Settings.System.getString(resolver,
|
||||
Settings.System.STATUS_BAR_CUSTOM_HEADER_PROVIDER);
|
||||
if (providerName == null) {
|
||||
providerName = mDaylightHeaderProvider;
|
||||
}
|
||||
mHeaderBrowse.setEnabled(isBrowseHeaderAvailable() && !providerName.equals(mFileHeaderProvider));
|
||||
|
||||
mHeaderProvider = (ListPreference) findPreference(CUSTOM_HEADER_PROVIDER);
|
||||
int valueIndex = mHeaderProvider.findIndexOfValue(providerName);
|
||||
mHeaderProvider.setValueIndex(valueIndex >= 0 ? valueIndex : 0);
|
||||
mHeaderProvider.setSummary(mHeaderProvider.getEntry());
|
||||
mHeaderProvider.setOnPreferenceChangeListener(this);
|
||||
mDaylightHeaderPack.setEnabled(providerName.equals(mDaylightHeaderProvider));
|
||||
|
||||
mFileHeader = findPreference(FILE_HEADER_SELECT);
|
||||
mFileHeader.setEnabled(providerName.equals(mFileHeaderProvider));
|
||||
}
|
||||
|
||||
private void updateHeaderProviderSummary() {
|
||||
String settingHeaderPackage = Settings.System.getString(getContext().getContentResolver(),
|
||||
Settings.System.STATUS_BAR_DAYLIGHT_HEADER_PACK);
|
||||
int valueIndex = mDaylightHeaderPack.findIndexOfValue(settingHeaderPackage);
|
||||
if (valueIndex >= 0) {
|
||||
mDaylightHeaderPack.setValueIndex(valueIndex >= 0 ? valueIndex : 0);
|
||||
mDaylightHeaderPack.setSummary(mDaylightHeaderPack.getEntry());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
ContentResolver resolver = getContext().getContentResolver();
|
||||
switch (preference.getKey()) {
|
||||
case DAYLIGHT_HEADER_PACK:
|
||||
String dhvalue = (String) newValue;
|
||||
Settings.System.putString(resolver,
|
||||
Settings.System.STATUS_BAR_DAYLIGHT_HEADER_PACK, dhvalue);
|
||||
int dhvalueIndex = mDaylightHeaderPack.findIndexOfValue(dhvalue);
|
||||
mDaylightHeaderPack.setSummary(mDaylightHeaderPack.getEntries()[dhvalueIndex]);
|
||||
return true;
|
||||
|
||||
case CUSTOM_HEADER_PROVIDER:
|
||||
String value = (String) newValue;
|
||||
Settings.System.putString(resolver,
|
||||
Settings.System.STATUS_BAR_CUSTOM_HEADER_PROVIDER, value);
|
||||
int valueIndex = mHeaderProvider.findIndexOfValue(value);
|
||||
mHeaderProvider.setSummary(mHeaderProvider.getEntries()[valueIndex]);
|
||||
mDaylightHeaderPack.setEnabled(value.equals(mDaylightHeaderProvider));
|
||||
mHeaderBrowse.setEnabled(!value.equals(mFileHeaderProvider));
|
||||
mHeaderBrowse.setTitle(valueIndex == 0 ? R.string.quick_settings_header_browse_title : R.string.quick_settings_header_pick_title);
|
||||
mHeaderBrowse.setSummary(valueIndex == 0 ? R.string.quick_settings_header_browse_summary : R.string.quick_settings_header_pick_summary);
|
||||
mFileHeader.setEnabled(value.equals(mFileHeaderProvider));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
if (preference == mFileHeader) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
intent.setType("image/*");
|
||||
startActivityForResult(intent, REQUEST_PICK_IMAGE);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(getContext(), R.string.quick_settings_header_needs_gallery, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
private boolean isBrowseHeaderAvailable() {
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
Intent browse = new Intent();
|
||||
browse.setClassName("org.omnirom.omnistyle", "org.omnirom.omnistyle.PickHeaderActivity");
|
||||
return pm.resolveActivity(browse, 0) != null;
|
||||
}
|
||||
|
||||
private void getAvailableHeaderPacks(List<String> entries, List<String> values) {
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
Intent intent = new Intent();
|
||||
PackageManager packageManager = getContext().getPackageManager();
|
||||
intent.setAction("org.omnirom.DaylightHeaderPack");
|
||||
for (ResolveInfo r : packageManager.queryIntentActivities(intent, 0)) {
|
||||
String packageName = r.activityInfo.packageName;
|
||||
String label = r.activityInfo.loadLabel(packageManager).toString();
|
||||
if (label == null) {
|
||||
label = packageName;
|
||||
}
|
||||
headerMap.put(label, packageName);
|
||||
}
|
||||
intent.setAction("org.omnirom.DaylightHeaderPack1");
|
||||
for (ResolveInfo r : packageManager.queryIntentActivities(intent, 0)) {
|
||||
String packageName = r.activityInfo.packageName;
|
||||
String label = r.activityInfo.loadLabel(packageManager).toString();
|
||||
if (r.activityInfo.name.endsWith(".theme")) {
|
||||
continue;
|
||||
}
|
||||
if (label == null) {
|
||||
label = packageName;
|
||||
}
|
||||
headerMap.put(label, packageName + "/" + r.activityInfo.name);
|
||||
}
|
||||
List<String> labelList = new ArrayList<>(headerMap.keySet());
|
||||
Collections.sort(labelList);
|
||||
for (String label : labelList) {
|
||||
entries.add(label);
|
||||
values.add(headerMap.get(label));
|
||||
}
|
||||
}
|
||||
|
||||
public static void reset(Context mContext) {
|
||||
ContentResolver resolver = mContext.getContentResolver();
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_CUSTOM_HEADER, 0, UserHandle.USER_CURRENT);
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_CUSTOM_HEADER_SHADOW, 0, UserHandle.USER_CURRENT);
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_CUSTOM_HEADER_HEIGHT, 142, UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent result) {
|
||||
if (requestCode == REQUEST_PICK_IMAGE && resultCode == Activity.RESULT_OK) {
|
||||
final Uri imageUri = result.getData();
|
||||
if (imageUri != null) {
|
||||
Settings.System.putString(getContentResolver(),
|
||||
Settings.System.STATUS_BAR_FILE_HEADER_IMAGE, imageUri.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For search
|
||||
*/
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
ArrayList<SearchIndexableResource> result =
|
||||
new ArrayList<SearchIndexableResource>();
|
||||
|
||||
SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.qs_header_image_settings;
|
||||
result.add(sir);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
@@ -46,40 +45,40 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
private static final String TAG = "QuickSettings";
|
||||
|
||||
private static final String QS_BRIGHTNESS_CATEGORY = "qs_brightness_slider_category";
|
||||
private static final String QS_LAYOUT_CATEGORY = "qs_layout_category";
|
||||
private static final String KEY_BATTERY_PERCENT = "qs_show_battery_percent";
|
||||
private static final String KEY_BATTERY_STYLE = "qs_battery_style";
|
||||
private static final String KEY_BRIGHTNESS_SLIDER_POSITION = "qs_brightness_slider_position";
|
||||
private static final String KEY_BRIGHTNESS_SLIDER_HAPTIC = "qs_brightness_slider_haptic";
|
||||
private static final String KEY_INTERFACE_CATEGORY = "quick_settings_interface_category";
|
||||
// private static final String QS_BRIGHTNESS_CATEGORY = "qs_brightness_slider_category";
|
||||
// private static final String QS_LAYOUT_CATEGORY = "qs_layout_category";
|
||||
// private static final String KEY_BATTERY_PERCENT = "qs_show_battery_percent";
|
||||
// private static final String KEY_BATTERY_STYLE = "qs_battery_style";
|
||||
// private static final String KEY_BRIGHTNESS_SLIDER_POSITION = "qs_brightness_slider_position";
|
||||
// private static final String KEY_BRIGHTNESS_SLIDER_HAPTIC = "qs_brightness_slider_haptic";
|
||||
// private static final String KEY_INTERFACE_CATEGORY = "quick_settings_interface_category";
|
||||
private static final String KEY_MISCELLANEOUS_CATEGORY = "quick_settings_miscellaneous_category";
|
||||
private static final String KEY_QS_BLUETOOTH_SHOW_DIALOG = "qs_bt_show_dialog";
|
||||
// private static final String KEY_QS_PANEL_STYLE = "qs_panel_style";
|
||||
// private static final String KEY_QS_UI_STYLE = "qs_tile_ui_style";
|
||||
// private static final String KEY_QS_WIDGETS_ENABLED = "qs_widgets_enabled";
|
||||
private static final String KEY_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider";
|
||||
private static final String KEY_SHOW_AUTO_BRIGHTNESS = "qs_show_auto_brightness";
|
||||
// private static final String KEY_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider";
|
||||
// private static final String KEY_SHOW_AUTO_BRIGHTNESS = "qs_show_auto_brightness";
|
||||
// private static final String KEY_TILE_ANIM_STYLE = "qs_tile_animation_style";
|
||||
// private static final String KEY_TILE_ANIM_DURATION = "qs_tile_animation_duration";
|
||||
// private static final String KEY_TILE_ANIM_INTERPOLATOR = "qs_tile_animation_interpolator";
|
||||
private static final String KEY_QS_TILE_HAPTIC = "qs_tile_haptic";
|
||||
// private static final String KEY_QS_TILE_HAPTIC = "qs_tile_haptic";
|
||||
|
||||
private static final int BATTERY_STYLE_PORTRAIT = 0;
|
||||
private static final int BATTERY_STYLE_TEXT = 4;
|
||||
private static final int BATTERY_STYLE_HIDDEN = 5;
|
||||
// private static final int BATTERY_STYLE_PORTRAIT = 0;
|
||||
// private static final int BATTERY_STYLE_TEXT = 4;
|
||||
// private static final int BATTERY_STYLE_HIDDEN = 5;
|
||||
|
||||
private PreferenceCategory mInterfaceCategory;
|
||||
private PreferenceCategory mMiscellaneousCategory;
|
||||
private ListPreference mShowBrightnessSlider;
|
||||
private ListPreference mBrightnessSliderPosition;
|
||||
// private ListPreference mShowBrightnessSlider;
|
||||
// private ListPreference mBrightnessSliderPosition;
|
||||
// private ListPreference mQsPanelStyle;
|
||||
// private ListPreference mQsUI;
|
||||
private SwitchPreferenceCompat mBrightnessSliderHaptic;
|
||||
private SwitchPreferenceCompat mShowAutoBrightness;
|
||||
private SwitchPreferenceCompat mQsTileHaptic;
|
||||
private SystemSettingListPreference mBatteryStyle;
|
||||
private SystemSettingListPreference mBatteryPercent;
|
||||
// private SwitchPreferenceCompat mBrightnessSliderHaptic;
|
||||
// private SwitchPreferenceCompat mShowAutoBrightness;
|
||||
// private SwitchPreferenceCompat mQsTileHaptic;
|
||||
// private SystemSettingListPreference mBatteryStyle;
|
||||
// private SystemSettingListPreference mBatteryPercent;
|
||||
// private SystemSettingListPreference mTileAnimationInterpolator;
|
||||
// private SystemSettingListPreference mTileAnimationStyle;
|
||||
// private SystemSettingSeekBarPreference mTileAnimationDuration;
|
||||
@@ -102,47 +101,47 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
final PreferenceScreen prefScreen = getPreferenceScreen();
|
||||
final Resources res = context.getResources();
|
||||
|
||||
PreferenceCategory brightnessCategory = (PreferenceCategory) findPreference(QS_BRIGHTNESS_CATEGORY);
|
||||
PreferenceCategory tileCategory = (PreferenceCategory) findPreference(QS_LAYOUT_CATEGORY);
|
||||
// PreferenceCategory brightnessCategory = (PreferenceCategory) findPreference(QS_BRIGHTNESS_CATEGORY);
|
||||
// PreferenceCategory tileCategory = (PreferenceCategory) findPreference(QS_LAYOUT_CATEGORY);
|
||||
|
||||
mBatteryStyle = (SystemSettingListPreference) findPreference(KEY_BATTERY_STYLE);
|
||||
mBatteryPercent = (SystemSettingListPreference) findPreference(KEY_BATTERY_PERCENT);
|
||||
// mBatteryStyle = (SystemSettingListPreference) findPreference(KEY_BATTERY_STYLE);
|
||||
// mBatteryPercent = (SystemSettingListPreference) findPreference(KEY_BATTERY_PERCENT);
|
||||
|
||||
int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.QS_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
// int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
// Settings.System.QS_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
|
||||
mBatteryStyle.setOnPreferenceChangeListener(this);
|
||||
// mBatteryStyle.setOnPreferenceChangeListener(this);
|
||||
|
||||
mBatteryPercent.setEnabled(
|
||||
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||
// mBatteryPercent.setEnabled(
|
||||
// batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||
|
||||
mShowBrightnessSlider = findPreference(KEY_SHOW_BRIGHTNESS_SLIDER);
|
||||
mShowBrightnessSlider.setOnPreferenceChangeListener(this);
|
||||
boolean showSlider = LineageSettings.Secure.getIntForUser(resolver,
|
||||
LineageSettings.Secure.QS_SHOW_BRIGHTNESS_SLIDER, 1, UserHandle.USER_CURRENT) > 0;
|
||||
// mShowBrightnessSlider = findPreference(KEY_SHOW_BRIGHTNESS_SLIDER);
|
||||
// mShowBrightnessSlider.setOnPreferenceChangeListener(this);
|
||||
// boolean showSlider = LineageSettings.Secure.getIntForUser(resolver,
|
||||
// LineageSettings.Secure.QS_SHOW_BRIGHTNESS_SLIDER, 1, UserHandle.USER_CURRENT) > 0;
|
||||
|
||||
mBrightnessSliderPosition = findPreference(KEY_BRIGHTNESS_SLIDER_POSITION);
|
||||
mBrightnessSliderPosition.setEnabled(showSlider);
|
||||
// mBrightnessSliderPosition = findPreference(KEY_BRIGHTNESS_SLIDER_POSITION);
|
||||
// mBrightnessSliderPosition.setEnabled(showSlider);
|
||||
|
||||
mBrightnessSliderHaptic = findPreference(KEY_BRIGHTNESS_SLIDER_HAPTIC);
|
||||
mQsTileHaptic = findPreference(KEY_QS_TILE_HAPTIC);
|
||||
boolean hapticAvailable = DeviceUtils.hasVibrator(context);
|
||||
// mBrightnessSliderHaptic = findPreference(KEY_BRIGHTNESS_SLIDER_HAPTIC);
|
||||
// mQsTileHaptic = findPreference(KEY_QS_TILE_HAPTIC);
|
||||
// boolean hapticAvailable = DeviceUtils.hasVibrator(context);
|
||||
|
||||
if (hapticAvailable) {
|
||||
mBrightnessSliderHaptic.setEnabled(showSlider);
|
||||
} else {
|
||||
brightnessCategory.removePreference(mBrightnessSliderHaptic);
|
||||
tileCategory.removePreference(mQsTileHaptic);
|
||||
}
|
||||
// if (hapticAvailable) {
|
||||
// mBrightnessSliderHaptic.setEnabled(showSlider);
|
||||
// } else {
|
||||
// brightnessCategory.removePreference(mBrightnessSliderHaptic);
|
||||
// tileCategory.removePreference(mQsTileHaptic);
|
||||
// }
|
||||
|
||||
mShowAutoBrightness = findPreference(KEY_SHOW_AUTO_BRIGHTNESS);
|
||||
boolean automaticAvailable = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_automatic_brightness_available);
|
||||
if (automaticAvailable) {
|
||||
mShowAutoBrightness.setEnabled(showSlider);
|
||||
} else {
|
||||
brightnessCategory.removePreference(mShowAutoBrightness);
|
||||
}
|
||||
// mShowAutoBrightness = findPreference(KEY_SHOW_AUTO_BRIGHTNESS);
|
||||
// boolean automaticAvailable = context.getResources().getBoolean(
|
||||
// com.android.internal.R.bool.config_automatic_brightness_available);
|
||||
// if (automaticAvailable) {
|
||||
// mShowAutoBrightness.setEnabled(showSlider);
|
||||
// } else {
|
||||
// brightnessCategory.removePreference(mShowAutoBrightness);
|
||||
// }
|
||||
|
||||
// mTileAnimationStyle = (SystemSettingListPreference) findPreference(KEY_TILE_ANIM_STYLE);
|
||||
// mTileAnimationDuration = (SystemSettingSeekBarPreference) findPreference(KEY_TILE_ANIM_DURATION);
|
||||
@@ -178,19 +177,19 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final Context context = getContext();
|
||||
final ContentResolver resolver = context.getContentResolver();
|
||||
if (preference == mShowBrightnessSlider) {
|
||||
int value = Integer.parseInt((String) newValue);
|
||||
mBrightnessSliderPosition.setEnabled(value > 0);
|
||||
if (mBrightnessSliderHaptic != null)
|
||||
mBrightnessSliderHaptic.setEnabled(value > 0);
|
||||
if (mShowAutoBrightness != null)
|
||||
mShowAutoBrightness.setEnabled(value > 0);
|
||||
return true;
|
||||
} else if (preference == mBatteryStyle) {
|
||||
int value = Integer.parseInt((String) newValue);
|
||||
mBatteryPercent.setEnabled(
|
||||
value != BATTERY_STYLE_TEXT && value != BATTERY_STYLE_HIDDEN);
|
||||
return true;
|
||||
// if (preference == mShowBrightnessSlider) {
|
||||
// int value = Integer.parseInt((String) newValue);
|
||||
// mBrightnessSliderPosition.setEnabled(value > 0);
|
||||
// if (mBrightnessSliderHaptic != null)
|
||||
// mBrightnessSliderHaptic.setEnabled(value > 0);
|
||||
// if (mShowAutoBrightness != null)
|
||||
// mShowAutoBrightness.setEnabled(value > 0);
|
||||
// return true;
|
||||
// } else if (preference == mBatteryStyle) {
|
||||
// int value = Integer.parseInt((String) newValue);
|
||||
// mBatteryPercent.setEnabled(
|
||||
// value != BATTERY_STYLE_TEXT && value != BATTERY_STYLE_HIDDEN);
|
||||
// return true;
|
||||
// } else if (preference == mQsUI) {
|
||||
// int value = Integer.parseInt((String) newValue);
|
||||
// Settings.System.putIntForUser(resolver,
|
||||
@@ -218,7 +217,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
// } else if (preference == mQsWidgetsPref) {
|
||||
// SystemUtils.showSystemUiRestartDialog(context);
|
||||
// return true;
|
||||
}
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -350,17 +349,17 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
final Resources res = context.getResources();
|
||||
|
||||
boolean automaticAvailable = res.getBoolean(
|
||||
com.android.internal.R.bool.config_automatic_brightness_available);
|
||||
if (!automaticAvailable) {
|
||||
keys.add(KEY_SHOW_AUTO_BRIGHTNESS);
|
||||
}
|
||||
// boolean automaticAvailable = res.getBoolean(
|
||||
// com.android.internal.R.bool.config_automatic_brightness_available);
|
||||
// if (!automaticAvailable) {
|
||||
// keys.add(KEY_SHOW_AUTO_BRIGHTNESS);
|
||||
// }
|
||||
|
||||
boolean hapticAvailable = DeviceUtils.hasVibrator(context);
|
||||
if (!hapticAvailable) {
|
||||
keys.add(KEY_BRIGHTNESS_SLIDER_HAPTIC);
|
||||
keys.add(KEY_QS_TILE_HAPTIC);
|
||||
}
|
||||
// boolean hapticAvailable = DeviceUtils.hasVibrator(context);
|
||||
// if (!hapticAvailable) {
|
||||
// keys.add(KEY_BRIGHTNESS_SLIDER_HAPTIC);
|
||||
// keys.add(KEY_QS_TILE_HAPTIC);
|
||||
// }
|
||||
|
||||
if (!DeviceUtils.deviceSupportsBluetooth(context)) {
|
||||
keys.add(KEY_QS_BLUETOOTH_SHOW_DIALOG);
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2024 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.statusbar;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lineageos.preference.LineageSystemSettingListPreference;
|
||||
import lineageos.providers.LineageSettings;
|
||||
|
||||
import org.evolution.settings.preferences.CustomSeekBarPreference;
|
||||
import org.evolution.settings.preferences.SystemSettingListPreference;
|
||||
import org.evolution.settings.utils.DeviceUtils;
|
||||
|
||||
@SearchIndexable
|
||||
public class Clock extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String TAG = "Clock";
|
||||
|
||||
private static final String STATUS_BAR_CLOCK_POSITION = "status_bar_clock";
|
||||
private static final String STATUS_BAR_AM_PM = "status_bar_am_pm";
|
||||
private static final String CLOCK_DATE_DISPLAY = "status_bar_clock_date_display";
|
||||
private static final String CLOCK_DATE_POSITION = "status_bar_clock_date_position";
|
||||
private static final String CLOCK_DATE_STYLE = "status_bar_clock_date_style";
|
||||
private static final String CLOCK_DATE_FORMAT = "status_bar_clock_date_format";
|
||||
|
||||
private static final int CLOCK_DATE_STYLE_LOWERCASE = 1;
|
||||
private static final int CLOCK_DATE_STYLE_UPPERCASE = 2;
|
||||
private static final int CUSTOM_CLOCK_DATE_FORMAT_INDEX = 18;
|
||||
|
||||
private LineageSystemSettingListPreference mClockPosition;
|
||||
private LineageSystemSettingListPreference mStatusBarAmPm;
|
||||
private SystemSettingListPreference mClockDateDisplay;
|
||||
private SystemSettingListPreference mClockDatePosition;
|
||||
private SystemSettingListPreference mClockDateStyle;
|
||||
private ListPreference mClockDateFormat;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.status_bar_clock);
|
||||
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
Context mContext = getActivity().getApplicationContext();
|
||||
|
||||
mClockPosition =
|
||||
(LineageSystemSettingListPreference) findPreference(STATUS_BAR_CLOCK_POSITION);
|
||||
|
||||
if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
if (DeviceUtils.hasCenteredCutout(mContext)) {
|
||||
mClockPosition.setEntries(R.array.status_bar_clock_position_entries_notch_rtl);
|
||||
mClockPosition.setEntryValues(R.array.status_bar_clock_position_values_notch_rtl);
|
||||
} else {
|
||||
mClockPosition.setEntries(R.array.status_bar_clock_position_entries_rtl);
|
||||
mClockPosition.setEntryValues(R.array.status_bar_clock_position_values_rtl);
|
||||
}
|
||||
} else if (DeviceUtils.hasCenteredCutout(mContext)) {
|
||||
mClockPosition.setEntries(R.array.status_bar_clock_position_entries_notch);
|
||||
mClockPosition.setEntryValues(R.array.status_bar_clock_position_values_notch);
|
||||
}
|
||||
|
||||
mStatusBarAmPm =
|
||||
(LineageSystemSettingListPreference) findPreference(STATUS_BAR_AM_PM);
|
||||
|
||||
if (DateFormat.is24HourFormat(getActivity())) {
|
||||
mStatusBarAmPm.setEnabled(false);
|
||||
mStatusBarAmPm.setSummary(R.string.status_bar_am_pm_info);
|
||||
}
|
||||
|
||||
int dateDisplay = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_CLOCK_DATE_DISPLAY, 0, UserHandle.USER_CURRENT);
|
||||
|
||||
mClockDateDisplay = (SystemSettingListPreference) findPreference(CLOCK_DATE_DISPLAY);
|
||||
mClockDateDisplay.setOnPreferenceChangeListener(this);
|
||||
|
||||
mClockDatePosition = (SystemSettingListPreference) findPreference(CLOCK_DATE_POSITION);
|
||||
mClockDatePosition.setEnabled(dateDisplay > 0);
|
||||
mClockDatePosition.setOnPreferenceChangeListener(this);
|
||||
|
||||
mClockDateStyle = (SystemSettingListPreference) findPreference(CLOCK_DATE_STYLE);
|
||||
mClockDateStyle.setEnabled(dateDisplay > 0);
|
||||
mClockDateStyle.setOnPreferenceChangeListener(this);
|
||||
|
||||
mClockDateFormat = (ListPreference) findPreference(CLOCK_DATE_FORMAT);
|
||||
if (mClockDateFormat.getValue() == null) {
|
||||
mClockDateFormat.setValue("EEE");
|
||||
}
|
||||
parseClockDateFormats();
|
||||
mClockDateFormat.setEnabled(dateDisplay > 0);
|
||||
mClockDateFormat.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
AlertDialog dialog;
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
if (preference == mClockDateDisplay) {
|
||||
int val = Integer.parseInt((String) newValue);
|
||||
if (val == 0) {
|
||||
mClockDatePosition.setEnabled(false);
|
||||
mClockDateStyle.setEnabled(false);
|
||||
mClockDateFormat.setEnabled(false);
|
||||
} else {
|
||||
mClockDatePosition.setEnabled(true);
|
||||
mClockDateStyle.setEnabled(true);
|
||||
mClockDateFormat.setEnabled(true);
|
||||
}
|
||||
return true;
|
||||
} else if (preference == mClockDatePosition) {
|
||||
parseClockDateFormats();
|
||||
return true;
|
||||
} else if (preference == mClockDateStyle) {
|
||||
parseClockDateFormats();
|
||||
return true;
|
||||
} else if (preference == mClockDateFormat) {
|
||||
int index = mClockDateFormat.findIndexOfValue((String) newValue);
|
||||
|
||||
if (index == CUSTOM_CLOCK_DATE_FORMAT_INDEX) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
|
||||
alert.setTitle(R.string.status_bar_date_string_edittext_title);
|
||||
alert.setMessage(R.string.status_bar_date_string_edittext_summary);
|
||||
|
||||
final EditText input = new EditText(getActivity());
|
||||
String oldText = Settings.System.getString(
|
||||
resolver,
|
||||
Settings.System.STATUS_BAR_CLOCK_DATE_FORMAT);
|
||||
if (oldText != null) {
|
||||
input.setText(oldText);
|
||||
}
|
||||
alert.setView(input);
|
||||
|
||||
alert.setPositiveButton(R.string.menu_save, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialogInterface, int whichButton) {
|
||||
String value = input.getText().toString();
|
||||
if (value.equals("")) {
|
||||
return;
|
||||
}
|
||||
Settings.System.putString(resolver,
|
||||
Settings.System.STATUS_BAR_CLOCK_DATE_FORMAT, value);
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
alert.setNegativeButton(R.string.menu_cancel,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialogInterface, int which) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
dialog = alert.create();
|
||||
dialog.show();
|
||||
} else {
|
||||
if ((String) newValue != null) {
|
||||
Settings.System.putString(resolver,
|
||||
Settings.System.STATUS_BAR_CLOCK_DATE_FORMAT, (String) newValue);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void parseClockDateFormats() {
|
||||
String[] dateEntries = getResources().getStringArray(
|
||||
R.array.status_bar_date_format_entries_values);
|
||||
CharSequence parsedDateEntries[];
|
||||
parsedDateEntries = new String[dateEntries.length];
|
||||
Date now = new Date();
|
||||
|
||||
int lastEntry = dateEntries.length - 1;
|
||||
int dateFormat = Settings.System.getIntForUser(getActivity()
|
||||
.getContentResolver(), Settings.System.STATUS_BAR_CLOCK_DATE_STYLE, 0, UserHandle.USER_CURRENT);
|
||||
for (int i = 0; i < dateEntries.length; i++) {
|
||||
if (i == lastEntry) {
|
||||
parsedDateEntries[i] = dateEntries[i];
|
||||
} else {
|
||||
String newDate;
|
||||
CharSequence dateString = DateFormat.format(dateEntries[i], now);
|
||||
if (dateFormat == CLOCK_DATE_STYLE_LOWERCASE) {
|
||||
newDate = dateString.toString().toLowerCase();
|
||||
} else if (dateFormat == CLOCK_DATE_STYLE_UPPERCASE) {
|
||||
newDate = dateString.toString().toUpperCase();
|
||||
} else {
|
||||
newDate = dateString.toString();
|
||||
}
|
||||
|
||||
parsedDateEntries[i] = newDate;
|
||||
}
|
||||
}
|
||||
mClockDateFormat.setEntries(parsedDateEntries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.status_bar_clock) {
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -42,9 +42,9 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
private static final String KEY_QUICK_PULLDOWN = "qs_quick_pulldown";
|
||||
|
||||
private static final String KEY_ICONS_CATEGORY = "status_bar_icons_category";
|
||||
private static final String KEY_BATTERY_STYLE = "status_bar_battery_style";
|
||||
private static final String KEY_BATTERY_PERCENT = "status_bar_show_battery_percent";
|
||||
private static final String KEY_BATTERY_TEXT_CHARGING = "status_bar_battery_text_charging";
|
||||
// private static final String KEY_BATTERY_STYLE = "status_bar_battery_style";
|
||||
// private static final String KEY_BATTERY_PERCENT = "status_bar_show_battery_percent";
|
||||
// private static final String KEY_BATTERY_TEXT_CHARGING = "status_bar_battery_text_charging";
|
||||
private static final String KEY_BLUETOOTH_BATTERY_STATUS = "bluetooth_show_battery";
|
||||
private static final String KEY_COLORED_ICONS = "statusbar_colored_icons";
|
||||
|
||||
@@ -52,16 +52,16 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
private static final int PULLDOWN_DIR_RIGHT = 1;
|
||||
private static final int PULLDOWN_DIR_LEFT = 2;
|
||||
private static final int PULLDOWN_DIR_BOTH = 3;
|
||||
private static final int BATTERY_STYLE_PORTRAIT = 0;
|
||||
private static final int BATTERY_STYLE_TEXT = 4;
|
||||
private static final int BATTERY_STYLE_HIDDEN = 5;
|
||||
// private static final int BATTERY_STYLE_PORTRAIT = 0;
|
||||
// private static final int BATTERY_STYLE_TEXT = 4;
|
||||
// private static final int BATTERY_STYLE_HIDDEN = 5;
|
||||
|
||||
private LineageSystemSettingListPreference mQuickPulldown;
|
||||
|
||||
private PreferenceCategory mIconsCategory;
|
||||
private SystemSettingListPreference mBatteryPercent;
|
||||
private SystemSettingListPreference mBatteryStyle;
|
||||
private SystemSettingSwitchPreference mBatteryTextCharging;
|
||||
// private SystemSettingListPreference mBatteryPercent;
|
||||
// private SystemSettingListPreference mBatteryStyle;
|
||||
// private SystemSettingSwitchPreference mBatteryTextCharging;
|
||||
private SystemSettingSwitchPreference mBluetoothBatteryStatus;
|
||||
private SystemSettingSwitchPreference mColoredIcons;
|
||||
|
||||
@@ -81,9 +81,9 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
updateQuickPulldownSummary(mQuickPulldown.getIntValue(0));
|
||||
|
||||
mIconsCategory = (PreferenceCategory) findPreference(KEY_ICONS_CATEGORY);
|
||||
mBatteryStyle = (SystemSettingListPreference) findPreference(KEY_BATTERY_STYLE);
|
||||
mBatteryPercent = (SystemSettingListPreference) findPreference(KEY_BATTERY_PERCENT);
|
||||
mBatteryTextCharging = (SystemSettingSwitchPreference) findPreference(KEY_BATTERY_TEXT_CHARGING);
|
||||
// mBatteryStyle = (SystemSettingListPreference) findPreference(KEY_BATTERY_STYLE);
|
||||
// mBatteryPercent = (SystemSettingListPreference) findPreference(KEY_BATTERY_PERCENT);
|
||||
// mBatteryTextCharging = (SystemSettingSwitchPreference) findPreference(KEY_BATTERY_TEXT_CHARGING);
|
||||
mBluetoothBatteryStatus = (SystemSettingSwitchPreference) findPreference(KEY_BLUETOOTH_BATTERY_STATUS);
|
||||
mColoredIcons = (SystemSettingSwitchPreference) findPreference(KEY_COLORED_ICONS);
|
||||
mColoredIcons.setOnPreferenceChangeListener(this);
|
||||
@@ -93,19 +93,19 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
mQuickPulldown.setEntryValues(R.array.status_bar_quick_pull_down_values_rtl);
|
||||
}
|
||||
|
||||
int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
int batterypercent = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
|
||||
// int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
// Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
// int batterypercent = Settings.System.getIntForUser(resolver,
|
||||
// Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
|
||||
|
||||
mBatteryStyle.setOnPreferenceChangeListener(this);
|
||||
// mBatteryStyle.setOnPreferenceChangeListener(this);
|
||||
|
||||
mBatteryPercent.setEnabled(
|
||||
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||
mBatteryPercent.setOnPreferenceChangeListener(this);
|
||||
// mBatteryPercent.setEnabled(
|
||||
// batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||
// mBatteryPercent.setOnPreferenceChangeListener(this);
|
||||
|
||||
mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN ||
|
||||
(batterystyle != BATTERY_STYLE_TEXT && batterypercent != 2));
|
||||
// mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN ||
|
||||
// (batterystyle != BATTERY_STYLE_TEXT && batterypercent != 2));
|
||||
|
||||
if (!DeviceUtils.deviceSupportsBluetooth(context)) {
|
||||
mIconsCategory.removePreference(mBluetoothBatteryStatus);
|
||||
@@ -120,22 +120,22 @@ public class StatusBar extends SettingsPreferenceFragment implements
|
||||
int value = Integer.parseInt((String) newValue);
|
||||
updateQuickPulldownSummary(value);
|
||||
return true;
|
||||
} else if (preference == mBatteryStyle) {
|
||||
int value = Integer.parseInt((String) newValue);
|
||||
int batterypercent = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
|
||||
mBatteryPercent.setEnabled(
|
||||
value != BATTERY_STYLE_TEXT && value != BATTERY_STYLE_HIDDEN);
|
||||
mBatteryTextCharging.setEnabled(value == BATTERY_STYLE_HIDDEN ||
|
||||
(value != BATTERY_STYLE_TEXT && batterypercent != 2));
|
||||
return true;
|
||||
} else if (preference == mBatteryPercent) {
|
||||
int value = Integer.parseInt((String) newValue);
|
||||
int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN ||
|
||||
(batterystyle != BATTERY_STYLE_TEXT && value != 2));
|
||||
return true;
|
||||
// } else if (preference == mBatteryStyle) {
|
||||
// int value = Integer.parseInt((String) newValue);
|
||||
// int batterypercent = Settings.System.getIntForUser(resolver,
|
||||
// Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
|
||||
// mBatteryPercent.setEnabled(
|
||||
// value != BATTERY_STYLE_TEXT && value != BATTERY_STYLE_HIDDEN);
|
||||
// mBatteryTextCharging.setEnabled(value == BATTERY_STYLE_HIDDEN ||
|
||||
// (value != BATTERY_STYLE_TEXT && batterypercent != 2));
|
||||
// return true;
|
||||
// } else if (preference == mBatteryPercent) {
|
||||
// int value = Integer.parseInt((String) newValue);
|
||||
// int batterystyle = Settings.System.getIntForUser(resolver,
|
||||
// Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT);
|
||||
// mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN ||
|
||||
// (batterystyle != BATTERY_STYLE_TEXT && value != 2));
|
||||
// return true;
|
||||
} else if (preference == mColoredIcons) {
|
||||
SystemUtils.showSystemUiRestartDialog(context);
|
||||
return true;
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -79,6 +80,20 @@ public class Fonts extends SettingsPreferenceFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDivider(@Nullable final Drawable divider) {
|
||||
RecyclerView list = getListView();
|
||||
if (list == null) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.post(() -> setDivider(divider));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.setDivider(divider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2025 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import static com.android.internal.util.evolution.ThemeUtils.ICON_SHAPE_KEY;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.internal.util.evolution.ThemeUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class IconShapes extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "IconShapes";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ThemeUtils mThemeUtils;
|
||||
private final String mCategory = ICON_SHAPE_KEY;
|
||||
private List<String> mPkgs;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isAdded()) return;
|
||||
requireActivity().setTitle(R.string.theme_customization_icon_shape_title);
|
||||
mThemeUtils = new ThemeUtils(requireContext());
|
||||
mPkgs = mThemeUtils.getOverlayPackagesForCategory(mCategory, "android");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.item_view, container, false);
|
||||
mRecyclerView = view.findViewById(R.id.recycler_view);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3));
|
||||
mRecyclerView.setAdapter(new Adapter(requireContext(), mPkgs, mThemeUtils, mCategory, mRecyclerView));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
public static class Adapter extends RecyclerView.Adapter<Adapter.CustomViewHolder> {
|
||||
private final WeakReference<Context> contextRef;
|
||||
private final List<String> mPkgs;
|
||||
private final ThemeUtils mThemeUtils;
|
||||
private final String mCategory;
|
||||
private final RecyclerView mRecyclerView;
|
||||
private final String mAppliedPkg;
|
||||
private String mSelectedPkg;
|
||||
|
||||
public Adapter(Context context, List<String> pkgs, ThemeUtils themeUtils, String category, RecyclerView recyclerView) {
|
||||
this.contextRef = new WeakReference<>(context);
|
||||
this.mPkgs = pkgs;
|
||||
this.mThemeUtils = themeUtils;
|
||||
this.mCategory = category;
|
||||
this.mRecyclerView = recyclerView;
|
||||
|
||||
mAppliedPkg = mThemeUtils.getOverlayInfos(mCategory).stream()
|
||||
.filter(info -> info.isEnabled())
|
||||
.map(info -> info.packageName)
|
||||
.findFirst()
|
||||
.orElse("android");
|
||||
|
||||
mSelectedPkg = mAppliedPkg;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_option, parent, false);
|
||||
return new CustomViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CustomViewHolder holder, int position) {
|
||||
Context context = contextRef.get();
|
||||
if (context == null) return;
|
||||
|
||||
String pkg = mPkgs.get(position);
|
||||
Drawable drawable = mThemeUtils.createShapeDrawable(pkg);
|
||||
if (drawable != null) {
|
||||
holder.image.setBackground(drawable);
|
||||
}
|
||||
|
||||
String label = getLabel(context, pkg);
|
||||
holder.name.setText("android".equals(pkg) ? "Default" : label);
|
||||
|
||||
boolean isDefault = "android".equals(mAppliedPkg) && "android".equals(pkg);
|
||||
int color = ColorUtils.setAlphaComponent(
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.colorAccent),
|
||||
pkg.equals(mAppliedPkg) || isDefault ? 170 : 75);
|
||||
holder.image.setBackgroundTintList(ColorStateList.valueOf(color));
|
||||
|
||||
holder.itemView.findViewById(R.id.option_tile).setBackground(null);
|
||||
holder.itemView.setActivated(pkg.equals(mSelectedPkg));
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (!pkg.equals(mSelectedPkg)) {
|
||||
mSelectedPkg = pkg;
|
||||
mThemeUtils.setOverlayEnabled(mCategory, pkg, "android");
|
||||
}
|
||||
updateActivatedStatus();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPkgs.size();
|
||||
}
|
||||
|
||||
private void updateActivatedStatus() {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static class CustomViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView name;
|
||||
ImageView image;
|
||||
public CustomViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.option_label);
|
||||
image = itemView.findViewById(R.id.option_thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
private String getLabel(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
return pm.getApplicationInfo(pkg, 0).loadLabel(pm).toString();
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Label load failed for pkg: " + pkg, e);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,424 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import org.evolution.settings.preferences.colorpicker.ColorPickerPreference;
|
||||
import org.evolution.settings.preferences.CustomSeekBarPreference;
|
||||
|
||||
import java.lang.CharSequence;
|
||||
|
||||
import lineageos.providers.LineageSettings;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@SearchIndexable
|
||||
public class MonetSettings extends DashboardFragment implements
|
||||
OnPreferenceChangeListener {
|
||||
|
||||
private static final String TAG = "MonetSettings";
|
||||
private static final String OVERLAY_CATEGORY_ACCENT_COLOR =
|
||||
"android.theme.customization.accent_color";
|
||||
private static final String OVERLAY_CATEGORY_SYSTEM_PALETTE =
|
||||
"android.theme.customization.system_palette";
|
||||
private static final String OVERLAY_CATEGORY_THEME_STYLE =
|
||||
"android.theme.customization.theme_style";
|
||||
private static final String OVERLAY_CATEGORY_BG_COLOR =
|
||||
"android.theme.customization.bg_color";
|
||||
private static final String OVERLAY_COLOR_SOURCE =
|
||||
"android.theme.customization.color_source";
|
||||
private static final String OVERLAY_COLOR_BOTH =
|
||||
"android.theme.customization.color_both";
|
||||
private static final String OVERLAY_LUMINANCE_FACTOR =
|
||||
"android.theme.customization.luminance_factor";
|
||||
private static final String OVERLAY_CHROMA_FACTOR =
|
||||
"android.theme.customization.chroma_factor";
|
||||
private static final String OVERLAY_WHOLE_PALETTE =
|
||||
"android.theme.customization.whole_palette";
|
||||
private static final String OVERLAY_TINT_BACKGROUND =
|
||||
"android.theme.customization.tint_background";
|
||||
private static final String COLOR_SOURCE_PRESET = "preset";
|
||||
private static final String COLOR_SOURCE_HOME = "home_wallpaper";
|
||||
private static final String COLOR_SOURCE_LOCK = "lock_wallpaper";
|
||||
private static final String TIMESTAMP_FIELD = "_applied_timestamp";
|
||||
|
||||
private static final String PREF_THEME_STYLE = "theme_style";
|
||||
private static final String PREF_COLOR_SOURCE = "color_source";
|
||||
private static final String PREF_ACCENT_COLOR = "accent_color";
|
||||
private static final String PREF_ACCENT_BACKGROUND = "accent_background";
|
||||
private static final String PREF_BG_COLOR = "bg_color";
|
||||
private static final String PREF_LUMINANCE_FACTOR = "luminance_factor";
|
||||
private static final String PREF_CHROMA_FACTOR = "chroma_factor";
|
||||
private static final String PREF_WHOLE_PALETTE = "whole_palette";
|
||||
private static final String PREF_TINT_BACKGROUND = "tint_background";
|
||||
|
||||
private static final int DEFAULT_COLOR = 0xFF1b6ef3;
|
||||
|
||||
private ListPreference mThemeStylePref;
|
||||
private ListPreference mColorSourcePref;
|
||||
private ColorPickerPreference mAccentColorPref;
|
||||
private SwitchPreferenceCompat mAccentBackgroundPref;
|
||||
private ColorPickerPreference mBgColorPref;
|
||||
private CustomSeekBarPreference mLuminancePref;
|
||||
private CustomSeekBarPreference mChromaPref;
|
||||
private SwitchPreferenceCompat mWholePalettePref;
|
||||
private SwitchPreferenceCompat mTintBackgroundPref;
|
||||
|
||||
private int mAccentColorValue;
|
||||
private int mBgColorValue;
|
||||
|
||||
private SharedPreferences mSharedPreferences;
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.monet_engine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mThemeStylePref = findPreference(PREF_THEME_STYLE);
|
||||
mColorSourcePref = findPreference(PREF_COLOR_SOURCE);
|
||||
mAccentColorPref = findPreference(PREF_ACCENT_COLOR);
|
||||
mAccentBackgroundPref = findPreference(PREF_ACCENT_BACKGROUND);
|
||||
mBgColorPref = findPreference(PREF_BG_COLOR);
|
||||
mLuminancePref = findPreference(PREF_LUMINANCE_FACTOR);
|
||||
mChromaPref = findPreference(PREF_CHROMA_FACTOR);
|
||||
mWholePalettePref = findPreference(PREF_WHOLE_PALETTE);
|
||||
mTintBackgroundPref = findPreference(PREF_TINT_BACKGROUND);
|
||||
mSharedPreferences = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
|
||||
|
||||
updatePreferences();
|
||||
|
||||
mThemeStylePref.setOnPreferenceChangeListener(this);
|
||||
mColorSourcePref.setOnPreferenceChangeListener(this);
|
||||
mAccentColorPref.setOnPreferenceChangeListener(this);
|
||||
mAccentBackgroundPref.setOnPreferenceChangeListener(this);
|
||||
mBgColorPref.setOnPreferenceChangeListener(this);
|
||||
mLuminancePref.setOnPreferenceChangeListener(this);
|
||||
mChromaPref.setOnPreferenceChangeListener(this);
|
||||
mWholePalettePref.setOnPreferenceChangeListener(this);
|
||||
mTintBackgroundPref.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updatePreferences();
|
||||
}
|
||||
|
||||
private void updatePreferences() {
|
||||
final String overlayPackageJson = Settings.Secure.getStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
UserHandle.USER_CURRENT);
|
||||
if (overlayPackageJson != null && !overlayPackageJson.isEmpty()) {
|
||||
try {
|
||||
final JSONObject object = new JSONObject(overlayPackageJson);
|
||||
final String style = object.optString(OVERLAY_CATEGORY_THEME_STYLE, "TONAL_SPOT");
|
||||
final String source = object.optString(OVERLAY_COLOR_SOURCE, COLOR_SOURCE_HOME);
|
||||
String color;
|
||||
if (object.has(OVERLAY_CATEGORY_SYSTEM_PALETTE)) {
|
||||
color = object.optString(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
mAccentColorValue = ColorPickerPreference.convertToColorInt(color);
|
||||
} else {
|
||||
mAccentColorValue = mSharedPreferences.getInt(PREF_ACCENT_COLOR, DEFAULT_COLOR);
|
||||
color = ColorPickerPreference.convertToRGB(mAccentColorValue).replace("#", "");
|
||||
}
|
||||
boolean hasBGColor = object.has(OVERLAY_CATEGORY_BG_COLOR);
|
||||
mAccentBackgroundPref.setChecked(mSharedPreferences.getBoolean(PREF_ACCENT_BACKGROUND, hasBGColor));
|
||||
if (hasBGColor) {
|
||||
mBgColorValue = object.optInt(OVERLAY_CATEGORY_BG_COLOR);
|
||||
} else {
|
||||
mBgColorValue = mSharedPreferences.getInt(PREF_BG_COLOR, DEFAULT_COLOR);
|
||||
}
|
||||
boolean both;
|
||||
if (object.has(OVERLAY_COLOR_BOTH)) {
|
||||
both = object.optInt(OVERLAY_COLOR_BOTH) == 1;
|
||||
} else {
|
||||
both = false;
|
||||
}
|
||||
final boolean wholePalette = object.optInt(OVERLAY_WHOLE_PALETTE, 0) == 1;
|
||||
final boolean tintBG = object.optInt(OVERLAY_TINT_BACKGROUND, 0) == 1;
|
||||
final float lumin = (float) object.optDouble(OVERLAY_LUMINANCE_FACTOR, 1d);
|
||||
final float chroma = (float) object.optDouble(OVERLAY_CHROMA_FACTOR, 1d);
|
||||
// style handling
|
||||
boolean styleUpdated = false;
|
||||
if (style != null && !style.isEmpty()) {
|
||||
for (CharSequence value : mThemeStylePref.getEntryValues()) {
|
||||
if (value.toString().equals(style)) {
|
||||
styleUpdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (styleUpdated) {
|
||||
updateListByValue(mThemeStylePref, style);
|
||||
}
|
||||
}
|
||||
if (!styleUpdated) {
|
||||
updateListByValue(mThemeStylePref,
|
||||
mThemeStylePref.getEntryValues()[0].toString());
|
||||
}
|
||||
// color handling
|
||||
final String sourceVal = (source == null || source.isEmpty() ||
|
||||
(source.equals(COLOR_SOURCE_HOME) && both)) ? "both" : source;
|
||||
updateListByValue(mColorSourcePref, sourceVal);
|
||||
updateAccentEnablement(sourceVal);
|
||||
// Set preview color irrespective it is enabled
|
||||
if (color != null && !color.isEmpty()) {
|
||||
mAccentColorPref.setNewPreviewColor(mAccentColorValue);
|
||||
}
|
||||
mBgColorPref.setNewPreviewColor(mBgColorValue);
|
||||
// etc
|
||||
int luminV = 0;
|
||||
if (lumin > 1d) luminV = Math.round((lumin - 1f) * 100f);
|
||||
else if (lumin < 1d) luminV = -1 * Math.round((1f - lumin) * 100f);
|
||||
mLuminancePref.setValue(luminV);
|
||||
int chromaV = 0;
|
||||
if (chroma > 1d) chromaV = Math.round((chroma - 1f) * 100f);
|
||||
else if (chroma < 1d) chromaV = -1 * Math.round((1f - chroma) * 100f);
|
||||
mChromaPref.setValue(chromaV);
|
||||
mWholePalettePref.setChecked(wholePalette);
|
||||
mTintBackgroundPref.setChecked(tintBG);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
} else {
|
||||
// reflect default values in every preference
|
||||
mThemeStylePref.setValueIndex(0);
|
||||
mColorSourcePref.setValueIndex(0);
|
||||
mLuminancePref.setValue(0);
|
||||
mChromaPref.setValue(0);
|
||||
mAccentBackgroundPref.setChecked(false);
|
||||
mWholePalettePref.setChecked(false);
|
||||
mTintBackgroundPref.setChecked(false);
|
||||
updateAccentEnablement("both");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final ContentResolver resolver = getActivity().getContentResolver();
|
||||
if (preference == mThemeStylePref) {
|
||||
String value = (String) newValue;
|
||||
setStyleValue(value);
|
||||
updateListByValue(mThemeStylePref, value, false);
|
||||
return true;
|
||||
} else if (preference == mColorSourcePref) {
|
||||
String value = (String) newValue;
|
||||
setSourceValue(value);
|
||||
updateListByValue(mColorSourcePref, value, false);
|
||||
updateAccentEnablement(value);
|
||||
return true;
|
||||
} else if (preference == mAccentColorPref) {
|
||||
mAccentColorValue = (Integer) newValue;
|
||||
mSharedPreferences.edit().putInt(PREF_ACCENT_COLOR, mAccentColorValue).apply();
|
||||
setColorValue();
|
||||
return true;
|
||||
} else if (preference == mAccentBackgroundPref) {
|
||||
boolean value = (Boolean) newValue;
|
||||
mAccentBackgroundPref.setChecked(value);
|
||||
mSharedPreferences.edit().putBoolean(PREF_ACCENT_BACKGROUND, value).apply();
|
||||
setBgColorValue();
|
||||
return true;
|
||||
} else if (preference == mBgColorPref) {
|
||||
mBgColorValue = (Integer) newValue;
|
||||
mSharedPreferences.edit().putInt(PREF_BG_COLOR, mBgColorValue).apply();
|
||||
setBgColorValue();
|
||||
return true;
|
||||
} else if (preference == mLuminancePref) {
|
||||
int value = (Integer) newValue;
|
||||
setLuminanceValue(value);
|
||||
return true;
|
||||
} else if (preference == mChromaPref) {
|
||||
int value = (Integer) newValue;
|
||||
setChromaValue(value);
|
||||
return true;
|
||||
} else if (preference == mWholePalettePref) {
|
||||
boolean value = (Boolean) newValue;
|
||||
setWholePaletteValue(value);
|
||||
return true;
|
||||
} else if (preference == mTintBackgroundPref) {
|
||||
boolean value = (Boolean) newValue;
|
||||
setTintBackgroundValue(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateListByValue(ListPreference pref, String value) {
|
||||
updateListByValue(pref, value, true);
|
||||
}
|
||||
|
||||
private void updateListByValue(ListPreference pref, String value, boolean set) {
|
||||
if (set) pref.setValue(value);
|
||||
final int index = pref.findIndexOfValue(value);
|
||||
pref.setSummary(pref.getEntries()[index]);
|
||||
}
|
||||
|
||||
private void updateAccentEnablement(String source) {
|
||||
final boolean shouldEnable = source != null && source.equals(COLOR_SOURCE_PRESET);
|
||||
mAccentColorPref.setEnabled(shouldEnable);
|
||||
mAccentBackgroundPref.setEnabled(shouldEnable);
|
||||
setColorValue();
|
||||
setBgColorValue();
|
||||
}
|
||||
|
||||
private JSONObject getSettingsJson() throws JSONException {
|
||||
final String overlayPackageJson = Settings.Secure.getStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
UserHandle.USER_CURRENT);
|
||||
JSONObject object;
|
||||
if (overlayPackageJson == null || overlayPackageJson.isEmpty())
|
||||
return new JSONObject();
|
||||
return new JSONObject(overlayPackageJson);
|
||||
}
|
||||
|
||||
private void putSettingsJson(JSONObject object) {
|
||||
Settings.Secure.putStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
object.toString(), UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
private void setStyleValue(String style) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
object.putOpt(OVERLAY_CATEGORY_THEME_STYLE, style);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setSourceValue(String source) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (source.equals("both")) {
|
||||
object.putOpt(OVERLAY_COLOR_BOTH, 1);
|
||||
object.putOpt(OVERLAY_COLOR_SOURCE, COLOR_SOURCE_HOME);
|
||||
} else {
|
||||
object.remove(OVERLAY_COLOR_BOTH);
|
||||
object.putOpt(OVERLAY_COLOR_SOURCE, source);
|
||||
}
|
||||
object.putOpt(TIMESTAMP_FIELD, System.currentTimeMillis());
|
||||
if (!source.equals(COLOR_SOURCE_PRESET)) {
|
||||
object.remove(OVERLAY_CATEGORY_ACCENT_COLOR);
|
||||
object.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
}
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setColorValue() {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
|
||||
if (mColorSourcePref.getValue().equals(COLOR_SOURCE_PRESET)) {
|
||||
final String rgbColor = ColorPickerPreference.convertToRGB(mAccentColorValue).replace("#", "");
|
||||
object.putOpt(OVERLAY_CATEGORY_ACCENT_COLOR, rgbColor);
|
||||
object.putOpt(OVERLAY_CATEGORY_SYSTEM_PALETTE, rgbColor);
|
||||
} else {
|
||||
object.remove(OVERLAY_CATEGORY_ACCENT_COLOR);
|
||||
object.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
}
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setBgColorValue() {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (mColorSourcePref.getValue().equals(COLOR_SOURCE_PRESET) && mAccentBackgroundPref.isChecked()) {
|
||||
object.putOpt(OVERLAY_CATEGORY_BG_COLOR, mBgColorValue);
|
||||
} else {
|
||||
object.remove(OVERLAY_CATEGORY_BG_COLOR);
|
||||
}
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setLuminanceValue(int lumin) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (lumin == 0)
|
||||
object.remove(OVERLAY_LUMINANCE_FACTOR);
|
||||
else
|
||||
object.putOpt(OVERLAY_LUMINANCE_FACTOR, 1d + ((double) lumin / 100d));
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setChromaValue(int chroma) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (chroma == 0)
|
||||
object.remove(OVERLAY_CHROMA_FACTOR);
|
||||
else
|
||||
object.putOpt(OVERLAY_CHROMA_FACTOR, 1d + ((double) chroma / 100d));
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setWholePaletteValue(boolean whole) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (!whole) object.remove(OVERLAY_WHOLE_PALETTE);
|
||||
else object.putOpt(OVERLAY_WHOLE_PALETTE, 1);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setTintBackgroundValue(boolean tint) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (!tint) object.remove(OVERLAY_TINT_BACKGROUND);
|
||||
else object.putOpt(OVERLAY_TINT_BACKGROUND, 1);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.monet_engine);
|
||||
}
|
||||
@@ -105,6 +105,20 @@ public class NavigationBarIcons extends SettingsPreferenceFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDivider(@Nullable final Drawable divider) {
|
||||
RecyclerView list = getListView();
|
||||
if (list == null) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.post(() -> setDivider(divider));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.setDivider(divider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2025 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.internal.util.evolution.ThemeUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class SignalIcons extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "SignalIcons";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ThemeUtils mThemeUtils;
|
||||
private final String mCategory = "android.theme.customization.signal_icon";
|
||||
private List<String> mPkgs;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isAdded()) return;
|
||||
requireActivity().setTitle(R.string.theme_customization_signal_icon_title);
|
||||
mThemeUtils = new ThemeUtils(requireContext());
|
||||
mPkgs = mThemeUtils.getOverlayPackagesForCategory(mCategory, "android");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.item_view, container, false);
|
||||
mRecyclerView = view.findViewById(R.id.recycler_view);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3));
|
||||
mRecyclerView.setAdapter(new Adapter(requireContext(), mPkgs, mThemeUtils, mCategory, mRecyclerView));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
public static class Adapter extends RecyclerView.Adapter<Adapter.CustomViewHolder> {
|
||||
private final WeakReference<Context> contextRef;
|
||||
private final List<String> mPkgs;
|
||||
private final ThemeUtils mThemeUtils;
|
||||
private final String mCategory;
|
||||
private final RecyclerView mRecyclerView;
|
||||
private final String mAppliedPkg;
|
||||
private String mSelectedPkg;
|
||||
|
||||
public Adapter(Context context, List<String> pkgs, ThemeUtils themeUtils, String category, RecyclerView recyclerView) {
|
||||
this.contextRef = new WeakReference<>(context);
|
||||
this.mPkgs = pkgs;
|
||||
this.mThemeUtils = themeUtils;
|
||||
this.mCategory = category;
|
||||
this.mRecyclerView = recyclerView;
|
||||
|
||||
mAppliedPkg = mThemeUtils.getOverlayInfos(mCategory).stream()
|
||||
.filter(info -> info.isEnabled())
|
||||
.map(info -> info.packageName)
|
||||
.findFirst()
|
||||
.orElse("android");
|
||||
mSelectedPkg = mAppliedPkg;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.icon_option, parent, false);
|
||||
return new CustomViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CustomViewHolder holder, int position) {
|
||||
Context context = contextRef.get();
|
||||
if (context == null) return;
|
||||
|
||||
String pkg = mPkgs.get(position);
|
||||
holder.image1.setBackgroundDrawable(getDrawable(context, pkg, "ic_signal_cellular_0_5_bar"));
|
||||
holder.image2.setBackgroundDrawable(getDrawable(context, pkg, "ic_signal_cellular_1_5_bar"));
|
||||
holder.image3.setBackgroundDrawable(getDrawable(context, pkg, "ic_signal_cellular_3_5_bar"));
|
||||
holder.image4.setBackgroundDrawable(getDrawable(context, pkg, "ic_signal_cellular_5_5_bar"));
|
||||
|
||||
String label = getLabel(context, pkg);
|
||||
holder.name.setText("android".equals(pkg) ? "Default" : label);
|
||||
holder.itemView.setActivated(pkg.equals(mSelectedPkg));
|
||||
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (!pkg.equals(mSelectedPkg)) {
|
||||
String oldPkg = mSelectedPkg;
|
||||
mSelectedPkg = pkg;
|
||||
mThemeUtils.setOverlayEnabled(mCategory, pkg, "android");
|
||||
updateActivatedStatus(oldPkg);
|
||||
updateActivatedStatus(mSelectedPkg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPkgs.size();
|
||||
}
|
||||
|
||||
private void updateActivatedStatus(String pkg) {
|
||||
int index = mPkgs.indexOf(pkg);
|
||||
if (index >= 0) {
|
||||
notifyItemChanged(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView name;
|
||||
ImageView image1, image2, image3, image4;
|
||||
|
||||
public CustomViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.option_label);
|
||||
image1 = itemView.findViewById(R.id.image1);
|
||||
image2 = itemView.findViewById(R.id.image2);
|
||||
image3 = itemView.findViewById(R.id.image3);
|
||||
image4 = itemView.findViewById(R.id.image4);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDrawable(Context context, String pkg, String drawableName) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
Resources res = pkg.equals("android") ? Resources.getSystem() : pm.getResourcesForApplication(pkg);
|
||||
int resId = res.getIdentifier(drawableName, "drawable", pkg);
|
||||
if (resId != 0) {
|
||||
return res.getDrawable(resId, context.getTheme());
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Drawable load failed for pkg: " + pkg + ", name: " + drawableName, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getLabel(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
return pm.getApplicationInfo(pkg, 0).loadLabel(pm).toString();
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Label load failed for pkg: " + pkg, e);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2025 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.internal.util.evolution.ThemeUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SystemIcons extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "StatusbarIcons";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ThemeUtils mThemeUtils;
|
||||
private final String mCategory = "android.theme.customization.icon_pack.android";
|
||||
private List<String> mPkgs;
|
||||
|
||||
private final Map<String, String> overlayMap = new HashMap<>();
|
||||
{
|
||||
overlayMap.put("com.android.settings", "android.theme.customization.icon_pack.settings");
|
||||
overlayMap.put("com.android.systemui", "android.theme.customization.icon_pack.systemui");
|
||||
overlayMap.put("com.android.launcher3", "android.theme.customization.icon_pack.launcher");
|
||||
overlayMap.put("com.android.wallpaper", "android.theme.customization.icon_pack.themepicker");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isAdded()) return;
|
||||
requireActivity().setTitle(R.string.theme_customization_icon_pack_title);
|
||||
mThemeUtils = new ThemeUtils(requireContext());
|
||||
mPkgs = mThemeUtils.getOverlayPackagesForCategory(mCategory, "android");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.item_view, container, false);
|
||||
mRecyclerView = view.findViewById(R.id.recycler_view);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3));
|
||||
mRecyclerView.setAdapter(new Adapter(requireContext(), mPkgs, mThemeUtils, mCategory, overlayMap, mRecyclerView));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
public static class Adapter extends RecyclerView.Adapter<Adapter.CustomViewHolder> {
|
||||
private final WeakReference<Context> contextRef;
|
||||
private final List<String> mPkgs;
|
||||
private final ThemeUtils mThemeUtils;
|
||||
private final String mCategory;
|
||||
private final Map<String, String> overlayMap;
|
||||
private final RecyclerView mRecyclerView;
|
||||
private final String mAppliedPkg;
|
||||
private String mSelectedPkg;
|
||||
|
||||
public Adapter(Context context, List<String> pkgs, ThemeUtils themeUtils, String category,
|
||||
Map<String, String> overlayMap, RecyclerView recyclerView) {
|
||||
this.contextRef = new WeakReference<>(context);
|
||||
this.mPkgs = pkgs;
|
||||
this.mThemeUtils = themeUtils;
|
||||
this.mCategory = category;
|
||||
this.overlayMap = overlayMap;
|
||||
this.mRecyclerView = recyclerView;
|
||||
|
||||
mAppliedPkg = mThemeUtils.getOverlayInfos(mCategory).stream()
|
||||
.filter(info -> info.isEnabled())
|
||||
.map(info -> info.packageName)
|
||||
.findFirst()
|
||||
.orElse("android");
|
||||
mSelectedPkg = mAppliedPkg;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.icon_option, parent, false);
|
||||
return new CustomViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CustomViewHolder holder, int position) {
|
||||
Context context = contextRef.get();
|
||||
if (context == null) return;
|
||||
|
||||
String pkg = mPkgs.get(position);
|
||||
holder.image1.setBackgroundDrawable(getDrawable(context, pkg, "ic_wifi_signal_4"));
|
||||
holder.image2.setBackgroundDrawable(getDrawable(context, pkg, "ic_signal_cellular_4_4_bar"));
|
||||
holder.image3.setBackgroundDrawable(getDrawable(context, pkg, "ic_qs_airplane"));
|
||||
holder.image4.setBackgroundDrawable(getDrawable(context, pkg, "ic_qs_flashlight"));
|
||||
|
||||
String label = getLabel(context, pkg);
|
||||
holder.name.setText("android".equals(pkg) ? "Default" : label);
|
||||
holder.itemView.setActivated(pkg.equals(mSelectedPkg));
|
||||
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (!pkg.equals(mSelectedPkg)) {
|
||||
String oldPkg = mSelectedPkg;
|
||||
mSelectedPkg = pkg;
|
||||
applyOverlays(pkg);
|
||||
updateActivatedStatus(oldPkg);
|
||||
updateActivatedStatus(mSelectedPkg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void applyOverlays(String selectedPkg) {
|
||||
mThemeUtils.setOverlayEnabled(mCategory, selectedPkg, "android");
|
||||
String pattern = "android".equals(selectedPkg) ? "" : selectedPkg.split("\\.")[4];
|
||||
for (Map.Entry<String, String> entry : overlayMap.entrySet()) {
|
||||
String target = entry.getKey();
|
||||
String category = entry.getValue();
|
||||
if (pattern.isEmpty()) {
|
||||
mThemeUtils.setOverlayEnabled(category, "android", "android");
|
||||
} else {
|
||||
for (String pkg : mThemeUtils.getOverlayPackagesForCategory(category, target)) {
|
||||
if (pkg.contains(pattern)) {
|
||||
mThemeUtils.setOverlayEnabled(category, pkg, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPkgs.size();
|
||||
}
|
||||
|
||||
private void updateActivatedStatus(String pkg) {
|
||||
int index = mPkgs.indexOf(pkg);
|
||||
if (index >= 0) {
|
||||
notifyItemChanged(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView name;
|
||||
ImageView image1, image2, image3, image4;
|
||||
|
||||
public CustomViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.option_label);
|
||||
image1 = itemView.findViewById(R.id.image1);
|
||||
image2 = itemView.findViewById(R.id.image2);
|
||||
image3 = itemView.findViewById(R.id.image3);
|
||||
image4 = itemView.findViewById(R.id.image4);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDrawable(Context context, String pkg, String drawableName) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
Resources res = pkg.equals("android") ? Resources.getSystem() : pm.getResourcesForApplication(pkg);
|
||||
int resId = res.getIdentifier(drawableName, "drawable", pkg);
|
||||
if (resId != 0) {
|
||||
return res.getDrawable(resId, context.getTheme());
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Drawable load failed for pkg: " + pkg + ", name: " + drawableName, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getLabel(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
return pm.getApplicationInfo(pkg, 0).loadLabel(pm).toString();
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Label load failed for pkg: " + pkg, e);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
|
||||
import org.evolution.settings.preferences.GlobalSettingListPreference;
|
||||
import org.evolution.settings.preferences.SystemSettingListPreference;
|
||||
import org.evolution.settings.utils.DeviceUtils;
|
||||
import org.evolution.settings.utils.SystemUtils;
|
||||
|
||||
@SearchIndexable
|
||||
@@ -42,49 +41,18 @@ public class Themes extends SettingsPreferenceFragment implements
|
||||
private static final String KEY_LOCK_SOUND = "lock_sound";
|
||||
private static final String KEY_UNLOCK_SOUND = "unlock_sound";
|
||||
private static final String KEY_ICONS_CATEGORY = "themes_icons_category";
|
||||
private static final String KEY_SIGNAL_ICON = "android.theme.customization.signal_icon";
|
||||
private static final String KEY_UDFPS_ICON = "udfps_icon";
|
||||
private static final String KEY_ANIMATIONS_CATEGORY = "themes_animations_category";
|
||||
private static final String KEY_UDFPS_ANIMATION = "udfps_animation";
|
||||
private static final String KEY_PGB_STYLE = "progress_bar_style";
|
||||
private static final String KEY_NOTIFICATION_STYLE = "notification_style";
|
||||
private static final String KEY_POWERMENU_STYLE = "powermenu_style";
|
||||
private static final String KEY_LAUNCHER_CATEGORY = "themes_launcher_category";
|
||||
|
||||
private static final String[] POWERMENU_OVERLAYS = {
|
||||
"com.android.theme.powermenu.cyberpunk",
|
||||
"com.android.theme.powermenu.duoline",
|
||||
"com.android.theme.powermenu.fluid",
|
||||
"com.android.theme.powermenu.ios",
|
||||
"com.android.theme.powermenu.layers"
|
||||
};
|
||||
|
||||
private static final String[] NOTIF_OVERLAYS = {
|
||||
"com.android.theme.notification.cyberpunk",
|
||||
"com.android.theme.notification.duoline",
|
||||
"com.android.theme.notification.fluid",
|
||||
"com.android.theme.notification.ios",
|
||||
"com.android.theme.notification.layers"
|
||||
};
|
||||
|
||||
private static final String[] PROGRESS_BAR_OVERLAYS = {
|
||||
"com.android.theme.progressbar.blocky_thumb",
|
||||
"com.android.theme.progressbar.minimal_thumb",
|
||||
"com.android.theme.progressbar.outline_thumb",
|
||||
"com.android.theme.progressbar.shishu"
|
||||
};
|
||||
|
||||
private GlobalSettingListPreference mLockSound;
|
||||
private GlobalSettingListPreference mUnlockSound;
|
||||
private PreferenceCategory mLauncherCategory;
|
||||
private PreferenceCategory mIconsCategory;
|
||||
private Preference mSignalIcon;
|
||||
private Preference mUdfpsIcon;
|
||||
private PreferenceCategory mAnimationsCategory;
|
||||
private Preference mUdfpsAnimation;
|
||||
private SystemSettingListPreference mNotificationStylePref;
|
||||
private SystemSettingListPreference mPowerMenuStylePref;
|
||||
private SystemSettingListPreference mProgressBarPref;
|
||||
private ThemeUtils mThemeUtils;
|
||||
|
||||
@Override
|
||||
@@ -104,15 +72,10 @@ public class Themes extends SettingsPreferenceFragment implements
|
||||
mUnlockSound.setOnPreferenceChangeListener(this);
|
||||
mLauncherCategory = (PreferenceCategory) findPreference(KEY_LAUNCHER_CATEGORY);
|
||||
mIconsCategory = (PreferenceCategory) findPreference(KEY_ICONS_CATEGORY);
|
||||
mSignalIcon = (Preference) findPreference(KEY_SIGNAL_ICON);
|
||||
mUdfpsIcon = (Preference) findPreference(KEY_UDFPS_ICON);
|
||||
mAnimationsCategory = (PreferenceCategory) findPreference(KEY_ANIMATIONS_CATEGORY);
|
||||
mUdfpsAnimation = (Preference) findPreference(KEY_UDFPS_ANIMATION);
|
||||
|
||||
if (!DeviceUtils.deviceSupportsMobileData(context)) {
|
||||
mIconsCategory.removePreference(mSignalIcon);
|
||||
}
|
||||
|
||||
FingerprintManager fingerprintManager = (FingerprintManager)
|
||||
getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
|
||||
@@ -128,40 +91,11 @@ public class Themes extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
mProgressBarPref = findPreference(KEY_PGB_STYLE);
|
||||
mProgressBarPref.setOnPreferenceChangeListener(this);
|
||||
|
||||
mNotificationStylePref = findPreference(KEY_NOTIFICATION_STYLE);
|
||||
mNotificationStylePref.setOnPreferenceChangeListener(this);
|
||||
|
||||
mPowerMenuStylePref = findPreference(KEY_POWERMENU_STYLE);
|
||||
mPowerMenuStylePref.setOnPreferenceChangeListener(this);
|
||||
|
||||
if (!Utils.isPackageInstalled(context, "com.google.android.apps.nexuslauncher")) {
|
||||
prefScreen.removePreference(mLauncherCategory);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStyle(String key, String category, String target,
|
||||
int defaultValue, String[] overlayPackages, int style) {
|
||||
mThemeUtils.setOverlayEnabled(category, target, target);
|
||||
if (style > 0 && style <= overlayPackages.length) {
|
||||
mThemeUtils.setOverlayEnabled(category, overlayPackages[style - 1], target);
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePowermenuStyle(int style) {
|
||||
updateStyle(KEY_POWERMENU_STYLE, "android.theme.customization.powermenu", "com.android.systemui", 0, POWERMENU_OVERLAYS, style);
|
||||
}
|
||||
|
||||
private void updateNotifStyle(int style) {
|
||||
updateStyle(KEY_NOTIFICATION_STYLE, "android.theme.customization.notification", "com.android.systemui", 0, NOTIF_OVERLAYS, style);
|
||||
}
|
||||
|
||||
private void updateProgressBarStyle(int style) {
|
||||
updateStyle(KEY_PGB_STYLE, "android.theme.customization.progress_bar", "android", 0, PROGRESS_BAR_OVERLAYS, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final Context context = getContext();
|
||||
@@ -180,19 +114,6 @@ public class Themes extends SettingsPreferenceFragment implements
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (preference == mProgressBarPref) {
|
||||
int value2 = Integer.parseInt((String) newValue);
|
||||
updateProgressBarStyle(value2);
|
||||
return true;
|
||||
} else if (preference == mNotificationStylePref) {
|
||||
int value2 = Integer.parseInt((String) newValue);
|
||||
updateNotifStyle(value2);
|
||||
return true;
|
||||
} else if (preference == mPowerMenuStylePref) {
|
||||
int value2 = Integer.parseInt((String) newValue);
|
||||
updatePowermenuStyle(value2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,10 +133,6 @@ public class Themes extends SettingsPreferenceFragment implements
|
||||
FingerprintManager fingerprintManager = (FingerprintManager)
|
||||
context.getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
|
||||
if (!DeviceUtils.deviceSupportsMobileData(context)) {
|
||||
keys.add(KEY_SIGNAL_ICON);
|
||||
}
|
||||
|
||||
if (!Utils.isPackageInstalled(context, "com.google.android.apps.nexuslauncher")) {
|
||||
keys.add(KEY_LAUNCHER_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,20 @@ public class UdfpsAnimations extends SettingsPreferenceFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDivider(@Nullable final Drawable divider) {
|
||||
RecyclerView list = getListView();
|
||||
if (list == null) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.post(() -> setDivider(divider));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.setDivider(divider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
|
||||
@@ -110,6 +110,20 @@ public class UdfpsIcons extends SettingsPreferenceFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDivider(@Nullable final Drawable divider) {
|
||||
RecyclerView list = getListView();
|
||||
if (list == null) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.post(() -> setDivider(divider));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.setDivider(divider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 the risingOS 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.
|
||||
*/
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import org.evolution.settings.preferences.CustomSeekBarPreference;
|
||||
import org.evolution.settings.utils.SystemUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
public class Wallpaper extends SettingsPreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
|
||||
public static final String TAG = "Wallpaper";
|
||||
|
||||
private Preference mBlurWpPref;
|
||||
private Preference mBlurWpStylePref;
|
||||
private Preference mDimPref;
|
||||
private Preference mDimLvlPref;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.evolution_settings_wallpaper);
|
||||
mBlurWpPref = findPreference("persist.sys.wallpaper.blur_enabled");
|
||||
mBlurWpPref.setOnPreferenceChangeListener(this);
|
||||
mBlurWpStylePref = findPreference("persist.sys.wallpaper.blur_type");
|
||||
mBlurWpStylePref.setOnPreferenceChangeListener(this);
|
||||
mDimPref = findPreference("persist.sys.wallpaper.dim_enabled");
|
||||
mDimPref.setOnPreferenceChangeListener(this);
|
||||
mDimLvlPref = findPreference("persist.sys.wallpaper.dim_level");
|
||||
mDimLvlPref.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final Context context = getContext();
|
||||
if (preference == mBlurWpPref
|
||||
|| preference == mBlurWpStylePref
|
||||
|| preference == mDimPref
|
||||
|| preference == mDimLvlPref) {
|
||||
if (preference == mDimLvlPref) {
|
||||
android.os.SystemProperties.set("persist.sys.wallpaper.dim_level", newValue.toString());
|
||||
}
|
||||
SystemUtils.showSystemUiRestartDialog(context);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* For search
|
||||
*/
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.evolution_settings_wallpaper) {
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2025 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.fragments.themes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.internal.util.evolution.ThemeUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class WifiIcons extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "WifiIcons";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ThemeUtils mThemeUtils;
|
||||
private final String mCategory = "android.theme.customization.wifi_icon";
|
||||
private List<String> mPkgs;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isAdded()) return;
|
||||
requireActivity().setTitle(R.string.theme_customization_wifi_icon_title);
|
||||
mThemeUtils = new ThemeUtils(requireContext());
|
||||
mPkgs = mThemeUtils.getOverlayPackagesForCategory(mCategory, "android");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.item_view, container, false);
|
||||
mRecyclerView = view.findViewById(R.id.recycler_view);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3));
|
||||
mRecyclerView.setAdapter(new Adapter(requireContext(), mPkgs, mThemeUtils, mCategory, mRecyclerView));
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.EVOLVER;
|
||||
}
|
||||
|
||||
public static class Adapter extends RecyclerView.Adapter<Adapter.CustomViewHolder> {
|
||||
private final WeakReference<Context> contextRef;
|
||||
private final List<String> mPkgs;
|
||||
private final ThemeUtils mThemeUtils;
|
||||
private final String mCategory;
|
||||
private final RecyclerView mRecyclerView;
|
||||
private final String mAppliedPkg;
|
||||
private String mSelectedPkg;
|
||||
|
||||
public Adapter(Context context, List<String> pkgs, ThemeUtils themeUtils, String category, RecyclerView recyclerView) {
|
||||
this.contextRef = new WeakReference<>(context);
|
||||
this.mPkgs = pkgs;
|
||||
this.mThemeUtils = themeUtils;
|
||||
this.mCategory = category;
|
||||
this.mRecyclerView = recyclerView;
|
||||
|
||||
mAppliedPkg = mThemeUtils.getOverlayInfos(mCategory).stream()
|
||||
.filter(info -> info.isEnabled())
|
||||
.map(info -> info.packageName)
|
||||
.findFirst()
|
||||
.orElse("android");
|
||||
mSelectedPkg = mAppliedPkg;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CustomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.icon_option, parent, false);
|
||||
return new CustomViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CustomViewHolder holder, int position) {
|
||||
Context context = contextRef.get();
|
||||
if (context == null) return;
|
||||
|
||||
String pkg = mPkgs.get(position);
|
||||
|
||||
holder.image1.setBackgroundDrawable(getDrawable(context, pkg, "ic_wifi_signal_0"));
|
||||
holder.image2.setBackgroundDrawable(getDrawable(context, pkg, "ic_wifi_signal_2"));
|
||||
holder.image3.setBackgroundDrawable(getDrawable(context, pkg, "ic_wifi_signal_3"));
|
||||
holder.image4.setBackgroundDrawable(getDrawable(context, pkg, "ic_wifi_signal_4"));
|
||||
|
||||
String label = getLabel(context, pkg);
|
||||
holder.name.setText("android".equals(pkg) ? "Default" : label);
|
||||
holder.itemView.setActivated(pkg.equals(mSelectedPkg));
|
||||
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (!pkg.equals(mSelectedPkg)) {
|
||||
String oldPkg = mSelectedPkg;
|
||||
mSelectedPkg = pkg;
|
||||
mThemeUtils.setOverlayEnabled(mCategory, pkg, "android");
|
||||
updateActivatedStatus(oldPkg);
|
||||
updateActivatedStatus(mSelectedPkg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPkgs.size();
|
||||
}
|
||||
|
||||
private void updateActivatedStatus(String pkg) {
|
||||
int index = mPkgs.indexOf(pkg);
|
||||
if (index >= 0) {
|
||||
notifyItemChanged(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView name;
|
||||
ImageView image1, image2, image3, image4;
|
||||
|
||||
public CustomViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.option_label);
|
||||
image1 = itemView.findViewById(R.id.image1);
|
||||
image2 = itemView.findViewById(R.id.image2);
|
||||
image3 = itemView.findViewById(R.id.image3);
|
||||
image4 = itemView.findViewById(R.id.image4);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDrawable(Context context, String pkg, String drawableName) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
Resources res = pkg.equals("android") ? Resources.getSystem() : pm.getResourcesForApplication(pkg);
|
||||
int resId = res.getIdentifier(drawableName, "drawable", pkg);
|
||||
if (resId != 0) {
|
||||
return res.getDrawable(resId, context.getTheme());
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Drawable load failed for pkg: " + pkg + ", name: " + drawableName, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getLabel(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
return pm.getApplicationInfo(pkg, 0).loadLabel(pm).toString();
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Label load failed for pkg: " + pkg, e);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 The risingOS 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.
|
||||
*/
|
||||
|
||||
package org.evolution.settings.utils
|
||||
|
||||
import android.app.WallpaperManager
|
||||
import android.content.Context
|
||||
import android.graphics.RenderEffect
|
||||
import android.graphics.Shader
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
import androidx.core.content.res.use
|
||||
import com.android.settings.R
|
||||
|
||||
open class WallpaperView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ImageView(context, attrs, defStyleAttr) {
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var currentWallpaperDrawable: Drawable? = null
|
||||
private var isBlurred: Boolean = false
|
||||
|
||||
private val wallpaperChecker = object : Runnable {
|
||||
override fun run() {
|
||||
setWallpaperPreview()
|
||||
handler.postDelayed(this, 2000)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
context.theme.obtainStyledAttributes(attrs, R.styleable.WallpaperView, 0, 0).use {
|
||||
isBlurred = it.getBoolean(R.styleable.WallpaperView_blurred, false)
|
||||
}
|
||||
setWallpaperPreview()
|
||||
handler.postDelayed(wallpaperChecker, 2000)
|
||||
}
|
||||
|
||||
protected open fun updateWallpaper() {
|
||||
val wallpaperManager = WallpaperManager.getInstance(context)
|
||||
val wallpaperDrawable: Drawable? = wallpaperManager.drawable
|
||||
|
||||
if (wallpaperDrawable != currentWallpaperDrawable) {
|
||||
currentWallpaperDrawable = wallpaperDrawable
|
||||
wallpaperDrawable?.let {
|
||||
setImageDrawable(it)
|
||||
applyBlurEffect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun setWallpaperPreview() {
|
||||
updateWallpaper()
|
||||
}
|
||||
|
||||
private fun applyBlurEffect() {
|
||||
if (isBlurred) {
|
||||
val blurEffect = RenderEffect.createBlurEffect(100f, 100f, Shader.TileMode.MIRROR)
|
||||
setRenderEffect(blurEffect)
|
||||
} else {
|
||||
setRenderEffect(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
handler.removeCallbacks(wallpaperChecker)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user