Search in sources :

Example 81 with MenuItem

use of android.view.MenuItem in project weiciyuan by qii.

the class WriteWeiboActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    String contentStr = content.getText().toString();
    if (!TextUtils.isEmpty(contentStr)) {
        menu.findItem(R.id.menu_clear).setVisible(true);
    } else {
        menu.findItem(R.id.menu_clear).setVisible(false);
    }
    MusicInfo musicInfo = GlobalContext.getInstance().getMusicInfo();
    if (!musicInfo.isEmpty()) {
        MenuItem musicMenu = menu.findItem(R.id.menu_add_now_playing);
        musicMenu.setVisible(true);
        musicMenu.setTitle(musicInfo.toString());
    }
    return super.onPrepareOptionsMenu(menu);
}
Also used : MenuItem(android.view.MenuItem) MusicInfo(org.qii.weiciyuan.bean.android.MusicInfo)

Example 82 with MenuItem

use of android.view.MenuItem in project weiciyuan by qii.

the class UserInfoActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (isMyselfProfile()) {
        getMenuInflater().inflate(R.menu.actionbar_menu_myinfoactivity, menu);
        MenuItem edit = menu.findItem(R.id.menu_edit);
        edit.setVisible(GlobalContext.getInstance().getAccountBean().isBlack_magic());
    } else {
        getMenuInflater().inflate(R.menu.actionbar_menu_infofragment, menu);
        if (bean.isFollowing()) {
            menu.findItem(R.id.menu_follow).setVisible(false);
            menu.findItem(R.id.menu_unfollow).setVisible(true);
            menu.findItem(R.id.menu_manage_group).setVisible(true);
        } else {
            menu.findItem(R.id.menu_follow).setVisible(true);
            menu.findItem(R.id.menu_unfollow).setVisible(false);
            menu.findItem(R.id.menu_manage_group).setVisible(false);
        }
        if (!bean.isFollowing() && bean.isFollow_me()) {
            menu.findItem(R.id.menu_remove_fan).setVisible(true);
        } else {
            menu.findItem(R.id.menu_remove_fan).setVisible(false);
        }
    }
    return super.onCreateOptionsMenu(menu);
}
Also used : MenuItem(android.view.MenuItem)

Example 83 with MenuItem

use of android.view.MenuItem in project weiciyuan by qii.

the class UserInfoFragment method onCreateOptionsMenu.

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (isMyself() && isOpenedFromMainPage()) {
        inflater.inflate(R.menu.actionbar_menu_newuserinfofragment_main_page, menu);
        MenuItem edit = menu.findItem(R.id.menu_edit);
        edit.setVisible(GlobalContext.getInstance().getAccountBean().isBlack_magic());
        refreshItem = menu.findItem(R.id.menu_refresh_my_profile);
    }
}
Also used : MenuItem(android.view.MenuItem)

Example 84 with MenuItem

use of android.view.MenuItem in project FloatingSearchView by renaudcerrato.

the class FloatingSearchView method showMenu.

private void showMenu(final boolean visible) {
    Menu menu = getMenu();
    for (int i = 0; i < menu.size(); i++) {
        MenuItem item = menu.getItem(i);
        if (mAlwaysShowingMenu.contains(item.getItemId()))
            continue;
        item.setVisible(visible);
    }
}
Also used : MenuItem(android.view.MenuItem) Menu(android.view.Menu)

Example 85 with MenuItem

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

the class GistFragment method onPrepareOptionsMenu.

@Override
public void onPrepareOptionsMenu(Menu menu) {
    boolean owner = isOwner();
    if (!owner) {
        menu.removeItem(R.id.m_delete);
        MenuItem starItem = menu.findItem(R.id.m_star);
        starItem.setEnabled(loadFinished && !owner);
        if (starred) {
            starItem.setTitle(R.string.unstar);
        } else {
            starItem.setTitle(R.string.star);
        }
    } else {
        menu.removeItem(R.id.m_star);
    }
}
Also used : MenuItem(android.view.MenuItem)

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