Cherish: Complete Allow toggling combined signal icons [2/2]
Change-Id: I5b39d5000fc3b1af94f88a5f8dbc62b82e400388 Co-authored-by: jhonboy121 <alfredmathew05@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -382,4 +382,8 @@
|
|||||||
<string name="flashlight_on_call_ignore_dnd_summary">Whether to flash when in Do Not Disturb mode</string>
|
<string name="flashlight_on_call_ignore_dnd_summary">Whether to flash when in Do Not Disturb mode</string>
|
||||||
<string name="flashlight_on_call_rate_title">Rate</string>
|
<string name="flashlight_on_call_rate_title">Rate</string>
|
||||||
<string name="flashlight_on_call_rate_summary">Flashlight on call blink rate</string>
|
<string name="flashlight_on_call_rate_summary">Flashlight on call blink rate</string>
|
||||||
|
|
||||||
|
<!-- Combined signal icons in status bar -->
|
||||||
|
<string name="combined_status_bar_signal_icons">Combined signal icons</string>
|
||||||
|
<string name="combined_status_bar_signal_icons_summary">Enable combined signal icons in status bar.\nRequires a SystemUI restart</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -90,6 +90,12 @@
|
|||||||
android:summary="@string/use_old_mobiletype_summary"
|
android:summary="@string/use_old_mobiletype_summary"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SecureSettingSwitchPreference
|
||||||
|
android:key="show_combined_status_bar_signal_icons"
|
||||||
|
android:title="@string/combined_status_bar_signal_icons"
|
||||||
|
android:summary="@string/combined_status_bar_signal_icons_summary"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="systemui_tuner_statusbar"
|
android:key="systemui_tuner_statusbar"
|
||||||
android:title="@string/statusbar_items_category" >
|
android:title="@string/statusbar_items_category" >
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import android.view.View;
|
|||||||
|
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||||
|
import com.cherish.settings.preferences.SecureSettingSwitchPreference;
|
||||||
import com.cherish.settings.preferences.SystemSettingSeekBarPreference;
|
import com.cherish.settings.preferences.SystemSettingSeekBarPreference;
|
||||||
import com.cherish.settings.preferences.SystemSettingListPreference;
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||||
@@ -47,20 +48,52 @@ import java.util.Collections;
|
|||||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||||
public class StatusBarSettings extends SettingsPreferenceFragment implements
|
public class StatusBarSettings extends SettingsPreferenceFragment implements
|
||||||
OnPreferenceChangeListener {
|
OnPreferenceChangeListener {
|
||||||
|
|
||||||
|
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
|
||||||
|
private static final String CONFIG_RESOURCE_NAME = "flag_combined_status_bar_signal_icons";
|
||||||
|
private static final String COBINED_STATUSBAR_ICONS = "show_combined_status_bar_signal_icons";
|
||||||
|
|
||||||
|
private SecureSettingSwitchPreference mCombinedIcons;
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.cherish_settings_statusbar);
|
addPreferencesFromResource(R.xml.cherish_settings_statusbar);
|
||||||
|
|
||||||
ContentResolver resolver = getActivity().getContentResolver();
|
PreferenceScreen prefSet = getPreferenceScreen();
|
||||||
|
final ContentResolver resolver = getActivity().getContentResolver();
|
||||||
|
|
||||||
PreferenceScreen prefSet = getPreferenceScreen();
|
mCombinedIcons = (SecureSettingSwitchPreference)
|
||||||
|
findPreference(COBINED_STATUSBAR_ICONS);
|
||||||
|
Resources sysUIRes = null;
|
||||||
|
boolean def = false;
|
||||||
|
int resId = 0;
|
||||||
|
try {
|
||||||
|
sysUIRes = getActivity().getPackageManager()
|
||||||
|
.getResourcesForApplication(SYSTEMUI_PACKAGE);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// If you don't have system UI you have bigger issues
|
||||||
|
}
|
||||||
|
if (sysUIRes != null) {
|
||||||
|
resId = sysUIRes.getIdentifier(
|
||||||
|
CONFIG_RESOURCE_NAME, "bool", SYSTEMUI_PACKAGE);
|
||||||
|
if (resId != 0) def = sysUIRes.getBoolean(resId);
|
||||||
|
}
|
||||||
|
boolean enabled = Settings.Secure.getInt(resolver,
|
||||||
|
COBINED_STATUSBAR_ICONS, def ? 1 : 0) == 1;
|
||||||
|
mCombinedIcons.setChecked(enabled);
|
||||||
|
mCombinedIcons.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||||
ContentResolver resolver = getActivity().getContentResolver();
|
ContentResolver resolver = getActivity().getContentResolver();
|
||||||
|
if (preference == mCombinedIcons) {
|
||||||
|
boolean enabled = (boolean) objValue;
|
||||||
|
Settings.Secure.putInt(resolver,
|
||||||
|
COBINED_STATUSBAR_ICONS, enabled ? 1 : 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user