Google is committed to advancing racial equity for Black communities. See how.

ComplicationStyle

open class ComplicationStyle
kotlin.Any
   ↳ androidx.wear.watchface.complications.rendering.ComplicationStyle

Defines attributes to customize appearance of rendered .

Summary

Constants
static Int

Default border radius.

static Int

Style where the borders are drawn as dashed lines.

static Int

Style where the borders are not drawn.

static Int

Style where the borders are drawn without any gap.

Public constructors

<init>(@NonNull style: ComplicationStyle)

Public methods
open Int

Returns the background color to be used.

open Drawable?

Returns the background drawable to be used, or null if there's no background drawable.

open Int

Returns the border color.

open Int

Returns the dash gap to be used when drawing borders of type BORDER_STYLE_DASHED.

open Int

Returns the dash width to be used when drawing borders of type BORDER_STYLE_DASHED.

open Int

Returns the border radius.

open Int

open Int

Returns the border width.

open Int

Returns the highlight color to be used when the complication is highlighted.

open Int

Returns the color for tinting icons.

open ColorFilter?

Returns the color filter to be used when rendering small and large images, or null if there's no color filter.

open Int

Returns the color to be used when rendering first part of ranged value indicator.

open Int

Returns the ring width to be used when rendering ranged value indicator.

open Int

Returns the color to be used when rendering second part of ranged value indicator.

open Int

Returns the text color.

open Int

Returns the text size to be used for short and long text.

open Typeface?

Returns the typeface to be used for short and long text.

open Int

Returns the title color.

open Int

Returns the text size to be used for short and long title.

open Typeface?

Returns the typeface to be used for short and long title.

open Unit
setBackgroundColor(@ColorInt backgroundColor: Int)

Sets the background color.

open Unit
setBackgroundDrawable(@Nullable backgroundDrawable: Drawable?)

Sets the Drawable to render in the background.

open Unit
setBorderColor(@ColorInt borderColor: Int)

Sets the color to render the complication border with.

open Unit
setBorderDashGap(borderDashGap: Int)

Sets the dash gap render the complication border with when drawing borders with style BORDER_STYLE_DASHED.

open Unit
setBorderDashWidth(borderDashWidth: Int)

Sets dash widths to render the complication border with when drawing borders with style BORDER_STYLE_DASHED.

open Unit
setBorderRadius(borderRadius: Int)

Sets the border radius to be applied to the corners of the bounds of the complication in active mode.

open Unit
setBorderStyle(borderStyle: Int)

Sets the style to render the complication border with.

open Unit
setBorderWidth(borderWidth: Int)

Sets the width to render the complication border with.

open Unit
setHighlightColor(@ColorInt highlightColor: Int)

Sets the background color to use when the complication is highlighted.

open Unit
setIconColor(@ColorInt iconColor: Int)

Sets the color for tinting the icon with.

open Unit
setImageColorFilter(@Nullable colorFilter: ColorFilter?)

Sets the color filter used in active mode when rendering large images and small images with style ComplicationData#IMAGE_STYLE_PHOTO.

open Unit
setRangedValuePrimaryColor(@ColorInt rangedValuePrimaryColor: Int)

Sets the main color to render the ranged value text with.

open Unit
setRangedValueRingWidth(rangedValueRingWidth: Int)

Sets the stroke width used when rendering the ranged value indicator.

open Unit
setRangedValueSecondaryColor(@ColorInt rangedValueSecondaryColor: Int)

Sets the secondary color to render the ranged value text with.

open Unit
setTextColor(@ColorInt textColor: Int)

Sets the color to render the text with.

open Unit
setTextSize(textSize: Int)

Sets the size of the text to use when rendering short text and long text fields.

open Unit
setTextTypeface(@NonNull textTypeface: Typeface)

Sets Typeface to use when rendering short text and long text fields.

open Unit
setTitleColor(@ColorInt titleColor: Int)

Sets the color to render the title with.

open Unit
setTitleSize(titleSize: Int)

