Remove weather

Revert "Lockscreen Colors: add back Weather color options [2/2]"

This reverts commit de292e0788.

Revert "Cherish:introduce WeatherView Bg Selection [2/2]"

This reverts commit 7f3e49bcd8.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>

Revert "Cherish:add WeatherView Alignment options [2/2]"

This reverts commit e9f1e46eb2.

Revert "LS Styles: add default values & summary for font preferences"

This reverts commit 60a7b23d9f.

Revert "Cherish:LS Weather Temp & City Fonts [2/2]"

This reverts commit a0bf7cbee1.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>

Revert "Cherish:Add switches for Weather Image as well"

This reverts commit afc4d880b1.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>

Revert "Weather: Add switches to show city/temp on lockscreen [2/2]"

This reverts commit e43f47cf7a.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>

Revert "Cherish:Add keyguard weather style (2/2)"

This reverts commit fd8b4b59fa.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>

Revert "Cherish:add back weather parts [3/3]"

This reverts commit 7287e081fc.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Hưng Phan
2021-01-29 19:31:19 +07:00
committed by Hung Phan
parent 56f93a0377
commit d5bfbf912c
9 changed files with 15 additions and 438 deletions

View File

@@ -1,7 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M19 18H6C3.79 18 2 16.21 2 14S3.79 10 6 10H6.71C7.37 7.69 9.5 6 12 6C15.04 6 17.5 8.46 17.5 11.5V12H19C20.66 12 22 13.34 22 15S20.66 18 19 18M19.35 10.03C18.67 6.59 15.64 4 12 4C9.11 4 6.6 5.64 5.35 8.03C2.34 8.36 0 10.9 0 14C0 17.31 2.69 20 6 20H19C21.76 20 24 17.76 24 15C24 12.36 21.95 10.22 19.35 10.03M10 17L6.5 13.5L7.91 12.08L10 14.17L14.59 9.59L16 11" />
</vector>

View File

@@ -1,7 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M12.74,5.47C15.1,6.5 16.35,9.03 15.92,11.46C17.19,12.56 18,14.19 18,16V16.17C18.31,16.06 18.65,16 19,16A3,3 0 0,1 22,19A3,3 0 0,1 19,22H6A4,4 0 0,1 2,18A4,4 0 0,1 6,14H6.27C5,12.45 4.6,10.24 5.5,8.26C6.72,5.5 9.97,4.24 12.74,5.47M11.93,7.3C10.16,6.5 8.09,7.31 7.31,9.07C6.85,10.09 6.93,11.22 7.41,12.13C8.5,10.83 10.16,10 12,10C12.7,10 13.38,10.12 14,10.34C13.94,9.06 13.18,7.86 11.93,7.3M13.55,3.64C13,3.4 12.45,3.23 11.88,3.12L14.37,1.82L15.27,4.71C14.76,4.29 14.19,3.93 13.55,3.64M6.09,4.44C5.6,4.79 5.17,5.19 4.8,5.63L4.91,2.82L7.87,3.5C7.25,3.71 6.65,4.03 6.09,4.44M18,9.71C17.91,9.12 17.78,8.55 17.59,8L19.97,9.5L17.92,11.73C18.03,11.08 18.05,10.4 18,9.71M3.04,11.3C3.11,11.9 3.24,12.47 3.43,13L1.06,11.5L3.1,9.28C3,9.93 2.97,10.61 3.04,11.3M19,18H16V16A4,4 0 0,0 12,12A4,4 0 0,0 8,16H6A2,2 0 0,0 4,18A2,2 0 0,0 6,20H19A1,1 0 0,0 20,19A1,1 0 0,0 19,18Z" />
</vector>

View File

@@ -448,15 +448,6 @@
<item>2</item>
</string-array>
<string-array name="lockscreen_weather_style_entries">
<item>@string/lockscreen_weather_omni_style_title</item>
<item>@string/lockscreen_weather_pixel_style_title</item>
</string-array>
<string-array name="lockscreen_weather_style_values" translatable="false">
<item>0</item>
<item>1</item>
</string-array>
<!-- Toast Animation -->
<string-array name="toast_animation_entries">
<item>@string/toast_none_animation</item>
@@ -921,31 +912,6 @@
<item>34</item>
<item>35</item>
</string-array>
<!-- Lockscreen Weather styles -->
<string-array name="lockscreen_weather_bg_entries" translatable="false">
<item>@string/lockscreen_date_selection_default</item>
<item>@string/lockscreen_date_selection_str_box</item>
<item>@string/lockscreen_date_selection_str_round</item>
<item>@string/lockscreen_date_selection_qbeta_style</item>
<item>@string/lockscreen_date_selection_str_accent</item>
<item>@string/lockscreen_date_selection_str_accent_transparent</item>
<item>@string/lockscreen_date_selection_str_gradient</item>
<item>@string/lockscreen_date_selection_str_border_accent</item>
<item>@string/lockscreen_date_selection_str_border_gradient</item>
</string-array>
<string-array name="lockscreen_weather_bg_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
</string-array>
<!-- QS Header data uasge -->
<string-array name="qs_datausage_entries" translatable="false">

