List of usage examples for android.view MenuItem getTitle
public CharSequence getTitle();
From source file:org.addhen.smssync.presentation.view.ui.activity.MainActivity.java
private void setToolbarTitle(MenuItem menuItem) { mCurrentMenu = menuItem.getItemId(); mCurrentMenuTitle = menuItem.getTitle().toString(); mToolbar.setTitle(mCurrentMenuTitle); onNavigationItemSelected(menuItem);/*from ww w. j av a 2s .c o m*/ }
From source file:com.sandklef.coachapp.fragments.MemberFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int position = acmi.position; Log.d(LOG_TAG, " context menu item, position: " + position); Log.d(LOG_TAG, " item: " + item.getTitle().toString()); Media m = Storage.getInstance().getMediaDate(item.getTitle().toString()); if (m != null) { Log.d(LOG_TAG, " video item: " + m.fileName() + ", " + m.getUuid() + ", " + m.getClubUuid() + ", "); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(m.fileName())), "video/*"); startActivity(intent);/*w w w . j a va2s . c om*/ } return true; }
From source file:com.normalexception.app.rx8club.fragment.pm.PrivateMessageInboxFragment.java
@Override public boolean onContextItemSelected(final MenuItem item) { final PMModel pmv = (PMModel) lv.getItemAtPosition(item.getItemId()); if (item.getTitle().equals(getString(R.string.reply))) { replyPm(pmv);/*w w w . ja v a 2 s.com*/ } else if (item.getTitle().equals(getString(R.string.delete))) { // Lets make sure the user didn't accidentally click this DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: deletePm(pmv); break; } } }; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.dialogPmDeleteConfirm).setPositiveButton(R.string.Yes, dialogClickListener) .setNegativeButton(R.string.No, dialogClickListener).show(); } else { return false; } return true; }
From source file:joshuatee.wx.MiscFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (getUserVisibleHint()) { String web_url = ""; if (((String) item.getTitle()).contains("Edit State")) { StateEdit(item.getItemId()); } else if (((String) item.getTitle()).contains("Iowa Mesonet hires conus radar")) { web_url = "http://mesonet.agron.iastate.edu/data/gis/images/4326/USCOMP/n0q_0.png"; intent = new Intent(getActivity(), USIOWAMesoRadarMosaicActivity.class); intent.putExtra(USIOWAMesoRadarMosaicActivity.URL, new String[] { web_url, "US Mosaics" }); startActivity(intent);/* ww w . j a v a 2s . c o m*/ } else if (((String) item.getTitle()).contains("SPC Compmap")) { intent = new Intent(getActivity(), SPCCompmapActivity.class); startActivity(intent); } else if (((String) item.getTitle()).contains("COD Model Web")) { intent = new Intent(getActivity(), WebscreenAB.class); intent.putExtra(WebscreenAB.URL, new String[] { "http://weather.cod.edu/forecast", "Cod Model Web" }); startActivity(intent); } else { SharedPreferences.Editor editor = preferences.edit(); editor.putString("NWS_RADAR_MOSAIC_SECTOR_CURRENT", (String) item.getTitle()); editor.commit(); } return true; } else { return false; } }
From source file:com.telestax.restcomm_olympus.MainFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); HashMap<String, String> contact = (HashMap) contactList.get(info.position); if (item.getTitle().toString().equals("Update Contact")) { mCallbacks.onContactUpdate(contact, AddUserDialogFragment.DIALOG_TYPE_UPDATE_CONTACT); }//w ww. j a v a 2s. c o m if (item.getTitle().toString().equals("Remove Contact")) { contactsController.removeContact(contactList, contact.get("username"), contact.get("sipuri")); this.listViewAdapter.notifyDataSetChanged(); } return true; }
From source file:com.rareventure.gps2.reviewer.SettingsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { GTG.cacheCreatorLock.registerReadingThread(); try {//from w w w. jav a2 s .c o m if (item.getTitle().equals(getText(R.string.go_to_main))) { startInternalActivity(new Intent(this, OsmMapGpsTrailerReviewerMapActivity.class)); finish(); return true; } return super.onOptionsItemSelected(item); } finally { GTG.cacheCreatorLock.unregisterReadingThread(); } }
From source file:cn.nekocode.camerafilter.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { filterId = item.getItemId();// w ww . j a v a2 s . c o m // TODO: need tidy up if (filterId == R.id.capture) { Toast.makeText(this, caputre() ? "The capture has been saved to your sdcard root path." : "Save failed!", Toast.LENGTH_SHORT).show(); return true; } setTitle(item.getTitle()); if (renderer != null) renderer.setSelectedFilter(filterId); return true; }
From source file:joshuatee.wx.NEXRADAttributesActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { if (((String) item.getTitle()).contains("Add new location for ")) { LocationAdd(item.getItemId());/*from ww w .ja v a 2 s. com*/ } else { return false; } return true; }
From source file:com.saloon.android.bluecactus.app.UI.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); enableMyLocation();/* w w w.ja va 2 s . c o m*/ // Location check Locator locator = new Locator(this); locator.getLocation(Locator.Method.NETWORK, listener); // Network request test with volley NetworkRequests networkRequest = new NetworkRequests(this); divisionList = networkRequest.getDivisions(); Log.i("Array List size: ", divisionList.size() + ""); GlobalVariables.getInstance().setArrayList(divisionList); // Adding Toolbar to Main screen Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) findViewById(R.id.tabs); tabs.setupWithViewPager(viewPager); // Create Navigation drawer and inlfate layout NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer); // Adding menu icon to Toolbar ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { VectorDrawableCompat indicator = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme()); indicator.setTint(ResourcesCompat.getColor(getResources(), R.color.white, getTheme())); supportActionBar.setHomeAsUpIndicator(indicator); supportActionBar.setDisplayHomeAsUpEnabled(true); } // Set behavior of Navigation drawer navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger on item Click of navigation menu @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // Set item in checked state menuItem.setChecked(true); Log.d("Menu Item id: ", menuItem.getTitle() + ""); handleMenuClick(menuItem.getTitle().toString()); // TODO: handle navigation // Toast.makeText(MainActivity.this, "Clicked: " + menuItem.getTitle(), Toast.LENGTH_SHORT).show(); // // Intent intent = new Intent(MainActivity.this, Appointment.class); // // MainActivity.this.startActivity(intent); // // Closing drawer on item click mDrawerLayout.closeDrawers(); return true; } }); // Adding Floating Action Button to bottom right of main view FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Snackbar.make(v, "Hello Snackbar!", Snackbar.LENGTH_LONG).show(); } }); }
From source file:com.google.android.apps.forscience.whistlepunk.MainActivity.java
private CharSequence getTitleToRestore(MenuItem menuItem) { if (menuItem.getItemId() == R.id.navigation_item_observe) { return null; } else {/*from www. j a va 2 s . c o m*/ return menuItem.getTitle(); } }