public class

StandardAppBar

extends LinearLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.LinearLayout
         ↳ com.droidux.pack.action.widget.StandardAppBar
Known Direct Subclasses

Class Overview

A standard application/action bar that can be used to replace the default Android title bar, following guideline and design pattern explained here, here and here. The application bar is a host/container of ActionInterfaces.Item.ActionItem.

Summary

XML Attributes
Attribute Name Related Method Description
dux_drawableEffect_colors Specifies the colors for the effect to be applied to the action drawable. 
dux_drawableEffect_type Specifies the effect to be applied to an action's icon/drawable. 
dux_glow_radius Specifies the radius of the glow around the action icon when the dux_drawableEffect_type is set to glow
dux_separator Reference to a drawable resource to use for a separator. 
dux_separatorWidth Specifies the width of the separator. 
dux_titleMode The mode of the appbar's title action. 
[Expand]
Inherited Constants
From class android.widget.LinearLayout
From class android.view.ViewGroup
From class android.view.View
Fields
public static final int TITLE_MODE_AUTO The application bar will show both text and logo, or either one based on ActionInterfaces.Item.ActionItem used to construct the title.
public static final int TITLE_MODE_LOGO The application bar will only show logo, or none if the ActionInterfaces.Item.ActionItem for the title does not have icon.
public static final int TITLE_MODE_TEXT The application bar will only show text, or none if the ActionInterfaces.Item.ActionItem for the title does not have text.
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
StandardAppBar(Context context)
StandardAppBar(Context context, AttributeSet attrs)
Public Methods
void addView(View child, int index, ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters.
ActionInterfaces.Layout.AppBarLayoutInterface beginLayout()
Begins the layout process to define the ActionInterfaces.Item.ActionItem that should be hosted by this action container.
View getActionView(ActionInterfaces.Item.ActionItem action)
Gets the View representing the specified action.
void onEndLayout(ActionInterfaces.Layout.ActionLayoutInterface layout)
Called when the layout process has ended (for internal use only, you normally don't need to call/override this method).
void setTitle(CharSequence title)
Sets the title text.
void showProgress(boolean show)
Whether to show or hide the progress indicator.
Protected Methods
void dispatchDraw(Canvas canvas)
Called by draw to draw the child views.
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
boolean verifyDrawable(Drawable who)
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.
[Expand]
Inherited Methods
From class android.widget.LinearLayout
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

dux_drawableEffect_colors

Since: API Level

Specifies the colors for the effect to be applied to the action drawable.

May be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

Related Methods

dux_drawableEffect_type

Since: API Level

Specifies the effect to be applied to an action's icon/drawable. The colors of the effect can be specified using the dux_drawableEffect_colors attribute.

Default is none.

Must be one of the following constant values.

ConstantValueDescription
none0 No effect will be applied.
glow1 The 'glow' effect will be applied to the action drawable.
colorize2 The 'colorize' effect will be applied to the action drawable.

Related Methods

dux_glow_radius

Since: API Level

Specifies the radius of the glow around the action icon when the dux_drawableEffect_type is set to glow.

Related Methods

dux_separator

Since: API Level

Reference to a drawable resource to use for a separator.

Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

Related Methods

dux_separatorWidth

Since: API Level

Specifies the width of the separator. Its value may be a dimension (such as "2dip") for a constant width or one of the special constants.

May be a dimension value, which is a floating point number appended with a unit such as "1.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

May be one of the following constant values.

ConstantValueDescription
auto-1 The width will be automatically determined, from the intrinsic width if the separator has intrinsic size, or from a default value (1dp).
none0 The separator will not be drawn.

Related Methods

dux_titleMode

Since: API Level

The mode of the appbar's title action.

Must be one of the following constant values.

ConstantValueDescription
auto0 The title will show both text and icon, or either text or icon whichever is set on the action.
logo1 The title will only show icon.
text2 The title will only show text.

Related Methods

Fields

public static final int TITLE_MODE_AUTO

Since: API Level 2.5

The application bar will show both text and logo, or either one based on ActionInterfaces.Item.ActionItem used to construct the title.

public static final int TITLE_MODE_LOGO

Since: API Level 2.5

The application bar will only show logo, or none if the ActionInterfaces.Item.ActionItem for the title does not have icon.

public static final int TITLE_MODE_TEXT

Since: API Level 2.5

The application bar will only show text, or none if the ActionInterfaces.Item.ActionItem for the title does not have text.

Public Constructors

public StandardAppBar (Context context)

Since: API Level 2.5

public StandardAppBar (Context context, AttributeSet attrs)

Since: API Level 2.5

Public Methods

public void addView (View child, int index, ViewGroup.LayoutParams params)

Since: API Level

Adds a child view with the specified layout parameters.

Note: do not invoke this method from draw(android.graphics.Canvas), onDraw(android.graphics.Canvas), dispatchDraw(android.graphics.Canvas) or any related method.

Parameters
child the child view to add
index the position at which to add the child
params the layout parameters to set on the child

public ActionInterfaces.Layout.AppBarLayoutInterface beginLayout ()

Since: API Level 2.5

Begins the layout process to define the ActionInterfaces.Item.ActionItem that should be hosted by this action container.

Important: When you finish adding the ActionInterfaces.Item.ActionItem to the container, you need to call the endLayout() to end the layout process.

public View getActionView (ActionInterfaces.Item.ActionItem action)

Since: API Level 2.5

Gets the View representing the specified action.

Parameters
action The action represented by the returned View.
Returns
  • Returns the View representing the specified action, or null if the action does not have associated view contained by this application bar.

public void onEndLayout (ActionInterfaces.Layout.ActionLayoutInterface layout)

Since: API Level 2.5

Called when the layout process has ended (for internal use only, you normally don't need to call/override this method).

public void setTitle (CharSequence title)

Since: API Level

Sets the title text.

Parameters
title The title.

public void showProgress (boolean show)

Since: API Level

Whether to show or hide the progress indicator.

Parameters
show If true, show the progress indicator, otherwise hide it.

Protected Methods

protected void dispatchDraw (Canvas canvas)

Since: API Level

Called by draw to draw the child views. This may be overridden by derived classes to gain control just before its children are drawn (but after its own view has been drawn).

Parameters
canvas the canvas on which to draw the view

protected void onAttachedToWindow ()

Since: API Level

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

protected void onDetachedFromWindow ()

Since: API Level

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

protected boolean verifyDrawable (Drawable who)

Since: API Level

If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled.

Be sure to call through to the super class when overriding this function.

Parameters
who The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class.
Returns
  • boolean If true than the Drawable is being displayed in the view; else false and it is not allowed to animate.