View File

@@ -485,8 +485,6 @@
<string name="lock_item_center">Center Aligned</string>
<string name="lock_item_right">Right Aligned</string>
<string name="lockscreen_item_padding_title">Lockscreen Items Padding</string>
<string name="lockscreen_weather_alignment_title">LS Weather Alignment</string>
<string name="lockscreen_weather_selection_title">WeatherView Background Style</string>
<!-- Data disabled icon -->
<string name="data_disabled_icon_title">Data disabled icon</string>
@@ -513,25 +511,6 @@
<string name="lockscreen_hide_shortcuts_title">Hide Bottom Shortcuts</string>
<string name="lockscreen_hide_shortcuts_summary">Hide Left-Right Shortcuts on secure lock screens</string>
<!-- Lockscreen weather -->
<string name="lockscreen_weather_category">Weather</string>
<string name="lockscreen_weather_enabled_title">Show on lockscreen</string>
<string name="lockscreen_weather_enabled_summary">Show weather information on lockscreen and during doze</string>
<string name="lockscreen_weather_settings_title">Setup weather options</string>
<string name="lockscreen_weather_settings_summary">Setup icon pack and weather service</string>
<string name="weather_config_title">Weather service</string>
<string name="weather_config_summary">System service settings</string>
<string name="header_weather_title">Header view weather</string>
<string name="header_weather_summary">Enable notification panel header weather display</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">Condition icon pack is used in quick settings and lock screen</string>
<!-- Lockscreen weather style -->
<string name="lockscreen_weather_style_title">Weather style</string>
<string name="lockscreen_weather_omni_style_title">Omni style</string>
<string name="lockscreen_weather_pixel_style_title">Pixel style</string>
<!-- AOKP custom system animations -->
<string name="animation_settings_title">Animations</string>
<string name="animation_settings_summary">System Wide Animation Options</string>
@@ -827,22 +806,6 @@
<string name="pixel_navbar_anim_title">Pixel animation</string>
<string name="pixel_navbar_anim_summary">Toggle home button animation</string>
<!-- LockWeather Switches -->
<string name="lockscreen_weather_show_city_title">Show city name</string>
<string name="lockscreen_weather_show_city_summary">Show name of current city on left of image</string>
<string name="lockscreen_weather_show_temp_title">Show temperature</string>
<string name="lockscreen_weather_show_temp_summary">Show current city temperature on right of image</string>
<string name="lockscreen_weather_show_image_title">Show Condition Image</string>
<string name="lockscreen_weather_show_image_summary">Show weather conditions image</string>
<!-- LS Weather Temp & City Fonts -->
<string name="lock_weather_temp_font_title">LS Weather Temp font</string>
<string name="lock_weather_temp_font_summary">Change the default font of the lockscreen weather temp</string>
<string name="lock_weather_temp_font_dialog_title">Select lock weather temp font</string>
<string name="lock_weather_city_font_title">LS Weather City font</string>
<string name="lock_weather_city_font_summary">Change the default font of the lockscreen weather city</string>
<string name="lock_weather_city_dialog_title">Select lock weather city font</string>
<!-- QS Footer Text -->
<string name="qs_footer_text_title">QS footer text</string>
<string name="qs_footer_text_summary">Display text at bottom of QS panel</string>

View File

@@ -199,15 +199,6 @@
android:summary="%s"
android:defaultValue="1" />
<com.cherish.settings.preferences.SecureSettingListPreference
android:key="lockscreen_weather_alignment"
android:title="@string/lockscreen_weather_alignment_title"
android:dialogTitle="@string/lockscreen_weather_alignment_title"
android:entries="@array/lockscreen_item_alignment_entries"
android:entryValues="@array/lockscreen_item_alignment_values"
android:summary="%s"
android:defaultValue="1" />
<com.cherish.settings.preferences.SecureSettingListPreference
android:key="lock_ownerinfo_alignment"
android:title="@string/lockscreen_ownerinfo_alignment_title"
@@ -239,34 +230,6 @@
android:title="@string/lockscreen_hide_shortcuts_title"
android:summary="@string/lockscreen_hide_shortcuts_summary"
android:defaultValue="false" />
<PreferenceCategory
android:key="lockscreen_weather"
android:title="@string/lockscreen_weather_category" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="lockscreen_weather_enabled"
android:icon="@drawable/ic_cloud"
android:title="@string/lockscreen_weather_enabled_title"
android:summary="@string/lockscreen_weather_enabled_summary"
android:defaultValue="false" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="lockscreen_weather_style"
android:title="@string/lockscreen_weather_style_title"
android:dialogTitle="@string/lockscreen_weather_style_title"
android:entries="@array/lockscreen_weather_style_entries"
android:entryValues="@array/lockscreen_weather_style_values"
android:defaultValue="0"
android:dependency="lockscreen_weather_enabled"
android:summary="%s" />
<Preference
android:key="omnijaws_settings"
android:icon="@drawable/ic_weather"
android:title="@string/lockscreen_weather_settings_title"
android:summary="@string/lockscreen_weather_settings_summary"
android:fragment="com.cherish.settings.fragments.OmniJawsSettings" />
<!-- Lockscreen Visualizer-->
<PreferenceCategory

