Search in sources :

Example 46 with SubMenu

use of android.view.SubMenu in project c-geo by just-radovan.

the class cgeopopup 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));
    // log visit
    menu.add(0, 6, 0, res.getString(R.string.cache_menu_visit)).setIcon(android.R.drawable.ic_menu_agenda);
    // caches around
    menu.add(0, 5, 0, res.getString(R.string.cache_menu_around)).setIcon(android.R.drawable.ic_menu_rotate);
    // browser
    menu.add(0, 7, 0, res.getString(R.string.cache_menu_browser)).setIcon(android.R.drawable.ic_menu_info_details);
    return true;
}
Also used : SubMenu(android.view.SubMenu)

Example 47 with SubMenu

use of android.view.SubMenu in project c-geo by just-radovan.

the class cgeocaches method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    SubMenu subMenuFilter = menu.addSubMenu(0, 105, 0, res.getString(R.string.caches_filter)).setIcon(android.R.drawable.ic_menu_search);
    subMenuFilter.setHeaderTitle(res.getString(R.string.caches_filter_title));
    subMenuFilter.add(0, 21, 0, res.getString(R.string.caches_filter_type));
    subMenuFilter.add(0, 22, 0, res.getString(R.string.caches_filter_size));
    subMenuFilter.add(0, 23, 0, res.getString(R.string.caches_filter_track));
    subMenuFilter.add(0, 24, 0, res.getString(R.string.caches_filter_clear));
    SubMenu subMenuSort = menu.addSubMenu(0, 104, 0, res.getString(R.string.caches_sort)).setIcon(android.R.drawable.ic_menu_sort_alphabetically);
    subMenuSort.setHeaderTitle(res.getString(R.string.caches_sort_title));
    // sort the context menu labels alphabetically for easier reading
    HashMap<String, Integer> comparators = new HashMap<String, Integer>();
    comparators.put(res.getString(R.string.caches_sort_distance), 10);
    comparators.put(res.getString(R.string.caches_sort_difficulty), 11);
    comparators.put(res.getString(R.string.caches_sort_terrain), 12);
    comparators.put(res.getString(R.string.caches_sort_size), 13);
    comparators.put(res.getString(R.string.caches_sort_favorites), 14);
    comparators.put(res.getString(R.string.caches_sort_name), 15);
    comparators.put(res.getString(R.string.caches_sort_gccode), 16);
    comparators.put(res.getString(R.string.caches_sort_rating), 18);
    comparators.put(res.getString(R.string.caches_sort_vote), 19);
    comparators.put(res.getString(R.string.caches_sort_inventory), 20);
    ArrayList<String> sortedLabels = new ArrayList<String>(comparators.keySet());
    Collections.sort(sortedLabels);
    for (String label : sortedLabels) {
        Integer id = comparators.get(label);
        subMenuSort.add(1, id, 0, label).setCheckable(true).setChecked(id == 10);
    }
    subMenuSort.setGroupCheckable(1, true, true);
    menu.add(0, 0, 0, res.getString(R.string.caches_select_mode)).setIcon(android.R.drawable.ic_menu_agenda);
    menu.add(0, 9, 0, res.getString(R.string.caches_select_invert)).setIcon(android.R.drawable.ic_menu_agenda);
    if (type.equals("offline") == true) {
        SubMenu subMenu = menu.addSubMenu(0, 103, 0, res.getString(R.string.caches_manage)).setIcon(android.R.drawable.ic_menu_save);
        // delete saved caches
        subMenu.add(0, 5, 0, res.getString(R.string.caches_drop_all));
        // download details for all caches
        subMenu.add(0, 1, 0, res.getString(R.string.cache_offline_refresh));
        // import gpx file
        menu.add(0, 6, 0, res.getString(R.string.gpx_import_title)).setIcon(android.R.drawable.ic_menu_upload);
    } else {
        // download details for all caches
        menu.add(0, 1, 0, res.getString(R.string.caches_store_offline)).setIcon(android.R.drawable.ic_menu_set_as);
    }
    final Intent intentTest = new Intent(Intent.ACTION_VIEW);
    intentTest.setData(Uri.parse("menion.points:x"));
    if (cgBase.isIntentAvailable(activity, intentTest) == true) {
        SubMenu subMenu = menu.addSubMenu(0, 101, 0, res.getString(R.string.caches_on_map)).setIcon(android.R.drawable.ic_menu_mapmode);
        // show all caches on map using c:geo
        subMenu.add(0, 2, 0, res.getString(R.string.caches_map_cgeo));
        // show all caches on map using Locus
        subMenu.add(0, 3, 0, res.getString(R.string.caches_map_locus));
    } else {
        // show all caches on map
        menu.add(0, 2, 0, res.getString(R.string.caches_on_map)).setIcon(android.R.drawable.ic_menu_mapmode);
    }
    if (type.equals("offline") == true) {
        SubMenu subMenu = menu.addSubMenu(0, 102, 0, res.getString(R.string.list_menu)).setIcon(android.R.drawable.ic_menu_more);
        subMenu.add(0, 7, 0, res.getString(R.string.list_menu_create));
        subMenu.add(0, 8, 0, res.getString(R.string.list_menu_drop));
        subMenu.add(0, 17, 0, res.getString(R.string.list_menu_change));
    }
    return true;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SubMenu(android.view.SubMenu) Intent(android.content.Intent)

