com.foxit.uiextensions.controls.toolbar.IBarsHandler Interface Reference

Classes

enum  BarName
 
interface  IItemClickListener
 

Public Member Functions

boolean addCustomToolBar (BarName barName, View view)
 
boolean addItem (BarName barName, BaseBar.TB_Position gravity, IBaseItem item, int index)
 
boolean addItem (BarName barName, BaseBar.TB_Position gravity, CharSequence text, int index, IItemClickListener clickListener)
 
boolean addItem (BarName barName, BaseBar.TB_Position gravity, Drawable drawable, int index, IItemClickListener clickListener)
 
boolean addItem (BarName barName, BaseBar.TB_Position gravity, int textId, int resId, int index, IItemClickListener clickListener)
 
void enableToolBar (BarName barName, boolean enabled)
 
IBaseItem getItem (BarName barName, BaseBar.TB_Position gravity, int tag)
 
IBaseItem getItemByIndex (BarName barName, BaseBar.TB_Position gravity, int index)
 
int getItemsCount (BarName barName, BaseBar.TB_Position gravity)
 
int getItemVisibility (BarName barName, BaseBar.TB_Position gravity, int index)
 
int getVisibility (BarName barName, BaseBar.TB_Position gravity, int tag)
 
void removeAllItems (BarName barName)
 
boolean removeItem (BarName barName, BaseBar.TB_Position gravity, int index)
 
boolean removeItem (BarName barName, BaseBar.TB_Position gravity, IBaseItem item)
 
boolean removeToolBar (BarName barName)
 
void setBackgroundColor (BarName barName, int color)
 
void setBackgroundResource (BarName barName, int resid)
 
void setItemVisibility (BarName barName, BaseBar.TB_Position gravity, int index, int visibility)
 
void setVisibility (BarName barName, BaseBar.TB_Position gravity, int tag, int visibility)
 

Detailed Description

Toolbar's Operation control class,you can use it show/hide/add/remove items on the toolbar . (PS:Currently toolbar has only the topbar/bottombar on the main page )

you can use it through com.foxit.uiextensions.UIExtensionsManager#getBarManager()

Member Function Documentation

◆ addCustomToolBar()

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.addCustomToolBar ( BarName  barName,
View  view 
)

add custom toolbar by BarName

Parameters
barNamethe toolbar name
viewthe custom view
Returns
true means add success,otherwise means add failure.

◆ addItem() [1/4]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.addItem ( BarName  barName,
BaseBar.TB_Position  gravity,
IBaseItem  item,
int  index 
)

Add an custom item to the toolbar

Inserts the specified IBaseItem at the specified position in the toolbar. Shifts the IBaseItem currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Note 1: if you want addItem in the topbar ,the gravity should be BaseBar.TB_Position#Position_LT orBaseBar.TB_Position#Position_RB; if you want addItem in the bottombar,the gravity should be BaseBar.TB_Position#Position_CENTER,Otherwise it may they overlap.

Note 2: If your item has set the tag IBaseItem#setTag(int),the tag must be unique and the tag must be less than 100, or more than 300, because the tag between 100 and 300 has been used or may be used in the futureToolbarItemConfig.

Note 3: the maximum number of items on the toolbar is 7,if the items counts more than 7,more than part will not be displayed and reture false

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
itemIf you want to add item in topbar, you can use BaseItemImpl or if want to add item in bottombar, you can useCircleItemImpl
indexthe position at which to add the item,starting from 0 ,less than or equal togetItemsCount(BarName, BaseBar.TB_Position) and is relative to BaseBar.TB_Position.
Returns
true means add success ,otherwise add failure.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ addItem() [2/4]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.addItem ( BarName  barName,
BaseBar.TB_Position  gravity,
CharSequence  text,
int  index,
IItemClickListener  clickListener 
)

Add a default text-only item

