@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == R.id.menu_new_playlist) {
     if (!RdioComm.getComm().isAuthorized()) {
       Toast.makeText(getActivity(), R.string.not_authorized, Toast.LENGTH_SHORT).show();
       return true;
     }
     if (isAnyTaskRunning()) {
       Toast.makeText(
               getActivity().getApplicationContext(),
               R.string.operation_in_progress,
               Toast.LENGTH_SHORT)
           .show();
       return true;
     }
     InputDialogFragment dialog =
         InputDialogFragment.newInstance(R.string.playlist_name, "playlistName");
     dialog.showDialog(getActivity());
     return true;
   } else if (item.getItemId() == R.id.menu_login) {
     if (isAnyTaskRunning()) {
       Toast.makeText(getActivity(), R.string.operation_in_progress, Toast.LENGTH_SHORT).show();
       return true;
     }
     RdioComm.getComm().cleanAuthTokens(getActivity());
     login();
     return true;
   } else {
     return super.onOptionsItemSelected(item);
   }
 }
예제 #2
0
 @Override
 public boolean onMenuItemSelected(int featureId, MenuItem item) {
   if (optionsMenu.containsKey(item.getItemId())) {
     optionsMenu.get(item.getItemId()).activity(this).item(item).run();
   }
   return super.onMenuItemSelected(featureId, item);
 }
예제 #3
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == android.R.id.home || item.getItemId() == 0) {
     return false;
   }
   THEME = item.getItemId();
   Toast.makeText(this, "Theme changed to \"" + item.getTitle() + "\"", Toast.LENGTH_SHORT).show();
   return true;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == R.id.map_view) {
      category =
          (getArguments() != null) ? getArguments().getString(SearchFragment.ARG_CATEGORY) : null;
      if (category != null) {
        MapManager.switchToMapView(category, HomeFragment.ARG_POI_CATEGORY, this);
      } else {
        ArrayList<BaseDTObject> target = new ArrayList<BaseDTObject>();
        for (int i = 0; i < list.getAdapter().getCount(); i++) {
          BaseDTObject o = (BaseDTObject) list.getAdapter().getItem(i);
          target.add(o);
        }
        MapManager.switchToMapView(target, this);
      }
      return true;
    } else if (item.getItemId() == R.id.menu_item_addpoi) {
      {
        FragmentTransaction fragmentTransaction =
            getSherlockActivity().getSupportFragmentManager().beginTransaction();
        Fragment fragment = new CreatePoiFragment();
        Bundle args = new Bundle();
        args.putString(SearchFragment.ARG_CATEGORY, category);
        fragment.setArguments(args);
        fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        // fragmentTransaction.detach(this);
        fragmentTransaction.replace(R.id.fragment_container, fragment, "pois");
        fragmentTransaction.addToBackStack(fragment.getTag());
        fragmentTransaction.commit();
        reload = true;
        return true;
      }
    } else if (item.getItemId() == R.id.submenu_search) {
      FragmentTransaction fragmentTransaction;
      Fragment fragment;
      fragmentTransaction = getSherlockActivity().getSupportFragmentManager().beginTransaction();
      fragment = new SearchFragment();
      Bundle args = new Bundle();
      args.putString(SearchFragment.ARG_CATEGORY, category);
      args.putString(CategoryHelper.CATEGORY_TYPE_POIS, CategoryHelper.CATEGORY_TYPE_POIS);
      if (getArguments() != null
          && getArguments().containsKey(SearchFragment.ARG_MY)
          && getArguments().getBoolean(SearchFragment.ARG_MY))
        args.putBoolean(SearchFragment.ARG_MY, getArguments().getBoolean(SearchFragment.ARG_MY));
      fragment.setArguments(args);
      fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
      fragmentTransaction.replace(R.id.fragment_container, fragment, "pois");
      fragmentTransaction.addToBackStack(fragment.getTag());
      fragmentTransaction.commit();
      /* add category to bundle */
      return true;

    } else {
      return super.onOptionsItemSelected(item);
    }
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == android.R.id.home || item.getItemId() == 0) {
     return false;
   }
   mSettings.edit().putInt(PREFS_SORT, item.getItemId()).commit();
   mFileMag.setSortType(item.getItemId());
   mHandler.updateDirectory(mFileMag.getNextDir(mFileMag.getCurrentDir(), true));
   return true;
 }
