List of usage examples for android.view MenuItem toString
public String toString()
From source file:osm.custommaps.create.PreviewMapActivity.java
private void prepareUI() { saveButton = (Button) findViewById(R.id.save); mapModeButton = (ImageButton) findViewById(R.id.mapmode); transparencyBar = (SeekBar) findViewById(R.id.transparencyBar); saveButton.setOnClickListener(new View.OnClickListener() { @Override//from www .j av a 2s.c o m public void onClick(View v) { computeAndReturnTiepoints(); } }); mapModeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { PopupMenu popupMenu = new PopupMenu(getApplicationContext(), view); popupMenu.inflate(R.menu.menu_options); popupMenu.show(); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.toString()) { case "Google Satellite": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.GOOGLE_SATELLITE); break; case "Google Maps": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.GOOGLE_MAPS); break; case "Google Terrain": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.GOOGLE_TERRAIN); break; case "Bing Maps": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.BING_MAPS); break; case "Bing Earth": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.BING_EARTH); break; case "Bing Hybrid": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.BING_HYBRID); break; case "Mapquest Aerial": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.MAPQUESTAERIAL_US); break; case "Mapquest OSM": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.MAPQUESTOSM); break; case "Mapnik": mapView.invalidate(); mapView.setMaxZoomLevel(20); mapView.setMinZoomLevel(3); mapView.setTileSource(WMSTileSourceFactory.MAPNIK); break; } return false; } }); } }); transparencyBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { private void updateImageOverlay(int value) { imageOverlay.setTransparency(value); mapView.invalidate(); } @Override public void onStopTrackingTouch(SeekBar seekBar) { updateImageOverlay(seekBar.getProgress()); } @Override public void onStartTrackingTouch(SeekBar seekBar) { updateImageOverlay(seekBar.getProgress()); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { updateImageOverlay(seekBar.getProgress()); } } }); }
From source file:com.google.cloud.solutions.flexenv.PlayActivity.java
@Override public boolean onNavigationItemSelected(MenuItem item) { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); messages.clear();/*from ww w .j a v a 2 s.co m*/ String msg = "Switching channel to '" + item.toString() + "'"; try { fbLog.log(inbox, msg); } catch (NullPointerException e) { updateUI(false); return false; } // Switching a listener to the selected channel. firebase.child(CHS + "/" + currentChannel).removeEventListener(channelListener); currentChannel = item.toString(); firebase.child(CHS + "/" + currentChannel).addChildEventListener(channelListener); channelLabel.setText(currentChannel); return true; }
From source file:com.appfirst.activities.details.AFServerDetail.java
@Override public boolean onOptionsItemSelected(MenuItem item) { String fieldName = item.toString(); if (data == null) { Toast.makeText(this, "Data is not available, please wait.", Toast.LENGTH_LONG); return super.onOptionsItemSelected(item); }/*from w w w . j a v a 2 s.c om*/ Log.i(TAG, String.format("Field change to: %s", fieldName)); if (fieldName == "Disk usage") { showDialog(DISK_DIALOG); } else if (fieldName == "CPU cores") { showDialog(CPU_DIALOG); } else if (fieldName == "Disk busy") { showDialog(DISK_BUSY_DIALOG); } return super.onOptionsItemSelected(item); }
From source file:com.android.music.AlbumBrowserActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { badSymptoms.saveMenu("menu", item.toString()); Intent intent;/*from www . j a v a2s . c o m*/ Cursor cursor; switch (item.getItemId()) { case PARTY_SHUFFLE: MusicUtils.togglePartyShuffle(); break; case SHUFFLE_ALL: cursor = MusicUtils.query(this, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Audio.Media._ID }, MediaStore.Audio.Media.IS_MUSIC + "=1", null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER); if (cursor != null) { MusicUtils.shuffleAll(this, cursor); cursor.close(); } return true; } return super.onOptionsItemSelected(item); }
From source file:com.android.music.AlbumBrowserActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { badSymptoms.saveMenu("popup", item.toString()); switch (item.getItemId()) { case PLAY_SELECTION: { // play the selected album long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); MusicUtils.playAll(this, list, 0); return true; }/*from www.ja va2 s. com*/ case QUEUE: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); MusicUtils.addToCurrentPlaylist(this, list); return true; } case NEW_PLAYLIST: { Intent intent = new Intent(); intent.setClass(this, CreatePlaylist.class); startActivityForResult(intent, NEW_PLAYLIST); return true; } case PLAYLIST_SELECTED: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); long playlist = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(this, list, playlist); return true; } case DELETE_ITEM: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); String f; if (android.os.Environment.isExternalStorageRemovable()) { f = getString(R.string.delete_album_desc); } else { f = getString(R.string.delete_album_desc_nosdcard); } String desc = String.format(f, mCurrentAlbumName); Bundle b = new Bundle(); b.putString("description", desc); b.putLongArray("items", list); Intent intent = new Intent(); intent.setClass(this, DeleteItems.class); intent.putExtras(b); startActivityForResult(intent, -1); return true; } case SEARCH: doSearch(); return true; } return super.onContextItemSelected(item); }
From source file:net.gerosyab.dailylog.activity.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); MyLog.d(LOG_TAG, "onContextItemSelected() - item : " + item.toString()); switch (item.getItemId()) { case R.id.action_edit: editCategory(info.id);//from w w w. j a va 2s. c o m return true; case R.id.action_delete: deleteCategory(info.id); return true; case R.id.action_export: exportCategory(info.id); return true; default: return super.onContextItemSelected(item); } }
From source file:com.pseudosudostudios.jdd.activities.GameActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_new_game: startNewGame();//from w ww .j a va 2 s . c o m return true; case R.id.action_instructions: startActivity(new Intent(this, Instructions.class)); return true; case R.id.action_win: win(bg.moves); return true; default: Log.w("Unkown menu item", item.toString()); return false; } }
From source file:com.keithandthegirl.ui.activity.EpisodesFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Log.v(TAG, "onOptionsItemSelected : enter"); Log.d(TAG, "onOptionsItemSelected : item=" + item.toString()); switch (item.getItemId()) { case R.id.episodes_refresh: Log.d(TAG, "onOptionsItemSelected : refresh selected"); loadData();/*from w w w . j a v a 2 s .co m*/ return true; // case R.id.episodes_player: // Log.d( TAG, "onOptionsItemSelected : player selected" ); // // if( mBound ) { // mMediaPlayer = mService.getMediaPlayer(); // mSelectedStream = mMediaPlayer.getStreamStation(); // // Intent playerActivity = new Intent( getActivity(), PlayerActivity.class ); // playerActivity.putExtra( PlayerActivity.PLAY_TYPE, mSelectedStream.getStationPlayType() ); // playerActivity.putExtra( PlayerActivity.PLAYBACK_URL, mSelectedStream.getStationUrl() ); // playerActivity.putExtra( PlayerActivity.TITLE, mSelectedStream.getStationLabel() ); // playerActivity.putExtra( PlayerActivity.DESCRIPTION, mSelectedStream.getmStationDescription() ); // // startActivity( playerActivity ); // // } // // return true; } Log.v(TAG, "onOptionsItemSelected : exit"); return super.onOptionsItemSelected(item); }
From source file:alaindc.memenguage.View.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { Intent settingsActivity = new Intent(this, SettingsActivity.class); startActivity(settingsActivity); return true; } else if (id == R.id.action_search) { Log.d("MainActivity Search", item.toString()); }//from w w w . j ava2 s .co m return super.onOptionsItemSelected(item); }
From source file:com.racoon.ampdroid.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Pass the event to ActionBarDrawerToggle, if it returns // true, then it has handled the app icon touch event if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }// ww w . j a va 2 s .c o m // Handle your other action bar items... if (item.toString().equals(getResources().getString(R.string.action_settings))) { FragmentTransaction tx = getSupportFragmentManager().beginTransaction(); tx.replace(R.id.content_frame, Fragment.instantiate(MainActivity.this, controller.getFragments()[5]), controller.getFragmentsNames()[5]); activeFragment = 5; // tx.addToBackStack(null); clearBackStack(); tx.commit(); getActionBar().setTitle(R.string.action_settings); } return super.onOptionsItemSelected(item); }