public class

PersistentFooter

extends ConstraintLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.constraintlayout.widget.ConstraintLayout
         ↳ com.sap.cloud.mobile.fiori.footer.PersistentFooter

Class Overview

A footer with 1-2 buttons (labeled primary and secondary), where the primary button is constrained to the end of the view. The primary button is emphasized by default.

There are 2 PersistentFooter.ActionMode modes that determine how the footer should be laid out: 1. RELATED_ACTIONS which group the buttons together at the end of the view. 2. OPPOSING_ACTIONS which align the buttons on opposite ends of each other.

Summary

Nested Classes
enum PersistentFooter.ActionMode  
XML Attributes
Attribute Name Related Method Description
PersistentFooter_actionMode  
PersistentFooter_dividerEnabled  
PersistentFooter_footerButtonStyleDefault  
PersistentFooter_footerButtonStyleEmphasized  
PersistentFooter_isPrimaryButtonEmphasized  
PersistentFooter_primaryButtonText  
PersistentFooter_primaryButtonTextAppearance  
PersistentFooter_secondaryButtonEnabled  
PersistentFooter_secondaryButtonText  
PersistentFooter_secondaryButtonTextAppearance  
Constants
int MAX_ACTIONS
[Expand]
Inherited Constants
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.ViewGroup
From class android.view.View
Fields
protected Integer mDefaultButtonTint
protected Integer mEmphasizedButtonTint
protected MaterialButton mPrimaryButton
protected int mPrimaryButtonTextAppearance
protected MaterialButton mSecondaryButton
protected int mSecondaryButtonTextAppearance
[Expand]
Inherited Fields
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.View
Public Constructors
PersistentFooter(Context context)
PersistentFooter(Context context, AttributeSet attrs)
PersistentFooter(Context context, AttributeSet attrs, int defStyleAttr)
PersistentFooter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
PersistentFooter.ActionMode getActionMode()
Get the action mode, visible only for testing.
View.OnClickListener getPrimaryActionClickListener()
CharSequence getPrimaryText()
View.OnClickListener getSecondaryActionClickListener()
CharSequence getSecondaryText()
boolean isDividerEnabled()
boolean isIsPrimaryEmphasized()
boolean isSecondaryEnabled()
void setActionMode(PersistentFooter.ActionMode actionMode)
Sets the action mode.
void setDividerEnabled(boolean isEnabled)
Enables/Disables the divider.
void setFooterButtonStyleDefault(int style)
Set the default button style for non-emphasized buttons.
void setFooterButtonStyleEmphasized(int style)
Set the button style for emphasized buttons.
void setOpposingActionsCenterAlignedEnabled(boolean isCenterAlignedEnabled)
For tablet only, set the footers opposing-action layout to be center aligned.
void setPrimaryActionClickListener(View.OnClickListener listener)
Set a callback listener for when the primary button is clicked.
void setPrimaryActionEmphasized(boolean isEmphasized)
A primary action can be emphasized by using a contained button.
void setPrimaryText(CharSequence primaryText)
void setPrimaryTextAppearance(int textAppearance)
void setSecondaryActionClickListener(View.OnClickListener listener)
Set a callback listener for when the secondary button is clicked.
void setSecondaryEnabled(boolean isEnabled)
Enables/disables the secondary action.
void setSecondaryText(CharSequence secondaryText)
void setSecondaryTextAppearance(int textAppearance)
void swapButtons()
Swaps the positions of the buttons while staying consistent with: 1.
[Expand]
Inherited Methods
From class androidx.constraintlayout.widget.ConstraintLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

XML Attributes

PersistentFooter_actionMode

Related Methods

PersistentFooter_dividerEnabled

Related Methods

PersistentFooter_footerButtonStyleDefault

Related Methods

PersistentFooter_footerButtonStyleEmphasized

Related Methods

PersistentFooter_isPrimaryButtonEmphasized

Related Methods

PersistentFooter_primaryButtonText

Related Methods

PersistentFooter_primaryButtonTextAppearance

Related Methods

PersistentFooter_secondaryButtonEnabled

Related Methods

PersistentFooter_secondaryButtonText

Related Methods

PersistentFooter_secondaryButtonTextAppearance

Related Methods

Constants

public static final int MAX_ACTIONS

Constant Value: 2 (0x00000002)

Fields

protected Integer mDefaultButtonTint

protected Integer mEmphasizedButtonTint

protected MaterialButton mPrimaryButton

protected int mPrimaryButtonTextAppearance

protected MaterialButton mSecondaryButton

protected int mSecondaryButtonTextAppearance

Public Constructors

public PersistentFooter (Context context)

public PersistentFooter (Context context, AttributeSet attrs)

public PersistentFooter (Context context, AttributeSet attrs, int defStyleAttr)

public PersistentFooter (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public Methods

public PersistentFooter.ActionMode getActionMode ()

Get the action mode, visible only for testing.

public View.OnClickListener getPrimaryActionClickListener ()

public CharSequence getPrimaryText ()

Returns
  • the text of the primary button

public View.OnClickListener getSecondaryActionClickListener ()

public CharSequence getSecondaryText ()

Returns
  • the text of the secondary button

public boolean isDividerEnabled ()

public boolean isIsPrimaryEmphasized ()

public boolean isSecondaryEnabled ()

Returns
  • true if the secondary button is enabled (visible), false otherwise

public void setActionMode (PersistentFooter.ActionMode actionMode)

Sets the action mode. There are currently 2 modes for PersistentFooter.

Parameters
actionMode the ActionMode that describes the layout for this footer

public void setDividerEnabled (boolean isEnabled)

Enables/Disables the divider.

public void setFooterButtonStyleDefault (int style)

Set the default button style for non-emphasized buttons.

Parameters
style the style to apply

public void setFooterButtonStyleEmphasized (int style)

Set the button style for emphasized buttons.

Parameters
style the style to apply

public void setOpposingActionsCenterAlignedEnabled (boolean isCenterAlignedEnabled)

For tablet only, set the footers opposing-action layout to be center aligned. Must call setActionMode(ActionMode) for this change to take effect. Default is true.

Parameters
isCenterAlignedEnabled center align opposing buttons if true, align buttons at the start and end of the view otherwise.

public void setPrimaryActionClickListener (View.OnClickListener listener)

Set a callback listener for when the primary button is clicked.

Parameters
listener the onClickListener to be set on the primary button

public void setPrimaryActionEmphasized (boolean isEmphasized)

A primary action can be emphasized by using a contained button. If the primary action is not very important, then a flat button (text button) can be used.

Parameters
isEmphasized true for a contained button, false for a flat button.

public void setPrimaryText (CharSequence primaryText)

Parameters
primaryText the text to be displayed on the primary button

public void setPrimaryTextAppearance (int textAppearance)

Parameters
textAppearance the appearance of how the primary button text should look

public void setSecondaryActionClickListener (View.OnClickListener listener)

Set a callback listener for when the secondary button is clicked.

Parameters
listener the onClickListener to be set on the secondary button

public void setSecondaryEnabled (boolean isEnabled)

Enables/disables the secondary action.

public void setSecondaryText (CharSequence secondaryText)

Parameters
secondaryText the text to be displayed on the secondary button

public void setSecondaryTextAppearance (int textAppearance)

Parameters
textAppearance the appearance of how the secondary button text should look

public void swapButtons ()

Swaps the positions of the buttons while staying consistent with: 1. The emphasis status of the primary action 2. The visibility state of the secondary action