Inserts the specified IBaseItem at the specified position in the toolbar. Shifts the IBaseItem currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Note 1: if you want addItem in the topbar ,the gravity should be BaseBar.TB_Position#Position_LT orBaseBar.TB_Position#Position_RB; if you want addItem in the bottombar,the gravity should be BaseBar.TB_Position#Position_CENTER,Otherwise it may they overlap.

Note 2: the maximum number of items on the toolbar is 7,if the items counts more than 7,more than part will not be displayed and reture false

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
texttext to be displayed
indexthe position at which to add the item,starting from 0 ,less than or equal togetItemsCount(BarName, BaseBar.TB_Position) and is relative to BaseBar.TB_Position.
clickListenerThe callback that will run
Returns
true means add success ,otherwise add failure.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ addItem() [3/4]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.addItem ( BarName  barName,
BaseBar.TB_Position  gravity,
Drawable  drawable,
int  index,
IItemClickListener  clickListener 
)

Add a default image-only item

Inserts the specified IBaseItem at the specified position in the toolbar. Shifts the IBaseItem currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Note 1: if you want addItem in the topbar ,the gravity should be BaseBar.TB_Position#Position_LT orBaseBar.TB_Position#Position_RB; if you want addItem in the bottombar,the gravity should be BaseBar.TB_Position#Position_CENTER,Otherwise it may they overlap.

Note 2: the maximum number of items on the toolbar is 7,if the items counts more than 7,more than part will not be displayed and reture false

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
drawablethe Drawable to set, or
null
to clear the content
indexthe position at which to add the item,starting from 0 ,less than or equal togetItemsCount(BarName, BaseBar.TB_Position) and is relative to BaseBar.TB_Position.
clickListenerThe callback that will run
Returns
true means add success ,otherwise add failure.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ addItem() [4/4]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.addItem ( BarName  barName,
BaseBar.TB_Position  gravity,
int  textId,
int  resId,
int  index,
IItemClickListener  clickListener 
)

Add a default item to the toolbar

Inserts the specified IBaseItem at the specified position in the toolbar. Shifts the IBaseItem currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Note 1: if you want addItem in the topbar ,the gravity should be BaseBar.TB_Position#Position_LT orBaseBar.TB_Position#Position_RB; if you want addItem in the bottombar,the gravity should be BaseBar.TB_Position#Position_CENTER,Otherwise it may they overlap.

Note 2: the maximum number of items on the toolbar is 7,if the items counts more than 7,more than part will not be displayed and reture false

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
textIdthe resource identifier of the string resource to be displayed
resIdthe resource identifier of the drawable
indexthe position at which to add the item,starting from 0 ,less than or equal togetItemsCount(BarName, BaseBar.TB_Position) and is relative to BaseBar.TB_Position.
clickListenerThe callback that will run
Returns
true means add success ,otherwise add failure.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ enableToolBar()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.enableToolBar ( BarName  barName,
boolean  enabled 
)

Set the enabled state of this view,and if set the enable to true, the bar is visible, or if set the enable to false,the bar is hide.

Parameters
barNamethe toolbar name
enabledTrue if this view is visible, false otherwise.

◆ getItem()

IBaseItem com.foxit.uiextensions.controls.toolbar.IBarsHandler.getItem ( BarName  barName,
BaseBar.TB_Position  gravity,
int  tag 
)

Get the item by tag, if tag does not exist, it return null

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
tagthe item id and is unique ,it may be the existing tag or you custom tag.
Returns
IBaseItem If tag does not exist, it return null
Deprecated:
instead of this method.

◆ getItemByIndex()

IBaseItem com.foxit.uiextensions.controls.toolbar.IBarsHandler.getItemByIndex ( BarName  barName,
BaseBar.TB_Position  gravity,
int  index 
)

Get the item by index

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
indexthe index of the IBaseItem and is relative to BaseBar.TB_Position.
Returns
the IBaseItem at the specified position in the toolbar
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ getItemsCount()

int com.foxit.uiextensions.controls.toolbar.IBarsHandler.getItemsCount ( BarName  barName,
BaseBar.TB_Position  gravity 
)

get the items count by BarName and BaseBar.TB_Position

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
Returns
the items count

