List of usage examples for android.support.v4.app Fragment getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.amaze.filemanager.activities.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) { return true; }// w w w .ja v a2 s . co m // Handle action buttons Main ma = null; try { TabFragment tabFragment = getFragment(); if (tabFragment != null) ma = (Main) tabFragment.getTab(); } catch (Exception e) { } switch (item.getItemId()) { case R.id.home: if (ma != null) ma.home(); break; case R.id.history: if (ma != null) utils.showHistoryDialog(ma); break; case R.id.sethome: if (ma == null) return super.onOptionsItemSelected(item); final Main main = ma; if (main.openMode != 0 || main.openMode != 3) { Toast.makeText(mainActivity, R.string.not_allowed, Toast.LENGTH_SHORT).show(); break; } final MaterialDialog b = utils.showBasicDialog(mainActivity, fabskin, theme1, new String[] { getResources().getString(R.string.questionset), getResources().getString(R.string.setashome), getResources().getString(R.string.yes), getResources().getString(R.string.no), null }); b.getActionButton(DialogAction.POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.home = main.CURRENT_PATH; updatepaths(main.no); b.dismiss(); } }); b.show(); break; case R.id.item3: finish(); break; case R.id.item10: Fragment fragment = getDFragment(); if (fragment.getClass().getName().contains("AppsList")) utils.showSortDialog((AppsList) fragment); break; case R.id.sortby: if (ma != null) utils.showSortDialog(ma); break; case R.id.dsort: if (ma == null) return super.onOptionsItemSelected(item); String[] sort = getResources().getStringArray(R.array.directorysortmode); MaterialDialog.Builder a = new MaterialDialog.Builder(mainActivity); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.directorysort); int current = Integer.parseInt(Sp.getString("dirontop", "0")); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { Sp.edit().putString("dirontop", "" + which).commit(); dialog.dismiss(); return true; } }); a.build().show(); break; case R.id.hiddenitems: utils.showHiddenDialog(ma); break; case R.id.view: if (ma.IS_LIST) { if (DataUtils.listfiles.contains(ma.CURRENT_PATH)) { DataUtils.listfiles.remove(ma.CURRENT_PATH); grid.removePath(ma.CURRENT_PATH, DataUtils.LIST); } grid.addPath(null, ma.CURRENT_PATH, DataUtils.GRID, 0); DataUtils.gridfiles.add(ma.CURRENT_PATH); } else { if (DataUtils.gridfiles.contains(ma.CURRENT_PATH)) { DataUtils.gridfiles.remove(ma.CURRENT_PATH); grid.removePath(ma.CURRENT_PATH, DataUtils.GRID); } grid.addPath(null, ma.CURRENT_PATH, DataUtils.LIST, 0); DataUtils.listfiles.add(ma.CURRENT_PATH); } ma.switchView(); break; case R.id.search: mainActivityHelper.search(); break; case R.id.paste: String path = ma.CURRENT_PATH; ArrayList<BaseFile> arrayList = new ArrayList<>(); if (COPY_PATH != null) { arrayList = COPY_PATH; new CopyFileCheck(ma, path, false, mainActivity, rootmode) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, arrayList); } else if (MOVE_PATH != null) { arrayList = MOVE_PATH; new CopyFileCheck(ma, path, true, mainActivity, rootmode) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, arrayList); } COPY_PATH = null; MOVE_PATH = null; invalidatePasteButton(item); break; case R.id.extract: Fragment fragment1 = getSupportFragmentManager().findFragmentById(R.id.content_frame); if (fragment1.getClass().getName().contains("ZipViewer")) mainActivityHelper.extractFile(((ZipViewer) fragment1).f); break; } return super.onOptionsItemSelected(item); }
From source file:com.igniva.filemanager.activities.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem s = menu.findItem(R.id.view); MenuItem search = menu.findItem(R.id.search); MenuItem paste = menu.findItem(R.id.paste); String f = null;//w w w. ja va 2 s . co m Fragment fragment; try { fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame); f = fragment.getClass().getName(); } catch (Exception e1) { return true; } if (f.contains("TabFragment")) { setActionBarTitle("Filemanager"); if (aBoolean) { s.setTitle(getResources().getString(R.string.gridview)); } else { s.setTitle(getResources().getString(R.string.listview)); } try { TabFragment tabFragment = (TabFragment) fragment; Main ma = ((Main) tabFragment.getTab()); if (ma.IS_LIST) s.setTitle(R.string.gridview); else s.setTitle(R.string.listview); updatePath(ma.CURRENT_PATH, ma.results, ma.openMode, ma.folder_count, ma.file_count); } catch (Exception e) { } initiatebbar(); if (Build.VERSION.SDK_INT >= 21) toolbar.setElevation(0); invalidatePasteButton(paste); search.setVisible(true); if (indicator_layout != null) indicator_layout.setVisibility(View.VISIBLE); menu.findItem(R.id.search).setVisible(true); menu.findItem(R.id.home).setVisible(true); menu.findItem(R.id.history).setVisible(true); menu.findItem(R.id.sethome).setVisible(true); menu.findItem(R.id.item10).setVisible(true); if (showHidden) menu.findItem(R.id.hiddenitems).setVisible(true); menu.findItem(R.id.view).setVisible(true); menu.findItem(R.id.extract).setVisible(false); invalidatePasteButton(menu.findItem(R.id.paste)); findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE); } else if (f.contains("AppsList") || f.contains("ProcessViewer") || f.contains(FTPServerFragment.class.getName())) { appBarLayout.setExpanded(true); menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); findViewById(R.id.buttonbarframe).setVisibility(View.GONE); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.extract).setVisible(false); if (f.contains("ProcessViewer")) menu.findItem(R.id.item10).setVisible(false); else { menu.findItem(R.id.dsort).setVisible(false); menu.findItem(R.id.sortby).setVisible(false); } menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); } else if (f.contains("ZipViewer")) { menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); TextView textView = (TextView) mainActivity.pathbar.findViewById(R.id.fullpath); pathbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.item10).setVisible(false); menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); menu.findItem(R.id.extract).setVisible(true); } return super.onPrepareOptionsMenu(menu); }
From source file:com.amaze.filemanager.activities.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem s = menu.findItem(R.id.view); MenuItem search = menu.findItem(R.id.search); MenuItem paste = menu.findItem(R.id.paste); String f = null;//from www . ja v a 2 s . c o m Fragment fragment; try { fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame); f = fragment.getClass().getName(); } catch (Exception e1) { return true; } if (f.contains("TabFragment")) { setActionBarTitle("Amaze"); if (aBoolean) { s.setTitle(getResources().getString(R.string.gridview)); } else { s.setTitle(getResources().getString(R.string.listview)); } try { TabFragment tabFragment = (TabFragment) fragment; Main ma = ((Main) tabFragment.getTab()); if (ma.IS_LIST) s.setTitle(R.string.gridview); else s.setTitle(R.string.listview); updatePath(ma.CURRENT_PATH, ma.results, ma.openMode, ma.folder_count, ma.file_count); } catch (Exception e) { } initiatebbar(); if (Build.VERSION.SDK_INT >= 21) toolbar.setElevation(0); invalidatePasteButton(paste); search.setVisible(true); if (indicator_layout != null) indicator_layout.setVisibility(View.VISIBLE); menu.findItem(R.id.search).setVisible(true); menu.findItem(R.id.home).setVisible(true); menu.findItem(R.id.history).setVisible(true); menu.findItem(R.id.sethome).setVisible(true); menu.findItem(R.id.item10).setVisible(true); if (showHidden) menu.findItem(R.id.hiddenitems).setVisible(true); menu.findItem(R.id.view).setVisible(true); menu.findItem(R.id.extract).setVisible(false); invalidatePasteButton(menu.findItem(R.id.paste)); findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE); } else if (f.contains("AppsList") || f.contains("ProcessViewer")) { appBarLayout.setExpanded(true); menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); findViewById(R.id.buttonbarframe).setVisibility(View.GONE); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.extract).setVisible(false); if (f.contains("ProcessViewer")) menu.findItem(R.id.item10).setVisible(false); else { menu.findItem(R.id.dsort).setVisible(false); menu.findItem(R.id.sortby).setVisible(false); } menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); } else if (f.contains("ZipViewer")) { menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); TextView textView = (TextView) mainActivity.pathbar.findViewById(R.id.fullpath); pathbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.item10).setVisible(false); menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); menu.findItem(R.id.extract).setVisible(true); } return super.onPrepareOptionsMenu(menu); }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
@Override public void onNewIntent(Intent i) { intent = i;//from ww w . j a va 2s . com path = i.getStringExtra("path"); if (path != null) { if (new File(path).isDirectory()) { Fragment f = getDFragment(); if ((f.getClass().getName().contains("TabFragment"))) { MainFragment m = ((MainFragment) getFragment().getTab()); m.loadlist(path, false, OpenMode.FILE); } else goToMain(path); } else utils.openFile(new File(path), mainActivity); } else if (i.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) { ArrayList<BaseFile> failedOps = i.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this); } } else if (i.getCategories() != null && i.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) { // we used an external authenticator instead of APIs. Probably for Google Drive CloudRail.setAuthenticationResponse(intent); } else if ((openProcesses = i.getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false))) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER); // transaction.addToBackStack(null); selectedStorage = SELECT_102; openProcesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commitAllowingStateLoss(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); zippath = uri.toString(); openZip(zippath); } if (SDK_INT >= Build.VERSION_CODES.KITKAT) { if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_ATTACHED)) { if (sharedPref.getString(KEY_PREF_OTG, null) == null) { sharedPref.edit().putString(KEY_PREF_OTG, VALUE_PREF_OTG_NULL).apply(); refreshDrawer(); } } else if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_DETACHED)) { sharedPref.edit().putString(KEY_PREF_OTG, null).apply(); refreshDrawer(); } } } }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
void onbackpressed() { try {//from w w w.j a v a2s . c om Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame); String name = fragment.getClass().getName(); if (searchViewLayout.isShown()) { // hide search view if visible, with an animation hideSearchView(); } else if (name.contains("TabFragment")) { if (floatingActionButton.isOpened()) { floatingActionButton.close(true); } else { TabFragment tabFragment = ((TabFragment) getSupportFragmentManager() .findFragmentById(R.id.content_frame)); Fragment fragment1 = tabFragment.getTab(); MainFragment mainFrag = (MainFragment) fragment1; mainFrag.goBack(); } } else if (name.contains("ZipViewer")) { ZipViewer zipViewer = (ZipViewer) getSupportFragmentManager().findFragmentById(R.id.content_frame); if (zipViewer.mActionMode == null) { if (zipViewer.canGoBack()) { zipViewer.goBack(); } else if (openzip) { openzip = false; finish(); } else { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.setCustomAnimations(R.anim.slide_out_bottom, R.anim.slide_out_bottom); fragmentTransaction.remove(zipViewer); fragmentTransaction.commit(); supportInvalidateOptionsMenu(); floatingActionButton.setVisibility(View.VISIBLE); floatingActionButton.showMenuButton(true); } } else { zipViewer.mActionMode.finish(); } } else if (name.contains("FTPServerFragment")) { //returning back from FTP server if (path != null && path.length() > 0) { HFile file = new HFile(OpenMode.UNKNOWN, path); file.generateMode(this); if (file.isDirectory()) goToMain(path); else { goToMain(""); utils.openFile(new File(path), this); } } else { goToMain(""); } } else goToMain(""); } catch (ClassCastException e) { goToMain(""); } }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) { return true; }// ww w .ja va2 s .co m // Handle action buttons MainFragment ma = null; try { TabFragment tabFragment = getFragment(); if (tabFragment != null) ma = (MainFragment) tabFragment.getTab(); } catch (Exception e) { } switch (item.getItemId()) { case R.id.home: if (ma != null) ma.home(); break; case R.id.history: if (ma != null) GeneralDialogCreation.showHistoryDialog(dataUtils, utils, ma, getAppTheme()); break; case R.id.sethome: if (ma == null) return super.onOptionsItemSelected(item); final MainFragment main = ma; if (main.openMode != OpenMode.FILE && main.openMode != OpenMode.ROOT) { Toast.makeText(mainActivity, R.string.not_allowed, Toast.LENGTH_SHORT).show(); break; } final MaterialDialog dialog = GeneralDialogCreation.showBasicDialog(mainActivity, BaseActivity.accentSkin, getAppTheme(), new String[] { getResources().getString(R.string.questionset), getResources().getString(R.string.setashome), getResources().getString(R.string.yes), getResources().getString(R.string.no), null }); dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.home = main.CURRENT_PATH; updatePaths(main.no); dialog.dismiss(); } }); dialog.show(); break; case R.id.exit: finish(); break; case R.id.sort: Fragment fragment = getDFragment(); if (fragment.getClass().getName().contains("AppsList")) GeneralDialogCreation.showSortDialog((AppsList) fragment, getAppTheme()); break; case R.id.sortby: if (ma != null) GeneralDialogCreation.showSortDialog(ma, getAppTheme()); break; case R.id.dsort: if (ma == null) return super.onOptionsItemSelected(item); String[] sort = getResources().getStringArray(R.array.directorysortmode); MaterialDialog.Builder builder = new MaterialDialog.Builder(mainActivity); builder.theme(getAppTheme().getMaterialDialogTheme()); builder.title(R.string.directorysort); int current = Integer.parseInt(sharedPref.getString("dirontop", "0")); final MainFragment mainFrag = ma; builder.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("dirontop", "" + which).commit(); mainFrag.getSortModes(); mainFrag.updateList(); dialog.dismiss(); return true; } }); builder.build().show(); break; case R.id.hiddenitems: GeneralDialogCreation.showHiddenDialog(dataUtils, utils, ma, getAppTheme()); break; case R.id.view: if (ma.IS_LIST) { if (dataUtils.getListfiles().contains(ma.CURRENT_PATH)) { dataUtils.getListfiles().remove(ma.CURRENT_PATH); grid.removePath(ma.CURRENT_PATH, DataUtils.LIST); } grid.addPath(null, ma.CURRENT_PATH, DataUtils.GRID, 0); dataUtils.getGridFiles().add(ma.CURRENT_PATH); } else { if (dataUtils.getGridFiles().contains(ma.CURRENT_PATH)) { dataUtils.getGridFiles().remove(ma.CURRENT_PATH); grid.removePath(ma.CURRENT_PATH, DataUtils.GRID); } grid.addPath(null, ma.CURRENT_PATH, DataUtils.LIST, 0); dataUtils.getListfiles().add(ma.CURRENT_PATH); } ma.switchView(); break; case R.id.paste: String path = ma.CURRENT_PATH; ArrayList<BaseFile> arrayList = COPY_PATH != null ? COPY_PATH : MOVE_PATH; boolean move = MOVE_PATH != null; new CopyFileCheck(ma, path, move, mainActivity, BaseActivity.rootMode) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, arrayList); COPY_PATH = null; MOVE_PATH = null; invalidatePasteButton(item); break; case R.id.extract: Fragment fragment1 = getSupportFragmentManager().findFragmentById(R.id.content_frame); if (fragment1.getClass().getName().contains("ZipViewer")) mainActivityHelper.extractFile(((ZipViewer) fragment1).f); break; case R.id.search: View searchItem = toolbar.findViewById(R.id.search); searchViewEditText.setText(""); searchItem.getLocationOnScreen(searchCoords); revealSearchView(); break; } return super.onOptionsItemSelected(item); }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem s = menu.findItem(R.id.view); MenuItem search = menu.findItem(R.id.search); MenuItem paste = menu.findItem(R.id.paste); String fragmentName;/* w ww . ja v a2 s.c o m*/ Fragment fragment; try { fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame); fragmentName = fragment.getClass().getName(); } catch (Exception e) { return true; } if (fragmentName.contains("TabFragment")) { setActionBarTitle("Amaze"); if (useGridView) { s.setTitle(getResources().getString(R.string.gridview)); } else { s.setTitle(getResources().getString(R.string.listview)); } try { TabFragment tabFragment = (TabFragment) fragment; MainFragment ma = ((MainFragment) tabFragment.getTab()); if (ma.IS_LIST) s.setTitle(R.string.gridview); else s.setTitle(R.string.listview); updatePath(ma.CURRENT_PATH, ma.results, ma.openMode, ma.folder_count, ma.file_count); } catch (Exception e) { } initiatebbar(); if (SDK_INT >= 21) toolbar.setElevation(0); invalidatePasteButton(paste); search.setVisible(true); if (indicator_layout != null) indicator_layout.setVisibility(View.VISIBLE); menu.findItem(R.id.search).setVisible(true); menu.findItem(R.id.home).setVisible(true); menu.findItem(R.id.history).setVisible(true); menu.findItem(R.id.sethome).setVisible(true); menu.findItem(R.id.sort).setVisible(true); if (showHidden) menu.findItem(R.id.hiddenitems).setVisible(true); menu.findItem(R.id.view).setVisible(true); menu.findItem(R.id.extract).setVisible(false); invalidatePasteButton(menu.findItem(R.id.paste)); findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE); } else if (fragmentName.contains("AppsList") || fragmentName.contains("ProcessViewer") || fragmentName.contains(FTPServerFragment.class.getName())) { appBarLayout.setExpanded(true); menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); findViewById(R.id.buttonbarframe).setVisibility(View.GONE); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.extract).setVisible(false); if (fragmentName.contains("ProcessViewer")) menu.findItem(R.id.sort).setVisible(false); else { menu.findItem(R.id.dsort).setVisible(false); menu.findItem(R.id.sortby).setVisible(false); } menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); } else if (fragmentName.contains("ZipViewer")) { menu.findItem(R.id.sethome).setVisible(false); if (indicator_layout != null) indicator_layout.setVisibility(View.GONE); TextView textView = (TextView) mainActivity.pathbar.findViewById(R.id.fullpath); pathbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); menu.findItem(R.id.search).setVisible(false); menu.findItem(R.id.home).setVisible(false); menu.findItem(R.id.history).setVisible(false); menu.findItem(R.id.sort).setVisible(false); menu.findItem(R.id.hiddenitems).setVisible(false); menu.findItem(R.id.view).setVisible(false); menu.findItem(R.id.paste).setVisible(false); menu.findItem(R.id.extract).setVisible(true); } return super.onPrepareOptionsMenu(menu); }