From 2f4c5991372cb0c5e5907d1b4e0dfcacfa6589d8 Mon Sep 17 00:00:00 2001 From: Joshua Mokut Date: Thu, 15 Jun 2023 17:46:35 +0100 Subject: [PATCH] Add hover effects to Dark mode and battery saver QS tiles Enabled ripple Drawable for dark mode and battery save QS tiles. this gives uniform hover behavior for all QS tiles. Test: atest BatterySaverTileScreenshotTest Fixes: 283750774 Change-Id: Iba6e6b4b96d2f91faaa8ec96607aeb77490d60bd --- .../plugin/src/com/android/systemui/plugins/qs/QSTile.java | 3 --- .../src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt | 5 ++++- .../src/com/android/systemui/qs/tiles/BatterySaverTile.java | 1 - .../src/com/android/systemui/qs/tiles/UiModeNightTile.java | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index c0b69c169ccde..25f77ea4e6d5d 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -172,7 +172,6 @@ public interface QSTile { public String expandedAccessibilityClassName; public SlashState slash; public boolean handlesLongClick = true; - public boolean showRippleEffect = true; @Nullable public Drawable sideViewCustomDrawable; public String spec; @@ -217,7 +216,6 @@ public interface QSTile { || !Objects.equals(other.dualTarget, dualTarget) || !Objects.equals(other.slash, slash) || !Objects.equals(other.handlesLongClick, handlesLongClick) - || !Objects.equals(other.showRippleEffect, showRippleEffect) || !Objects.equals(other.sideViewCustomDrawable, sideViewCustomDrawable); other.spec = spec; other.icon = icon; @@ -234,7 +232,6 @@ public interface QSTile { other.isTransient = isTransient; other.slash = slash != null ? slash.copy() : null; other.handlesLongClick = handlesLongClick; - other.showRippleEffect = showRippleEffect; other.sideViewCustomDrawable = sideViewCustomDrawable; return changed; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index d81e4c229aa7c..764ef681106ba 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -116,6 +116,10 @@ open class QSTileViewImpl @JvmOverloads constructor( private lateinit var customDrawableView: ImageView private lateinit var chevronView: ImageView private var mQsLogger: QSLogger? = null + + /** + * Controls if tile background is set to a [RippleDrawable] see [setClickable] + */ protected var showRippleEffect = true private lateinit var ripple: RippleDrawable @@ -440,7 +444,6 @@ open class QSTileViewImpl @JvmOverloads constructor( protected open fun handleStateChanged(state: QSTile.State) { val allowAnimations = animationsEnabled() - showRippleEffect = state.showRippleEffect isClickable = state.state != Tile.STATE_UNAVAILABLE isLongClickable = state.handlesLongClick icon.setIcon(state, allowAnimations) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java index a444e76315276..9f10e6f1f2c6b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java @@ -155,7 +155,6 @@ public class BatterySaverTile extends QSTileImpl implements state.contentDescription = state.label; state.value = mPowerSave; state.expandedAccessibilityClassName = Switch.class.getName(); - state.showRippleEffect = mSetting.getValue() == 0; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java index a60d1ad448b41..9ffcba62ad09a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UiModeNightTile.java @@ -169,7 +169,6 @@ public class UiModeNightTile extends QSTileImpl implements state.icon = ResourceIcon.get(state.state == Tile.STATE_ACTIVE ? R.drawable.qs_light_dark_theme_icon_on : R.drawable.qs_light_dark_theme_icon_off); - state.showRippleEffect = false; state.expandedAccessibilityClassName = Switch.class.getName(); }