Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import com.android.app.animation.Interpolators import com.android.systemui.log.core.Logger import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ThemeConfig import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData Loading Loading @@ -111,7 +111,7 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : override fun onZenDataChanged(data: ZenData) {} override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) { override fun onFontAxesChanged(axes: ClockAxisStyle) { view.updateAxes(axes) } Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +2 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.customization.R import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockConfig import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockEventListener Loading @@ -33,7 +34,6 @@ import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceController import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ClockMessageBuffers import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.plugins.clocks.DefaultClockFaceLayout Loading Loading @@ -232,7 +232,7 @@ class DefaultClockController( override fun onZenDataChanged(data: ZenData) {} override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) {} override fun onFontAxesChanged(axes: ClockAxisStyle) {} } open inner class DefaultClockAnimations( Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt +33 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.os.Vibrator import android.view.LayoutInflater import com.android.systemui.customization.R import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.clocks.AxisPresetConfig import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockLogger Loading @@ -28,7 +30,7 @@ import com.android.systemui.plugins.clocks.ClockMetadata import com.android.systemui.plugins.clocks.ClockPickerConfig import com.android.systemui.plugins.clocks.ClockProvider import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.shared.clocks.FlexClockController.Companion.AXIS_PRESETS import com.android.systemui.shared.clocks.FlexClockController.Companion.buildPresetGroup import com.android.systemui.shared.clocks.FlexClockController.Companion.getDefaultAxes private val TAG = DefaultClockProvider::class.simpleName Loading Loading @@ -80,7 +82,7 @@ class DefaultClockProvider( return if (isClockReactiveVariantsEnabled) { val buffers = messageBuffers ?: ClockMessageBuffers(ClockLogger.DEFAULT_MESSAGE_BUFFER) val fontAxes = getDefaultAxes(settings).merge(settings.axes) val clockSettings = settings.copy(axes = fontAxes.map { it.toSetting() }) val clockSettings = settings.copy(axes = ClockAxisStyle(fontAxes)) val typefaceCache = TypefaceCache(buffers.infraMessageBuffer, NUM_CLOCK_FONT_ANIMATION_STEPS) { FLEX_TYPEFACE Loading @@ -106,17 +108,35 @@ class DefaultClockProvider( throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG") } if (!isClockReactiveVariantsEnabled) { return ClockPickerConfig( settings.clockId ?: DEFAULT_CLOCK_ID, resources.getString(R.string.clock_default_name), resources.getString(R.string.clock_default_description), resources.getDrawable(R.drawable.clock_default_thumbnail, null), isReactiveToTone = true, axes = if (!isClockReactiveVariantsEnabled) emptyList() else getDefaultAxes(settings).merge(settings.axes), axisPresets = if (!isClockReactiveVariantsEnabled) emptyList() else AXIS_PRESETS, axes = emptyList(), presetConfig = null, ) } else { val fontAxes = getDefaultAxes(settings).merge(settings.axes) return ClockPickerConfig( settings.clockId ?: DEFAULT_CLOCK_ID, resources.getString(R.string.clock_default_name), resources.getString(R.string.clock_default_description), resources.getDrawable(R.drawable.clock_default_thumbnail, null), isReactiveToTone = true, axes = fontAxes, presetConfig = AxisPresetConfig( listOf( buildPresetGroup(resources, isRound = true), buildPresetGroup(resources, isRound = false), ) ) .let { cfg -> cfg.copy(current = cfg.findStyle(ClockAxisStyle(fontAxes))) }, ) } } companion object { Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt +46 −62 Original line number Diff line number Diff line Loading @@ -16,20 +16,24 @@ package com.android.systemui.shared.clocks import android.content.res.Resources import com.android.systemui.animation.GSFAxes import com.android.systemui.customization.R import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.AxisPresetConfig import com.android.systemui.plugins.clocks.AxisType import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockConfig import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockEventListener import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFontAxis import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.shared.clocks.FontUtils.put import com.android.systemui.shared.clocks.FontUtils.toClockAxis import com.android.systemui.shared.clocks.view.FlexClockView import java.io.PrintWriter import java.util.Locale Loading Loading @@ -96,8 +100,8 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController largeClock.events.onZenDataChanged(data) } override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) { val fontAxes = getDefaultAxes(clockCtx.settings).merge(axes).map { it.toSetting() } override fun onFontAxesChanged(axes: ClockAxisStyle) { val fontAxes = ClockAxisStyle(getDefaultAxes(clockCtx.settings).merge(axes)) smallClock.events.onFontAxesChanged(fontAxes) largeClock.events.onFontAxesChanged(fontAxes) } Loading Loading @@ -162,66 +166,46 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController ), ) private val LEGACY_FLEX_SETTINGS = listOf( GSFAxes.WEIGHT.toClockAxisSetting(600f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(0f), private val LEGACY_FLEX_SETTINGS = ClockAxisStyle { put(GSFAxes.WEIGHT, 600f) put(GSFAxes.WIDTH, 100f) put(GSFAxes.ROUND, 100f) put(GSFAxes.SLANT, 0f) } private val PRESET_COUNT = 8 private val PRESET_WIDTH_INIT = 30f private val PRESET_WIDTH_STEP = 12.5f private val PRESET_WEIGHT_INIT = 800f private val PRESET_WEIGHT_STEP = -100f private val BASE_PRESETS: List<ClockAxisStyle> = run { val presets = mutableListOf<ClockAxisStyle>() var weight = PRESET_WEIGHT_INIT var width = PRESET_WIDTH_INIT for (i in 1..PRESET_COUNT) { presets.add( ClockAxisStyle { put(GSFAxes.WEIGHT, weight) put(GSFAxes.WIDTH, width) put(GSFAxes.ROUND, 0f) put(GSFAxes.SLANT, 0f) } ) val AXIS_PRESETS = listOf( FONT_AXES.map { it.toSetting() }, LEGACY_FLEX_SETTINGS, listOf( // Porcelain GSFAxes.WEIGHT.toClockAxisSetting(500f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Midnight GSFAxes.WEIGHT.toClockAxisSetting(300f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-10f), ), listOf( // Sterling GSFAxes.WEIGHT.toClockAxisSetting(1000f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Smoky Green GSFAxes.WEIGHT.toClockAxisSetting(150f), GSFAxes.WIDTH.toClockAxisSetting(50f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Iris GSFAxes.WEIGHT.toClockAxisSetting(500f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Margarita GSFAxes.WEIGHT.toClockAxisSetting(300f), GSFAxes.WIDTH.toClockAxisSetting(30f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-10f), ), listOf( // Raspberry GSFAxes.WEIGHT.toClockAxisSetting(700f), GSFAxes.WIDTH.toClockAxisSetting(140f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-7f), ), listOf( // Ultra Blue GSFAxes.WEIGHT.toClockAxisSetting(850f), GSFAxes.WIDTH.toClockAxisSetting(130f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), weight += PRESET_WEIGHT_STEP width += PRESET_WIDTH_STEP } return@run presets } fun buildPresetGroup(resources: Resources, isRound: Boolean): AxisPresetConfig.Group { val round = if (isRound) GSFAxes.ROUND.maxValue else GSFAxes.ROUND.minValue return AxisPresetConfig.Group( presets = BASE_PRESETS.map { it.copy { put(GSFAxes.ROUND, round) } }, // TODO(b/395647577): Placeholder Icon; Replace or remove icon = resources.getDrawable(R.drawable.clock_default_thumbnail, null), ) } } } packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt +7 −12 Original line number Diff line number Diff line Loading @@ -25,16 +25,18 @@ import com.android.systemui.animation.GSFAxes import com.android.systemui.customization.R import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceController import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFaceLayout import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.DefaultClockFaceLayout import com.android.systemui.plugins.clocks.ThemeConfig import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.shared.clocks.FontUtils.get import com.android.systemui.shared.clocks.FontUtils.set import com.android.systemui.shared.clocks.ViewUtils.computeLayoutDiff import com.android.systemui.shared.clocks.view.FlexClockView import com.android.systemui.shared.clocks.view.HorizontalAlignment Loading Loading @@ -129,17 +131,10 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: layerController.faceEvents.onThemeChanged(theme) } override fun onFontAxesChanged(settings: List<ClockFontAxisSetting>) { var axes = settings if (!isLargeClock) { axes = axes.map { axis -> if (axis.key == GSFAxes.WIDTH.tag && axis.value > SMALL_CLOCK_MAX_WDTH) { axis.copy(value = SMALL_CLOCK_MAX_WDTH) } else { axis } } override fun onFontAxesChanged(settings: ClockAxisStyle) { var axes = ClockAxisStyle(settings) if (!isLargeClock && axes[GSFAxes.WIDTH] > SMALL_CLOCK_MAX_WDTH) { axes[GSFAxes.WIDTH] = SMALL_CLOCK_MAX_WDTH } layerController.events.onFontAxesChanged(axes) Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/ComposedDigitalLayerController.kt +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import com.android.app.animation.Interpolators import com.android.systemui.log.core.Logger import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ThemeConfig import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData Loading Loading @@ -111,7 +111,7 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) : override fun onZenDataChanged(data: ZenData) {} override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) { override fun onFontAxesChanged(axes: ClockAxisStyle) { view.updateAxes(axes) } Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +2 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.systemui.customization.R import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockConfig import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockEventListener Loading @@ -33,7 +34,6 @@ import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceController import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ClockMessageBuffers import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.plugins.clocks.DefaultClockFaceLayout Loading Loading @@ -232,7 +232,7 @@ class DefaultClockController( override fun onZenDataChanged(data: ZenData) {} override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) {} override fun onFontAxesChanged(axes: ClockAxisStyle) {} } open inner class DefaultClockAnimations( Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt +33 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.os.Vibrator import android.view.LayoutInflater import com.android.systemui.customization.R import com.android.systemui.log.core.MessageBuffer import com.android.systemui.plugins.clocks.AxisPresetConfig import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockLogger Loading @@ -28,7 +30,7 @@ import com.android.systemui.plugins.clocks.ClockMetadata import com.android.systemui.plugins.clocks.ClockPickerConfig import com.android.systemui.plugins.clocks.ClockProvider import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.shared.clocks.FlexClockController.Companion.AXIS_PRESETS import com.android.systemui.shared.clocks.FlexClockController.Companion.buildPresetGroup import com.android.systemui.shared.clocks.FlexClockController.Companion.getDefaultAxes private val TAG = DefaultClockProvider::class.simpleName Loading Loading @@ -80,7 +82,7 @@ class DefaultClockProvider( return if (isClockReactiveVariantsEnabled) { val buffers = messageBuffers ?: ClockMessageBuffers(ClockLogger.DEFAULT_MESSAGE_BUFFER) val fontAxes = getDefaultAxes(settings).merge(settings.axes) val clockSettings = settings.copy(axes = fontAxes.map { it.toSetting() }) val clockSettings = settings.copy(axes = ClockAxisStyle(fontAxes)) val typefaceCache = TypefaceCache(buffers.infraMessageBuffer, NUM_CLOCK_FONT_ANIMATION_STEPS) { FLEX_TYPEFACE Loading @@ -106,17 +108,35 @@ class DefaultClockProvider( throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG") } if (!isClockReactiveVariantsEnabled) { return ClockPickerConfig( settings.clockId ?: DEFAULT_CLOCK_ID, resources.getString(R.string.clock_default_name), resources.getString(R.string.clock_default_description), resources.getDrawable(R.drawable.clock_default_thumbnail, null), isReactiveToTone = true, axes = if (!isClockReactiveVariantsEnabled) emptyList() else getDefaultAxes(settings).merge(settings.axes), axisPresets = if (!isClockReactiveVariantsEnabled) emptyList() else AXIS_PRESETS, axes = emptyList(), presetConfig = null, ) } else { val fontAxes = getDefaultAxes(settings).merge(settings.axes) return ClockPickerConfig( settings.clockId ?: DEFAULT_CLOCK_ID, resources.getString(R.string.clock_default_name), resources.getString(R.string.clock_default_description), resources.getDrawable(R.drawable.clock_default_thumbnail, null), isReactiveToTone = true, axes = fontAxes, presetConfig = AxisPresetConfig( listOf( buildPresetGroup(resources, isRound = true), buildPresetGroup(resources, isRound = false), ) ) .let { cfg -> cfg.copy(current = cfg.findStyle(ClockAxisStyle(fontAxes))) }, ) } } companion object { Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockController.kt +46 −62 Original line number Diff line number Diff line Loading @@ -16,20 +16,24 @@ package com.android.systemui.shared.clocks import android.content.res.Resources import com.android.systemui.animation.GSFAxes import com.android.systemui.customization.R import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.AxisPresetConfig import com.android.systemui.plugins.clocks.AxisType import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockConfig import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockEventListener import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFontAxis import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.ClockSettings import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.shared.clocks.FontUtils.put import com.android.systemui.shared.clocks.FontUtils.toClockAxis import com.android.systemui.shared.clocks.view.FlexClockView import java.io.PrintWriter import java.util.Locale Loading Loading @@ -96,8 +100,8 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController largeClock.events.onZenDataChanged(data) } override fun onFontAxesChanged(axes: List<ClockFontAxisSetting>) { val fontAxes = getDefaultAxes(clockCtx.settings).merge(axes).map { it.toSetting() } override fun onFontAxesChanged(axes: ClockAxisStyle) { val fontAxes = ClockAxisStyle(getDefaultAxes(clockCtx.settings).merge(axes)) smallClock.events.onFontAxesChanged(fontAxes) largeClock.events.onFontAxesChanged(fontAxes) } Loading Loading @@ -162,66 +166,46 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController ), ) private val LEGACY_FLEX_SETTINGS = listOf( GSFAxes.WEIGHT.toClockAxisSetting(600f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(0f), private val LEGACY_FLEX_SETTINGS = ClockAxisStyle { put(GSFAxes.WEIGHT, 600f) put(GSFAxes.WIDTH, 100f) put(GSFAxes.ROUND, 100f) put(GSFAxes.SLANT, 0f) } private val PRESET_COUNT = 8 private val PRESET_WIDTH_INIT = 30f private val PRESET_WIDTH_STEP = 12.5f private val PRESET_WEIGHT_INIT = 800f private val PRESET_WEIGHT_STEP = -100f private val BASE_PRESETS: List<ClockAxisStyle> = run { val presets = mutableListOf<ClockAxisStyle>() var weight = PRESET_WEIGHT_INIT var width = PRESET_WIDTH_INIT for (i in 1..PRESET_COUNT) { presets.add( ClockAxisStyle { put(GSFAxes.WEIGHT, weight) put(GSFAxes.WIDTH, width) put(GSFAxes.ROUND, 0f) put(GSFAxes.SLANT, 0f) } ) val AXIS_PRESETS = listOf( FONT_AXES.map { it.toSetting() }, LEGACY_FLEX_SETTINGS, listOf( // Porcelain GSFAxes.WEIGHT.toClockAxisSetting(500f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Midnight GSFAxes.WEIGHT.toClockAxisSetting(300f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-10f), ), listOf( // Sterling GSFAxes.WEIGHT.toClockAxisSetting(1000f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Smoky Green GSFAxes.WEIGHT.toClockAxisSetting(150f), GSFAxes.WIDTH.toClockAxisSetting(50f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Iris GSFAxes.WEIGHT.toClockAxisSetting(500f), GSFAxes.WIDTH.toClockAxisSetting(100f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(0f), ), listOf( // Margarita GSFAxes.WEIGHT.toClockAxisSetting(300f), GSFAxes.WIDTH.toClockAxisSetting(30f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-10f), ), listOf( // Raspberry GSFAxes.WEIGHT.toClockAxisSetting(700f), GSFAxes.WIDTH.toClockAxisSetting(140f), GSFAxes.ROUND.toClockAxisSetting(100f), GSFAxes.SLANT.toClockAxisSetting(-7f), ), listOf( // Ultra Blue GSFAxes.WEIGHT.toClockAxisSetting(850f), GSFAxes.WIDTH.toClockAxisSetting(130f), GSFAxes.ROUND.toClockAxisSetting(0f), GSFAxes.SLANT.toClockAxisSetting(0f), ), weight += PRESET_WEIGHT_STEP width += PRESET_WIDTH_STEP } return@run presets } fun buildPresetGroup(resources: Resources, isRound: Boolean): AxisPresetConfig.Group { val round = if (isRound) GSFAxes.ROUND.maxValue else GSFAxes.ROUND.minValue return AxisPresetConfig.Group( presets = BASE_PRESETS.map { it.copy { put(GSFAxes.ROUND, round) } }, // TODO(b/395647577): Placeholder Icon; Replace or remove icon = resources.getDrawable(R.drawable.clock_default_thumbnail, null), ) } } }
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt +7 −12 Original line number Diff line number Diff line Loading @@ -25,16 +25,18 @@ import com.android.systemui.animation.GSFAxes import com.android.systemui.customization.R import com.android.systemui.plugins.clocks.AlarmData import com.android.systemui.plugins.clocks.ClockAnimations import com.android.systemui.plugins.clocks.ClockAxisStyle import com.android.systemui.plugins.clocks.ClockEvents import com.android.systemui.plugins.clocks.ClockFaceConfig import com.android.systemui.plugins.clocks.ClockFaceController import com.android.systemui.plugins.clocks.ClockFaceEvents import com.android.systemui.plugins.clocks.ClockFaceLayout import com.android.systemui.plugins.clocks.ClockFontAxisSetting import com.android.systemui.plugins.clocks.DefaultClockFaceLayout import com.android.systemui.plugins.clocks.ThemeConfig import com.android.systemui.plugins.clocks.WeatherData import com.android.systemui.plugins.clocks.ZenData import com.android.systemui.shared.clocks.FontUtils.get import com.android.systemui.shared.clocks.FontUtils.set import com.android.systemui.shared.clocks.ViewUtils.computeLayoutDiff import com.android.systemui.shared.clocks.view.FlexClockView import com.android.systemui.shared.clocks.view.HorizontalAlignment Loading Loading @@ -129,17 +131,10 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock: layerController.faceEvents.onThemeChanged(theme) } override fun onFontAxesChanged(settings: List<ClockFontAxisSetting>) { var axes = settings if (!isLargeClock) { axes = axes.map { axis -> if (axis.key == GSFAxes.WIDTH.tag && axis.value > SMALL_CLOCK_MAX_WDTH) { axis.copy(value = SMALL_CLOCK_MAX_WDTH) } else { axis } } override fun onFontAxesChanged(settings: ClockAxisStyle) { var axes = ClockAxisStyle(settings) if (!isLargeClock && axes[GSFAxes.WIDTH] > SMALL_CLOCK_MAX_WDTH) { axes[GSFAxes.WIDTH] = SMALL_CLOCK_MAX_WDTH } layerController.events.onFontAxesChanged(axes) Loading