Object

TimeTextDefaults

Contains the default values used by TimeText.

Source set: Android
public object TimeTextDefaults

Contains the default values used by TimeText.

Properties

TimeFormat24Hours

Source set: Android
public val TimeFormat24Hours: String

Default format for 24h clock.

TimeFormat12Hours

Source set: Android
public val TimeFormat12Hours: String

Default format for 12h clock.

MaxSweepAngle

Source set: Android
public val MaxSweepAngle: Float

The default maximum sweep angle in degrees used by TimeText.

This is calculated by keeping the length of the corresponding chord on the circle to be approximately 57% of the screen width.

ContentPadding

Source set: Android
public val ContentPadding: PaddingValues

The default content padding used by TimeText.

Functions

timeFormat

@Composable
public fun timeFormat(): String

Retrieves default timeFormat for the device. Depending on settings, it can be either 12h or 24h format.

timeTextStyle

@Composable
public fun timeTextStyle(
    background: Color = Color.Unspecified,
    color: Color = MaterialTheme.colorScheme.onBackground.setLuminance(80f),
    fontSize: TextUnit = TextUnit.Unspecified,
): CurvedTextStyle

Creates a CurvedTextStyle with default parameters used for showing time. By default a copy of MaterialTheme.typography.arcMedium style is created.

Parameters

background The background color.
color The main color.
fontSize The font size.

rememberTimeSource

@Composable
public fun rememberTimeSource(timeFormat: String): TimeSource

Creates a default implementation of TimeSource and remembers it. Once the system time changes, it triggers an update of the TimeSource.currentTime which is formatted using timeFormat param.

DefaultTimeSource for Android uses android.text.format.DateFormat timeFormat should follow the standard Date and Time patterns Examples: "h:mm a" - 12:08 PM "yyyy.MM.dd HH:mm:ss" - 2021.11.01 14:08:56 More examples can be found here.

Parameters

timeFormat Date and time string pattern.

backgroundColor

@Composable public fun backgroundColor(): Color

The recommended background color to use when displaying curved text so it is visible on top of other content.

Last updated: