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