com.annahid.libs.artenus.extras
SlideMenu
Provides the user interface for horizontal menus that use slide action to navigate. It takes
sprites as menu items and handles scaling and moving them as necessary. At any point you can get
the currently focused item.
public final class SlideMenu extends EntityCollection
Field Summary
Fields inherited from com.annahid.libs.artenus.entities.EntityCollection
Constructor Summary
Modifier and Type | Constructor and Description |
---|---|
public | SlideMenu(Point2D center, float itemDistance, float height) Creates a SlideMenu with the given information for the given scene. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public final boolean | add(Entity entity) Adds a menu item in the form of an entity. |
public void | addListener(SlideMenu.Listener listener) Appoints a new event listener to listen to item selection events. |
public final void | advance(float elapsedTime) Advances animations for the amount of time specified. |
public void | clear() Clears all menu items from this slide menu. |
public final float | getIndicatorAlpha(int index) Provides information required to set up indicators. |
public final int | getSelectedItem() Gets the currently selected (focused) menu item. |
public final boolean | handleTouch(TouchEvent event) Handles a touch event for this SlideMenu. |
public void | removeListener(SlideMenu.Listener listener) Removes an event listener currently assigned to this slide menu. |
public void | setPosition(Point2D position) Does nothing. |
public void | setPosition(float x, float y) Does nothing. |
public final void | setSelectedItem(int index) Navigates to the menu item specified and focuses that item. |
public void | setTapFocus(float tapHeight) Adjusts the tap focus for this SlideMenu. |
Methods inherited from com.annahid.libs.artenus.entities.EntityCollection
add
, advance
, bringToFront
, clear
, getAlpha
, getAnimation
, getColorFilter
, getPosition
, getRotation
, getScale
, getScene
, handleTouch
, hasBehavior
, iterator
, move
, onAttach
, onDetach
, prepend
, recursiveIterator
, recursiveRemove
, render
, rotate
, sendToBack
, setAlpha
, setAnimation
, setColorFilter
, setColorFilter
, setPosition
, setPosition
, setRotation
, setScale
, setScale
Methods inherited from com.annahid.libs.artenus.data.ConcurrentCollection
add
, addAll
, clear
, contains
, containsAll
, getFirst
, getLast
, isEmpty
, iterator
, prepend
, remove
, removeAll
, retainAll
, size
, toArray
, toArray
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Constructor Detail
SlideMenu | ||||||
---|---|---|---|---|---|---|
public SlideMenu( Point2D center, float itemDistance, float height )Creates a SlideMenu with the given information for the given scene. Parameters:
|
Method Detail
add | ||
---|---|---|
public final boolean add( Entity entity ) Adds a menu item in the form of an entity. Parameters:
Overrides:
|
addListener | ||
---|---|---|
public void addListener( SlideMenu.Listener listener ) Appoints a new event listener to listen to item selection events. Parameters:
|
advance | ||
---|---|---|
public final void advance( float elapsedTime ) Advances animations for the amount of time specified. Parameters:
Overrides:
|
clear |
---|
public void clear() Clears all menu items from this slide menu. Overrides:
|
getIndicatorAlpha | ||
---|---|---|
public final float getIndicatorAlpha( int index ) Provides information required to set up indicators. It provides transparency information for
each indicator. An indicator has full transparency if the corresponding menu item is
completely in view and starts to gradually decrease to zero when it goes out of focus. Parameters:
Returns:
Indicator transparency |
getSelectedItem |
---|
public final int getSelectedItem() Gets the currently selected (focused) menu item. Returns:
Item index |
handleTouch | ||
---|---|---|
public final boolean handleTouch( TouchEvent event ) Handles a touch event for this SlideMenu. It also determines whether
and item has been tapped. Parameters:
Overrides:
|
removeListener | ||
---|---|---|
public void removeListener( SlideMenu.Listener listener ) Removes an event listener currently assigned to this slide menu. Parameters:
|
setPosition | ||
---|---|---|
public void setPosition( Point2D position ) Does nothing. Changing position is not supported by slide menu. Parameters:
Overrides:
|
setPosition | ||||
---|---|---|---|---|
public void setPosition( float x, float y ) Does nothing. Changing position is not supported by slide menu. Parameters:
Overrides:
|
setSelectedItem | ||
---|---|---|
public final void setSelectedItem( int index ) Navigates to the menu item specified and focuses that item. Parameters:
|
setTapFocus | ||
---|---|---|
public void setTapFocus( float tapHeight ) Adjusts the tap focus for this SlideMenu. Tap focus is the vertical
distance inside which a touch can be considered as a "tap" if there is not
much horizontal motion. Parameters:
|