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);
}
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);
}
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);
}
}
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);
}
}
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);
}
}
Aggregations