Cherish:Add a toggle for QS footer text & Allow customizing footer text [2/2]
This commit is contained in:
8
res/drawable/ic_edit.xml
Normal file
8
res/drawable/ic_edit.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- drawable/pencil_outline.xml -->
|
||||
<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="M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z" />
|
||||
</vector>
|
||||
8
res/drawable/ic_edit_show.xml
Normal file
8
res/drawable/ic_edit_show.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- drawable/file_edit_outline.xml -->
|
||||
<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="M10 20H6V4H13V9H18V12.1L20 10.1V8L14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H10V20M20.2 13C20.3 13 20.5 13.1 20.6 13.2L21.9 14.5C22.1 14.7 22.1 15.1 21.9 15.3L20.9 16.3L18.8 14.2L19.8 13.2C19.9 13.1 20 13 20.2 13M20.2 16.9L14.1 23H12V20.9L18.1 14.8L20.2 16.9Z" />
|
||||
</vector>
|
||||
@@ -539,4 +539,10 @@
|
||||
<string name="vowifi_icon_asus">Asus Icon</string>
|
||||
<string name="vowifi_icon_oneplus">OOS Icon</string>
|
||||
<string name="vowifi_icon_moto">Motorola Icon</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>
|
||||
</resources>
|
||||
|
||||
@@ -68,6 +68,21 @@
|
||||
android:summary="@string/enable_oneui_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="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"/>
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingEditTextPreference
|
||||
android:key="footer_text_string"
|
||||
android:icon="@drawable/ic_edit"
|
||||
android:title="@string/qs_footer_text_string_title"
|
||||
android:summary="@string/qs_footer_text_string_summary"
|
||||
android:dependency="footer_text_show"
|
||||
android:defaultValue="#KeeptheLove" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.util.Locale;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.cherish.settings.preferences.SystemSettingEditTextPreference;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -30,10 +32,12 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
private static final String QS_BLUR_ALPHA = "qs_blur_alpha";
|
||||
private static final String QS_BLUR_INTENSITY = "qs_blur_intensity";
|
||||
private static final String QUICK_PULLDOWN = "quick_pulldown";
|
||||
private static final String FOOTER_TEXT_STRING = "footer_text_string";
|
||||
|
||||
private ListPreference mQuickPulldown;
|
||||
private CustomSeekBarPreference mQSBlurAlpha;
|
||||
private CustomSeekBarPreference mQSBlurIntensity;
|
||||
private SystemSettingEditTextPreference mFooterString;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -62,7 +66,19 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
mQuickPulldown.setValue(String.valueOf(quickPulldownValue));
|
||||
updatePulldownSummary(quickPulldownValue);
|
||||
|
||||
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
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
@@ -83,6 +99,17 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
quickPulldownValue, UserHandle.USER_CURRENT);
|
||||
updatePulldownSummary(quickPulldownValue);
|
||||
return true;
|
||||
} else 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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user