예제 #6
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == MENU_ID_CHANGE_STATIONS) {
     changeStations();
     return true;
   } else if (item.getItemId() == MENU_ITEM_HISTORY) {
     RequestHistoryActivity.show(this, REQUEST_CODE_HISTORY_SELECTED);
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
 @Override
 public boolean onOptionsItemSelected(final MenuItem item) {
   if (item.getItemId() == android.R.id.home) {
     finish();
     return true;
   } else if (item.getItemId() == R.id.menu_clear_all) {
     clearAll();
     return true;
   }
   return false;
 }
예제 #8
0
 @Override
 public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
   if (item.getItemId() == UPLOAD_ID) {
     toUpload = dataPoints.toArray(new OsmPoint[0]);
     showDialog(DIALOG_PROGRESS_UPLOAD);
     return true;
   } else if (item.getItemId() == BACKUP_ID) {
     new BackupOpenstreetmapPointAsyncTask().execute(dataPoints.toArray(new OsmPoint[0]));
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #9
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    Log.d("ABN", "MENU ITEM CLICKED " + item.getItemId());

    switch (item.getItemId()) {
      case android.R.id.home:
        // go to previous screen when app icon in action bar is clicked
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
      finish();
      return true;

    } else if (item.getItemId() == R.id.menu_comment) {
      goToAddComment(reportId);
      return true;
    }
    return super.onOptionsItemSelected(item);
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == android.R.id.home) {
     Intent myIntent = new Intent(this, Principal.class);
     myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
     startActivity(myIntent);
     finish();
     return true;
   } else if (item.getItemId() == R.id.gotodirection) {
     if (marcador != null) {
       LocationResult locationResult =
           new LocationResult() {
             @Override
             public void gotLocation(Location location) {
               try {
                 Intent intent =
                     new Intent(
                         android.content.Intent.ACTION_VIEW,
                         Uri.parse(
                             "http://maps.google.com/maps?saddr="
                                 + location.getLatitude()
                                 + ","
                                 + location.getLongitude()
                                 + "&daddr="
                                 + marcador.getPosition().latitude
                                 + ","
                                 + marcador.getPosition().longitude));
                 pd.dismiss();
                 startActivity(intent);
               } catch (Exception e) {
               }
               pd.dismiss();
             }
           };
       pd =
           ProgressDialog.show(
               ctx,
               getResources().getText(R.string.procesando),
               getResources().getText(R.string.location));
       pd.setIndeterminate(false);
       pd.setCancelable(true);
       MyLocation myLocation = new MyLocation();
       myLocation.getLocation(ctx, locationResult);
     }
     return true;
   } else if (item.getItemId() == R.id.infoDetails) {
     Intent myIntent = new Intent(this, Info.class);
     startActivity(myIntent);
     return true;
   }
   return false;
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == 10001) {
     product.setPanDianNum(Integer.parseInt(pro_pandiannum.getText().toString()));
     Intent intent = new Intent();
     intent.putExtra("product", product);
     setResult(RESULT_OK, intent);
     this.finish();
   } else if (item.getItemId() == android.R.id.home) {
     this.finish();
     return false;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #13
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == FILTER) {
     filterPOI();
     return true;
   } else if (item.getItemId() == DELETE_FILTER) {
     removePoiFilter();
     return true;
   } else if (item.getItemId() == SAVE_FILTER) {
     savePoiFilter();
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #14
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent = new Intent(ViewWeiboActivity.this, PostActivity.class);
    switch (item.getItemId()) {
      case android.R.id.home:
        this.finish();
        return true;

      case R.id.menu_comment:
        intent.putExtra("type", PostActivity.COMMENT);
        intent.putExtra("status", status);
        startActivityForResult(intent, 0);
        return true;

      case R.id.menu_forward:
        intent.putExtra("type", PostActivity.FORWARD);
        intent.putExtra("status", status);
        startActivityForResult(intent, 1);
        return true;

      case R.id.menu_favorite:
        love();
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
예제 #15
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        finish();
        return true;
    }
    if (item.getTitle().equals("가입")) {
      if (member_name_edit_text.getText().length() < 2) {
        Toast.makeText(getApplicationContext(), "이름은 2자 이상!", Toast.LENGTH_LONG).show();
        return true;
      } else if (member_phone_num_edit_text.getText().length() < 11) {
        Toast.makeText(getApplicationContext(), "전화번호가 올바르지 않습니다!", Toast.LENGTH_LONG).show();
        return true;
      } else {
        showDialog(0);
        name = member_name_edit_text.getText().toString();
        phone = member_phone_num_edit_text.getText().toString();
        if (resized != null) {
          bm = resized;
        }
        new Usercreate().execute();

        return true;
      }
    }
    return true;
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.menu_new_message:
        createConversation(-1, null);
        return true;
      case R.id.menu_unlock:
        promptForPassphrase();
        return true;
      case R.id.menu_settings:
        handleDisplaySettings();
        return true;
      case R.id.menu_export:
        handleExportDatabase();
        return true;
      case R.id.menu_import:
        handleImportDatabase();
        return true;
      case R.id.menu_clear_passphrase:
        handleClearPassphrase();
        return true;
    }

    return false;
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        // provide a back button on the actionbar
        finish();
        break;
      case R.id.action_help:
        HelpDialog helpDialog = new HelpDialog();
        helpDialog.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
        helpDialog.show(getSupportFragmentManager(), "helpdialog");
        break;
      case R.id.action_framework:
        FrameworkInfoDialog frameworkInfoDialog = new FrameworkInfoDialog();
        frameworkInfoDialog.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
        frameworkInfoDialog.show(getSupportFragmentManager(), "frameworkinfodialog");
        break;
      case R.id.action_glossary:
        GlossaryDialog glossaryDialog = new GlossaryDialog();
        glossaryDialog.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
        glossaryDialog.show(getSupportFragmentManager(), "glossarydialog");
        break;
      case R.id.action_save:
        updateActivity();
        break;
      default:
        return super.onOptionsItemSelected(item);
    }

    return true;
  }
