Skip to content
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
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,12 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
* @hide
*/
public static final String STATUSBAR_TOGGLES_BRIGHTNESS_LOC = "statusbar_toggles_brightness_loc";

/**
* Show Icon next to brightness slider
* @hide
*/
public static String STATUSBAR_TOGGLES_BRIGHTNESS_SHOW_ICON = "statusbar_toggles_brightness_show_icon";

/**
* @hide
Expand Down
9 changes: 8 additions & 1 deletion packages/SystemUI/res/layout/status_bar_toggle_slider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:id="@+id/icon" />
<CheckBox
android:id="@+id/toggle"
android:layout_width="48dp"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/icon"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:button="@null"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.ImageView;

import com.android.systemui.R;

Expand All @@ -45,6 +46,7 @@ public interface Listener {
private CompoundButton mToggle;
private SeekBar mSlider;
private TextView mLabel;
private ImageView mIcon;

public ToggleSlider(Context context) {
this(context, null);
Expand All @@ -71,9 +73,21 @@ public ToggleSlider(Context context, AttributeSet attrs, int defStyle) {

mLabel = (TextView)findViewById(R.id.label);
mLabel.setText(a.getString(R.styleable.ToggleSlider_text));

mIcon = (ImageView)findViewById(R.id.icon);

a.recycle();
}

public void setIcon(int res) {
if (mIcon != null) {
mIcon.setImageResource(res);
}
}

public void setupInfo(boolean showIcon) {
mIcon.setVisibility(showIcon ? View.VISIBLE : View.GONE);
}

public void onCheckedChanged(CompoundButton toggle, boolean checked) {
Drawable thumb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public BrightnessSlider(Context context) {
mView = View.inflate(mContext, R.layout.brightness_slider, null);

mControl = (ToggleSlider) mView.findViewById(R.id.brightness);

mControl.setIcon(R.drawable.ic_sysbar_brightness);
mControl.setupInfo(Settings.System.getInt(mContext.getContentResolver(),
Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_SHOW_ICON, 0) == 1);

mScreenBrightnessDim = mContext.getResources().getInteger(
com.android.internal.R.integer.config_screenBrightnessDim);

Expand Down Expand Up @@ -93,6 +96,7 @@ public BrightnessSlider(Context context) {

SettingsObserver so = new SettingsObserver(new Handler());
so.observe();

}

public View getView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ void observe() {
resolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_LOC),
false, this);
resolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_SHOW_ICON),
false, this);
resolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.STATUSBAR_TOGGLES_NUMBER_PER_ROW),
false, this);
Expand Down