Sets the size of the title text to use when rendering short text and long text fields.

open Unit
setTitleTypeface(@NonNull titleTypeface: Typeface)

Sets the Typeface to render the title for short and long text with.

Constants

BORDER_RADIUS_DEFAULT

static val BORDER_RADIUS_DEFAULT: Int

Default border radius.

Value: Integer.MAX_VALUE

BORDER_STYLE_DASHED

static val BORDER_STYLE_DASHED: Int

Style where the borders are drawn as dashed lines. If this is set as current border style, dash width and dash gap should also be set via setBorderDashWidth(int), setBorderDashGap(int) or XML attributes, or default values will be used.

Value: 2

BORDER_STYLE_NONE

static val BORDER_STYLE_NONE: Int

Style where the borders are not drawn.

Value: 0

BORDER_STYLE_SOLID

static val BORDER_STYLE_SOLID: Int

Style where the borders are drawn without any gap.

Value: 1

Public constructors

<init>

ComplicationStyle()

<init>

ComplicationStyle(@NonNull style: ComplicationStyle)

Public methods

getBackgroundColor

@ColorInt open fun getBackgroundColor(): Int

Returns the background color to be used.

getBackgroundDrawable

@Nullable open fun getBackgroundDrawable(): Drawable?

Returns the background drawable to be used, or null if there's no background drawable.

getBorderColor

@ColorInt open fun getBorderColor(): Int

Returns the border color.

getBorderDashGap

open fun getBorderDashGap(): Int

Returns the dash gap to be used when drawing borders of type BORDER_STYLE_DASHED.

getBorderDashWidth

open fun getBorderDashWidth(): Int

Returns the dash width to be used when drawing borders of type BORDER_STYLE_DASHED.

getBorderRadius

open fun getBorderRadius(): Int

Returns the border radius. If ComplicationStyle#BORDER_RADIUS_DEFAULT is returned, border radius should be reduced to half of the minimum of width or height during the rendering.

getBorderStyle

open fun getBorderStyle(): Int

getBorderWidth

open fun getBorderWidth(): Int

Returns the border width.

getHighlightColor

@ColorInt open fun getHighlightColor(): Int

Returns the highlight color to be used when the complication is highlighted.

getIconColor

@ColorInt open fun getIconColor(): Int

Returns the color for tinting icons.

getImageColorFilter

@Nullable open fun getImageColorFilter(): ColorFilter?

Returns the color filter to be used when rendering small and large images, or null if there's no color filter.

getRangedValuePrimaryColor

@ColorInt open fun getRangedValuePrimaryColor(): Int

Returns the color to be used when rendering first part of ranged value indicator.

getRangedValueRingWidth

open fun getRangedValueRingWidth(): Int

Returns the ring width to be used when rendering ranged value indicator.

getRangedValueSecondaryColor

@ColorInt open fun getRangedValueSecondaryColor(): Int

Returns the color to be used when rendering second part of ranged value indicator.

getTextColor

@ColorInt open fun getTextColor(): Int

Returns the text color. Text color should be used for short and long text.

getTextSize

open fun getTextSize(): Int

Returns the text size to be used for short and long text.

getTextTypeface

@Nullable open fun getTextTypeface(): Typeface?

Returns the typeface to be used for short and long text.

getTitleColor

@ColorInt open fun getTitleColor(): Int

Returns the title color. Title color should be used for short and long title.

getTitleSize

open fun getTitleSize(): Int

Returns the text size to be used for short and long title.

getTitleTypeface

@Nullable open fun getTitleTypeface(): Typeface?

Returns the typeface to be used for short and long title.

setBackgroundColor

open fun setBackgroundColor(@ColorInt backgroundColor: Int): Unit

Sets the background color.

Parameters
backgroundColor Int: The color to set

setBackgroundDrawable

open fun setBackgroundDrawable(@Nullable backgroundDrawable: Drawable?): Unit

Sets the Drawable to render in the background.

Parameters
backgroundDrawable Drawable?: The Drawable to render in the background

setBorderColor

