Search in sources :

Example 6 with SubMenu

use of android.view.SubMenu in project HoloEverywhere by Prototik.

the class BaseMenuWrapper method getSubMenuWrapper.

final SubMenu getSubMenuWrapper(android.view.SubMenu frameworkSubMenu) {
    if (frameworkSubMenu != null) {
        // Instantiate HashMap if null
        if (mSubMenus == null) {
            mSubMenus = new HashMap<android.view.SubMenu, SubMenu>();
        }
        SubMenu compatSubMenu = mSubMenus.get(frameworkSubMenu);
        if (null == compatSubMenu) {
            compatSubMenu = MenuWrapperFactory.createSupportSubMenuWrapper(frameworkSubMenu);
            mSubMenus.put(frameworkSubMenu, compatSubMenu);
        }
        return compatSubMenu;
    }
    return null;
}
Also used : SubMenu(android.view.SubMenu)

Example 7 with SubMenu

use of android.view.SubMenu in project Anki-Android by Ramblurr.

the class Reviewer method onCreateOptionsMenu.

//    @Override
//    public void onConfigurationChanged(Configuration newConfig) {
//        super.onConfigurationChanged(newConfig);
//        setLanguage(mLocale);
//        Log.i(AnkiDroidApp.TAG, "onConfigurationChanged");
//
//        mConfigurationChanged = true;
//
//        long savedTimer = mCardTimer.getBase();
//        CharSequence savedAnswerField = mAnswerField.getText();
//        boolean cardVisible = mCardContainer.getVisibility() == View.VISIBLE;
//        int lookupButtonVis = mLookUpIcon.getVisibility();
//
//        // Reload layout
//        initLayout(R.layout.flashcard);
//
//        if (mRelativeButtonSize != 100) {
//            mFlipCard.setHeight(mButtonHeight);
//            mEase1.setHeight(mButtonHeight);
//            mEase2.setHeight(mButtonHeight);
//            mEase3.setHeight(mButtonHeight);
//            mEase4.setHeight(mButtonHeight);
//        }
//
//        // Modify the card template to indicate the new available width and refresh card
//        mCardTemplate = mCardTemplate.replaceFirst("var availableWidth = \\d*;", "var availableWidth = "
//                + getAvailableWidthInCard() + ";");
//
//        if (typeAnswer()) {
//            mAnswerField.setText(savedAnswerField);
//        }
//        if (mPrefWhiteboard) {
//            mWhiteboard.rotate();
//        }
//        if (mInvertedColors) {
//            invertColors(true);
//        }
//
//        // If the card hasn't loaded yet, don't refresh it
//        // Also skipping the counts (because we don't know which one to underline)
//        // They will be updated when the card loads anyway
//        if (mCurrentCard != null) {
//            if (cardVisible) {
//                fillFlashcard(false);
//                if (mPrefTimer) {
//                    mCardTimer.setBase(savedTimer);
//                    mCardTimer.start();
//                }
//                if (sDisplayAnswer) {
//                    updateForNewCard();
//                }
//            } else {
//                mCardContainer.setVisibility(View.INVISIBLE);
//                switchVisibility(mProgressBars, View.INVISIBLE);
//                switchVisibility(mCardTimer, View.INVISIBLE);
//            }
//            if (sDisplayAnswer) {
//                showEaseButtons();
//            }
//        }
//        mLookUpIcon.setVisibility(lookupButtonVis);
//        mConfigurationChanged = false;
//    }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    Resources res = getResources();
    UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_MARK, Menu.NONE, R.string.menu_mark_card, R.drawable.ic_menu_mark);
    UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_UNDO, Menu.NONE, R.string.undo, R.drawable.ic_menu_revert_disabled);
    UIUtils.addMenuItem(menu, Menu.NONE, MENU_EDIT, Menu.NONE, R.string.menu_edit_card, R.drawable.ic_menu_edit);
    if (mPrefWhiteboard) {
        if (mShowWhiteboard) {
            UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.hide_whiteboard, R.drawable.ic_menu_compose);
        } else {
            UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_WHITEBOARD, Menu.NONE, R.string.show_whiteboard, R.drawable.ic_menu_compose);
        }
        UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_CLEAR_WHITEBOARD, Menu.NONE, R.string.clear_whiteboard, R.drawable.ic_menu_clear_playlist);
    }
    SubMenu removeDeckSubMenu = menu.addSubMenu(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.menu_dismiss_note);
    removeDeckSubMenu.setIcon(R.drawable.ic_menu_stop);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY_CARD, Menu.NONE, R.string.menu_bury_card);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_BURY_NOTE, Menu.NONE, R.string.menu_bury_note);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_CARD, Menu.NONE, R.string.menu_suspend_card);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_SUSPEND_NOTE, Menu.NONE, R.string.menu_suspend_note);
    removeDeckSubMenu.add(Menu.NONE, MENU_REMOVE_DELETE, Menu.NONE, R.string.menu_delete_note);
    if (mPrefTextSelection) {
        MenuItem item = menu.add(Menu.NONE, MENU_SEARCH, Menu.NONE, res.getString(R.string.menu_select));
        item.setIcon(R.drawable.ic_menu_search);
        item.setEnabled(Lookup.isAvailable());
    }
    return true;
}
Also used : SubMenu(android.view.SubMenu) MenuItem(android.view.MenuItem) Resources(android.content.res.Resources)

Example 8 with SubMenu

