Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to show Brightness Icon #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@
<string name="toggles_order_title">Toggle order</string>
<string name="toggles_order_summary">Choose the order which your toggles are displayed</string>
<string name="brightness_location_title">Brightness location</string>
<string name="brightness_show_icon_title">Show brightness icon</string>
<string name="brightness_show_icon_summary">Show brightness icon to the left of the slider</string>

<!-- Statusbar | Signal -->
<string name="signal_style">Signal Text Style</string>
Expand Down
5 changes: 5 additions & 0 deletions res/xml/prefs_statusbar_toggles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
android:entryValues="@array/brightness_location_values"
android:key="brightness_location"
android:title="@string/brightness_location_title" />

<CheckBoxPreference
android:key="brightness_show_icon"
android:title="@string/brightness_show_icon_title"
android:summary="@string/brightness_show_icon_summary" />

<PreferenceCategory
android:key="advanced_cat"
Expand Down
12 changes: 12 additions & 0 deletions src/com/roman/romcontrol/fragments/StatusBarToggles.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ public class StatusBarToggles extends PreferenceFragment implements

private static final String PREF_ENABLE_TOGGLES = "enable_toggles";
private static final String PREF_BRIGHTNESS_LOC = "brightness_location";
private static final String PREF_BRIGHTNESS_SHOW_ICON = "brightness_show_icon";
private static final String PREF_TOGGLES_STYLE = "toggle_style";
private static final String PREF_ALT_BUTTON_LAYOUT = "alternate_button_layout";

Preference mEnabledToggles;
Preference mLayout;
ListPreference mBrightnessLocation;
CheckBoxPreference mBrightnessShowIcon;
CheckBoxPreference mAlternateButtonLayout;
ListPreference mToggleStyle;
Preference mResetToggles;
Expand All @@ -64,6 +66,11 @@ public void onCreate(Bundle savedInstanceState) {
mBrightnessLocation.setValue(Integer.toString(Settings.System.getInt(getActivity()
.getContentResolver(), Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_LOC,
1)));

mBrightnessShowIcon = (CheckBoxPreference) findPreference(PREF_BRIGHTNESS_SHOW_ICON);
mBrightnessShowIcon.setChecked(Settings.System.getInt(
getActivity().getContentResolver(),
Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_SHOW_ICON, 0) == 1);

mToggleStyle = (ListPreference) findPreference(PREF_TOGGLES_STYLE);
mToggleStyle.setOnPreferenceChangeListener(this);
Expand Down Expand Up @@ -131,6 +138,11 @@ public void onClick(DialogInterface dialog, int which, boolean isChecked) {
d.show();

return true;
} else if (preference == mBrightnessShowIcon) {
Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_SHOW_ICON,
((CheckBoxPreference) preference).isChecked() ? 1 : 0);
return true;
} else if (preference == mAlternateButtonLayout) {

Settings.System.putInt(getActivity().getContentResolver(),
Expand Down