예제 #18
0
  public void saveActionViewStates(Bundle outStates) {
    SparseArray<Parcelable> viewStates = null;

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
      final MenuItem item = getItem(i);
      final View v = item.getActionView();
      if (v != null && v.getId() != View.NO_ID) {
        if (viewStates == null) {
          viewStates = new SparseArray<Parcelable>();
        }
        v.saveHierarchyState(viewStates);
        if (item.isActionViewExpanded()) {
          outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
        }
      }
      if (item.hasSubMenu()) {
        final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
        subMenu.saveActionViewStates(outStates);
      }
    }

    if (viewStates != null) {
      outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
    }
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_settings:
       Intent launchNewIntent = new Intent(this, DisplaySettingsActivity.class);
       startActivity(launchNewIntent);
       return true;
     case R.id.invert_colors:
       UIHelper.ToggleColorPref(this);
       UIHelper.Recreate(this);
       return true;
     case R.id.menu_bookmarks:
       Intent bookmarkIntent = new Intent(this, DisplayBookmarkActivity.class);
       startActivity(bookmarkIntent);
       return true;
     case R.id.menu_downloads_list:
       Intent downloadsItent = new Intent(this, DownloadListActivity.class);
       startActivity(downloadsItent);
       ;
       return true;
     case android.R.id.home:
       super.onBackPressed();
       return true;
   }
   return super.onOptionsItemSelected(item);
 }
 @Override
 public boolean onMenuItemSelected(int featureId, MenuItem item) {
   switch (item.getItemId()) {
     case R.id.share_menu_item:
       share();
       return true;
     case R.id.preferences_menu_item:
       Intent p = new Intent(this, Preferences.class);
       startActivityForResult(p, PREFERENCES_REQUEST);
       return true;
     case R.id.edit_menu_item:
       Intent i = new Intent(this, ShiftListActivity.class);
       startActivity(i);
       return true;
     case R.id.notes_menu_item:
       initNote();
       return true;
     case R.id.statistics_menu_item:
       initStatistics();
       return true;
     case R.id.help_menu_item:
       showDialog(DIALOG_HELP_ID);
       return true;
     case R.id.backup_menu_item:
       Intent j = new Intent(this, BackupActivity.class);
       startActivityForResult(j, PREFERENCES_REQUEST);
       return true;
     case R.id.pattern_menu_item:
       Intent ii = new Intent(this, ShiftPatternActivity.class);
       startActivityForResult(ii, PATTERN_REQUEST);
       return true;
   }
   return super.onMenuItemSelected(featureId, item);
 }
