Search in sources :

Example 86 with MenuItem

use of android.view.MenuItem in project PocketHub by pockethub.

the class CommentListAdapter method showMorePopup.

private void showMorePopup(View v, final GitHubComment comment, final boolean canEdit, final boolean canDelete) {
    PopupMenu menu = new PopupMenu(context, v);
    menu.inflate(R.menu.comment_popup);
    menu.getMenu().findItem(R.id.m_edit).setEnabled(canEdit);
    menu.getMenu().findItem(R.id.m_delete).setEnabled(canDelete);
    menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
            switch(menuItem.getItemId()) {
                case R.id.m_edit:
                    if (editCommentListener != null) {
                        editCommentListener.onEditComment(comment);
                    }
                    break;
                case R.id.m_delete:
                    if (deleteCommentListener != null) {
                        deleteCommentListener.onDeleteComment(comment);
                    }
                    break;
            }
            return false;
        }
    });
    menu.show();
}
Also used : MenuItem(android.view.MenuItem) PopupMenu(android.support.v7.widget.PopupMenu)

Example 87 with MenuItem

use of android.view.MenuItem in project PocketHub by pockethub.

the class CommitFileViewActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(final Menu optionsMenu) {
    getMenuInflater().inflate(R.menu.activity_file_view, optionsMenu);
    MenuItem wrapItem = optionsMenu.findItem(R.id.m_wrap);
    if (PreferenceUtils.getCodePreferences(this).getBoolean(WRAP, false)) {
        wrapItem.setTitle(R.string.disable_wrapping);
    } else {
        wrapItem.setTitle(R.string.enable_wrapping);
    }
    markdownItem = optionsMenu.findItem(R.id.m_render_markdown);
    if (isMarkdownFile) {
        markdownItem.setEnabled(blob != null);
        markdownItem.setVisible(true);
        if (PreferenceUtils.getCodePreferences(this).getBoolean(RENDER_MARKDOWN, true)) {
            markdownItem.setTitle(R.string.show_raw_markdown);
        } else {
            markdownItem.setTitle(R.string.render_markdown);
        }
    }
    return true;
}
Also used : MenuItem(android.view.MenuItem)

Example 88 with MenuItem

use of android.view.MenuItem in project PocketHub by pockethub.

the class IssueSearchActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu options) {
    getMenuInflater().inflate(R.menu.activity_search, options);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = options.findItem(R.id.m_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    Bundle args = new Bundle();
    args.putParcelable(EXTRA_REPOSITORY, repository);
    searchView.setAppSearchData(args);
    return true;
}
Also used : SearchManager(android.app.SearchManager) Bundle(android.os.Bundle) MenuItem(android.view.MenuItem)

Example 89 with MenuItem

use of android.view.MenuItem in project android by owncloud.

the class DrawerActivity method repopulateAccountList.

/**
     * re-populates the account list.
     *
     * @param accounts list of accounts
     */
private void repopulateAccountList(Account[] accounts) {
    // remove all accounts from list
    mNavigationView.getMenu().removeGroup(R.id.drawer_menu_accounts);
    // add all accounts to list
    for (int i = 0; i < accounts.length; i++) {
        if (!getAccount().name.equals(accounts[i].name)) {
            MenuItem accountMenuItem = mNavigationView.getMenu().add(R.id.drawer_menu_accounts, Menu.NONE, MENU_ORDER_ACCOUNT, accounts[i].name);
            ThumbnailsCacheManager.GetAvatarTask task = new ThumbnailsCacheManager.GetAvatarTask(accountMenuItem, accounts[i], mMenuAccountAvatarRadiusDimension, false);
            task.execute();
        }
    }
    // re-add add-account and manage-accounts
    mNavigationView.getMenu().add(R.id.drawer_menu_accounts, R.id.drawer_menu_account_add, MENU_ORDER_ACCOUNT_FUNCTION, getResources().getString(R.string.prefs_add_account)).setIcon(R.drawable.ic_account_plus);
    mNavigationView.getMenu().add(R.id.drawer_menu_accounts, R.id.drawer_menu_account_manage, MENU_ORDER_ACCOUNT_FUNCTION, getResources().getString(R.string.drawer_manage_accounts)).setIcon(R.drawable.ic_settings);
    // adding sets menu group back to visible, so safety check and setting invisible
    showMenu();
}
Also used : ThumbnailsCacheManager(com.owncloud.android.datamodel.ThumbnailsCacheManager) MenuItem(android.view.MenuItem)

Example 90 with MenuItem

use of android.view.MenuItem in project V2HOT by djyde.

the class ContentActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.content_activity, menu);
    MenuItem item = menu.findItem(R.id.menu_item_share);
    ShareActionProvider shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
    shareActionProvider.setShareIntent(getShareIntent());
    return true;
}
Also used : MenuItem(android.view.MenuItem) ShareActionProvider(android.support.v7.widget.ShareActionProvider)

Aggregations

MenuItem (android.view.MenuItem)761 View (android.view.View)140 Intent (android.content.Intent)86 TextView (android.widget.TextView)78 PopupMenu (android.widget.PopupMenu)62 ImageView (android.widget.ImageView)58 Menu (android.view.Menu)52 SearchView (android.support.v7.widget.SearchView)46 SmallTest (android.test.suitebuilder.annotation.SmallTest)42 RecyclerView (android.support.v7.widget.RecyclerView)36 MenuInflater (android.view.MenuInflater)35 AdapterView (android.widget.AdapterView)33 ListView (android.widget.ListView)32 SubMenu (android.view.SubMenu)30 ComponentName (android.content.ComponentName)25 PackageManager (android.content.pm.PackageManager)25 Parcelable (android.os.Parcelable)24 Toolbar (android.support.v7.widget.Toolbar)24 Bundle (android.os.Bundle)19 PopupMenu (android.support.v7.widget.PopupMenu)19