use of android.view.SubMenu in project Shuttle by timusus.
the class MenuUtils method setupSongMenu.
public static void setupSongMenu(PopupMenu menu, boolean showRemoveButton) {
menu.inflate(R.menu.menu_song);
if (!showRemoveButton) {
menu.getMenu().findItem(R.id.remove).setVisible(false);
}
// Add playlist menu
SubMenu sub = menu.getMenu().findItem(R.id.addToPlaylist).getSubMenu();
PlaylistUtils.createPlaylistMenu(sub);
}
use of android.view.SubMenu in project Shuttle by timusus.
the class MenuUtils method setupAlbumMenu.
// Albums
public static void setupAlbumMenu(PopupMenu menu) {
menu.inflate(R.menu.menu_album);
// Add playlist menu
SubMenu sub = menu.getMenu().findItem(R.id.addToPlaylist).getSubMenu();
PlaylistUtils.createPlaylistMenu(sub);
}
use of android.view.SubMenu in project android_frameworks_base by ResurrectionRemix.
the class ListContextMenu method onCreateContextMenu.
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
String text = ((TextView) info.targetView).getText().toString();
if (text.contains("[0]")) {
menu.setHeaderTitle("This is a test of the title and the icon").setHeaderIcon(android.R.drawable.sym_def_app_icon);
} else if (text.contains("[1]")) {
menu.setHeaderTitle("This is a test of just the title");
} else {
TextView textView = new TextView(this);
textView.setText("This is a test of a custom View");
menu.setHeaderView(textView);
}
menu.add(0, 0, 0, "Test 1");
SubMenu sm = menu.addSubMenu(0, 0, 0, "Test 1.5 SM");
sm.add(0, 0, 0, "CM Subitem 1");
sm.add(0, 0, 0, "CM Subitem 2");
sm.add(0, 0, 0, "CM Subitem 3");
menu.add(0, 0, 0, "Test 2");
menu.add(0, 0, 0, "Test 3");
menu.add(0, 0, 0, "Test 4");
menu.add(0, 0, 0, "Test 5");
menu.add(0, 0, 0, "Test 6");
menu.add(0, 0, 0, "Test 7");
menu.add(0, 0, 0, "Test 8");
menu.add(0, 0, 0, "Test 9");
menu.add(0, 0, 0, "Test 10");
menu.add(0, 0, 0, "Test 11");
menu.add(0, 0, 0, "Test 12");
menu.add(0, 0, 0, "Test 13");
menu.add(0, 0, 0, "Test 14");
menu.add(0, 0, 0, "Test 15");
menu.add(0, 0, 0, "Test 16");
menu.add(0, 0, 0, "Test 17");
menu.add(0, 0, 0, "Test 18");
menu.add(0, 0, 0, "Test 19");
menu.add(0, 0, 0, "Test 20");
menu.add(0, 0, 0, "Test 21");
menu.add(0, 0, 0, "Test 22");
menu.add(0, 0, 0, "Test 23");
menu.add(0, 0, 0, "Test 24");
}
use of android.view.SubMenu in project android_frameworks_base by ResurrectionRemix.
the class MenuTest method testSubMenu.
@SmallTest
public void testSubMenu() {
final SubMenu subMenu = mMenu.addSubMenu(0, 0, 0, "submenu");
final MenuItem subMenuItem = subMenu.getItem();
final MenuItem item1 = subMenu.add(0, 1, 0, "item1");
final MenuItem item2 = subMenu.add(0, 2, 0, "item2");
// findItem should recurse into submenus
Assert.assertEquals(item1, mMenu.findItem(1));
Assert.assertEquals(item2, mMenu.findItem(2));
}
use of android.view.SubMenu in project c-geo by just-radovan.
the class cgeopoint method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// compass
menu.add(0, 2, 0, res.getString(R.string.cache_menu_compass)).setIcon(android.R.drawable.ic_menu_compass);
SubMenu subMenu = menu.addSubMenu(1, 0, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_more);
// radar
subMenu.add(0, 3, 0, res.getString(R.string.cache_menu_radar));
// c:geo map
subMenu.add(0, 1, 0, res.getString(R.string.cache_menu_map));
if (base.isLocus(activity)) {
// ext.: locus
subMenu.add(0, 20, 0, res.getString(R.string.cache_menu_locus));
}
if (base.isRmaps(activity)) {
// ext.: rmaps
subMenu.add(0, 21, 0, res.getString(R.string.cache_menu_rmaps));
}
// ext.: other
subMenu.add(0, 23, 0, res.getString(R.string.cache_menu_map_ext));
// turn-by-turn
subMenu.add(0, 4, 0, res.getString(R.string.cache_menu_tbt));
// caches around
menu.add(0, 5, 0, res.getString(R.string.cache_menu_around)).setIcon(android.R.drawable.ic_menu_rotate);
return true;
}
Aggregations