I would like know how to list all available contextual commands on card, where the "Ok, glass" is at footer and ready to accepting the commands. My app has more than 10 contextual commands and the user might not remember all the commands.
My code below will just show "Ok glass" as footer and nothing above the footer. However, the list of commands will be shown right after the "Ok glass" command. I would like to have the list and "ok glass" to be shown at the same time.
Please advise.
public class MenuActivity extends Activity {
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// Requests a voice menu on this activity. As for any other
// window feature, be sure to request this before
// setContentView() is called
getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
setContentView(R.layout.start);
}
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == WindowUtils.FEATURE_VOICE_COMMANDS||
featureId == Window.FEATURE_OPTIONS_PANEL) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
// Pass through to super to setup touch menu.
return super.onCreatePanelMenu(featureId, menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
if (featureId == WindowUtils.FEATURE_VOICE_COMMANDS||
featureId == Window.FEATURE_OPTIONS_PANEL) {
switch (item.getItemId()) {
case R.id.Atrig_menu_item:
// handle A trigger
break;
case R.id.Btrig_menu_item:
// handle B trigger
break;
case R.id.Ctrig_menu_item:
// handle C trigger
break;
case R.id.Dtrig_menu_item:
// handle D trigger
break;
case R.id.Etrig_menu_item:
// handle E trigger
this.finish();
default:
return true;
}
return true;
}
// Good practice to pass through to super if not handled
return super.onMenuItemSelected(featureId, item);
}
}