예제 #21
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == android.R.id.home) {
     finish();
   }
   return super.onOptionsItemSelected(item);
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_refresh_novel_list:
       refreshList();
       return true;
     case R.id.invert_colors:
       UIHelper.ToggleColorPref(this);
       UIHelper.Recreate(this);
       return true;
     case R.id.menu_manual_add:
       manualAdd();
       return true;
     case R.id.menu_download_all_info:
       downloadAllNovelInfo();
       return true;
     case R.id.menu_downloads_list:
       Intent downloadsItent = new Intent(this, DownloadListActivity.class);
       startActivity(downloadsItent);
       return true;
     case android.R.id.home:
       super.onBackPressed();
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
예제 #23
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        /* case SEARCH_ID:

        Intent intent=new Intent(getApplicationContext(),SearchThread.class);
        startActivity(intent);

           return true;*/
      case REFRESH_MORE:
        viewPager.setCurrentItem(0);
        viewPager.setAdapter(new PagerAdapters(getSupportFragmentManager()));

        return true;
      case CONTACT_US:
        Intent intented = new Intent(getApplicationContext(), ContactUs.class);
        startActivity(intented);
        return true;

      case REQUEST_CAT:
        Intent inten = new Intent(getApplicationContext(), AddCommentorThread.class);
        Bundle bundle = new Bundle();
        bundle.putString("id_to_change_topic_name", "3");
        inten.putExtras(bundle);
        startActivity(inten);
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
예제 #24
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menuSalin:
        {
          if (currentSong != null) {
            U.copyToClipboard(convertSongToText(currentSong));

            Toast.makeText(this, R.string.sn_copied, Toast.LENGTH_SHORT).show();
          }
        }
        return true;
      case R.id.menuBagikan:
        {
          if (currentSong != null) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain"); // $NON-NLS-1$
            intent.putExtra(
                Intent.EXTRA_SUBJECT,
                currentBookName + ' ' + currentSong.code + ' ' + currentSong.title);
            intent.putExtra(Intent.EXTRA_TEXT, (CharSequence) convertSongToText(currentSong));
            startActivityForResult(
                ShareActivity.createIntent(intent, getString(R.string.sn_share_title)),
                REQCODE_share);
          }
        }
        return true;
    }
    return false;
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.cart_add_by_voice:
       Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
       intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());
       intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.cart_add_voice_prompt));
       intent.putExtra(
           RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
       intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5);
       startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
       break;
     case R.id.cart_add_by_barcode:
       IntentIntegrator integrator = new IntentIntegrator(this);
       integrator.initiateScan();
       break;
     case android.R.id.home:
       if (mDrawerLayout.isDrawerOpen(mDrawerList)) mDrawerLayout.closeDrawer(mDrawerList);
       else {
         // Specify the parent activity
         Intent parentActivityIntent = new Intent(this, ShopCartOverviewFragmentActivity.class);
         parentActivityIntent.addFlags(
             Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(parentActivityIntent);
         this.finish();
       }
       return true;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #26
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    Image image = adapter.getImages().get(picturePosition);
    Intent intent;
    int currentItem = pager.getCurrentItem();
    Log.d("AcBig : selected item :" + currentItem);
    switch (item.getItemId()) {
      case android.R.id.home:
        // app icon in action bar clicked; go home
        finish();
        return true;
      case R.id.menu_save:
        // Okay, i load it from the internet
        Log.d("Load service before start");
        intent = new Intent(this, FileSaver.class);
        intent.putExtra(FileSaver.FILE_URL, image.getBigImageUrl());
        startService(intent);

        break;
      case R.id.menu_share:
        // Share image url on the site
        Dif.share(this, image);
        break;
      default:
        return super.onOptionsItemSelected(item);
    }
    return true;
  }