View File

@@ -48,7 +48,7 @@
android:key="lockscreen_indication_text_color"
android:title="@string/lockscreen_indication_text_color"
android:defaultValue="0xffffffff" />
<!--
<net.margaritov.preference.colorpicker.ColorPickerPreference
android:key="lockscreen_weather_temp_color"
android:title="@string/lockscreen_weather_temp_color"
@@ -63,7 +63,7 @@
android:key="lockscreen_weather_icon_color"
android:title="@string/lockscreen_weather_icon_color"
android:defaultValue="0xffffffff" />
-->
</PreferenceScreen>

View File

@@ -1,86 +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">
<PreferenceScreen
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" />
</PreferenceScreen>
<ListPreference
android:key="weather_icon_pack"
android:title="@string/weather_icon_pack_title"
android:persistent="false" />
<Preference
android:icon="@drawable/ic_info_outline_24dp"
android:persistent="false"
android:summary="@string/weather_icon_pack_info_title" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="lockscreen_weather_show_image"
android:title="@string/lockscreen_weather_show_image_title"
android:summary="@string/lockscreen_weather_show_image_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="lockscreen_weather_show_city"
android:title="@string/lockscreen_weather_show_city_title"
android:summary="@string/lockscreen_weather_show_city_summary"
android:defaultValue="true" />
<ListPreference
android:key="lock_weather_city_fonts"
android:title="@string/lock_weather_city_font_title"
android:dialogTitle="@string/lock_weather_city_dialog_title"
android:entries="@array/sb_clock_fonts_entries"
android:entryValues="@array/sb_clock_fonts_values"
android:summary="@string/lock_weather_city_font_summary"
android:dependency="lockscreen_weather_show_city"
android:persistent="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="lockscreen_weather_show_temp"
android:title="@string/lockscreen_weather_show_temp_title"
android:summary="@string/lockscreen_weather_show_temp_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingListPreference
android:key="lockscreen_weather_selection"
android:title="@string/lockscreen_weather_selection_title"
android:dialogTitle="@string/lockscreen_weather_selection_title"
android:entries="@array/lockscreen_weather_bg_entries"
android:entryValues="@array/lockscreen_weather_bg_values"
android:summary="%s"
android:defaultValue="0" />
<ListPreference
android:key="lock_weather_temp_fonts"
android:title="@string/lock_weather_temp_font_title"
android:dialogTitle="@string/lock_weather_temp_font_dialog_title"
android:entries="@array/sb_clock_fonts_entries"
android:entryValues="@array/sb_clock_fonts_values"
android:summary="@string/lock_weather_temp_font_summary"
android:dependency="lockscreen_weather_show_temp"
android:persistent="false" />
</PreferenceScreen>

View File

