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

ComplicationStyle

public class ComplicationStyle
extends Object

java.lang.Object
   ↳ androidx.wear.watchface.complications.rendering.ComplicationStyle


Defines attributes to customize appearance of rendered ComplicationData.

Summary

Constants

int BORDER_RADIUS_DEFAULT

Default border radius.

int BORDER_STYLE_DASHED

Style where the borders are drawn as dashed lines.

int BORDER_STYLE_NONE

Style where the borders are not drawn.

int BORDER_STYLE_SOLID

Style where the borders are drawn without any gap.

Public constructors

ComplicationStyle()
ComplicationStyle(ComplicationStyle style)

Public methods

int getBackgroundColor()

Returns the background color to be used.

Drawable getBackgroundDrawable()

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

int getBorderColor()

Returns the border color.

int getBorderDashGap()

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

int getBorderDashWidth()

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

int getBorderRadius()

Returns the border radius.

int getBorderStyle()
int getBorderWidth()

Returns the border width.

int getHighlightColor()

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

int getIconColor()

Returns the color for tinting icons.

ColorFilter getImageColorFilter()

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

int getRangedValuePrimaryColor()

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

int getRangedValueRingWidth()

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

int getRangedValueSecondaryColor()

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

int getTextColor()

Returns the text color.

int getTextSize()

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

Typeface getTextTypeface()

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

int getTitleColor()

Returns the title color.

int getTitleSize()

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

Typeface getTitleTypeface()

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

void setBackgroundColor(int backgroundColor)

Sets the background color.

void setBackgroundDrawable(Drawable backgroundDrawable)

Sets the Drawable to render in the background.

void setBorderColor(int borderColor)

Sets the color to render the complication border with.

void setBorderDashGap(int borderDashGap)

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

void setBorderDashWidth(int borderDashWidth)

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

void setBorderRadius(int borderRadius)

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

void setBorderStyle(int borderStyle)

Sets the style to render the complication border with.

void setBorderWidth(int borderWidth)

Sets the width to render the complication border with.

void setHighlightColor(int highlightColor)

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

void setIconColor(int iconColor)

Sets the color for tinting the icon with.

void setImageColorFilter(ColorFilter colorFilter)

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

void setRangedValuePrimaryColor(int rangedValuePrimaryColor)

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

void setRangedValueRingWidth(int rangedValueRingWidth)

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

void setRangedValueSecondaryColor(int rangedValueSecondaryColor)

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

void setTextColor(int textColor)

Sets the color to render the text with.

void setTextSize(int textSize)

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

void setTextTypeface(Typeface textTypeface)

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

void setTitleColor(int titleColor)

Sets the color to render the title with.

void setTitleSize(int titleSize)

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

void setTitleTypeface(Typeface titleTypeface)

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

Inherited methods

Constants

BORDER_RADIUS_DEFAULT

public static final int BORDER_RADIUS_DEFAULT

Default border radius.

Constant Value: 2147483647 (0x7fffffff)

BORDER_STYLE_DASHED

public static final int BORDER_STYLE_DASHED

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.

Constant Value: 2 (0x00000002)

BORDER_STYLE_NONE

public static final int BORDER_STYLE_NONE

Style where the borders are not drawn.

Constant Value: 0 (0x00000000)

BORDER_STYLE_SOLID

public static final int BORDER_STYLE_SOLID

Style where the borders are drawn without any gap.

Constant Value: 1 (0x00000001)

Public constructors

ComplicationStyle

public ComplicationStyle ()

ComplicationStyle

public ComplicationStyle (ComplicationStyle style)

Parameters
style ComplicationStyle

Public methods

getBackgroundColor

public int getBackgroundColor ()

Returns the background color to be used.

Returns
int

getBackgroundDrawable

public Drawable getBackgroundDrawable ()

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

Returns
Drawable

getBorderColor

public int getBorderColor ()

Returns the border color.

Returns
int

getBorderDashGap

public int getBorderDashGap ()

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

Returns
int

getBorderDashWidth

public int getBorderDashWidth ()

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

Returns
int

getBorderRadius

public int getBorderRadius ()

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

Returns
int

getBorderStyle

public int getBorderStyle ()

Returns
int

getBorderWidth

public int getBorderWidth ()

Returns the border width.

Returns
int

getHighlightColor

public int getHighlightColor ()

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

Returns
int

getIconColor

public int getIconColor ()

Returns the color for tinting icons.

Returns
int

getImageColorFilter

public ColorFilter getImageColorFilter ()

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

Returns
ColorFilter

getRangedValuePrimaryColor

public int getRangedValuePrimaryColor ()

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

Returns
int

getRangedValueRingWidth

public int getRangedValueRingWidth ()

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

Returns
int

getRangedValueSecondaryColor

public int getRangedValueSecondaryColor ()

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

Returns
int

getTextColor

public int getTextColor ()

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

Returns
int

getTextSize

public int getTextSize ()

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

Returns
int

getTextTypeface

public Typeface getTextTypeface ()

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

Returns
Typeface

getTitleColor

public int getTitleColor ()

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

Returns
int

getTitleSize

public int getTitleSize ()

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

Returns
int

getTitleTypeface

public Typeface getTitleTypeface ()

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

Returns
Typeface

setBackgroundColor

public void setBackgroundColor (int backgroundColor)

Sets the background color.

Parameters
backgroundColor int: The color to set

setBackgroundDrawable

public void setBackgroundDrawable (Drawable backgroundDrawable)

Sets the Drawable to render in the background.

Parameters
backgroundDrawable Drawable: The Drawable to render in the background

setBorderColor

public void setBorderColor (int borderColor)

Sets the color to render the complication border with.

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

setBorderDashGap

public void setBorderDashGap (int borderDashGap)

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

public void setBorderDashWidth (int borderDashWidth)

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

public void setBorderRadius (int borderRadius)

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

public void setBorderStyle (int borderStyle)

Sets the style to render the complication border with.

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

setBorderWidth

public void setBorderWidth (int borderWidth)

Sets the width to render the complication border with.

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

setHighlightColor

public void setHighlightColor (int highlightColor)

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

public void setIconColor (int iconColor)

Sets the color for tinting the icon with.

Parameters
iconColor int: The color to render the icon with

setImageColorFilter

public void setImageColorFilter (ColorFilter colorFilter)

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

public void setRangedValuePrimaryColor (int rangedValuePrimaryColor)

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

public void setRangedValueRingWidth (int rangedValueRingWidth)

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

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

setRangedValueSecondaryColor

public void setRangedValueSecondaryColor (int rangedValueSecondaryColor)

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

public void setTextColor (int textColor)

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

public void setTextSize (int textSize)

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

public void setTextTypeface (Typeface textTypeface)

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

Parameters
textTypeface Typeface: The Typeface to render the text with

setTitleColor

public void setTitleColor (int titleColor)

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

public void setTitleSize (int titleSize)

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

public void setTitleTypeface (Typeface titleTypeface)

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

Parameters
titleTypeface Typeface: The Typeface to render the title with