Cherish: Add back footer text

This reverts commit 45c73083bd.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Hưng Phan
2021-09-01 09:25:44 +07:00
parent 0979fe036f
commit 10aadd9e46
3 changed files with 48 additions and 1 deletions

View File

@@ -646,6 +646,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>
<!-- 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>
<string name="qs_footer_text_string_title">Customize footer text</string>
<string name="qs_footer_text_string_summary">Set to empty for default #KeepTheLove</string>
<!-- Navbar options --> <!-- Navbar options -->
<string name="navigation_bar_invert_layout_title">Invert layout</string> <string name="navigation_bar_invert_layout_title">Invert layout</string>
<string name="navigation_bar_invert_layout_summary">Inverts the layout of the navigation bar and other items, such as the IME switcher</string> <string name="navigation_bar_invert_layout_summary">Inverts the layout of the navigation bar and other items, such as the IME switcher</string>

View File

@@ -54,6 +54,22 @@
android:summary="@string/qs_footer_datausage_summary" android:summary="@string/qs_footer_datausage_summary"
android:defaultValue="true" /> android:defaultValue="true" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="omni_footer_text_show"
android:icon="@drawable/ic_edit_show"
android:title="@string/qs_footer_text_title"
android:summary="@string/qs_footer_text_summary"
android:defaultValue="false"/>
<!-- QS footer text string -->
<com.cherish.settings.preferences.SystemSettingEditTextPreference
android:key="footer_text_string"
android:icon="@drawable/ic_edit1"
android:title="@string/qs_footer_text_string_title"
android:summary="@string/qs_footer_text_string_summary"
android:dependency="omni_footer_text_show"
android:defaultValue="#KeeptheLove" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference <com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="qs_footer_show_edit" android:key="qs_footer_show_edit"
android:icon="@drawable/ic_edit1" android:icon="@drawable/ic_edit1"

View File

@@ -37,8 +37,10 @@ import java.util.ArrayList;
public class QuickSettings extends SettingsPreferenceFragment implements public class QuickSettings extends SettingsPreferenceFragment implements
OnPreferenceChangeListener { OnPreferenceChangeListener {
private static final String FOOTER_TEXT_STRING = "footer_text_string";
private static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header"; private static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header";
private SystemSettingEditTextPreference mFooterString;
private SystemSettingMasterSwitchPreference mCustomHeader; private SystemSettingMasterSwitchPreference mCustomHeader;
@Override @Override
@@ -55,12 +57,35 @@ public class QuickSettings extends SettingsPreferenceFragment implements
Settings.System.STATUS_BAR_CUSTOM_HEADER, 0); Settings.System.STATUS_BAR_CUSTOM_HEADER, 0);
mCustomHeader.setChecked(qsHeader != 0); mCustomHeader.setChecked(qsHeader != 0);
mCustomHeader.setOnPreferenceChangeListener(this); mCustomHeader.setOnPreferenceChangeListener(this);
mFooterString = (SystemSettingEditTextPreference) findPreference(FOOTER_TEXT_STRING);
mFooterString.setOnPreferenceChangeListener(this);
String footerString = Settings.System.getString(getContentResolver(),
FOOTER_TEXT_STRING);
if (footerString != null && footerString != "")
mFooterString.setText(footerString);
else {
mFooterString.setText("#KeepTheLove");
Settings.System.putString(getActivity().getContentResolver(),
Settings.System.FOOTER_TEXT_STRING, "#KeepTheLove");
}
} }
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
ContentResolver resolver = getActivity().getContentResolver(); ContentResolver resolver = getActivity().getContentResolver();
if (preference == mCustomHeader) { if (preference == mFooterString) {
String value = (String) newValue;
if (value != "" && value != null)
Settings.System.putString(getActivity().getContentResolver(),
Settings.System.FOOTER_TEXT_STRING, value);
else {
mFooterString.setText("#KeepTheLove");
Settings.System.putString(getActivity().getContentResolver(),
Settings.System.FOOTER_TEXT_STRING, "#KeepTheLove");
}
return true;
} else if (preference == mCustomHeader) {
boolean header = (Boolean) newValue; boolean header = (Boolean) newValue;
Settings.System.putInt(resolver, Settings.System.putInt(resolver,
Settings.System.STATUS_BAR_CUSTOM_HEADER, header ? 1 : 0); Settings.System.STATUS_BAR_CUSTOM_HEADER, header ? 1 : 0);