Example 48 with SubMenu

use of android.view.SubMenu in project c-geo by just-radovan.

the class cgeocaches method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo info) {
    super.onCreateContextMenu(menu, view, info);
    if (adapter == null) {
        return;
    }
    AdapterContextMenuInfo adapterInfo = null;
    try {
        adapterInfo = (AdapterContextMenuInfo) info;
    } catch (Exception e) {
        Log.w(cgSettings.tag, "cgeocaches.onCreateContextMenu: " + e.toString());
    }
    if ((adapterInfo == null || adapterInfo.position < 0) && selectedFilter != null) {
        if (selectedFilter.equals(res.getString(R.string.caches_filter_size))) {
            menu.setHeaderTitle(res.getString(R.string.caches_filter_size_title));
            menu.add(0, 8, 0, res.getString(R.string.caches_filter_size_micro));
            menu.add(0, 9, 0, res.getString(R.string.caches_filter_size_small));
            menu.add(0, 10, 0, res.getString(R.string.caches_filter_size_regular));
            menu.add(0, 11, 0, res.getString(R.string.caches_filter_size_large));
            menu.add(0, 12, 0, res.getString(R.string.caches_filter_size_other));
            menu.add(0, 13, 0, res.getString(R.string.caches_filter_size_virtual));
            menu.add(0, 14, 0, res.getString(R.string.caches_filter_size_notchosen));
        } else if (selectedFilter.equals(res.getString(R.string.caches_filter_type))) {
            menu.setHeaderTitle(res.getString(R.string.caches_filter_type_title));
            menu.add(0, 15, 0, res.getString(R.string.caches_filter_type_traditional));
            menu.add(0, 16, 0, res.getString(R.string.caches_filter_type_multi));
            menu.add(0, 17, 0, res.getString(R.string.caches_filter_type_mystery));
            menu.add(0, 18, 0, res.getString(R.string.caches_filter_type_letterbox));
            menu.add(0, 19, 0, res.getString(R.string.caches_filter_type_event));
            menu.add(0, 20, 0, res.getString(R.string.caches_filter_type_mega));
            menu.add(0, 21, 0, res.getString(R.string.caches_filter_type_earth));
            menu.add(0, 22, 0, res.getString(R.string.caches_filter_type_cito));
            menu.add(0, 23, 0, res.getString(R.string.caches_filter_type_webcam));
            menu.add(0, 24, 0, res.getString(R.string.caches_filter_type_virtual));
            menu.add(0, 25, 0, res.getString(R.string.caches_filter_type_wherigo));
            menu.add(0, 26, 0, res.getString(R.string.caches_filter_type_lostfound));
            menu.add(0, 27, 0, res.getString(R.string.caches_filter_type_ape));
            menu.add(0, 28, 0, res.getString(R.string.caches_filter_type_gchq));
            menu.add(0, 29, 0, res.getString(R.string.caches_filter_type_gps));
        }
    } else {
        final cgCache cache = adapter.getItem(adapterInfo.position);
        if (cache.name != null && cache.name.length() > 0) {
            menu.setHeaderTitle(cache.name);
        } else {
            menu.setHeaderTitle(cache.geocode);
        }
        if (cache.latitude != null && cache.longitude != null) {
            menu.add(0, 1, 0, res.getString(R.string.cache_menu_compass));
            menu.add(0, 2, 0, res.getString(R.string.cache_menu_radar));
            menu.add(0, 3, 0, res.getString(R.string.cache_menu_map));
            menu.add(0, 4, 0, res.getString(R.string.cache_menu_map_ext));
            menu.add(0, 5, 0, res.getString(R.string.cache_menu_tbt));
            menu.add(0, 6, 0, res.getString(R.string.cache_menu_visit));
            menu.add(0, 7, 0, res.getString(R.string.cache_menu_details));
        }
    }
    ArrayList<cgList> cacheLists = app.getLists();
    int listCount = cacheLists.size();
    if (listCount > 1) {
        SubMenu submenu = menu.addSubMenu(0, 8, 0, res.getString(R.string.cache_menu_move_list));
        for (int i = 0; i < listCount; i++) {
            cgList list = cacheLists.get(i);
            submenu.add(Menu.NONE, 100 + list.id, Menu.NONE, list.title);
        }
    }
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) SubMenu(android.view.SubMenu)

