Search in sources :

Example 41 with SubMenu

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);
}
Also used : SubMenu(android.view.SubMenu)

Example 42 with SubMenu

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);
}
Also used : SubMenu(android.view.SubMenu)

Example 43 with SubMenu

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");
}
Also used : AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SubMenu(android.view.SubMenu)

Example 44 with SubMenu

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));
}
Also used : SubMenu(android.view.SubMenu) MenuItem(android.view.MenuItem) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 45 with SubMenu

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;
}
Also used : SubMenu(android.view.SubMenu)

Aggregations

SubMenu (android.view.SubMenu)80 MenuItem (android.view.MenuItem)38 View (android.view.View)11 LayoutInflater (android.view.LayoutInflater)10 PackageManager (android.content.pm.PackageManager)9 Bundle (android.os.Bundle)9 Nullable (android.support.annotation.Nullable)9 ViewGroup (android.view.ViewGroup)9 R (com.simplecity.amp_library.R)9 UpgradeDialog (com.simplecity.amp_library.ui.dialog.UpgradeDialog)9 SelectableViewModel (com.simplecity.amp_library.ui.modelviews.SelectableViewModel)9 ContextualToolbar (com.simplecity.amp_library.ui.views.ContextualToolbar)9 ContextualToolbarHelper (com.simplecity.amp_library.utils.ContextualToolbarHelper)9 MenuUtils (com.simplecity.amp_library.utils.MenuUtils)9 PlaylistUtils (com.simplecity.amp_library.utils.PlaylistUtils)9 ViewModel (com.simplecityapps.recycler_adapter.model.ViewModel)9 Disposable (io.reactivex.disposables.Disposable)9 ResolveInfo (android.content.pm.ResolveInfo)8 MusicUtils (com.simplecity.amp_library.utils.MusicUtils)8 RecyclerListener (com.simplecityapps.recycler_adapter.recyclerview.RecyclerListener)8