Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aec42a08b3 |
@@ -797,4 +797,57 @@
|
|||||||
<item>11</item>
|
<item>11</item>
|
||||||
<item>12</item>
|
<item>12</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- KG Weather options -->
|
||||||
|
<string-array name="kg_launcher_weather_entries" translatable="false">
|
||||||
|
<item>@string/qs_weather_hidden</item>
|
||||||
|
<item>@string/qs_temperature_image_show_scale</item>
|
||||||
|
<item>@string/qs_temperature_image_hide_scale</item>
|
||||||
|
<item>@string/qs_temperature_show_scale_hide_image</item>
|
||||||
|
<item>@string/qs_temperature_hide_scale_hide_image</item>
|
||||||
|
<item>@string/qs_show_image</item>
|
||||||
|
<item>@string/weather_show_all_condition</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="kg_launcher_weather_values" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- QS Weather options -->
|
||||||
|
<string-array name="qs_weather_entries" translatable="false">
|
||||||
|
<item>@string/qs_weather_hidden</item>
|
||||||
|
<item>@string/qs_temperature_image_show_scale</item>
|
||||||
|
<item>@string/qs_temperature_image_hide_scale</item>
|
||||||
|
<item>@string/qs_temperature_show_scale_hide_image</item>
|
||||||
|
<item>@string/qs_temperature_hide_scale_hide_image</item>
|
||||||
|
<item>@string/qs_show_image</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="qs_weather_values" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</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>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -914,15 +914,33 @@
|
|||||||
<string name="laboratory_parallel_space_title">Parallel space</string>
|
<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>
|
<string name="laboratory_parallel_space_summary">Allow running multiple instances of the same application in parallel</string>
|
||||||
|
|
||||||
<!-- Weather -->
|
<!-- QS Weather Options -->
|
||||||
<string name="weather_settings_title">Weather settings</string>
|
<string name="qs_weather_title">QS System weather style</string>
|
||||||
<string name="weather_settings_summary">Setup icon pack and weather service</string>
|
<string name="qs_weather_summary">Configure system weather</string>
|
||||||
<string name="lockscreen_weather_title">Weather condition</string>
|
<string name="qsweather_dialog_title">QuickSettings weather location</string>
|
||||||
<string name="lockscreen_weather_summary">Display current weather condition and temperature</string>
|
<string name="qs_weather_hidden">Hide weather</string>
|
||||||
<string name="lockscreen_weather_enabled_info">Requires weather service to be enabled</string>
|
<string name="qs_temperature_image_show_scale">Show temp with scale and image</string>
|
||||||
<string name="lockscreen_weather_location_title">Weather location</string>
|
<string name="qs_temperature_image_hide_scale">Show temp with image without scale</string>
|
||||||
<string name="lockscreen_weather_location_summary">Display current weather location</string>
|
<string name="qs_temperature_show_scale_hide_image">Show temp with scale</string>
|
||||||
<string name="lockscreen_weather_style_title">Pixel style</string>
|
<string name="qs_temperature_hide_scale_hide_image">Show temp without scale</string>
|
||||||
<string name="lockscreen_weather_style_summary">Display weather as separate row</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>
|
||||||
|
|||||||
@@ -53,24 +53,6 @@
|
|||||||
android:title="@string/lockscreen_charging_info_title"
|
android:title="@string/lockscreen_charging_info_title"
|
||||||
android:summary="@string/lockscreen_charging_info_summary"
|
android:summary="@string/lockscreen_charging_info_summary"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
|
||||||
android:key="lockscreen_weather_enabled"
|
|
||||||
android:title="@string/lockscreen_weather_title"
|
|
||||||
android:summary="@string/lockscreen_weather_summary"/>
|
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
|
||||||
android:key="lockscreen_weather_location"
|
|
||||||
android:title="@string/lockscreen_weather_location_title"
|
|
||||||
android:summary="@string/lockscreen_weather_location_summary"
|
|
||||||
android:dependency="lockscreen_weather_enabled" />
|
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
|
||||||
android:key="lockscreen_weather_style"
|
|
||||||
android:title="@string/lockscreen_weather_style_title"
|
|
||||||
android:summary="@string/lockscreen_weather_style_summary"
|
|
||||||
android:dependency="lockscreen_weather_enabled" />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Udfps options -->
|
<!-- Udfps options -->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
android:title="@string/laboratory_ignore_window_secure_title"
|
android:title="@string/laboratory_ignore_window_secure_title"
|
||||||
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
|
||||||
@@ -58,16 +64,6 @@
|
|||||||
android:summary="@string/use_photos_spoof_summary"
|
android:summary="@string/use_photos_spoof_summary"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
|
||||||
<!-- Weather -->
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<!-- Parallel space -->
|
<!-- Parallel space -->
|
||||||
<Preference
|
<Preference
|
||||||
android:key="parallel_space"
|
android:key="parallel_space"
|
||||||
|
|||||||
60
res/xml/omnijaws_settings.xml
Normal file
60
res/xml/omnijaws_settings.xml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?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>
|
||||||
@@ -43,7 +43,6 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.internal.util.cherish.udfps.UdfpsUtils;
|
import com.android.internal.util.cherish.udfps.UdfpsUtils;
|
||||||
import com.android.internal.util.cherish.CherishUtils;
|
import com.android.internal.util.cherish.CherishUtils;
|
||||||
import com.android.internal.util.cherish.OmniJawsClient;
|
|
||||||
import com.cherish.settings.preferences.SystemSettingListPreference;
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||||
import com.cherish.settings.preferences.SecureSettingListPreference;
|
import com.cherish.settings.preferences.SecureSettingListPreference;
|
||||||
@@ -66,7 +65,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private static final String FINGERPRINT_SUCCESS_VIB = "fingerprint_success_vib";
|
private static final String FINGERPRINT_SUCCESS_VIB = "fingerprint_success_vib";
|
||||||
private static final String FINGERPRINT_ERROR_VIB = "fingerprint_error_vib";
|
private static final String FINGERPRINT_ERROR_VIB = "fingerprint_error_vib";
|
||||||
private static final String KEY_WEATHER = "lockscreen_weather_enabled";
|
|
||||||
|
|
||||||
private FingerprintManager mFingerprintManager;
|
private FingerprintManager mFingerprintManager;
|
||||||
private SwitchPreference mFingerprintSuccessVib;
|
private SwitchPreference mFingerprintSuccessVib;
|
||||||
@@ -74,8 +72,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
|
|
||||||
private ListPreference mLockClockStyles;
|
private ListPreference mLockClockStyles;
|
||||||
private OmniJawsClient mWeatherClient;
|
|
||||||
private Preference mWeather;
|
|
||||||
private PreferenceCategory mUdfpsCategory;
|
private PreferenceCategory mUdfpsCategory;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private ListPreference mTorchPowerButton;
|
private ListPreference mTorchPowerButton;
|
||||||
@@ -131,10 +127,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
prefSet.removePreference(mFingerprintSuccessVib);
|
prefSet.removePreference(mFingerprintSuccessVib);
|
||||||
prefSet.removePreference(mFingerprintErrorVib);
|
prefSet.removePreference(mFingerprintErrorVib);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mWeather = (Preference) findPreference(KEY_WEATHER);
|
@Override
|
||||||
mWeatherClient = new OmniJawsClient(getContext());
|
public void onResume() {
|
||||||
updateWeatherSettings();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
@@ -161,21 +158,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWeatherSettings() {
|
|
||||||
if (mWeatherClient == null || mWeather == null) return;
|
|
||||||
|
|
||||||
boolean weatherEnabled = mWeatherClient.isOmniJawsEnabled();
|
|
||||||
mWeather.setEnabled(weatherEnabled);
|
|
||||||
mWeather.setSummary(weatherEnabled ? R.string.lockscreen_weather_summary :
|
|
||||||
R.string.lockscreen_weather_enabled_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
updateWeatherSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||||
|
|||||||
189
src/com/cherish/settings/fragments/mics/OmniJawsSettings.java
Normal file
189
src/com/cherish/settings/fragments/mics/OmniJawsSettings.java
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user