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

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
SuperDroidBond
2018-10-28 14:20:55 +05:30
committed by Hưng Phan
parent afc4d880b1
commit a0bf7cbee1
4 changed files with 140 additions and 2 deletions

View File

@@ -826,4 +826,83 @@
<item>13</item> <item>13</item>
<item>14</item> <item>14</item>
</string-array> </string-array>
<!-- SB Clock Fonts -->
<string-array name="sb_clock_fonts_entries">
<item>@string/lock_clock_font_stock</item>
<item>@string/lock_clock_font_italic</item>
<item>@string/lock_clock_font_bold</item>
<item>@string/lock_clock_font_bold_italic</item>
<item>@string/lock_clock_font_light_italic</item>
<item>@string/lock_clock_font_light</item>
<item>@string/lock_clock_font_thin_italic</item>
<item>@string/lock_clock_font_thin</item>
<item>@string/lock_clock_font_condensed_normal</item>
<item>@string/lock_clock_font_condensed_italic</item>
<item>@string/lock_clock_font_condensed_bold</item>
<item>@string/lock_clock_font_condensed_bold_italic</item>
<item>@string/lock_clock_font_condensed_light</item>
<item>@string/lock_clock_font_condensed_light_italic</item>
<item>@string/lock_clock_font_medium_normal</item>
<item>@string/lock_clock_font_medium_italic</item>
<item>@string/lock_clock_font_black</item>
<item>@string/lock_clock_font_black_italic</item>
<item>@string/lock_clock_font_dancingscript</item>
<item>@string/lock_clock_font_dancingscript_bold</item>
<item>@string/lock_clock_font_comingsoon</item>
<item>@string/lock_clock_font_notoserif</item>
<item>@string/lock_clock_font_notoserif_italic</item>
<item>@string/lock_clock_font_notoserif_bold</item>
<item>@string/lock_clock_font_notoserif_bold_italic</item>
<item>@string/lock_clock_font_gobold</item>
<item>@string/lock_clock_font_roadrage</item>
<item>@string/lock_clock_font_snowstorm</item>
<item>@string/lock_clock_font_googlesans</item>
<item>@string/lock_clock_font_neoneon</item>
<item>@string/lock_clock_font_themeable</item>
<item>@string/lock_clock_font_samsung</item>
<item>@string/lock_clock_font_mexcellent</item>
<item>@string/lock_clock_font_burnstown</item>
<item>@string/lock_clock_font_dumbledor</item>
<item>@string/lock_clock_font_phantombold</item>
</string-array>
<string-array name="sb_clock_fonts_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>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>33</item>
<item>33</item>
<item>34</item>
<item>35</item>
</string-array>
</resources> </resources>

View File

@@ -846,4 +846,12 @@
<string name="lockscreen_weather_show_image_title">Show Condition 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> <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>
</resources> </resources>

View File

@@ -48,10 +48,30 @@
android:title="@string/lockscreen_weather_show_city_title" android:title="@string/lockscreen_weather_show_city_title"
android:summary="@string/lockscreen_weather_show_city_summary" android:summary="@string/lockscreen_weather_show_city_summary"
android:defaultValue="true" /> 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 <com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="lockscreen_weather_show_temp" android:key="lockscreen_weather_show_temp"
android:title="@string/lockscreen_weather_show_temp_title" android:title="@string/lockscreen_weather_show_temp_title"
android:summary="@string/lockscreen_weather_show_temp_summary" android:summary="@string/lockscreen_weather_show_temp_summary"
android:defaultValue="true" /> android:defaultValue="true" />
<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> </PreferenceScreen>

View File

@@ -55,9 +55,13 @@ public class OmniJawsSettings extends SettingsPreferenceFragment implements
private static final String DEFAULT_WEATHER_ICON_PREFIX = "outline"; private static final String DEFAULT_WEATHER_ICON_PREFIX = "outline";
private static final String WEATHER_SERVICE_PACKAGE = "org.omnirom.omnijaws"; 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 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 PreferenceCategory mWeatherCategory;
private ListPreference mWeatherIconPack; private ListPreference mWeatherIconPack;
ListPreference mLockTempFonts;
ListPreference mLockCityFonts;
@Override @Override
public int getMetricsCategory() { public int getMetricsCategory() {
@@ -99,6 +103,20 @@ public class OmniJawsSettings extends SettingsPreferenceFragment implements
mWeatherIconPack.setSummary(mWeatherIconPack.getEntry()); mWeatherIconPack.setSummary(mWeatherIconPack.getEntry());
mWeatherIconPack.setOnPreferenceChangeListener(this); 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) { public boolean onPreferenceChange(Preference preference, Object objValue) {
@@ -108,8 +126,21 @@ public class OmniJawsSettings extends SettingsPreferenceFragment implements
Settings.System.OMNIJAWS_WEATHER_ICON_PACK, value); Settings.System.OMNIJAWS_WEATHER_ICON_PACK, value);
int valueIndex = mWeatherIconPack.findIndexOfValue(value); int valueIndex = mWeatherIconPack.findIndexOfValue(value);
mWeatherIconPack.setSummary(mWeatherIconPack.getEntries()[valueIndex]); mWeatherIconPack.setSummary(mWeatherIconPack.getEntries()[valueIndex]);
} return true;
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) { private void getAvailableWeatherIconPacks(List<String> entries, List<String> values) {