◆ getItemVisibility()

int com.foxit.uiextensions.controls.toolbar.IBarsHandler.getItemVisibility ( BarName  barName,
BaseBar.TB_Position  gravity,
int  index 
)

Returns the visibility status for this view.

Parameters
barNamethe toolbar name IBarsHandler.BarName
gravitythe location of item in the toolbarBaseBar.TB_Position
indexthe index of the IBaseItem and is relative to BaseBar.TB_Position.
Returns
One of View#VISIBLE, View#INVISIBLE, View#GONE
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ getVisibility()

int com.foxit.uiextensions.controls.toolbar.IBarsHandler.getVisibility ( BarName  barName,
BaseBar.TB_Position  gravity,
int  tag 
)

Returns the visibility status for this view.If this toolbar does not contain the tag, it will not work.

Parameters
barNamethe toolbar name IBarsHandler.BarName
gravitythe location of item in the toolbarBaseBar.TB_Position
tagthe item id and is unique ,it may be the existing tag or you custom tag.
Returns
One of View#VISIBLE, View#INVISIBLE, View#GONE or -1. if return -1,means can't find this item by tag.
Deprecated:
get instead of this method.

◆ removeAllItems()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.removeAllItems ( BarName  barName)

Removes all items from the toolbar

Parameters
barNamethe toolbar name

◆ removeItem() [1/2]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.removeItem ( BarName  barName,
BaseBar.TB_Position  gravity,
int  index 
)

Removes the IBaseItem at the specified position in this toolbar Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
indexthe index of the IBaseItem and is relative to BaseBar.TB_Position.
Returns
true means remove success,otherwise means remove failure
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ removeItem() [2/2]

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.removeItem ( BarName  barName,
BaseBar.TB_Position  gravity,
IBaseItem  item 
)

Removes the IBaseItem in this toolbar,if it is present.If this toolbar does not contain the IBaseItem, it is unchanged.

Parameters
barNamethe toolbar name
gravitythe location of item in the toolbarBaseBar.TB_Position
itemthe specified item in the toolbar
Returns
true means remove success,otherwise means remove failure.

◆ removeToolBar()

boolean com.foxit.uiextensions.controls.toolbar.IBarsHandler.removeToolBar ( BarName  barName)

remove toolbar by BarName

Parameters
barNamethe toolbar name
Returns
true means remove success,otherwise means remove failure.

◆ setBackgroundColor()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.setBackgroundColor ( BarName  barName,
int  color 
)

Sets the background color for the toolbar.

Parameters
barNamethe toolbar name
colorthe color of the background

◆ setBackgroundResource()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.setBackgroundResource ( BarName  barName,
int  resid 
)

Set the background to a given resource. The resource should refer to a Drawable object or 0 to remove the background.

Parameters
barNamethe toolbar name
residThe identifier of the resource.

◆ setItemVisibility()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.setItemVisibility ( BarName  barName,
BaseBar.TB_Position  gravity,
int  index,
int  visibility 
)

Set the enabled state of this item view.

Parameters
barNamethe toolbar name IBarsHandler.BarName
gravitythe location of item in the toolbarBaseBar.TB_Position
indexthe index of the IBaseItem and is relative to BaseBar.TB_Position.
visibilityOne of View#VISIBLE, View#INVISIBLE, or View#GONE.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (index < 0 || index > getItemsCount())

◆ setVisibility()

void com.foxit.uiextensions.controls.toolbar.IBarsHandler.setVisibility ( BarName  barName,
BaseBar.TB_Position  gravity,
int  tag,
int  visibility 
)

Set the enabled state of this view. If this toolbar does not contain the tag, it will not work.

Parameters
barNamethe toolbar name IBarsHandler.BarName
gravitythe location of item in the toolbarBaseBar.TB_Position
tagthe item id and is unique ,it may be the existing tag or you custom tag.
visibilityOne of View#VISIBLE, View#INVISIBLE, or View#GONE.
Deprecated:
instead of this method.