Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/DarkIconDispatcher.java +17 −14 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.annotations.DependsOn; import com.android.systemui.plugins.annotations.ProvidesInterface; import java.util.ArrayList; /** * Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area and dark * intensity. Accessible through {@link PluginDependency} Loading @@ -32,15 +34,15 @@ import com.android.systemui.plugins.annotations.ProvidesInterface; @ProvidesInterface(version = DarkIconDispatcher.VERSION) @DependsOn(target = DarkReceiver.class) public interface DarkIconDispatcher { int VERSION = 1; int VERSION = 2; /** * Sets the dark area so {@link #applyDark} only affects the icons in the specified area. * * @param r the area in which icons should change its tint, in logical screen * @param r the areas in which icons should change its tint, in logical screen * coordinates */ void setIconsDarkArea(Rect r); void setIconsDarkArea(ArrayList<Rect> r); /** * Adds a receiver to receive callbacks onDarkChanged Loading Loading @@ -76,8 +78,8 @@ public interface DarkIconDispatcher { * @return the tint to apply to view depending on the desired tint color and * the screen tintArea in which to apply that tint */ static int getTint(Rect tintArea, View view, int color) { if (isInArea(tintArea, view)) { static int getTint(ArrayList<Rect> tintAreas, View view, int color) { if (isInAreas(tintAreas, view)) { return color; } else { return DEFAULT_ICON_TINT; Loading @@ -85,15 +87,16 @@ public interface DarkIconDispatcher { } /** * @return the dark intensity to apply to view depending on the desired dark * intensity and the screen tintArea in which to apply that intensity * @return true if more than half of the view area are in any of the given * areas, false otherwise */ static float getDarkIntensity(Rect tintArea, View view, float intensity) { if (isInArea(tintArea, view)) { return intensity; } else { return 0f; static boolean isInAreas(ArrayList<Rect> areas, View view) { for (Rect area : areas) { if (isInArea(area, view)) { return true; } } return false; } /** Loading Loading @@ -122,7 +125,7 @@ public interface DarkIconDispatcher { */ @ProvidesInterface(version = DarkReceiver.VERSION) interface DarkReceiver { int VERSION = 1; void onDarkChanged(Rect area, float darkIntensity, int tint); int VERSION = 2; void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint); } } packages/SystemUI/src/com/android/systemui/DarkReceiverImpl.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,11 +32,11 @@ class DarkReceiverImpl @JvmOverloads constructor( private val dualToneHandler = DualToneHandler(context) init { onDarkChanged(Rect(), 1f, DarkIconDispatcher.DEFAULT_ICON_TINT) onDarkChanged(ArrayList<Rect>(), 1f, DarkIconDispatcher.DEFAULT_ICON_TINT) } override fun onDarkChanged(area: Rect?, darkIntensity: Float, tint: Int) { val intensity = if (DarkIconDispatcher.isInArea(area, this)) darkIntensity else 0f override fun onDarkChanged(areas: ArrayList<Rect>?, darkIntensity: Float, tint: Int) { val intensity = if (DarkIconDispatcher.isInAreas(areas, this)) darkIntensity else 0f setBackgroundColor(dualToneHandler.getSingleColor(intensity)) } } No newline at end of file packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +4 −3 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.text.NumberFormat; import java.util.ArrayList; public class BatteryMeterView extends LinearLayout implements DarkReceiver { Loading Loading @@ -125,7 +126,7 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { updateShowPercent(); mDualToneHandler = new DualToneHandler(context); // Init to not dark at all. onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); onDarkChanged(new ArrayList<Rect>(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); setClipChildren(false); setClipToPadding(false); Loading Loading @@ -353,8 +354,8 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { } @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { float intensity = DarkIconDispatcher.isInArea(area, this) ? darkIntensity : 0; public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { float intensity = DarkIconDispatcher.isInAreas(areas, this) ? darkIntensity : 0; mNonAdaptedSingleToneColor = mDualToneHandler.getSingleColor(intensity); mNonAdaptedForegroundColor = mDualToneHandler.getFillColor(intensity); mNonAdaptedBackgroundColor = mDualToneHandler.getBackgroundColor(intensity); Loading packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java +4 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry.OnSensitivityChangedListener; import java.util.ArrayList; /** * The view in the statusBar that contains part of the heads-up information Loading Loading @@ -161,8 +163,8 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout { return mIconDrawingRect; } public void onDarkChanged(Rect area, float darkIntensity, int tint) { mTextView.setTextColor(DarkIconDispatcher.getTint(area, this, tint)); public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { mTextView.setTextColor(DarkIconDispatcher.getTint(areas, this, tint)); } public void setOnDrawingRectChangedListener(Runnable onDrawingRectChangedListener) { Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +3 −2 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.util.drawable.DrawableSize; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; public class StatusBarIconView extends AnimatedImageView implements StatusIconDisplayable { Loading Loading @@ -961,8 +962,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { int areaTint = getTint(area, this, tint); public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { int areaTint = getTint(areas, this, tint); ColorStateList color = ColorStateList.valueOf(areaTint); setImageTintList(color); setDecorColor(areaTint); Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/DarkIconDispatcher.java +17 −14 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.annotations.DependsOn; import com.android.systemui.plugins.annotations.ProvidesInterface; import java.util.ArrayList; /** * Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area and dark * intensity. Accessible through {@link PluginDependency} Loading @@ -32,15 +34,15 @@ import com.android.systemui.plugins.annotations.ProvidesInterface; @ProvidesInterface(version = DarkIconDispatcher.VERSION) @DependsOn(target = DarkReceiver.class) public interface DarkIconDispatcher { int VERSION = 1; int VERSION = 2; /** * Sets the dark area so {@link #applyDark} only affects the icons in the specified area. * * @param r the area in which icons should change its tint, in logical screen * @param r the areas in which icons should change its tint, in logical screen * coordinates */ void setIconsDarkArea(Rect r); void setIconsDarkArea(ArrayList<Rect> r); /** * Adds a receiver to receive callbacks onDarkChanged Loading Loading @@ -76,8 +78,8 @@ public interface DarkIconDispatcher { * @return the tint to apply to view depending on the desired tint color and * the screen tintArea in which to apply that tint */ static int getTint(Rect tintArea, View view, int color) { if (isInArea(tintArea, view)) { static int getTint(ArrayList<Rect> tintAreas, View view, int color) { if (isInAreas(tintAreas, view)) { return color; } else { return DEFAULT_ICON_TINT; Loading @@ -85,15 +87,16 @@ public interface DarkIconDispatcher { } /** * @return the dark intensity to apply to view depending on the desired dark * intensity and the screen tintArea in which to apply that intensity * @return true if more than half of the view area are in any of the given * areas, false otherwise */ static float getDarkIntensity(Rect tintArea, View view, float intensity) { if (isInArea(tintArea, view)) { return intensity; } else { return 0f; static boolean isInAreas(ArrayList<Rect> areas, View view) { for (Rect area : areas) { if (isInArea(area, view)) { return true; } } return false; } /** Loading Loading @@ -122,7 +125,7 @@ public interface DarkIconDispatcher { */ @ProvidesInterface(version = DarkReceiver.VERSION) interface DarkReceiver { int VERSION = 1; void onDarkChanged(Rect area, float darkIntensity, int tint); int VERSION = 2; void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint); } }
packages/SystemUI/src/com/android/systemui/DarkReceiverImpl.kt +3 −3 Original line number Diff line number Diff line Loading @@ -32,11 +32,11 @@ class DarkReceiverImpl @JvmOverloads constructor( private val dualToneHandler = DualToneHandler(context) init { onDarkChanged(Rect(), 1f, DarkIconDispatcher.DEFAULT_ICON_TINT) onDarkChanged(ArrayList<Rect>(), 1f, DarkIconDispatcher.DEFAULT_ICON_TINT) } override fun onDarkChanged(area: Rect?, darkIntensity: Float, tint: Int) { val intensity = if (DarkIconDispatcher.isInArea(area, this)) darkIntensity else 0f override fun onDarkChanged(areas: ArrayList<Rect>?, darkIntensity: Float, tint: Int) { val intensity = if (DarkIconDispatcher.isInAreas(areas, this)) darkIntensity else 0f setBackgroundColor(dualToneHandler.getSingleColor(intensity)) } } No newline at end of file
packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +4 −3 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.text.NumberFormat; import java.util.ArrayList; public class BatteryMeterView extends LinearLayout implements DarkReceiver { Loading Loading @@ -125,7 +126,7 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { updateShowPercent(); mDualToneHandler = new DualToneHandler(context); // Init to not dark at all. onDarkChanged(new Rect(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); onDarkChanged(new ArrayList<Rect>(), 0, DarkIconDispatcher.DEFAULT_ICON_TINT); setClipChildren(false); setClipToPadding(false); Loading Loading @@ -353,8 +354,8 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { } @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { float intensity = DarkIconDispatcher.isInArea(area, this) ? darkIntensity : 0; public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { float intensity = DarkIconDispatcher.isInAreas(areas, this) ? darkIntensity : 0; mNonAdaptedSingleToneColor = mDualToneHandler.getSingleColor(intensity); mNonAdaptedForegroundColor = mDualToneHandler.getFillColor(intensity); mNonAdaptedBackgroundColor = mDualToneHandler.getBackgroundColor(intensity); Loading
packages/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java +4 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry.OnSensitivityChangedListener; import java.util.ArrayList; /** * The view in the statusBar that contains part of the heads-up information Loading Loading @@ -161,8 +163,8 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout { return mIconDrawingRect; } public void onDarkChanged(Rect area, float darkIntensity, int tint) { mTextView.setTextColor(DarkIconDispatcher.getTint(area, this, tint)); public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { mTextView.setTextColor(DarkIconDispatcher.getTint(areas, this, tint)); } public void setOnDrawingRectChangedListener(Runnable onDrawingRectChangedListener) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +3 −2 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.util.drawable.DrawableSize; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; public class StatusBarIconView extends AnimatedImageView implements StatusIconDisplayable { Loading Loading @@ -961,8 +962,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi } @Override public void onDarkChanged(Rect area, float darkIntensity, int tint) { int areaTint = getTint(area, this, tint); public void onDarkChanged(ArrayList<Rect> areas, float darkIntensity, int tint) { int areaTint = getTint(areas, this, tint); ColorStateList color = ColorStateList.valueOf(areaTint); setImageTintList(color); setDecorColor(areaTint); Loading