예제 #27
0
 // Cuando se pulsa un elemento del menú.
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Dependiendo del item pulsado se realiza la acción deseada.
   switch (item.getItemId()) {
     case android.R.id.home:
       mostrarTostada(getString(R.string.ir_a_la_actividad_superior));
       break;
     case R.id.mnuAgregar:
       mostrarTostada(getString(R.string.agregar));
       break;
     case R.id.mnuCargar:
       mostrarTostada(getString(R.string.cargar));
       break;
     case R.id.mnuEditar:
       mostrarTostada(item.getTitle().toString());
       break;
     case R.id.mnuEliminar:
       mostrarTostada(getString(R.string.eliminar));
       break;
     case R.id.mnuBuscar:
       mostrarTostada(getString(R.string.buscar));
       break;
     case R.id.mnuCompartir:
       mostrarTostada(getString(R.string.compartir));
       break;
     default:
       return super.onOptionsItemSelected(item);
   }
   // Retorna que ya ha sido gestionado.
   return true;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        return super.onOptionsItemSelected(item);

      case R.id.menu_recurring_transactions:
        Intent intent = new Intent(this, ScheduledActionsActivity.class);
        intent.putExtra(
            ScheduledActionsActivity.EXTRA_DISPLAY_MODE,
            ScheduledActionsActivity.DisplayMode.TRANSACTION_ACTIONS);
        startActivity(intent);
        return true;

      case R.id.menu_settings:
        startActivity(new Intent(this, SettingsActivity.class));
        return true;

      case R.id.menu_reports:
        startActivity(new Intent(this, ChartReportActivity.class));
        return true;

      default:
        return false;
    }
  }
예제 #29
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       getHomeFragment().setCurrentPage(0);
       return true;
     case R.id.menu_reply:
       toggle();
       return true;
     case R.id.menu_refresh:
       if (!getHomeFragment().isBoardsPage()) {
         getHomeFragment().refreshPage(getHomeFragment().getCurrentPage());
       }
       return true;
     case R.id.menu_close:
       if (!getHomeFragment().isBoardsPage()) {
         int currPage = getHomeFragment().getCurrentPage();
         // getHomeFragment().setCurrentPage(currPage-1);
         getHomeFragment().removePage(currPage);
       }
       return true;
     case R.id.menu_settings:
       Intent intent = new Intent(MainActivity.this, PrefsActivity.class);
       intent.putExtra("IS_GOLD", isGold(MainActivity.this));
       startActivityForResult(intent, REQ_CODE_PREFS);
       return true;
     case R.id.menu_jump:
       registerForContextMenu(findViewById(R.id.phone_main));
       openContextMenu(findViewById(R.id.phone_main));
       unregisterForContextMenu(findViewById(R.id.phone_main));
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
예제 #30
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        pager.setCurrentItem(0, false);
        return (true);

      case R.id.about:
        Intent i = new Intent(this, SimpleContentActivity.class);

        i.putExtra(SimpleContentActivity.EXTRA_FILE, "file:///android_asset/misc/about.html");
        startActivity(i);

        return (true);

      case R.id.help:
        i = new Intent(this, SimpleContentActivity.class);
        i.putExtra(SimpleContentActivity.EXTRA_FILE, "file:///android_asset/misc/help.html");

        startActivity(i);

        return (true);
    }

    return (super.onOptionsItemSelected(item));
  }