Example 49 with SubMenu

use of android.view.SubMenu in project c-geo by just-radovan.

the class cgeovisit method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    SubMenu subMenu = null;
    subMenu = menu.addSubMenu(0, 0, 0, res.getString(R.string.log_add)).setIcon(android.R.drawable.ic_menu_add);
    subMenu.add(0, LOG_DATE_TIME, 0, res.getString(R.string.log_date_time));
    subMenu.add(0, LOG_DATE, 0, res.getString(R.string.log_date));
    subMenu.add(0, LOG_TIME, 0, res.getString(R.string.log_time));
    subMenu.add(0, LOG_SIGNATURE, 0, res.getString(R.string.init_signature));
    subMenu.add(0, LOG_SIGNATURE_DATE_TIME, 0, res.getString(R.string.log_date_time) + " & " + res.getString(R.string.init_signature));
    subMenu = menu.addSubMenu(0, 9, 0, res.getString(R.string.log_rating)).setIcon(android.R.drawable.ic_menu_sort_by_size);
    subMenu.add(0, 10, 0, res.getString(R.string.log_no_rating));
    subMenu.add(0, 15, 0, res.getString(R.string.log_stars_5));
    subMenu.add(0, 14, 0, res.getString(R.string.log_stars_4));
    subMenu.add(0, 13, 0, res.getString(R.string.log_stars_3));
    subMenu.add(0, 12, 0, res.getString(R.string.log_stars_2));
    subMenu.add(0, 11, 0, res.getString(R.string.log_stars_1));
    return true;
}
Also used : SubMenu(android.view.SubMenu)

Example 50 with SubMenu

use of android.view.SubMenu in project c-geo by just-radovan.

the class cgeowaypoint method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // compass
    menu.add(0, MENU_ID_COMPASS, 0, res.getString(R.string.cache_menu_compass)).setIcon(android.R.drawable.ic_menu_compass);
    SubMenu subMenu = menu.addSubMenu(1, MENU_ID_NAVIGATION, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_more);
    // radar
    subMenu.add(0, MENU_ID_RADAR, 0, res.getString(R.string.cache_menu_radar));
    // c:geo map
    subMenu.add(0, MENU_ID_MAP, 0, res.getString(R.string.cache_menu_map));
    if (base.isLocus(activity)) {
        // ext.: locus
        subMenu.add(0, MENU_ID_LOCUS, 0, res.getString(R.string.cache_menu_locus));
    }
    if (base.isRmaps(activity)) {
        // ext.: rmaps
        subMenu.add(0, MENU_ID_RMAPS, 0, res.getString(R.string.cache_menu_rmaps));
    }
    // ext.: other
    subMenu.add(0, MENU_ID_EXTERN, 0, res.getString(R.string.cache_menu_map_ext));
    // turn-by-turn
    subMenu.add(0, MENU_ID_TURNBYTURN, 0, res.getString(R.string.cache_menu_tbt));
    // caches around
    menu.add(0, MENU_ID_CACHES_AROUND, 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