Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +41 −43 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.content.IntentFilter import android.content.IntentFilter import android.content.res.Resources import android.graphics.Rect import android.graphics.Rect import android.hardware.display.DisplayManager import android.hardware.display.DisplayManager import android.os.Bundle import android.os.Bundle Loading Loading @@ -411,15 +410,52 @@ constructor( private fun setUpClock(parentView: ViewGroup) { private fun setUpClock(parentView: ViewGroup) { largeClockHostView = largeClockHostView = if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view_large) parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view_large) else createLargeClockHostView() } else { val hostView = FrameLayout(context) hostView.layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) parentView.addView(hostView) hostView } largeClockHostView.isInvisible = true largeClockHostView.isInvisible = true smallClockHostView = smallClockHostView = if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view) parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view) else createSmallClockHostView(parentView.resources) } else { val resources = parentView.resources val hostView = FrameLayout(context) val layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_height ) ) layoutParams.topMargin = KeyguardPreviewSmartspaceViewModel.getStatusBarHeight(resources) + resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_padding_top ) hostView.layoutParams = layoutParams hostView.setPaddingRelative( resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.clock_padding_start ), 0, 0, 0 ) hostView.clipChildren = false parentView.addView(hostView) hostView } smallClockHostView.isInvisible = true smallClockHostView.isInvisible = true // TODO (b/283465254): Move the listeners to KeyguardClockRepository // TODO (b/283465254): Move the listeners to KeyguardClockRepository Loading Loading @@ -476,44 +512,6 @@ constructor( onClockChanged() onClockChanged() } } private fun createLargeClockHostView(): FrameLayout { val hostView = FrameLayout(context) hostView.layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) return hostView } private fun createSmallClockHostView(resources: Resources): FrameLayout { val hostView = FrameLayout(context) val layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_height ) ) layoutParams.topMargin = KeyguardPreviewSmartspaceViewModel.getStatusBarHeight(resources) + resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_padding_top ) hostView.layoutParams = layoutParams hostView.setPaddingRelative( resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.clock_padding_start ), 0, 0, 0 ) hostView.clipChildren = false return hostView } private fun onClockChanged() { private fun onClockChanged() { val clock = clockRegistry.createCurrentClock() val clock = clockRegistry.createCurrentClock() clockController.clock = clock clockController.clock = clock Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +41 −43 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.content.IntentFilter import android.content.IntentFilter import android.content.res.Resources import android.graphics.Rect import android.graphics.Rect import android.hardware.display.DisplayManager import android.hardware.display.DisplayManager import android.os.Bundle import android.os.Bundle Loading Loading @@ -411,15 +410,52 @@ constructor( private fun setUpClock(parentView: ViewGroup) { private fun setUpClock(parentView: ViewGroup) { largeClockHostView = largeClockHostView = if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view_large) parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view_large) else createLargeClockHostView() } else { val hostView = FrameLayout(context) hostView.layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) parentView.addView(hostView) hostView } largeClockHostView.isInvisible = true largeClockHostView.isInvisible = true smallClockHostView = smallClockHostView = if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view) parentView.requireViewById<FrameLayout>(R.id.lockscreen_clock_view) else createSmallClockHostView(parentView.resources) } else { val resources = parentView.resources val hostView = FrameLayout(context) val layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_height ) ) layoutParams.topMargin = KeyguardPreviewSmartspaceViewModel.getStatusBarHeight(resources) + resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_padding_top ) hostView.layoutParams = layoutParams hostView.setPaddingRelative( resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.clock_padding_start ), 0, 0, 0 ) hostView.clipChildren = false parentView.addView(hostView) hostView } smallClockHostView.isInvisible = true smallClockHostView.isInvisible = true // TODO (b/283465254): Move the listeners to KeyguardClockRepository // TODO (b/283465254): Move the listeners to KeyguardClockRepository Loading Loading @@ -476,44 +512,6 @@ constructor( onClockChanged() onClockChanged() } } private fun createLargeClockHostView(): FrameLayout { val hostView = FrameLayout(context) hostView.layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, ) return hostView } private fun createSmallClockHostView(resources: Resources): FrameLayout { val hostView = FrameLayout(context) val layoutParams = FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_height ) ) layoutParams.topMargin = KeyguardPreviewSmartspaceViewModel.getStatusBarHeight(resources) + resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.small_clock_padding_top ) hostView.layoutParams = layoutParams hostView.setPaddingRelative( resources.getDimensionPixelSize( com.android.systemui.customization.R.dimen.clock_padding_start ), 0, 0, 0 ) hostView.clipChildren = false return hostView } private fun onClockChanged() { private fun onClockChanged() { val clock = clockRegistry.createCurrentClock() val clock = clockRegistry.createCurrentClock() clockController.clock = clock clockController.clock = clock Loading