public final class

WalletFragmentStyle

extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.wallet.fragment.WalletFragmentStyle

Class Overview

Defines attributes to customize the look and feel of WalletFragment, to be used in setFragmentStyle(WalletFragmentStyle). You may also specify these attributes using custom XML tags in a style resource and either add wallet:fragmentStyle="@style/MyWalletFragmentCustomStyle" to your <fragment> tag or pass the id of the style resource in setFragmentStyle(int).

See WalletFragmentDefaultStyle for an example of the wallet fragment style.

Summary

Nested Classes
@interface WalletFragmentStyle.BuyButtonAppearance Options for buy button appearance. 
@interface WalletFragmentStyle.BuyButtonText Options for text displayed on the buy button. 
@interface WalletFragmentStyle.Dimension Constants for specifying dimensions in WalletFragmentStyle
@interface WalletFragmentStyle.LogoImageType Logo image types. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<WalletFragmentStyle> CREATOR
Public Constructors
WalletFragmentStyle()
Public Methods
WalletFragmentStyle setBuyButtonAppearance(int buyButtonAppearance)
Sets the appearance of the buy button.
WalletFragmentStyle setBuyButtonHeight(int unit, float height)
Specifies a height for the buy button.
WalletFragmentStyle setBuyButtonHeight(int height)
Specifies a height for the buy button.
WalletFragmentStyle setBuyButtonText(int buyButtonText)
Sets text for the buy button.
WalletFragmentStyle setBuyButtonWidth(int width)
Specifies a width for the buy button.
WalletFragmentStyle setBuyButtonWidth(int unit, float width)
Specifies a width for the buy button.
WalletFragmentStyle setMaskedWalletDetailsBackgroundColor(int color)
Sets the color for the masked wallet details view background.
WalletFragmentStyle setMaskedWalletDetailsBackgroundResource(int resourceId)
Sets the drawable resource id for the masked wallet details view background.
WalletFragmentStyle setMaskedWalletDetailsButtonBackgroundColor(int color)
Sets the color for the masked wallet details "Change" button background.
WalletFragmentStyle setMaskedWalletDetailsButtonBackgroundResource(int resourceId)
Sets the drawable resource id for the masked wallet details "Change" button background.
WalletFragmentStyle setMaskedWalletDetailsButtonTextAppearance(int resourceId)
Sets the text appearance for the masked wallet details "Change" button text.
WalletFragmentStyle setMaskedWalletDetailsHeaderTextAppearance(int resourceId)
Sets text appearance for the headers describing masked wallet details.
WalletFragmentStyle setMaskedWalletDetailsLogoImageType(int imageType)
Sets the type of the wallet image logo in masked wallet details view.
WalletFragmentStyle setMaskedWalletDetailsLogoTextColor(int color)
This method is deprecated. Support for customizing this color will be removed in the future. Please, stop using this API.
WalletFragmentStyle setMaskedWalletDetailsTextAppearance(int resourceId)
Sets text appearance for the masked wallet details.
WalletFragmentStyle setStyleResourceId(int id)
Sets resource id of the style which will be used to customize wallet fragment UI.
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<WalletFragmentStyle> CREATOR

Public Constructors

public WalletFragmentStyle ()

Public Methods

public WalletFragmentStyle setBuyButtonAppearance (int buyButtonAppearance)

Sets the appearance of the buy button. See WalletFragmentStyle.BuyButtonAppearance for the list of possible values. Defaults to ANDROID_PAY_DARK. This will override the buy button appearance defined in any style passed in setStyleResourceId(int).

Parameters
buyButtonAppearance int: appearance of the buy button
Returns
WalletFragmentStyle

public WalletFragmentStyle setBuyButtonHeight (int unit, float height)

Specifies a height for the buy button. The height includes a padding of 8dp (4dp on each side). The padding is used for a border around the button in pressed and focused states. The range of height supported is 40dp~72dp. This will override the buy button height defined in any style passed in setStyleResourceId(int).

Parameters
unit int: unit of the height value. See constants starting with UNIT_ in WalletFragmentStyle.Dimension for a list of supported units
height float: value of the height
Returns
WalletFragmentStyle

public WalletFragmentStyle setBuyButtonHeight (int height)

Specifies a height for the buy button. The height includes a padding of 8dp (4dp on each side). The padding is used for a border around the button in pressed and focused states. The range of height supported is 40dp~72dp. This will override the buy button height defined in any style passed in setStyleResourceId(int).

