Loading packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:clipChildren="false" android:clipChildren="false" android:layout_gravity="center_horizontal|top"> android:layout_gravity="center_horizontal|top"> <FrameLayout <com.android.keyguard.KeyguardClockFrame android:id="@+id/lockscreen_clock_view" android:id="@+id/lockscreen_clock_view" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="@dimen/small_clock_height" android:layout_height="@dimen/small_clock_height" Loading @@ -34,7 +34,7 @@ android:clipChildren="false" android:clipChildren="false" android:paddingStart="@dimen/clock_padding_start" android:paddingStart="@dimen/clock_padding_start" android:visibility="invisible" /> android:visibility="invisible" /> <FrameLayout <com.android.keyguard.KeyguardClockFrame android:id="@+id/lockscreen_clock_view_large" android:id="@+id/lockscreen_clock_view_large" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" Loading packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ android:clipChildren="false" android:clipChildren="false" android:layout_width="0dp" android:layout_width="0dp" android:layout_height="wrap_content"> android:layout_height="wrap_content"> <LinearLayout <com.android.keyguard.KeyguardStatusContainer android:id="@+id/status_view_container" android:id="@+id/status_view_container" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading @@ -48,5 +48,5 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/qs_media_padding" android:padding="@dimen/qs_media_padding" /> /> </LinearLayout> </com.android.keyguard.KeyguardStatusContainer> </com.android.keyguard.KeyguardStatusView> </com.android.keyguard.KeyguardStatusView> packages/SystemUI/src/com/android/keyguard/KeyguardClockFrame.kt 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line package com.android.keyguard import android.content.Context import android.graphics.Canvas import android.util.AttributeSet import android.view.View import android.widget.FrameLayout class KeyguardClockFrame( context: Context, attrs: AttributeSet, ) : FrameLayout(context, attrs) { private var drawAlpha: Int = 255 protected override fun onSetAlpha(alpha: Int): Boolean { drawAlpha = alpha return true } protected override fun dispatchDraw(canvas: Canvas) { val restoreTo = saveCanvasAlpha(this, canvas, drawAlpha) super.dispatchDraw(canvas) canvas.restoreToCount(restoreTo) } companion object { @JvmStatic fun saveCanvasAlpha(view: View, canvas: Canvas, alpha: Int): Int { var (x, y) = run { val locationOnScreen = IntArray(2) view.getLocationOnScreen(locationOnScreen) Pair(locationOnScreen[0].toFloat(), locationOnScreen[1].toFloat()) } return canvas.saveLayerAlpha(-1f * x, -1f * y, x + view.width, y + view.height, alpha) } } } packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -5,11 +5,11 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ObjectAnimator; import android.content.Context; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Rect; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.RelativeLayout; import androidx.annotation.IntDef; import androidx.annotation.IntDef; Loading Loading @@ -69,12 +69,13 @@ public class KeyguardClockSwitch extends RelativeLayout { /** /** * Frame for small/large clocks * Frame for small/large clocks */ */ private FrameLayout mSmallClockFrame; private KeyguardClockFrame mSmallClockFrame; private FrameLayout mLargeClockFrame; private KeyguardClockFrame mLargeClockFrame; private ClockController mClock; private ClockController mClock; private View mStatusArea; private View mStatusArea; private int mSmartspaceTopOffset; private int mSmartspaceTopOffset; private int mDrawAlpha = 255; /** /** * Maintain state so that a newly connected plugin can be initialized. * Maintain state so that a newly connected plugin can be initialized. Loading Loading @@ -121,6 +122,19 @@ public class KeyguardClockSwitch extends RelativeLayout { onDensityOrFontScaleChanged(); onDensityOrFontScaleChanged(); } } @Override protected boolean onSetAlpha(int alpha) { mDrawAlpha = alpha; return true; } @Override protected void dispatchDraw(Canvas canvas) { int restoreTo = KeyguardClockFrame.saveCanvasAlpha(this, canvas, mDrawAlpha); super.dispatchDraw(canvas); canvas.restoreToCount(restoreTo); } public void setLogBuffer(LogBuffer logBuffer) { public void setLogBuffer(LogBuffer logBuffer) { mLogBuffer = logBuffer; mLogBuffer = logBuffer; } } Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +0 −14 Original line number Original line Diff line number Diff line Loading @@ -178,20 +178,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } } } } /** * Set alpha directly to mView will clip clock, so we set alpha to clock face instead */ public void setAlpha(float alpha) { ClockController clock = getClock(); if (clock != null) { clock.getLargeClock().getView().setAlpha(alpha); clock.getSmallClock().getView().setAlpha(alpha); } if (mStatusArea != null) { mStatusArea.setAlpha(alpha); } } /** /** * Attach the controller to the view it relates to. * Attach the controller to the view it relates to. */ */ Loading Loading
packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:clipChildren="false" android:clipChildren="false" android:layout_gravity="center_horizontal|top"> android:layout_gravity="center_horizontal|top"> <FrameLayout <com.android.keyguard.KeyguardClockFrame android:id="@+id/lockscreen_clock_view" android:id="@+id/lockscreen_clock_view" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="@dimen/small_clock_height" android:layout_height="@dimen/small_clock_height" Loading @@ -34,7 +34,7 @@ android:clipChildren="false" android:clipChildren="false" android:paddingStart="@dimen/clock_padding_start" android:paddingStart="@dimen/clock_padding_start" android:visibility="invisible" /> android:visibility="invisible" /> <FrameLayout <com.android.keyguard.KeyguardClockFrame android:id="@+id/lockscreen_clock_view_large" android:id="@+id/lockscreen_clock_view_large" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_height="match_parent" Loading
packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ android:clipChildren="false" android:clipChildren="false" android:layout_width="0dp" android:layout_width="0dp" android:layout_height="wrap_content"> android:layout_height="wrap_content"> <LinearLayout <com.android.keyguard.KeyguardStatusContainer android:id="@+id/status_view_container" android:id="@+id/status_view_container" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading @@ -48,5 +48,5 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/qs_media_padding" android:padding="@dimen/qs_media_padding" /> /> </LinearLayout> </com.android.keyguard.KeyguardStatusContainer> </com.android.keyguard.KeyguardStatusView> </com.android.keyguard.KeyguardStatusView>
packages/SystemUI/src/com/android/keyguard/KeyguardClockFrame.kt 0 → 100644 +39 −0 Original line number Original line Diff line number Diff line package com.android.keyguard import android.content.Context import android.graphics.Canvas import android.util.AttributeSet import android.view.View import android.widget.FrameLayout class KeyguardClockFrame( context: Context, attrs: AttributeSet, ) : FrameLayout(context, attrs) { private var drawAlpha: Int = 255 protected override fun onSetAlpha(alpha: Int): Boolean { drawAlpha = alpha return true } protected override fun dispatchDraw(canvas: Canvas) { val restoreTo = saveCanvasAlpha(this, canvas, drawAlpha) super.dispatchDraw(canvas) canvas.restoreToCount(restoreTo) } companion object { @JvmStatic fun saveCanvasAlpha(view: View, canvas: Canvas, alpha: Int): Int { var (x, y) = run { val locationOnScreen = IntArray(2) view.getLocationOnScreen(locationOnScreen) Pair(locationOnScreen[0].toFloat(), locationOnScreen[1].toFloat()) } return canvas.saveLayerAlpha(-1f * x, -1f * y, x + view.width, y + view.height, alpha) } } }
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +17 −3 Original line number Original line Diff line number Diff line Loading @@ -5,11 +5,11 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ObjectAnimator; import android.content.Context; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.Rect; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.RelativeLayout; import androidx.annotation.IntDef; import androidx.annotation.IntDef; Loading Loading @@ -69,12 +69,13 @@ public class KeyguardClockSwitch extends RelativeLayout { /** /** * Frame for small/large clocks * Frame for small/large clocks */ */ private FrameLayout mSmallClockFrame; private KeyguardClockFrame mSmallClockFrame; private FrameLayout mLargeClockFrame; private KeyguardClockFrame mLargeClockFrame; private ClockController mClock; private ClockController mClock; private View mStatusArea; private View mStatusArea; private int mSmartspaceTopOffset; private int mSmartspaceTopOffset; private int mDrawAlpha = 255; /** /** * Maintain state so that a newly connected plugin can be initialized. * Maintain state so that a newly connected plugin can be initialized. Loading Loading @@ -121,6 +122,19 @@ public class KeyguardClockSwitch extends RelativeLayout { onDensityOrFontScaleChanged(); onDensityOrFontScaleChanged(); } } @Override protected boolean onSetAlpha(int alpha) { mDrawAlpha = alpha; return true; } @Override protected void dispatchDraw(Canvas canvas) { int restoreTo = KeyguardClockFrame.saveCanvasAlpha(this, canvas, mDrawAlpha); super.dispatchDraw(canvas); canvas.restoreToCount(restoreTo); } public void setLogBuffer(LogBuffer logBuffer) { public void setLogBuffer(LogBuffer logBuffer) { mLogBuffer = logBuffer; mLogBuffer = logBuffer; } } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +0 −14 Original line number Original line Diff line number Diff line Loading @@ -178,20 +178,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } } } } /** * Set alpha directly to mView will clip clock, so we set alpha to clock face instead */ public void setAlpha(float alpha) { ClockController clock = getClock(); if (clock != null) { clock.getLargeClock().getView().setAlpha(alpha); clock.getSmallClock().getView().setAlpha(alpha); } if (mStatusArea != null) { mStatusArea.setAlpha(alpha); } } /** /** * Attach the controller to the view it relates to. * Attach the controller to the view it relates to. */ */ Loading