Base class for lightweight transient bars that are displayed along the bottom edge of the
application window.
Nested classes
|
class
|
BaseTransientBottomBar.BaseCallback
<B>
Base class for
BaseTransientBottomBar
callbacks.
|
class
|
BaseTransientBottomBar.Behavior
Behavior for
BaseTransientBottomBar
.
|
interface
|
BaseTransientBottomBar.ContentViewCallback
This interface is deprecated.
Use
ContentViewCallback
instead.
|
Inherited methods
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Constants
ANIMATION_MODE_FADE
public static final int ANIMATION_MODE_FADE
Animation mode that corresponds to the fade in and out animations.
Constant Value:
1
(0x00000001)
ANIMATION_MODE_SLIDE
public static final int ANIMATION_MODE_SLIDE
Animation mode that corresponds to the slide in and out animations.
Constant Value:
0
(0x00000000)
LENGTH_INDEFINITE
public static final int LENGTH_INDEFINITE
Show the Snackbar indefinitely. This means that the Snackbar will be displayed from the time
that is
shown
until either it is dismissed, or another Snackbar is shown.
Constant Value:
-2
(0xfffffffe)
LENGTH_LONG
public static final int LENGTH_LONG
Show the Snackbar for a long period of time.
Constant Value:
0
(0x00000000)
LENGTH_SHORT
public static final int LENGTH_SHORT
Show the Snackbar for a short period of time.
Constant Value:
-1
(0xffffffff)
Fields
Protected constructors
BaseTransientBottomBar
protected BaseTransientBottomBar (ViewGroup parent,
View content,
ContentViewCallback
contentViewCallback)
Constructor for the transient bottom bar.
Uses
Context
from
parent
.
Parameters
|
parent
|
ViewGroup
: The parent for this transient bottom bar.
|
content
|
View
: The content view for this transient bottom bar.
|
contentViewCallback
|
ContentViewCallback
: The content view callback for this transient bottom bar.
|
BaseTransientBottomBar
protected BaseTransientBottomBar (Context context,
ViewGroup parent,
View content,
ContentViewCallback
contentViewCallback)
Parameters
|
context
|
Context
|
parent
|
ViewGroup
|
content
|
View
|
contentViewCallback
|
ContentViewCallback
|
Public methods
addCallback
public B addCallback (
BaseCallback
<B> callback)
Adds the specified callback to the list of callbacks that will be notified of transient bottom
bar events.
Parameters
|
callback
|
BaseCallback
: Callback to notify when transient bottom bar events occur.
|
getAnimationMode
public int getAnimationMode ()
Returns the animation mode.
getDuration
public int getDuration ()
Return the duration.
isAnchorViewLayoutListenerEnabled
public boolean isAnchorViewLayoutListenerEnabled ()
Returns whether the anchor view layout listener is enabled.
isGestureInsetBottomIgnored
public boolean isGestureInsetBottomIgnored ()
Returns whether this bottom bar should adjust it's position based on the system gesture area on
Android Q and above. See
setGestureInsetBottomIgnored(boolean)
.
isShownOrQueued
public boolean isShownOrQueued ()
Returns whether this
BaseTransientBottomBar
is currently being shown, or is queued to
be shown next.
removeCallback
public B removeCallback (
BaseCallback
<B> callback)
Removes the specified callback from the list of callbacks that will be notified of transient
bottom bar events.
Parameters
|
callback
|
BaseCallback
: Callback to remove from being notified of transient bottom bar events
|
setAnchorView
public B setAnchorView (int anchorViewId)
Sets the view the
BaseTransientBottomBar
should be anchored above by id.
Parameters
|
anchorViewId
|
int
|
Throws
|
IllegalArgumentException
|
if the anchor view is not found.
|
setAnchorView
public B setAnchorView (View anchorView)
Sets the view the
BaseTransientBottomBar
should be anchored above.
Parameters
|
anchorView
|
View
|
setAnchorViewLayoutListenerEnabled
public void setAnchorViewLayoutListenerEnabled (boolean anchorViewLayoutListenerEnabled)
Sets whether the anchor view layout listener is enabled. If enabled, the
BaseTransientBottomBar
will recalculate and update its position when the position of the
anchor view is changed.
Parameters
|
anchorViewLayoutListenerEnabled
|
boolean
|
setAnimationMode
public B setAnimationMode (int animationMode)
Sets the animation mode.
setDuration
public B setDuration (int duration)
Set how long to show the view for.
setGestureInsetBottomIgnored
public B setGestureInsetBottomIgnored (boolean gestureInsetBottomIgnored)
Sets whether this bottom bar should adjust it's position based on the system gesture area on
Android Q and above.
Note: the bottom bar will only adjust it's position if it is dismissable via swipe (because
that would cause a gesture conflict), gesture navigation is enabled, and this
gestureInsetBottomIgnored
flag is false.
Parameters
|
gestureInsetBottomIgnored
|
boolean
|
Protected methods
dispatchDismiss
protected void dispatchDismiss (int event)
getSnackbarBaseLayoutResId
protected int getSnackbarBaseLayoutResId ()
hasSnackbarStyleAttr
protected boolean hasSnackbarStyleAttr ()
Snackbar
s should still work with AppCompat themes, which don't specify a
snackbarStyle
. This method helps to check if a valid
snackbarStyle
is set within the
current context, so that we know whether we can use the attribute.