17 Commits
test ... qpr3

Author SHA1 Message Date
aswin7469
47d8740bd5 Cherish:MonetSetting: Add monochromatic style
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-26 23:30:26 +07:00
Ido Ben-Hur
e0f2441316 Cherish: Allow choosing a custom background color seed [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-24 10:31:54 +07:00
Ido Ben-Hur
c811849ab5 SystemUI: monet: Allow a more granular control over shades [2/2]
Do that by letting the user control the luminance and chroma factors of accent / background colors
Use Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES as an existing medium to store choices

Also refactor the code here

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-24 10:31:46 +07:00
Ido Ben-Hur
70da7a554e Cherish: Add some native monet settings
Goal is to let users control monet engine more granularly
Generally all we can set solely by changing Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES
Adds the ability to choose the accent color source, a custom accent color and the theme style
Theme styles are generally available with a preview on ThemePicker but not with custom sources nor color

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-24 10:31:36 +07:00
minaripenguin
50fa51cd17 Cherish: Combined signal icons toggle [2/2]
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-24 00:40:46 +07:00
SuperDroidBond
c53f9af382 [SQUASHED] SystemUI: user selectable VoLTE/VoWifi Icons [2/2]
This reverts commit dc7f7b2ee5.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-24 00:40:37 +07:00
Ghosuto
458ef94a1d Cherish: Add more clock bg chip styles [2/2]
Change-Id: I4a5b19037b78f3353da8e46089781e993c378705
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 16:26:21 +07:00
minaripenguin
0b3a6a1cb0 Cherish: Statusbar clock background chip styles [2/2]
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 16:26:09 +07:00
adindotdev
dd524f9294 Cherish: Smart Pixels [2/2]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 16:25:23 +07:00
Hưng Phan
cac222a0b0 Cherish:Disable customization for QS now
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 11:35:40 +07:00
cjybyjk
44fe9b8f7e Cherish: add SystemPropertySwitchPreference
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:16:47 +07:00
Hưng Phan
02edf931db Cherish:Cleanup old applock
This reverts commit fc7a0c985e.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:16:39 +07:00
Tkiliay
bc3be39190 Add grus maintainer 2023-06-23 03:15:31 +07:00
DhRV00T
714b2e0abb add RMX3461 maintainer
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:15:31 +07:00
FrEeRuNnEr4EvEr
565d76f073 add Galaxy S10/ N10 series maintainer
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:15:31 +07:00
Hưng Phan
6e068591f5 Cherish:Nuke QS date and Resize QS
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:15:30 +07:00
Pranav Vashi
db8a7a8f95 Pulse: Implement pulse color based album art [2/2]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
2023-06-23 03:15:30 +07:00
11 changed files with 54 additions and 423 deletions

View File

@@ -184,7 +184,7 @@
</string-array> </string-array>
<!-- QS battery style --> <!-- QS battery style -->
<string-array name="qs_battery_style_entries" translatable="false"> <!-- <string-array name="qs_battery_style_entries" translatable="false">
<item>@string/qs_use_status_bar_battery_style</item> <item>@string/qs_use_status_bar_battery_style</item>
<item>@string/status_bar_battery_style_icon_portrait</item> <item>@string/status_bar_battery_style_icon_portrait</item>
<item>@string/status_bar_battery_style_icon_rlandscape</item> <item>@string/status_bar_battery_style_icon_rlandscape</item>
@@ -228,7 +228,7 @@
<item>9</item> <item>9</item>
<item>4</item> <item>4</item>
<item>5</item> <item>5</item>
</string-array> </string-array> -->
<!-- Quick Settings brightness slider --> <!-- Quick Settings brightness slider -->
<string-array name="qs_show_brightness_slider_entries" translatable="false"> <string-array name="qs_show_brightness_slider_entries" translatable="false">
@@ -727,44 +727,6 @@
<item>8</item> <item>8</item>
</string-array> </string-array>
<!-- Monet theme styles -->
<string-array name="theme_style_entries">
<item>@string/theme_style_tonal_spot</item>
<item>@string/theme_style_vibrant</item>
<item>@string/theme_style_expressive</item>
<item>@string/theme_style_spritz</item>
<item>@string/theme_style_rainbow</item>
<item>@string/theme_style_fruit_salad</item>
<item>@string/theme_style_muted</item>
<item>@string/theme_style_content</item>
</string-array>
<string-array name="theme_style_values" translatable="false">
<item>TONAL_SPOT</item>
<item>VIBRANT</item>
<item>EXPRESSIVE</item>
<item>SPRITZ</item>
<item>RAINBOW</item>
<item>FRUIT_SALAD</item>
<item>MUTED</item>
<item>CONTENT</item>
</string-array>
<!-- Monet color sources -->
<string-array name="color_source_entries">
<item>@string/color_source_both</item>
<item>@string/color_source_home</item>
<item>@string/color_source_lock</item>
<item>@string/color_source_preset</item>
</string-array>
<string-array name="color_source_values" translatable="false">
<item>both</item>
<item>home_wallpaper</item>
<item>lock_wallpaper</item>
<item>preset</item>
</string-array>
<!-- Status bar chip styles--> <!-- Status bar chip styles-->
<string-array name="statusbar_clock_chip_entries" translatable="false"> <string-array name="statusbar_clock_chip_entries" translatable="false">
<item>@string/disabled</item> <item>@string/disabled</item>
@@ -798,56 +760,43 @@
<item>12</item> <item>12</item>
</string-array> </string-array>
<!-- KG Weather options --> <!-- Monet theme styles -->
<string-array name="kg_launcher_weather_entries" translatable="false"> <string-array name="theme_style_entries">
<item>@string/qs_weather_hidden</item> <item>@string/theme_style_tonal_spot</item>
<item>@string/qs_temperature_image_show_scale</item> <item>@string/theme_style_vibrant</item>
<item>@string/qs_temperature_image_hide_scale</item> <item>@string/theme_style_expressive</item>
<item>@string/qs_temperature_show_scale_hide_image</item> <item>@string/theme_style_spritz</item>
<item>@string/qs_temperature_hide_scale_hide_image</item> <item>@string/theme_style_rainbow</item>
<item>@string/qs_show_image</item> <item>@string/theme_style_fruit_salad</item>
<item>@string/weather_show_all_condition</item> <item>@string/theme_style_muted</item>
<item>@string/theme_style_content</item>
<item>@string/theme_style_monochromatic</item>
</string-array> </string-array>
<string-array name="kg_launcher_weather_values" translatable="false"> <string-array name="theme_style_values" translatable="false">
<item>0</item> <item>TONAL_SPOT</item>
<item>1</item> <item>VIBRANT</item>
<item>2</item> <item>EXPRESSIVE</item>
<item>3</item> <item>SPRITZ</item>
<item>4</item> <item>RAINBOW</item>
<item>5</item> <item>FRUIT_SALAD</item>
<item>6</item> <item>MUTED</item>
<item>CONTENT</item>
<item>MONOCHROMATIC</item>
</string-array> </string-array>
<!-- QS Weather options --> <!-- Monet color sources -->
<string-array name="qs_weather_entries" translatable="false"> <string-array name="color_source_entries">
<item>@string/qs_weather_hidden</item> <item>@string/color_source_both</item>
<item>@string/qs_temperature_image_show_scale</item> <item>@string/color_source_home</item>
<item>@string/qs_temperature_image_hide_scale</item> <item>@string/color_source_lock</item>
<item>@string/qs_temperature_show_scale_hide_image</item> <item>@string/color_source_preset</item>
<item>@string/qs_temperature_hide_scale_hide_image</item>
<item>@string/qs_show_image</item>
</string-array> </string-array>
<string-array name="qs_weather_values" translatable="false"> <string-array name="color_source_values" translatable="false">
<item>0</item> <item>both</item>
<item>1</item> <item>home_wallpaper</item>
<item>2</item> <item>lock_wallpaper</item>
<item>3</item> <item>preset</item>
<item>4</item>
<item>5</item>
</string-array>
<!-- QS Weather positions -->
<string-array name="qsweather_position_entries" translatable="false">
<item>@string/qsweather_position_qqs</item>
<item>@string/qsweather_position_qsb</item>
<item>@string/qsweather_position_both</item>
</string-array>
<string-array name="qsweather_position_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array> </string-array>
</resources> </resources>

View File

@@ -102,6 +102,8 @@
<string name="santoni_maintainer">EvilAnsh</string> <string name="santoni_maintainer">EvilAnsh</string>
<string name="device_ysl">Xiaomi Redmi S2</string> <string name="device_ysl">Xiaomi Redmi S2</string>
<string name="ysl_maintainer">Iris</string> <string name="ysl_maintainer">Iris</string>
<string name="device_grus">Xiaomi Mi 9 SE</string>
<string name="grus_maintainer">Toyohama</string>
<!-- Realme Device maintainers --> <!-- Realme Device maintainers -->
<string name="device_RMX3461">Realme 9 SE 5g</string> <string name="device_RMX3461">Realme 9 SE 5g</string>

View File

@@ -252,13 +252,7 @@
<string name="lockscreen_albumart_filter_tint">Accent tinted</string> <string name="lockscreen_albumart_filter_tint">Accent tinted</string>
<string name="lockscreen_albumart_filter_blur">Blur</string> <string name="lockscreen_albumart_filter_blur">Blur</string>
<string name="lockscreen_albumart_filter_grayblur">Grayscale and blurred</string> <string name="lockscreen_albumart_filter_grayblur">Grayscale and blurred</string>
<!-- Media artwork -->
<string name="artwork_media_background_enable_blur_title">Blur media media notification artwork background</string>
<string name="artwork_media_background_blur_radius_title">Blur amount for media notification artwork</string>
<string name="media_artwork_fade_percent_title">Fade percent for media notification artwork</string>
<string name="lockscreen_albumart_filter_blur_radius_title">Blur amount for lockscreen media artwork</string> <string name="lockscreen_albumart_filter_blur_radius_title">Blur amount for lockscreen media artwork</string>
<string name="ls_media_artwork_fade_percent_title">Fade amount for lockscreen media artwork</string>
<!-- Show VoLTE icon on statusbar --> <!-- Show VoLTE icon on statusbar -->
<string name="volte_icon_style_title">Select VoLTE/HD Icon</string> <string name="volte_icon_style_title">Select VoLTE/HD Icon</string>
@@ -887,6 +881,7 @@
<string name="theme_style_fruit_salad">Fruit Salad</string> <string name="theme_style_fruit_salad">Fruit Salad</string>
<string name="theme_style_muted">Muted</string> <string name="theme_style_muted">Muted</string>
<string name="theme_style_content">Content</string> <string name="theme_style_content">Content</string>
<string name="theme_style_monochromatic">Monochromatic</string>
<string name="color_source_title">Color source</string> <string name="color_source_title">Color source</string>
<string name="color_source_both">Both (Default)</string> <string name="color_source_both">Both (Default)</string>
<string name="color_source_home">Home wallpaper</string> <string name="color_source_home">Home wallpaper</string>
@@ -905,42 +900,4 @@
<string name="tint_background_title">Tint Background</string> <string name="tint_background_title">Tint Background</string>
<string name="tint_background_summary">Make Luminance and Chroma selection affect background colors as well</string> <string name="tint_background_summary">Make Luminance and Chroma selection affect background colors as well</string>
<!-- QS Header -->
<string name="qs_header_image_title">QS Header Image</string>
<string name="qs_header_random_image_title">QS Header Random Image</string>
<string name="qs_header_random_image_summary">Enable random QS header image</string>
<!-- Parallel space -->
<string name="laboratory_parallel_space_title">Parallel space</string>
<string name="laboratory_parallel_space_summary">Allow running multiple instances of the same application in parallel</string>
<!-- QS Weather Options -->
<string name="qs_weather_title">QS System weather style</string>
<string name="qs_weather_summary">Configure system weather</string>
<string name="qsweather_dialog_title">QuickSettings weather location</string>
<string name="qs_weather_hidden">Hide weather</string>
<string name="qs_temperature_image_show_scale">Show temp with scale and image</string>
<string name="qs_temperature_image_hide_scale">Show temp with image without scale</string>
<string name="qs_temperature_show_scale_hide_image">Show temp with scale</string>
<string name="qs_temperature_hide_scale_hide_image">Show temp without scale</string>
<string name="qs_show_image">Show image</string>
<string name="weather_show_all_condition">Show temp with scale,image and weather condition</string>
<string name="qsweather_position_qqs">QuickSettings</string>
<string name="qsweather_position_qsb">QuickStatusbar</string>
<string name="qsweather_position_both">Both</string>
<string name="launcher_weather_title">Launcher System weather style</string>
<string name="kg_weather_title">Lockscreen System weather style</string>
<!-- Omni weather -->
<string name="qs_weather_settings_title">Weather Settings</string>
<string name="qs_weather_settings_summary">Setup icon pack and weather service</string>
<string name="weather_title">Weather Settings</string>
<string name="weather_config_title">Weather service</string>
<string name="weather_config_summary">System service settings</string>
<string name="weather_icon_pack_title">Condition icon pack</string>
<string name="weather_icon_pack_note">Note\u003a you can install new icon packs from play store by searching for \"Chronus icons\"</string>
<string name="weather_icon_pack_info_title">Tips\u003a \n\n1. Users can install new icon packs from play store by searching for \"Chronus icons\".\n\n2. Condition icon pack is used for weather icons on quick settings and sushi launcher at a glance.\n\n3. Long press the QuickSettings weather view/logo/temperature to access weather settings with ease.</string>
<string name="qsweather_settings_title">QuickSettings Weather</string>
<string name="qsweather_settings_summary">Setup quicksettings weather views</string>
</resources> </resources>

View File

@@ -353,6 +353,15 @@
android:data="https://t.me/bruh_its_your_brother" /> android:data="https://t.me/bruh_its_your_brother" />
</Preference> </Preference>
<Preference
android:title="@string/grus_maintainer"
android:summary="@string/device_grus"
android:icon="@drawable/ic_devs_phone" >
<intent
android:action="android.intent.action.VIEW"
android:data="https://t.me/Tkiliay" />
</Preference>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@@ -117,20 +117,11 @@
android:fragment="com.cherish.settings.fragments.sound.PulseSettings" /> android:fragment="com.cherish.settings.fragments.sound.PulseSettings" />
<com.cherish.settings.preferences.SystemSettingSeekBarPreference <com.cherish.settings.preferences.SystemSettingSeekBarPreference
android:key="ls_media_filter_blur_radius" android:key="ls_media_filter_blur_radius"
android:title="@string/lockscreen_albumart_filter_blur_radius_title" android:title="@string/lockscreen_albumart_filter_blur_radius_title"
android:dependency="lockscreen_media_metadata" android:defaultValue="10"
android:defaultValue="125" android:max="25"
android:max="125" settings:min="1" />
settings:min="2" />
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
android:key="ls_media_artwork_fade_percent"
android:title="@string/ls_media_artwork_fade_percent_title"
android:dependency="lockscreen_media_metadata"
android:defaultValue="30"
android:max="80"
settings:min="1" />
</PreferenceCategory> </PreferenceCategory>

View File

@@ -31,12 +31,6 @@
android:summary="@string/laboratory_ignore_window_secure_summary" android:summary="@string/laboratory_ignore_window_secure_summary"
android:defaultValue="false"/> android:defaultValue="false"/>
<Preference
android:key="omnijaws_settings"
android:title="@string/qs_weather_settings_title"
android:summary="@string/qs_weather_settings_summary"
android:fragment="com.cherish.settings.fragments.misc.OmniJawsSettings" />
<!-- Smart Charging --> <!-- Smart Charging -->
<Preference <Preference
android:key="smart_charging" android:key="smart_charging"
@@ -64,16 +58,6 @@
android:summary="@string/use_photos_spoof_summary" android:summary="@string/use_photos_spoof_summary"
android:defaultValue="true" /> android:defaultValue="true" />
<!-- Parallel space -->
<Preference
android:key="parallel_space"
android:title="@string/laboratory_parallel_space_title"
android:summary="@string/laboratory_parallel_space_summary">
<intent
android:targetPackage="ink.kscope.parallelspace"
android:targetClass="ink.kscope.parallelspace.MainActivity" />
</Preference>
<com.cherish.settings.preferences.SystemSettingSwitchPreference <com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="click_partial_screenshot" android:key="click_partial_screenshot"
android:title="@string/click_partial_screenshot_title" android:title="@string/click_partial_screenshot_title"

View File

@@ -81,14 +81,6 @@
android:key="qs_layout_category" android:key="qs_layout_category"
android:title="@string/qs_layout_category_title"> android:title="@string/qs_layout_category_title">
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
android:key="qs_header_image"
android:title="@string/qs_header_image_title"
android:defaultValue="0"
settings:interval="1"
android:max="74"
android:min="0" />
<Preference <Preference
android:key="qs_tile_layout" android:key="qs_tile_layout"
android:icon="@drawable/ic_qs_tile" android:icon="@drawable/ic_qs_tile"

View File

@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The OmniROM Project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="omnijaws_settings"
android:title="@string/weather_title">
<ListPreference
android:key="weather_icon_pack"
android:title="@string/weather_icon_pack_title"
android:persistent="false" />
<com.android.settingslib.widget.FooterPreference
android:title="@string/weather_icon_pack_info_title" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="kg_show_weather_temp"
android:title="@string/kg_weather_title"
android:dialogTitle="@string/kg_weather_title"
android:entries="@array/kg_launcher_weather_entries"
android:summary="%s"
android:entryValues="@array/kg_launcher_weather_values" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="qs_show_weather_temp"
android:title="@string/qs_weather_title"
android:dialogTitle="@string/qs_weather_title"
android:entries="@array/qs_weather_entries"
android:summary="%s"
android:entryValues="@array/qs_weather_values" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="qs_weather_position"
android:title="@string/qsweather_dialog_title"
android:dialogTitle="@string/qsweather_dialog_title"
android:entries="@array/qsweather_position_entries"
android:summary="%s"
android:entryValues="@array/qsweather_position_values" />
<Preference
android:title="@string/weather_config_title"
android:summary="@string/weather_config_summary">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="org.omnirom.omnijaws"
android:targetClass="org.omnirom.omnijaws.SettingsActivityService" />
</Preference>
</PreferenceScreen>

View File

@@ -46,7 +46,7 @@
</PreferenceCategory> </PreferenceCategory>
<!-- QS panel battery customizations --> <!-- QS panel battery customizations -->
<PreferenceCategory <!-- <PreferenceCategory
android:title="@string/qs_battery_category_title"> android:title="@string/qs_battery_category_title">
<com.cherish.settings.preferences.SystemSettingListPreference <com.cherish.settings.preferences.SystemSettingListPreference
@@ -63,6 +63,6 @@
android:entryValues="@array/status_bar_battery_percent_values" android:entryValues="@array/status_bar_battery_percent_values"
android:defaultValue="2" /> android:defaultValue="2" />
</PreferenceCategory> </PreferenceCategory> -->
</PreferenceScreen> </PreferenceScreen>

View File

@@ -109,10 +109,6 @@ public class StatusBarBattery extends SettingsPreferenceFragment
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT); Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
Settings.System.putIntForUser(resolver, Settings.System.putIntForUser(resolver,
Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, 1, UserHandle.USER_CURRENT); Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, 1, UserHandle.USER_CURRENT);
Settings.System.putIntForUser(resolver,
Settings.System.QS_BATTERY_STYLE, -1, UserHandle.USER_CURRENT);
Settings.System.putIntForUser(resolver,
Settings.System.QS_SHOW_BATTERY_PERCENT, 2, UserHandle.USER_CURRENT);
} }
@Override @Override

