目录

Constant Summary

Type Name Desc
int COLOR_POLICY_BLUE Blue button.
int COLOR_POLICY_RED Red button.
int COLOR_POLICY_WHITE White button.
int COLOR_POLICY_WHITE_WITH_BORDER White button with strokes.
int COLOR_POLICY_BLACK Black button.
int COLOR_POLICY_GRAY Gray button.
int THEME_NO_TITLE Button without any title.
int THEME_FULL_TITLE Button with an icon and a title.
int CORNER_RADIUS_LARGE Button with large rounded corners.
int CORNER_RADIUS_MEDIUM Button with medium-sized rounded corners.
int CORNER_RADIUS_SMALL Button with small rounded corners.

Public Constructor Summary

Constructor name

HuaweiIdAuthButton(Context context)

Creates a HuaweiIdAuthButton instance.

HuaweiIdAuthButton(Context context, AttributeSet attributeSet)

Creates a HuaweiIdAuthButton instance.

HuaweiIdAuthButton(Context context, AttributeSet attributeSet, int defStyleAttr)

Creates a HuaweiIdAuthButton instance. The default style can be specified.

Public Method Summary

Return type Method name
void

performClick()

Triggers a tap event.

void

setColorPolicy(int colorPolicy)

Sets a color scheme.

void

setEnabled(boolean flag)

Sets whether a button can be tapped.

void

setOnClickListener(View.OnClickListener onClickListener)

Sets a tap event listener.

void

setTheme(int theme)

Sets the theme of HuaweiIdAuthButton.

void

setUIMode(int theme, int colorPolicy, int cornerRadius)

Sets the theme, color scheme and radius of a rounded corner of HuaweiIdAuthButton.

void

setCornerRadius(int cornerRadiusPx)

Sets the radius of the rounded corner. The unit is px. The radius can be a constant value CORNER_RADIUS_LARGE, CORNER_RADIUS_MEDIUM, or CORNER_RADIUS_SMALL.

int

getTheme()

Obtains the button theme.

int

getColorPolicy()

Obtains the color scheme.

int

getCornerRadius()

Obtains the radius of a rounded corner. The unit is px. The radius can be a constant value CORNER_RADIUS_LARGE, CORNER_RADIUS_MEDIUM, or CORNER_RADIUS_SMALL.

Constants

Constant
public static final int COLOR_POLICY_BLUE

This constant indicates that the color scheme of HuaweiIdAuthButton is blue.

Constant value: 0

Constant
public static final int COLOR_POLICY_RED

This constant indicates that the color scheme of HuaweiIdAuthButton is red.

Constant value: 1

Constant
public static final int COLOR_POLICY_WHITE

This constant indicates that the color scheme of HuaweiIdAuthButton is white.

Constant value: 2

Constant
public static final int COLOR_POLICY_WHITE_WITH_BORDER

This constant indicates that the color scheme of HuaweiIdAuthButton is white with strokes.

Constant value: 3

Constant
public static final int COLOR_POLICY_BLACK

This constant indicates that the color scheme of HuaweiIdAuthButton is black.

Constant value: 4

Constant
public static final int COLOR_POLICY_GRAY

This constant indicates that the color scheme of HuaweiIdAuthButton is gray.

Constant value: 5

Constant
public static final int THEME_NO_TITLE

This constant indicates that the theme of HuaweiIdAuthButton does not contain any title.

Constant value: 0

Constant
public static final int THEME_FULL_TITLE

This constant indicates that the HuaweiIdAuthButton theme contains an icon and a title.

Constant value: 1

Constant
public static final int CORNER_RADIUS_LARGE

This constant indicates HuaweiIdAuthButton uses large rounded corners.

Constant value: -1

Constant
public static final int CORNER_RADIUS_MEDIUM

This constant indicates HuaweiIdAuthButton uses medium-sized rounded corners.

Constant value: -2

Constant
public static final int CORNER_RADIUS_SMALL

This constant indicates HuaweiIdAuthButton uses small rounded corners.

Constant value: -3

Public Constructors

HuaweiIdAuthButton(Context context)

Constructor for creating a HuaweiIdAuthButton instance.


Parameters

Parameter name Parameter desc
context Context for which a HuaweiIdAuthButton instance is to be created.
constructor
HuaweiIdAuthButton(Context context, AttributeSet attributeSet)
Creates a HuaweiIdAuthButton instance.

Parameters

Parameter name Parameter desc
context Context for which a HuaweiIdAuthButton instance is to be created.
attributeSet Custom view attribute in the XML layout file.
constructor
HuaweiIdAuthButton(Context context, AttributeSet attributeSet, int defStyleAttr)
Creates a HuaweiIdAuthButton instance. The default style can be specified.

Parameters

Parameter name Parameter desc
context Context for which a HuaweiIdAuthButton instance is to be created.
attributeSet Custom view attribute in the XML layout file.
defStyleAttr Attribute in the current theme, which provides a reference to a style resource that contains default settings for the view. The value 0 indicates that no default settings are defined for the view.

Public Method Summary

Method
public void performClick()
Triggers a tap event.

Method
public void setColorPolicy(int colorPolicy)
Sets a color scheme.

Parameters

Parameter name Parameter desc
colorPolicy Color scheme.
Method
public void setEnabled(boolean flag)
Sets whether a button can be tapped.

Parameters

Parameter name Parameter desc
flag Indicates whether a button can be tapped. Two options are available: true (yes) and false (no).
Method
public void setOnClickListener(View.OnClickListener onClickListener)
Sets a tap event listener.

Parameters

Parameter name Parameter desc
onClickListener Tap event listener.

Method
public void setTheme(int theme)
Sets the theme of HuaweiIdAuthButton.

Parameters

Parameter name Parameter desc
theme Theme.
Method
public void setUIMode(int theme, int colorPolicy, int cornerRadius)
Sets the theme, size, color scheme and radius of a rounded corner of HuaweiIdAuthButton.

Parameters

Parameter name Parameter desc
theme Theme.
colorPolicy Color scheme.
cornerRadius Radius of the rounded corner.
Method
public void setCornerRadius(int cornerRadiusPx)

Sets the radius of the rounded corner. The unit is px. The radius can be a constant value CORNER_RADIUS_LARGE, CORNER_RADIUS_MEDIUM, or CORNER_RADIUS_SMALL.

Parameters

cornerRadiusPx Radius of the rounded corner.
Method
public int getTheme()
Obtains the theme of HuaweiIdAuthButton.
Method
public int getColorPolicy()
Obtains the color scheme.
Method
public int getCornerRadius()
Obtains the radius of a rounded corner. The unit is px. The radius can be a constant value CORNER_RADIUS_LARGE, CORNER_RADIUS_MEDIUM, or CORNER_RADIUS_SMALL.