Loading packages/SystemUI/proguard.flags +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ public void setGlowScale(float); } -keep class com.android.systemui.settings.brightness.BrightnessSliderView { public float getSliderScaleY(); public void setSliderScaleY(float); } -keep class com.android.systemui.recents.OverviewProxyRecentsImpl -keep class com.android.systemui.statusbar.car.CarStatusBar -keep class com.android.systemui.statusbar.phone.StatusBar Loading packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +3 −3 Original line number Diff line number Diff line Loading @@ -379,10 +379,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha brightness.getMeasuredHeight() * 0.5f, 0); mBrightnessAnimator = new TouchAnimator.Builder() .addFloat(brightness, "alpha", 0, 1) .addFloat(brightness, "scaleY", 0.3f, 1) .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .addFloat(brightness, "sliderScaleY", 0.3f, 1) .setInterpolator(Interpolators.ALPHA_IN) .setStartDelay(0.3f) .build(); brightness.setPivotY(0); mAllViews.add(brightness); } else { mBrightnessAnimator = null; Loading packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java +50 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ package com.android.systemui.settings.brightness; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.DrawableWrapper; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; Loading @@ -24,6 +28,7 @@ import android.widget.FrameLayout; import android.widget.SeekBar.OnSeekBarChangeListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.settingslib.RestrictedLockUtils; import com.android.systemui.Gefingerpoken; Loading @@ -39,6 +44,9 @@ public class BrightnessSliderView extends FrameLayout { private ToggleSeekBar mSlider; private DispatchTouchEventListener mListener; private Gefingerpoken mOnInterceptListener; @Nullable private Drawable mProgressDrawable; private float mScale = 1f; public BrightnessSliderView(Context context) { this(context, null); Loading @@ -55,6 +63,17 @@ public class BrightnessSliderView extends FrameLayout { mSlider = requireViewById(R.id.slider); mSlider.setAccessibilityLabel(getContentDescription().toString()); // Finds the progress drawable. Assumes brightness_progress_drawable.xml try { LayerDrawable progress = (LayerDrawable) mSlider.getProgressDrawable(); DrawableWrapper progressSlider = (DrawableWrapper) progress .findDrawableByLayerId(android.R.id.progress); LayerDrawable actualProgressSlider = (LayerDrawable) progressSlider.getDrawable(); mProgressDrawable = actualProgressSlider.findDrawableByLayerId(R.id.slider_foreground); } catch (Exception e) { // Nothing to do, mProgressDrawable will be null. } } /** Loading Loading @@ -151,6 +170,37 @@ public class BrightnessSliderView extends FrameLayout { return super.onInterceptTouchEvent(ev); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); applySliderScale(); } /** * Sets the scale for the progress bar (for brightness_progress_drawable.xml) * * This will only scale the thick progress bar and not the icon inside */ public void setSliderScaleY(float scale) { if (scale != mScale) { mScale = scale; applySliderScale(); } } private void applySliderScale() { if (mProgressDrawable != null) { final Rect r = mProgressDrawable.getBounds(); int height = (int) (mProgressDrawable.getIntrinsicHeight() * mScale); int inset = (mProgressDrawable.getIntrinsicHeight() - height) / 2; mProgressDrawable.setBounds(r.left, inset, r.right, inset + height); } } public float getSliderScaleY() { return mScale; } /** * Interface to attach a listener for {@link View#dispatchTouchEvent}. */ Loading Loading
packages/SystemUI/proguard.flags +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ public void setGlowScale(float); } -keep class com.android.systemui.settings.brightness.BrightnessSliderView { public float getSliderScaleY(); public void setSliderScaleY(float); } -keep class com.android.systemui.recents.OverviewProxyRecentsImpl -keep class com.android.systemui.statusbar.car.CarStatusBar -keep class com.android.systemui.statusbar.phone.StatusBar Loading
packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +3 −3 Original line number Diff line number Diff line Loading @@ -379,10 +379,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha brightness.getMeasuredHeight() * 0.5f, 0); mBrightnessAnimator = new TouchAnimator.Builder() .addFloat(brightness, "alpha", 0, 1) .addFloat(brightness, "scaleY", 0.3f, 1) .setInterpolator(Interpolators.FAST_OUT_SLOW_IN) .addFloat(brightness, "sliderScaleY", 0.3f, 1) .setInterpolator(Interpolators.ALPHA_IN) .setStartDelay(0.3f) .build(); brightness.setPivotY(0); mAllViews.add(brightness); } else { mBrightnessAnimator = null; Loading
packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessSliderView.java +50 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ package com.android.systemui.settings.brightness; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.DrawableWrapper; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; Loading @@ -24,6 +28,7 @@ import android.widget.FrameLayout; import android.widget.SeekBar.OnSeekBarChangeListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.settingslib.RestrictedLockUtils; import com.android.systemui.Gefingerpoken; Loading @@ -39,6 +44,9 @@ public class BrightnessSliderView extends FrameLayout { private ToggleSeekBar mSlider; private DispatchTouchEventListener mListener; private Gefingerpoken mOnInterceptListener; @Nullable private Drawable mProgressDrawable; private float mScale = 1f; public BrightnessSliderView(Context context) { this(context, null); Loading @@ -55,6 +63,17 @@ public class BrightnessSliderView extends FrameLayout { mSlider = requireViewById(R.id.slider); mSlider.setAccessibilityLabel(getContentDescription().toString()); // Finds the progress drawable. Assumes brightness_progress_drawable.xml try { LayerDrawable progress = (LayerDrawable) mSlider.getProgressDrawable(); DrawableWrapper progressSlider = (DrawableWrapper) progress .findDrawableByLayerId(android.R.id.progress); LayerDrawable actualProgressSlider = (LayerDrawable) progressSlider.getDrawable(); mProgressDrawable = actualProgressSlider.findDrawableByLayerId(R.id.slider_foreground); } catch (Exception e) { // Nothing to do, mProgressDrawable will be null. } } /** Loading Loading @@ -151,6 +170,37 @@ public class BrightnessSliderView extends FrameLayout { return super.onInterceptTouchEvent(ev); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); applySliderScale(); } /** * Sets the scale for the progress bar (for brightness_progress_drawable.xml) * * This will only scale the thick progress bar and not the icon inside */ public void setSliderScaleY(float scale) { if (scale != mScale) { mScale = scale; applySliderScale(); } } private void applySliderScale() { if (mProgressDrawable != null) { final Rect r = mProgressDrawable.getBounds(); int height = (int) (mProgressDrawable.getIntrinsicHeight() * mScale); int inset = (mProgressDrawable.getIntrinsicHeight() - height) / 2; mProgressDrawable.setBounds(r.left, inset, r.right, inset + height); } } public float getSliderScaleY() { return mScale; } /** * Interface to attach a listener for {@link View#dispatchTouchEvent}. */ Loading