Parameters
height int: height in pixels, or MATCH_PARENT, WRAP_CONTENT
Returns
WalletFragmentStyle

public WalletFragmentStyle setBuyButtonText (int buyButtonText)

Sets text for the buy button. This will override the buy button text defined in any style passed in setStyleResourceId(int). See WalletFragmentStyle.BuyButtonText for the list of possible values. Defaults to BUY_WITH.

Parameters
buyButtonText int: text on the buy button
Returns
WalletFragmentStyle

public WalletFragmentStyle setBuyButtonWidth (int width)

Specifies a width for the buy button. The width includes a padding of 8dp (4dp on each side). The padding is used for a border around the button in pressed and focused states. A minimum width is enforced, and is computed from the height of the button and the width of the button text. This will override the buy button width defined in any style passed in setStyleResourceId(int).

Parameters
width int: width in pixels, or MATCH_PARENT, WRAP_CONTENT
Returns
WalletFragmentStyle

public WalletFragmentStyle setBuyButtonWidth (int unit, float width)

Specifies a width for the buy button. The width includes a padding of 8dp (4dp on each side). The padding is used for a border around the button in pressed and focused states. A minimum width is enforced, and is computed from the height of the button and the width of the button text. This will override the buy button width defined in any style passed in setStyleResourceId(int).

Parameters
unit int: unit of the width value. See constants starting with UNIT_ in WalletFragmentStyle.Dimension for a list of supported units
width float: value of the width
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsBackgroundColor (int color)

Sets the color for the masked wallet details view background. This will override the color defined in any style passed in setStyleResourceId(int) and background drawable which was previously set.

Parameters
color int: the color as defined in android.graphics.Color
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsBackgroundResource (int resourceId)

Sets the drawable resource id for the masked wallet details view background. This will override the drawable defined in any style passed in setStyleResourceId(int) and background color which was previously set.

Parameters
resourceId int: the id of the drawable resource.
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsButtonBackgroundColor (int color)

Sets the color for the masked wallet details "Change" button background. This will override the background defined in any style passed in setStyleResourceId(int) and drawable resource id which was previously set for button background.

Parameters
color int: the color as defined in android.graphics.Color
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsButtonBackgroundResource (int resourceId)

Sets the drawable resource id for the masked wallet details "Change" button background. This will override the background defined in any style passed in setStyleResourceId(int) and color previously set for the button background.

Parameters
resourceId int: the id of the drawable resource.
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsButtonTextAppearance (int resourceId)

Sets the text appearance for the masked wallet details "Change" button text. This will override the text appearance defined in any style passed in setStyleResourceId(int).

Parameters
resourceId int: the id of a TextAppearance style
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsHeaderTextAppearance (int resourceId)

Sets text appearance for the headers describing masked wallet details. This will override the text appearance defined in any style passed in setStyleResourceId(int).

Parameters
resourceId int: the id of a TextAppearance style
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsLogoImageType (int imageType)

Sets the type of the wallet image logo in masked wallet details view. See WalletFragmentStyle.LogoImageType for the list of possible values. Defaults to ANDROID_PAY. This will override the image type defined in any style passed in setStyleResourceId(int).

Parameters
imageType int: the type of the logo image.
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsLogoTextColor (int color)

This method is deprecated.
Support for customizing this color will be removed in the future. Please, stop using this API.

Sets the color for the masked wallet details logo text. This will override the text color defined in any style passed in setStyleResourceId(int).

Note: Not all WalletFragmentStyle.LogoImageTypes support this customization, so this value may be ignored depending on the logo type set using setMaskedWalletDetailsLogoImageType(int).

Parameters
color int: the color as defined in android.graphics.Color
Returns
WalletFragmentStyle

public WalletFragmentStyle setMaskedWalletDetailsTextAppearance (int resourceId)

Sets text appearance for the masked wallet details. This will override the text appearance defined in any style passed in setStyleResourceId(int).

Parameters
resourceId int: the id of a TextAppearance style
Returns
WalletFragmentStyle

public WalletFragmentStyle setStyleResourceId (int id)

Sets resource id of the style which will be used to customize wallet fragment UI. If not set explicitly the default style WalletFragmentDefaultStyle will be used. In most cases you will need to customize the style of the wallet fragment so that the UI of the fragment better matches the UI of the application.

Parameters
id int: id of a style defined in xml
Returns
WalletFragmentStyle

public void writeToParcel (Parcel dest, int flags)

Parameters
dest Parcel
flags int