diff --git a/res/drawable/ic_cloud.xml b/res/drawable/ic_cloud.xml
new file mode 100644
index 0000000..2141470
--- /dev/null
+++ b/res/drawable/ic_cloud.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_weather.xml b/res/drawable/ic_weather.xml
new file mode 100644
index 0000000..1654261
--- /dev/null
+++ b/res/drawable/ic_weather.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml
index 39df830..cb5cbcd 100644
--- a/res/values/cherish_strings.xml
+++ b/res/values/cherish_strings.xml
@@ -523,4 +523,18 @@
Hide Bottom Shortcuts
Hide Left-Right Shortcuts on secure lock screens
+
+
+ Weather
+ Show on lockscreen
+ Show weather information on lockscreen and during doze
+ Setup weather options
+ Setup icon pack and weather service
+ Weather service
+ System service settings
+ Header view weather
+ Enable notification panel header weather display
+ Condition icon pack
+ Note\u003a you can install new icon packs from play store by searching for \"Chronus icons\"
+ Condition icon pack is used in quick settings and lock screen
diff --git a/res/xml/cherish_settings_lockscreen.xml b/res/xml/cherish_settings_lockscreen.xml
index e064e1b..cfc823c 100644
--- a/res/xml/cherish_settings_lockscreen.xml
+++ b/res/xml/cherish_settings_lockscreen.xml
@@ -195,6 +195,24 @@
android:title="@string/lockscreen_hide_shortcuts_title"
android:summary="@string/lockscreen_hide_shortcuts_summary"
android:defaultValue="false" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/com/cherish/settings/preferences/fragments/OmniJawsSettings.java b/src/com/cherish/settings/preferences/fragments/OmniJawsSettings.java
new file mode 100644
index 0000000..57b0f88
--- /dev/null
+++ b/src/com/cherish/settings/preferences/fragments/OmniJawsSettings.java
@@ -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 .
+ *
+*/
+
+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.settings.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 entries = new ArrayList();
+ List values = new ArrayList();
+ 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 entries, List 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 getXmlResourcesToIndex(Context context,
+ boolean enabled) {
+ ArrayList result =
+ new ArrayList();
+
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.omnijaws_settings;
+ result.add(sir);
+
+ return result;
+ }
+
+ @Override
+ public List getNonIndexableKeys(Context context) {
+ ArrayList result = new ArrayList();
+ return result;
+ }
+ };
+}