Esempio n. 1
0
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
   final ListView view = (ListView) getTabHost().getCurrentView();
   final Bookmark bookmark = ((BookmarksAdapter) view.getAdapter()).getItem(position);
   switch (item.getItemId()) {
     case OPEN_ITEM_ID:
       gotoBookmark(bookmark);
       return true;
     case EDIT_ITEM_ID:
       final Intent intent = new Intent(this, BookmarkEditActivity.class);
       OrientationUtil.startActivityForResult(this, intent, 1);
       // TODO: implement
       return true;
     case DELETE_ITEM_ID:
       myCollection.deleteBookmark(bookmark);
       if (myThisBookAdapter != null) {
         myThisBookAdapter.remove(bookmark);
       }
       if (myAllBooksAdapter != null) {
         myAllBooksAdapter.remove(bookmark);
       }
       if (mySearchResultsAdapter != null) {
         mySearchResultsAdapter.remove(bookmark);
       }
       return true;
   }
   return super.onContextItemSelected(item);
 }
Esempio n. 2
0
  /** Called when one of the menu items is selected. */
  public boolean onOptionsItemSelected(MenuItem item) {

    int itemId = item.getItemId();
    Utilities.LogInfo("Option item selected - " + String.valueOf(item.getTitle()));

    switch (itemId) {
      case R.id.mnuSettings:
        Intent settingsActivity = new Intent(getApplicationContext(), GpsSettingsActivity.class);
        startActivity(settingsActivity);
        break;
      case R.id.mnuOSM:
        UploadToOpenStreetMap();
        break;
      case R.id.mnuDropBox:
        UploadToDropBox();
        break;
      case R.id.mnuAnnotate:
        Annotate();
        break;
      case R.id.mnuShare:
        Share();
        break;
      case R.id.mnuEmailnow:
        EmailNow();
        break;
      case R.id.mnuExit:
        loggingService.StopLogging();
        loggingService.stopSelf();
        finish();
        break;
    }
    return false;
  }
Esempio n. 3
0
 public boolean onMenuItemClick(MenuItem item) {
   switch (item.getItemId()) {
     case 1:
       return onSearchRequested();
     default:
       return true;
   }
 }
 @Override
 public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_remove:
       SparseBooleanArray positions = getListView().getCheckedItemPositions();
       long[] ids = getListView().getCheckedItemIds();
       removeItem(positions, ids, mode);
       return true;
   }
   return false;
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case MENU_SEARCH:
       return onSearchRequested();
     case MENU_ADD_CATALOG:
       AddCustomCatalogItemActions.addCustomCatalog(this);
       return true;
     case MENU_REFRESH:
       refreshCatalogsList();
       return true;
     case MENU_LANGUAGE_FILTER:
       runLanguageFilterDialog();
       return true;
     default:
       return true;
   }
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_add:
        AddFilterDialog dialog = new AddFilterDialog();
        dialog.setTargetFragment(AbstractFilterFragment.this, 0);
        dialog.show(getFragmentManager(), "");
        break;
      case R.id.filter_clear:
        ClearFilterDialog clearFilterDialog = new ClearFilterDialog();
        clearFilterDialog.setTargetFragment(this, 0);
        clearFilterDialog.show(getFragmentManager(), "");

        return true;
    }

    return true;
  }
Esempio n. 7
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.loader_menu_set_user_id:
        {
          showUserHashDialog();
          return true;
        }

      case R.id.loader_menu_refresh_map_list:
        {
          refreshMapList();
          return true;
        }

      default:
        return super.onOptionsItemSelected(item);
    }
  }
  // code which handles the action for each menu item
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.settings:
        {
          Intent preferences_intent = new Intent();
          preferences_intent.setComponent(
              new ComponentName(download_photos.this, preferences.class));
          preferences_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          getApplicationContext().startActivity(preferences_intent);

          return true;
        }
      case R.id.logout:
        {
          try {
            download_photos.this.facebook.logout(getApplicationContext());
          } catch (IOException e) {
            e.printStackTrace();
          }

          mPrefs = getSharedPreferences("COMMON", MODE_PRIVATE);

          SharedPreferences.Editor editor = mPrefs.edit();
          editor.putString("access_token", null);
          editor.putLong("access_expires", 0);
          editor.putBoolean("logout", true);
          editor.commit();
          finish();
          return true;
        }
      case R.id.about:
        {
          // shows our customized about dialog
          AboutDialog about = new AboutDialog(this);

          about.show();
          return true;
        }
        // lets deal with default case
      default:
        return super.onOptionsItemSelected(item);
    }
  }