This class is used for basic manipulation with sidebar like showing/hiding the sidebar or adding/removing widgets to sidebar. More...
Classes | |
| enum | NaviType |
| Type of navigation where sidebar will be used. More... | |
Public Member Functions | |
| void | show (boolean show) |
| Shows or hides the sidebar. More... | |
| int | setWidget (int position, Widget widget) |
| Puts the widget to the sidebar. More... | |
| void | updateWidget (Widget widget) |
| Pushes the latest state of widget to sidebar. More... | |
| Widget | findWidgetByTag (String tag) |
| Finds the Widget in sidebar. More... | |
| void | addLogo (String path, int x, int y, int width, int height) |
| Adds the logo image to the sidebar. More... | |
| void | removeLogos () |
| Removes all logos that were added to the sidebar with addLogo(String, int, int, int, int) method. More... | |
Static Public Attributes | |
| static final int | RESULT_OK = 0 |
| Result code - OK. More... | |
| static final int | RESULT_FAILED = -1 |
| Result code - Unknown error. More... | |
| static final int | RESULT_FAILED_SPACE_OCCUPIED = -2 |
| Result code - Failed to add widget because another widget already exists on given position. More... | |
| static final int | RESULT_FAILED_DUPLICATE_TAG = -3 |
| Result code - Failed to add widget because another widget with this tag already exists in sidebar. More... | |
| static final int | WIDGET1 = 0 |
| Widget slot 1 in sidebar. More... | |
| static final int | WIDGET2 = 1 |
| Widget slot 2 in sidebar. More... | |
| static final int | WIDGET3 = 2 |
| Widget slot 3 in sidebar. More... | |
| static final int | WIDGET4 = 3 |
| Widget slot 4 in sidebar. More... | |
Package Functions | |
| Sidebar (ISidebarService service, Widget[] widgets) | |
| Package private constructor. More... | |
This class is used for basic manipulation with sidebar like showing/hiding the sidebar or adding/removing widgets to sidebar.
Package private constructor.
Use SidebarConnection#connect method to obtain instance of Sidebar. Once the connection is created successfully, instance of Sidebar is provided in SidebarConnectionListener#onSidebarConnected callback as parameter.
| void addLogo | ( | String | path, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height | ||
| ) |
Adds the logo image to the sidebar.
| path | full path of the logo image |
| x | |
| y | |
| width | |
| height |
| Widget findWidgetByTag | ( | String | tag | ) |
Finds the Widget in sidebar.
| tag | tag of the widget to be found |
| void removeLogos | ( | ) |
Removes all logos that were added to the sidebar with addLogo(String, int, int, int, int) method.
| int setWidget | ( | int | position, |
| Widget | widget | ||
| ) |
Puts the widget to the sidebar.
If widget parameter is null, any existing widget on the given position will be removed.
| position | position where to place widget. Use constants WIDGET1 .. WIDGET4 |
| widget | widget to be added. If null, any widget on the given position will be removed. |
References Widget.getTag(), Sidebar.RESULT_FAILED, and Sidebar.RESULT_FAILED_DUPLICATE_TAG.
| void show | ( | boolean | show | ) |
Shows or hides the sidebar.
| show | use true to show, false to hide the sidebar. |
| void updateWidget | ( | Widget | widget | ) |
Pushes the latest state of widget to sidebar.
Widgets are not updated otherwise.
| widget | widget to update. Must not be null. |
Example:
TextWidget textWidget;
...
textWidget.setText("New text");
// text widget is still not updated in navigation sidebarsidebar.updateWidget(textWidget); // now it is updated
|
static |
Result code - Unknown error.
Referenced by Sidebar.setWidget().
|
static |
Result code - Failed to add widget because another widget with this tag already exists in sidebar.
Referenced by Sidebar.setWidget().
|
static |
Result code - Failed to add widget because another widget already exists on given position.
|
static |
Result code - OK.
|
static |
Widget slot 1 in sidebar.
|
static |
Widget slot 2 in sidebar.
|
static |
Widget slot 3 in sidebar.
|
static |
Widget slot 4 in sidebar.