open fun setBorderColor(@ColorInt borderColor: Int): Unit

Sets the color to render the complication border with.

Parameters
borderColor Int: The color to render the complication border with

setBorderDashGap

open fun setBorderDashGap(borderDashGap: Int): Unit

Sets the dash gap render the complication border with when drawing borders with style BORDER_STYLE_DASHED.

Parameters
borderDashGap Int: The dash gap render the complication border with

setBorderDashWidth

open fun setBorderDashWidth(borderDashWidth: Int): Unit

Sets dash widths to render the complication border with when drawing borders with style BORDER_STYLE_DASHED.

Parameters
borderDashWidth Int: The dash widths to render the complication border with

setBorderRadius

open fun setBorderRadius(borderRadius: Int): Unit

Sets the border radius to be applied to the corners of the bounds of the complication in active mode. Border radius will be limited to the half of width or height, depending on which one is smaller.

Parameters
borderRadius Int: The radius to render the complication border with

setBorderStyle

open fun setBorderStyle(borderStyle: Int): Unit

Sets the style to render the complication border with.

Parameters
borderStyle Int: The style to render the complication border with

setBorderWidth

open fun setBorderWidth(borderWidth: Int): Unit

Sets the width to render the complication border with.

Parameters
borderWidth Int: The width to render the complication border with

setHighlightColor

open fun setHighlightColor(@ColorInt highlightColor: Int): Unit

Sets the background color to use when the complication is highlighted.

Parameters
highlightColor Int: The background color to use when the complication is highlighted

setIconColor

open fun setIconColor(@ColorInt iconColor: Int): Unit

Sets the color for tinting the icon with.

Parameters
iconColor Int: The color to render the icon with

setImageColorFilter

open fun setImageColorFilter(@Nullable colorFilter: ColorFilter?): Unit

Sets the color filter used in active mode when rendering large images and small images with style ComplicationData#IMAGE_STYLE_PHOTO.

Parameters
colorFilter ColorFilter?: The ColorFilter to use

setRangedValuePrimaryColor

open fun setRangedValuePrimaryColor(@ColorInt rangedValuePrimaryColor: Int): Unit

Sets the main color to render the ranged value text with.

Parameters
rangedValuePrimaryColor Int: The main color to render the ranged value text with

setRangedValueRingWidth

open fun setRangedValueRingWidth(rangedValueRingWidth: Int): Unit

Sets the stroke width used when rendering the ranged value indicator.

Parameters
rangedValueRingWidth Int: The width to render the ranged value ring with

setRangedValueSecondaryColor

open fun setRangedValueSecondaryColor(@ColorInt rangedValueSecondaryColor: Int): Unit

Sets the secondary color to render the ranged value text with.

Parameters
rangedValueSecondaryColor Int: The secondary color to render the ranged value text with

setTextColor

open fun setTextColor(@ColorInt textColor: Int): Unit

Sets the color to render the text with. Text color is used for rendering short text and long text fields.

Parameters
textColor Int: The color to render the text with

setTextSize

open fun setTextSize(textSize: Int): Unit

Sets the size of the text to use when rendering short text and long text fields.

Parameters
textSize Int: The size of the text=

setTextTypeface

open fun setTextTypeface(@NonNull textTypeface: Typeface): Unit

Sets Typeface to use when rendering short text and long text fields.

Parameters
textTypeface Typeface: The Typeface to render the text with

setTitleColor

open fun setTitleColor(@ColorInt titleColor: Int): Unit

Sets the color to render the title with. Title color is used for rendering short title and long title fields.

Parameters
titleColor Int: The color to render the title with

setTitleSize

open fun setTitleSize(titleSize: Int): Unit

Sets the size of the title text to use when rendering short text and long text fields.

Parameters
titleSize Int: The size of the title text=

setTitleTypeface

open fun setTitleTypeface(@NonNull titleTypeface: Typeface): Unit

Sets the Typeface to render the title for short and long text with.

Parameters
titleTypeface Typeface: The Typeface to render the title with