-
Notifications
You must be signed in to change notification settings - Fork 3
More Options
More Options is a widget that brings up a new panel from the bottom of the screen which contains additional voice commands, or "options". These voice commands are only registered when the more options widget is on screen, so this is an ideal place to place commands that are less commonly used and would otherwise clutter the UI. When the More Options widget is showing, only the voice commands in the widget will be registered - voice commands from views in the background will be unregistered. To close the More Options widget, simply give the command, “Hide Options”.
You can create the More Options widget either in the XML layout file or programmatically in the java code.
<com.realwear.ux.viewgroups.moreoptions.MoreOptionsWidget
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
or
val moreOptionsWidget = MoreOptionsWidget(context)
Once the widget is created, the content view for the widget will have to be set. The developer will need to programmatically inflate a view and then set it to the More Options Widget, as shown below:
val contentForMoreOptions = layoutInflater.inflate(
R.layout.more_options_content,
findViewById(android.R.id.content),
false)
moreOptionsWidget.setContentView(contentForMoreOptions)
Once the content view has been set, the More Options widget is ready. There are two ways to bring it on screen: by giving the "More Options" command this is automatically included in the widget, or programmatically with the function showMoreOptions().
moreOptionsWidget.showMoreOptions()
The More Options Widget can be closed two ways: by giving the “Hide Options” command that is automatically included in the widget, or programmatically with the function hideMoreOptions().
moreOptionsWidget.hideMoreOptions()
All other behavior in the More Options Widget is up to the developer to implement. The content view can hold any Android components and views, as well as other UX Library components, including the Horizontal Selector. The desired behavior will have to be set on the content view before you actually set it to the More Options Widget.
val contentForMoreOptions = layoutInflater.inflate(
R.layout.more_options_content,
findViewById(android.R.id.content),
false)
contentForMoreOptions.my_button.setOnClickListener {
// Action for this Button to trigger.
}
moreOptionsWidget.setContentView(contentForMoreOptions)