Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cebfd537 authored by Emilio López's avatar Emilio López
Browse files

Hide the Automatic brightness button on tablets when there's no support

Change-Id: Ib715a4703af6d91e1496bbfa2fe1aa31c1a1cbba
parent 2f05489b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -58,8 +58,7 @@ public class BrightnessController implements ToggleSlider.Listener {
            }
            control.setChecked(automatic != 0);
        } else {
            control.setChecked(false);
            //control.hideToggle();
            control.hideToggle();
        }
        
        int value;
+14 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
@@ -75,6 +76,19 @@ public class ToggleSlider extends RelativeLayout
        a.recycle();
    }

    /* @hide */
    public void hideToggle() {
        /* Using View.GONE makes the slider disappear */
        ViewGroup.LayoutParams params = mToggle.getLayoutParams();
        params.width = 0;
        params.height = 0;
        mToggle.setLayoutParams(params);
        mToggle.setVisibility(View.INVISIBLE);

        /* We can use GONE on the label though */
        mLabel.setVisibility(View.GONE);
    }

    public void onCheckedChanged(CompoundButton toggle, boolean checked) {
        Drawable thumb;
        Drawable slider;