use of android.view.SubMenu in project FileExplorer by MiCode.

the class FileViewInteractionHub method onCreateOptionsMenu.

public boolean onCreateOptionsMenu(Menu menu) {
    clearSelection();
    showDropdownNavigation(false);
    // menu.add(0, MENU_SEARCH, 0,
    // R.string.menu_item_search).setOnMenuItemClickListener(
    // menuItemClick);
    addMenuItem(menu, MENU_SELECTALL, 0, R.string.operation_selectall, R.drawable.ic_menu_select_all);
    SubMenu sortMenu = menu.addSubMenu(0, MENU_SORT, 1, R.string.menu_item_sort).setIcon(R.drawable.ic_menu_sort);
    addMenuItem(sortMenu, MENU_SORT_NAME, 0, R.string.menu_item_sort_name);
    addMenuItem(sortMenu, MENU_SORT_SIZE, 1, R.string.menu_item_sort_size);
    addMenuItem(sortMenu, MENU_SORT_DATE, 2, R.string.menu_item_sort_date);
    addMenuItem(sortMenu, MENU_SORT_TYPE, 3, R.string.menu_item_sort_type);
    sortMenu.setGroupCheckable(0, true, true);
    sortMenu.getItem(0).setChecked(true);
    // addMenuItem(menu, GlobalConsts.MENU_PASTE, 2,
    // R.string.operation_paste);
    addMenuItem(menu, GlobalConsts.MENU_NEW_FOLDER, 3, R.string.operation_create_folder, R.drawable.ic_menu_new_folder);
    addMenuItem(menu, GlobalConsts.MENU_FAVORITE, 4, R.string.operation_favorite, R.drawable.ic_menu_delete_favorite);
    addMenuItem(menu, GlobalConsts.MENU_SHOWHIDE, 5, R.string.operation_show_sys, R.drawable.ic_menu_show_sys);
    addMenuItem(menu, MENU_REFRESH, 6, R.string.operation_refresh, R.drawable.ic_menu_refresh);
    addMenuItem(menu, MENU_SETTING, 7, R.string.menu_setting, drawable.ic_menu_preferences);
    addMenuItem(menu, MENU_EXIT, 8, R.string.menu_exit, drawable.ic_menu_close_clear_cancel);
    return true;
}
Also used : SubMenu(android.view.SubMenu)

Example 9 with SubMenu

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

the class cgeonavigate method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (settings.useCompass == 1) {
        menu.add(0, 1, 0, res.getString(R.string.use_gps)).setIcon(android.R.drawable.ic_menu_compass);
    } else {
        menu.add(0, 1, 0, res.getString(R.string.use_compass)).setIcon(android.R.drawable.ic_menu_compass);
    }
    menu.add(0, 0, 0, res.getString(R.string.caches_on_map)).setIcon(android.R.drawable.ic_menu_mapmode);
    menu.add(0, 2, 0, res.getString(R.string.destination_set)).setIcon(android.R.drawable.ic_menu_edit);
    if (coordinates != null && coordinates.size() > 1) {
        SubMenu subMenu = menu.addSubMenu(0, 3, 0, res.getString(R.string.destination_select)).setIcon(android.R.drawable.ic_menu_myplaces);
        int cnt = 4;
        for (cgCoord coordinate : coordinates) {
            subMenu.add(0, cnt, 0, coordinate.name + " (" + coordinate.type + ")");
            cnt++;
        }
        return true;
    } else {
        menu.add(0, 3, 0, res.getString(R.string.destination_select)).setIcon(android.R.drawable.ic_menu_myplaces).setEnabled(false);
        return true;
    }
}
Also used : SubMenu(android.view.SubMenu)

Example 10 with SubMenu

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

the class cgeotouch method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    SubMenu subMenu = menu.addSubMenu(0, 0, 0, res.getString(R.string.log_add)).setIcon(android.R.drawable.ic_menu_add);
    subMenu.add(0, 0x6, 0, res.getString(R.string.log_date_time));
    subMenu.add(0, 0x4, 0, res.getString(R.string.log_date));
    subMenu.add(0, 0x2, 0, res.getString(R.string.log_time));
    subMenu.add(0, 0x1, 0, res.getString(R.string.init_signature));
    subMenu.add(0, 0x7, 0, res.getString(R.string.log_date_time) + " & " + res.getString(R.string.init_signature));
    return true;
}
Also used : SubMenu(android.view.SubMenu)

Aggregations

SubMenu (android.view.SubMenu)64 MenuItem (android.view.MenuItem)25 PackageManager (android.content.pm.PackageManager)9 ResolveInfo (android.content.pm.ResolveInfo)8 TextView (android.widget.TextView)8 AdapterView (android.widget.AdapterView)7 SmallTest (android.test.suitebuilder.annotation.SmallTest)6 Paint (android.graphics.Paint)5 ArrayList (java.util.ArrayList)5 Cursor (android.database.Cursor)3 SuppressLint (android.annotation.SuppressLint)2 Intent (android.content.Intent)2 Drawable (android.graphics.drawable.Drawable)2 PopupMenu (android.support.v7.widget.PopupMenu)2 RecyclerView (android.support.v7.widget.RecyclerView)2 MenuInflater (android.view.MenuInflater)2 View (android.view.View)2 Playlist (com.simplecity.amp_library.model.Playlist)2 TargetApi (android.annotation.TargetApi)1 ProgressDialog (android.app.ProgressDialog)1