View File

@@ -1,189 +0,0 @@
/*
* Copyright (C) 2017 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cherish.settings.fragments.misc;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.util.Log;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.Indexable;
import java.util.List;
import java.util.ArrayList;
public class OmniJawsSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Indexable {
private static final String TAG = "OmniJawsSettings";
private static final String CATEGORY_WEATHER = "weather_category";
private static final String WEATHER_ICON_PACK = "weather_icon_pack";
private static final String DEFAULT_WEATHER_ICON_PACKAGE = "org.omnirom.omnijaws";
private static final String DEFAULT_WEATHER_ICON_PREFIX = "outline";
private static final String WEATHER_SERVICE_PACKAGE = "org.omnirom.omnijaws";
private static final String CHRONUS_ICON_PACK_INTENT = "com.dvtonder.chronus.ICON_PACK";
private PreferenceCategory mWeatherCategory;
private ListPreference mWeatherIconPack;
@Override
public int getMetricsCategory() {
return MetricsEvent.CHERISH_SETTINGS;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.omnijaws_settings);
final PreferenceScreen prefScreen = getPreferenceScreen();
mWeatherCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_WEATHER);
if (mWeatherCategory != null) {
prefScreen.removePreference(mWeatherCategory);
} else {
String settingHeaderPackage = Settings.System.getString(getContentResolver(),
Settings.System.OMNIJAWS_WEATHER_ICON_PACK);
if (settingHeaderPackage == null) {
settingHeaderPackage = DEFAULT_WEATHER_ICON_PACKAGE + "." + DEFAULT_WEATHER_ICON_PREFIX;
}
mWeatherIconPack = (ListPreference) findPreference(WEATHER_ICON_PACK);
List<String> entries = new ArrayList<String>();
List<String> values = new ArrayList<String>();
getAvailableWeatherIconPacks(entries, values);
mWeatherIconPack.setEntries(entries.toArray(new String[entries.size()]));
mWeatherIconPack.setEntryValues(values.toArray(new String[values.size()]));
int valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage);
if (valueIndex == -1) {
// no longer found
settingHeaderPackage = DEFAULT_WEATHER_ICON_PACKAGE + "." + DEFAULT_WEATHER_ICON_PREFIX;
Settings.System.putString(getContentResolver(),
Settings.System.OMNIJAWS_WEATHER_ICON_PACK, settingHeaderPackage);
valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage);
}
mWeatherIconPack.setValueIndex(valueIndex >= 0 ? valueIndex : 0);
mWeatherIconPack.setSummary(mWeatherIconPack.getEntry());
mWeatherIconPack.setOnPreferenceChangeListener(this);
}
}
public boolean onPreferenceChange(Preference preference, Object objValue) {
if (preference == mWeatherIconPack) {
String value = (String) objValue;
Settings.System.putString(getContentResolver(),
Settings.System.OMNIJAWS_WEATHER_ICON_PACK, value);
int valueIndex = mWeatherIconPack.findIndexOfValue(value);
mWeatherIconPack.setSummary(mWeatherIconPack.getEntries()[valueIndex]);
}
return true;
}
private void getAvailableWeatherIconPacks(List<String> entries, List<String> values) {
Intent i = new Intent();
PackageManager packageManager = getPackageManager();
i.setAction("org.omnirom.WeatherIconPack");
for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) {
String packageName = r.activityInfo.packageName;
if (packageName.equals(DEFAULT_WEATHER_ICON_PACKAGE)) {
values.add(0, r.activityInfo.name);
} else {
values.add(r.activityInfo.name);
}
String label = r.activityInfo.loadLabel(getPackageManager()).toString();
if (label == null) {
label = r.activityInfo.packageName;
}
if (packageName.equals(DEFAULT_WEATHER_ICON_PACKAGE)) {
entries.add(0, label);
} else {
entries.add(label);
}
}
i = new Intent(Intent.ACTION_MAIN);
i.addCategory(CHRONUS_ICON_PACK_INTENT);
for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) {
String packageName = r.activityInfo.packageName;
values.add(packageName + ".weather");
String label = r.activityInfo.loadLabel(getPackageManager()).toString();
if (label == null) {
label = r.activityInfo.packageName;
}
entries.add(label);
}
}
private boolean isOmniJawsEnabled() {
final Uri SETTINGS_URI
= Uri.parse("content://org.omnirom.omnijaws.provider/settings");
final String[] SETTINGS_PROJECTION = new String[] {
"enabled"
};
final Cursor c = getContentResolver().query(SETTINGS_URI, SETTINGS_PROJECTION,
null, null, null);
if (c != null) {
int count = c.getCount();
if (count == 1) {
c.moveToPosition(0);
boolean enabled = c.getInt(0) == 1;
return enabled;
}
}
return true;
}
public static final Indexable.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.omnijaws_settings;
result.add(sir);
return result;
}
@Override
public List<String> getNonIndexableKeys(Context context) {
ArrayList<String> result = new ArrayList<String>();
return result;
}
};
}