@@ -54,9 +54,9 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
private static final String LOCKSCREEN_CLOCK_COLOR = "lockscreen_clock_color";
private static final String LOCKSCREEN_CLOCK_DATE_COLOR = "lockscreen_clock_date_color";
private static final String LOCKSCREEN_OWNER_INFO_COLOR = "lockscreen_owner_info_color";
private static final String LOCKSCREEN_WEATHER_TEMP_COLOR = "lockscreen_weather_temp_color";
/* private static final String LOCKSCREEN_WEATHER_TEMP_COLOR = "lockscreen_weather_temp_color";
private static final String LOCKSCREEN_WEATHER_CITY_COLOR = "lockscreen_weather_city_color";
private static final String LOCKSCREEN_WEATHER_ICON_COLOR = "lockscreen_weather_icon_color";
private static final String LOCKSCREEN_WEATHER_ICON_COLOR = "lockscreen_weather_icon_color";*/
static final int DEFAULT = 0xffffffff;
static final int TRANSPARENT = 0x99FFFFFF;
@@ -69,9 +69,9 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
private ColorPickerPreference mLockscreenClockColorPicker;
private ColorPickerPreference mLockscreenClockDateColorPicker;
private ColorPickerPreference mLockscreenOwnerInfoColorPicker;
private ColorPickerPreference mWeatherRightTextColorPicker;
/*private ColorPickerPreference mWeatherRightTextColorPicker;
private ColorPickerPreference mWeatherLeftTextColorPicker;
private ColorPickerPreference mWeatherIconColorPicker;
private ColorPickerPreference mWeatherIconColorPicker;*/
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -132,7 +132,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
hexColor = String.format("#%08x", (0xffffffff & intColor));
mLockscreenOwnerInfoColorPicker.setSummary(hexColor);
mLockscreenOwnerInfoColorPicker.setNewPreviewColor(intColor);
/*
mWeatherRightTextColorPicker = (ColorPickerPreference) findPreference(LOCKSCREEN_WEATHER_TEMP_COLOR);
mWeatherRightTextColorPicker.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(),
@@ -156,7 +156,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
hexColor = String.format("#%08x", (0x99FFFFFF & intColor));
mWeatherIconColorPicker.setSummary(hexColor);
mWeatherIconColorPicker.setNewPreviewColor(intColor);
*/
setHasOptionsMenu(true);
}
@@ -210,7 +210,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(),
Settings.System.LOCKSCREEN_OWNER_INFO_COLOR, intHex);
return true;
} else if (preference == mWeatherRightTextColorPicker) {
/* } else if (preference == mWeatherRightTextColorPicker) {
String hex = ColorPickerPreference.convertToARGB(
Integer.valueOf(String.valueOf(newValue)));
preference.setSummary(hex);
@@ -233,7 +233,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
int intHex = ColorPickerPreference.convertToColorInt(hex);
Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(),
Settings.System.LOCK_SCREEN_WEATHER_ICON_COLOR, intHex);
return true;
return true;*/
}
return false;
}
@@ -295,7 +295,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
Settings.System.LOCKSCREEN_OWNER_INFO_COLOR, DEFAULT);
mLockscreenOwnerInfoColorPicker.setNewPreviewColor(DEFAULT);
mLockscreenOwnerInfoColorPicker.setSummary(R.string.default_string);
Settings.System.putInt(getContentResolver(),
/*Settings.System.putInt(getContentResolver(),
Settings.System.LOCK_SCREEN_WEATHER_TEMP_COLOR, DEFAULT);
mWeatherRightTextColorPicker.setNewPreviewColor(DEFAULT);
mWeatherRightTextColorPicker.setSummary(R.string.default_string);
@@ -306,7 +306,7 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
Settings.System.putInt(getContentResolver(),
Settings.System.LOCK_SCREEN_WEATHER_ICON_COLOR, DEFAULT);
mWeatherIconColorPicker.setNewPreviewColor(DEFAULT);
mWeatherIconColorPicker.setSummary(R.string.default_string);
mWeatherIconColorPicker.setSummary(R.string.default_string);*/
}
@Override
@@ -319,3 +319,6 @@ public class LockColors extends SettingsPreferenceFragment implements Preference
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
}
}

View File

@@ -1,218 +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;
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.SearchIndexable;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
@SearchIndexable
public class OmniJawsSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
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 static final String LOCK_WEATHER_TEMP_FONTS = "lock_weather_temp_fonts";
private static final String LOCK_WEATHER_CITY_FONTS = "lock_weather_city_fonts";
private PreferenceCategory mWeatherCategory;
private ListPreference mWeatherIconPack;
ListPreference mLockTempFonts;
ListPreference mLockCityFonts;
@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);
}
// Lockscren Weather Temp Fonts
mLockTempFonts = (ListPreference) findPreference(LOCK_WEATHER_TEMP_FONTS);
mLockTempFonts.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.LOCK_WEATHER_TEMP_FONTS, 27)));
mLockTempFonts.setSummary(mLockTempFonts.getEntry());
mLockTempFonts.setOnPreferenceChangeListener(this);
// Lockscren Weather City Fonts
mLockCityFonts = (ListPreference) findPreference(LOCK_WEATHER_CITY_FONTS);
mLockCityFonts.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.LOCK_WEATHER_CITY_FONTS, 27)));
mLockCityFonts.setSummary(mLockCityFonts.getEntry());
mLockCityFonts.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;
} else if (preference == mLockTempFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_WEATHER_TEMP_FONTS,
Integer.valueOf((String) objValue));
mLockTempFonts.setValue(String.valueOf(objValue));
mLockTempFonts.setSummary(mLockTempFonts.getEntry());
return true;
} else if (preference == mLockCityFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_WEATHER_CITY_FONTS,
Integer.valueOf((String) objValue));
mLockCityFonts.setValue(String.valueOf(objValue));
mLockCityFonts.setSummary(mLockCityFonts.getEntry());
return true;
}
return false;
}
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 SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.omnijaws_settings;
return Arrays.asList(sir);
}
@Override
public List<String> getNonIndexableKeys(Context context) {
ArrayList<String> result = new ArrayList<String>();
return result;
}
};
}