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

Commit db808c3e authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am b1c07444: Implement intermediate brigthness control on header.

* commit 'b1c074442571c278421f3424d991124af1abf252':
  Implement intermediate brigthness control on header.
parents b889b686 f056e35a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
    <com.android.systemui.settings.ToggleSlider
        android:id="@+id/brightness_slider"
        android:layout_width="0dp"
        android:layout_height="40dp"
        android:layout_height="44dp"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        systemui:text="@string/status_bar_settings_auto_brightness_label" />
+6 −0
Original line number Diff line number Diff line
@@ -98,6 +98,12 @@
        android:layout_marginEnd="4dp"
        />

    <include
        layout="@layout/quick_settings_brightness_dialog"
        android:id="@+id/brightness_container"
        android:layout_width="match_parent"
        />

    <TextView
        android:id="@+id/header_debug_info"
        android:visibility="invisible"
+1 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:padding">16dp</item>
        <item name="android:layout_alignParentBottom">true</item>
    </style>

    <style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer" />
+13 −8
Original line number Diff line number Diff line
@@ -119,7 +119,6 @@ public class BrightnessController implements ToggleSlider.Listener {
            }
        };
        mBrightnessObserver = new BrightnessObserver(mHandler);
        mBrightnessObserver.startObserving();

        PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        mMinimumBacklight = pm.getMinimumScreenBrightnessSetting();
@@ -128,13 +127,6 @@ public class BrightnessController implements ToggleSlider.Listener {
        mAutomaticAvailable = context.getResources().getBoolean(
                com.android.internal.R.bool.config_automatic_brightness_available);
        mPower = IPowerManager.Stub.asInterface(ServiceManager.getService("power"));

        // Update the slider and mode before attaching the listener so we don't receive the
        // onChanged notifications for the initial values.
        updateMode();
        updateSlider();

        control.setOnChangedListener(this);
    }

    public void addStateChangedCallback(BrightnessStateChangeCallback cb) {
@@ -150,11 +142,24 @@ public class BrightnessController implements ToggleSlider.Listener {
        // Do nothing
    }

    public void registerCallbacks() {
        mBrightnessObserver.startObserving();
        mUserTracker.startTracking();

        // Update the slider and mode before attaching the listener so we don't receive the
        // onChanged notifications for the initial values.
        updateMode();
        updateSlider();

        mControl.setOnChangedListener(this);
    }

    /** Unregister all call backs, both to and from the controller */
    public void unregisterCallbacks() {
        mBrightnessObserver.stopObserving();
        mChangeCallbacks.clear();
        mUserTracker.stopTracking();
        mControl.setOnChangedListener(null);
    }

    public void onChanged(ToggleSlider view, boolean tracking, boolean automatic, int value) {
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class BrightnessDialog extends Dialog implements
        mBrightnessController = new BrightnessController(getContext(),
                (ImageView) findViewById(R.id.brightness_icon),
                (ToggleSlider) findViewById(R.id.brightness_slider));
        mBrightnessController.registerCallbacks();
        dismissBrightnessDialog(mBrightnessDialogLongTimeout);
        mBrightnessController.addStateChangedCallback(this);
    }
Loading