Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d6b0065 authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Android (Google) Code Review
Browse files

Merge "Default Clock Font Axis Presets" into main

parents badfb594 a9e9abeb
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -28,6 +28,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.getDefaultAxes

private val TAG = DefaultClockProvider::class.simpleName
@@ -98,16 +99,16 @@ class DefaultClockProvider(
            throw IllegalArgumentException("${settings.clockId} is unsupported by $TAG")
        }

        val fontAxes =
            if (!isClockReactiveVariantsEnabled) listOf()
            else 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,
            axes =
                if (!isClockReactiveVariantsEnabled) emptyList()
                else getDefaultAxes(settings).merge(settings.axes),
            axisPresets = if (!isClockReactiveVariantsEnabled) emptyList() else AXIS_PRESETS,
        )
    }

+55 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController
            listOf(
                GSFAxes.WEIGHT.toClockAxis(
                    type = AxisType.Float,
                    currentValue = 400f,
                    currentValue = 475f,
                    name = "Weight",
                    description = "Glyph Weight",
                ),
@@ -161,5 +161,59 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController
                GSFAxes.ROUND.toClockAxisSetting(100f),
                GSFAxes.SLANT.toClockAxisSetting(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),
                ),
            )
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ constructor(

    /** Font axes that can be modified on this clock */
    val axes: List<ClockFontAxis> = listOf(),

    /** List of font presets for this clock. Can be assigned directly. */
    val axisPresets: List<List<ClockFontAxisSetting>> = listOf(),
)

/** Represents an Axis that can be modified */