CategoryTabs

public class CategoryTabs extends RecyclerView

A CategoryTabs view shows the list of available BlocklyCategorys as tabs.

The view can be configured in either HORIZONTAL (default) or VERTICAL orientation. If there is not enough space, the tabs will scroll in the same direction.

Additionally, the tab labels can be rotated using the Rotation constants. All tabs will be rotated in the same direction.

Nested Class Summary

class CategoryTabs.DefaultTabsAdapter Manages TextView labels derived from default_toolbox_tab
class CategoryTabs.LabelAdapter  

Constant Summary

String TAG

Field Summary

public static final int HORIZONTAL
public static final int VERTICAL
protected CategorySelectorUI.Callback mCallback
protected final List<BlocklyCategory> mCategories
protected BlocklyCategory mCurrentCategory
protected int mLabelRotation
protected boolean mTapSelectedDeselects

Public Constructor Summary

CategoryTabs(Context context)
CategoryTabs(Context context, AttributeSet attrs)
CategoryTabs(Context context, AttributeSet attrs, int style)

Public Method Summary

BlocklyCategory
int
void
setCallback(CategorySelectorUI.Callback callback)
Sets the CategorySelectorUI.Callback used by this instance.
void
setCategories(List<BlocklyCategory> categories)
Sets the list of BlocklyCategorys used to populate the tab labels.
void
setLabelAdapter(CategoryTabs.LabelAdapter labelAdapter)
Sets the ERROR(/Adapter) responsible for the label views.
void
setLabelRotation(int labelRotation)
Sets the Rotation direction constant for the tab labels.
void
setOrientation(int orientation)
Sets the orientation in which the tabs will accumulate, which is also the scroll direction when there are more tabs than space allows.
void
setSelectedCategory(BlocklyCategory category)
Sets the currently selected tab.
void
setTapSelectedDeselects(boolean tapSelectedDeselects)
Sets whether the selected tab will deselect when clicked again.

Inherited Method Summary

Constants

public static final String TAG

Constant Value: "CategoryTabs"

Fields

public static final int HORIZONTAL

public static final int VERTICAL

protected CategorySelectorUI.Callback mCallback

protected final List<BlocklyCategory> mCategories

protected BlocklyCategory mCurrentCategory

protected int mLabelRotation

protected boolean mTapSelectedDeselects

Public Constructors

public CategoryTabs (Context context)

Parameters
context

public CategoryTabs (Context context, AttributeSet attrs)

Parameters
context
attrs

public CategoryTabs (Context context, AttributeSet attrs, int style)

Parameters
context
attrs
style

Public Methods

public BlocklyCategory getSelectedCategory ()

Returns
  • The currently highlighted category or null.

public int getTabCount ()

public void setCallback (CategorySelectorUI.Callback callback)

Sets the CategorySelectorUI.Callback used by this instance.

Parameters
callback The CategorySelectorUI.Callback for event handling.

public void setCategories (List<BlocklyCategory> categories)

Sets the list of BlocklyCategorys used to populate the tab labels.

Parameters
categories The list of BlocklyCategorys used to populate the tab labels.

public void setLabelAdapter (CategoryTabs.LabelAdapter labelAdapter)

Sets the ERROR(/Adapter) responsible for the label views.

Parameters
labelAdapter

public void setLabelRotation (int labelRotation)

Sets the Rotation direction constant for the tab labels.

Parameters
labelRotation The Rotation direction constant for the tab labels.

public void setOrientation (int orientation)

Sets the orientation in which the tabs will accumulate, which is also the scroll direction when there are more tabs than space allows.

Parameters
orientation Either HORIZONTAL or VERTICAL.

public void setSelectedCategory (BlocklyCategory category)

Sets the currently selected tab. If the tab is not a member of the assigned categories, no tab will render selected.

public void setTapSelectedDeselects (boolean tapSelectedDeselects)

Sets whether the selected tab will deselect when clicked again.

Parameters
tapSelectedDeselects If true, selected tab will deselect when clicked again.