Ejemplo n.º 1
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   this.menu = menu;
   createMenu(menu, ACTION_EXPAND_ALL, R.string.menuExpandAll, R.drawable.menu_expand);
   createMenu(menu, ACTION_COLLAPSE_ALL, R.string.menuCollapseAll, R.drawable.menu_collapse);
   createMenu(menu, ACTION_RELOAD, R.string.menuReload, R.drawable.menu_reload);
   createMenu(menu, ACTION_NEW_BM, R.string.menuCreate, R.drawable.menu_create);
   createMenu(
       menu,
       ACTION_BACKUP_RESTORE,
       SystemUtil.isHoneycombOrNewer() ? R.string.brDialogTitle : R.string.menuBackup,
       R.drawable.menu_save);
   createMenu(menu, ACTION_SETTINGS, R.string.menuPrefs, R.drawable.menu_prefs);
   return true;
 }
Ejemplo n.º 2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    menu.close();

    int id = item.getItemId();
    if (id == ACTION_COLLAPSE_ALL || id == ACTION_EXPAND_ALL) {
      ctx.bookmarkManager.toggleFolders(id);
      ctx.bookmarkListAdapter.redraw();
    } else if (id == ACTION_RELOAD) {
      ctx.reloadAndRefresh();
      int numberOfBookmarks = ctx.bookmarkManager.getNumberOfBookmarks();
      SystemUtil.toastShort(
          ctx.activity, StringUtil.textWithParam(this, R.string.hintReloaded, numberOfBookmarks));
    } else if (id == ACTION_NEW_BM) {
      new EditBookmarkDialog(ctx);
    } else if (id == ACTION_SETTINGS) {
      new PreferencesDialog(ctx);
    } else if (id == ACTION_BACKUP_RESTORE) {
      new BackupRestoreDialog(ctx);
    }
    return true;
  }