List of usage examples for android.widget PopupMenu show
public void show()
From source file:org.alfresco.mobile.android.application.fragments.site.browser.SiteAdapter.java
@Override protected void updateTopText(TwoLinesViewHolder vh, Site item) { super.updateTopText(vh, item); if (mode == ListingModeFragment.MODE_IMPORT || mode == ListingModeFragment.MODE_PICK) { UIUtils.setBackground(vh.choose, null); return;//from w w w . j a va 2s . c o m } vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); AccessibilityUtils.addContentDescription(vh.choose, String.format(getContext().getString(R.string.more_options_site), item.getTitle())); vh.choose.setTag(R.id.site_action, item); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { Site item = (Site) v.getTag(R.id.site_action); selectedOptionItems.add(item); PopupMenu popup = new PopupMenu(getContext(), v); getMenu(popup.getMenu(), item); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(SiteAdapter.this); popup.show(); } }); }
From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java
@TargetApi(11) @Override//from ww w.j a va 2s. c o m public void onClick(View v) { switch (v.getId()) { case R.id.contact_actions: if (Utility.isPreHoneycomb()) { showContactQuickActions(v); return; } else { PopupMenu popup = new PopupMenu(getActivity(), v); popup.setOnMenuItemClickListener(HoneycombListeners.getPopupMenuListener(this)); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.contact_actions_menu, popup.getMenu()); popup.show(); } break; case R.id.save_contact: this.contactWriter.saveContact(getView().getContext()); default: break; } }
From source file:com.owncloud.android.ui.adapter.UserListAdapter.java
private void onOverflowIconClicked(View view, AppCompatCheckBox allowEditsCheckBox, OCShare share) { // use grey as fallback for elements where custom theming is not available if (ThemeUtils.themingEnabled(context)) { context.getTheme().applyStyle(R.style.FallbackThemingTheme, true); }/* w ww . ja v a2s . c o m*/ PopupMenu popup = new PopupMenu(context, view); popup.inflate(R.menu.file_detail_sharing_menu); prepareOptionsMenu(popup.getMenu(), share); popup.setOnMenuItemClickListener( item -> optionsItemSelected(popup.getMenu(), item, allowEditsCheckBox, share)); popup.show(); }
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//w w w . j av a 2s . co 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:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java
@Override public void onChannelCoupling(final View view) { Log.i(TAG, "onChannelCoupling"); PopupMenu popup = createPopupMenu(view, R.menu.coupling_menu); popup.show(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override/* w w w . jav a2 s. co m*/ public boolean onMenuItemClick(MenuItem item) { boolean handled = false; String coup = ""; switch (item.getItemId()) { case R.id.menu_coupling_ac: handled = true; coup = getResources().getString(R.string.coupling_ac); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_COUPLING, mId, "AC"); break; case R.id.menu_coupling_dc: handled = true; coup = getResources().getString(R.string.coupling_dc); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_COUPLING, mId, "DC"); break; case R.id.menu_coupling_gnd: handled = true; coup = getResources().getString(R.string.coupling_gnd); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_COUPLING, mId, "GND"); break; } ((TextView) view.findViewById(R.id.channel_coupling_subtext)).setText(coup); // mPopupWindow.dismiss(); return handled; } }); }
From source file:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java
@Override public void onTriggerSource(final View view) { Log.i(TAG, "onTriggerSource"); PopupMenu popup = createPopupMenu(view, R.menu.trigger_source_menu); popup.show(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override/*w ww.j a v a 2s. c o m*/ public boolean onMenuItemClick(MenuItem item) { boolean handled = false; String ch = ""; switch (item.getItemId()) { case R.id.menu_source_ch1: handled = true; ch = getResources().getString(R.string.source_ch1); mOnDataChanged.doCommand(ScopeInterface.Command.SET_TRIGGER_SOURCE, 0, "CHAN1"); break; case R.id.menu_source_ch2: handled = true; ch = getResources().getString(R.string.source_ch2); mOnDataChanged.doCommand(ScopeInterface.Command.SET_TRIGGER_SOURCE, 0, "CHAN2"); break; } ((TextView) view.findViewById(R.id.trigger_source_subtext)).setText(ch); // mPopupWindow.dismiss(); return handled; } }); }
From source file:com.scooter1556.sms.androidtv.fragment.AudioPlayerFragment.java
public void showOptionsMenu(View v) { PopupMenu popup = new PopupMenu(getActivity(), v); // This activity implements OnMenuItemClickListener popup.setOnMenuItemClickListener(this); popup.inflate(R.menu.menu_playlist_item); popup.show(); }
From source file:de.aw.monma.actions.FragmentWPList.java
/** * Bei Click wird das contextmenu gezeigt. In den jeweiligen extras sind folgende Informationen * enthalten: WPID, AMOUNT, WPNAME des gewaehlten Wertpapiers. *///from w w w. ja va2s .c o m @Override public void onRecyclerItemClick(View view, int position, WertpapierListItem item) { super.onRecyclerItemClick(view, position, item); Intent intent = new Intent(); intent.putExtra(WPID, item.getID()); intent.putExtra(WPNAME, item.getWPName()); intent.putExtra(ACCOUNTID, NOID); intent.putExtra(AMOUNT, item.getGewinn()); PopupMenu popUpMenu = new PopupMenu(getActivity(), view); popUpMenu.inflate(R.menu.context_fragment_wpuebersicht); popUpMenu.inflate(R.menu.context_fragment_wpliste); Menu menu = popUpMenu.getMenu(); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setIntent(intent); } popUpMenu.setOnMenuItemClickListener(this); popUpMenu.show(); }
From source file:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java
@Override public void onTriggerSlope(final View view) { Log.i(TAG, "onTriggerSlope"); PopupMenu popup = createPopupMenu(view, R.menu.trigger_slope_menu); popup.show(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override// w w w . j a v a 2 s . c o m public boolean onMenuItemClick(MenuItem item) { boolean handled = false; switch (item.getItemId()) { case R.id.menu_slope_positive: { handled = true; mOnDataChanged.doCommand(ScopeInterface.Command.SET_TRIGGER_SLOPE, 0, "POS"); ImageView imageView = (ImageView) view.findViewById(R.id.trigger_slope_subImage); imageView.setImageResource(R.drawable.positive_slope); break; } case R.id.menu_slope_negative: { handled = true; mOnDataChanged.doCommand(ScopeInterface.Command.SET_TRIGGER_SLOPE, 0, "NEG"); ImageView imageView = (ImageView) view.findViewById(R.id.trigger_slope_subImage); imageView.setImageResource(R.drawable.negative_slope); break; } case R.id.menu_slope_both: { handled = true; mOnDataChanged.doCommand(ScopeInterface.Command.SET_TRIGGER_SLOPE, 0, "ALT"); ImageView imageView = (ImageView) view.findViewById(R.id.trigger_slope_subImage); imageView.setImageResource(R.drawable.both_slope); break; } } // mPopupWindow.dismiss(); return handled; } }); }
From source file:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java
@Override public void onChannelProbe(final View view) { Log.i(TAG, "onChannelProbe"); PopupMenu popup = createPopupMenu(view, R.menu.probe_menu); popup.show(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override/*from ww w . jav a 2 s .c o m*/ public boolean onMenuItemClick(MenuItem item) { boolean handled = false; String probe = ""; switch (item.getItemId()) { case R.id.menu_probe_1: handled = true; probe = getResources().getString(R.string.probe_1X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 1); break; case R.id.menu_probe_5: handled = true; probe = getResources().getString(R.string.probe_5X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 5); break; case R.id.menu_probe_10: handled = true; probe = getResources().getString(R.string.probe_10X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 10); break; case R.id.menu_probe_50: handled = true; probe = getResources().getString(R.string.probe_50X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 50); break; case R.id.menu_probe_100: handled = true; probe = getResources().getString(R.string.probe_100X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 100); break; case R.id.menu_probe_500: handled = true; probe = getResources().getString(R.string.probe_500X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 500); break; case R.id.menu_probe_1000: handled = true; probe = getResources().getString(R.string.probe_1000X); mOnDataChanged.doCommand(ScopeInterface.Command.SET_CHANNEL_PROBE, mId, 1000); break; } ((TextView) view.findViewById(R.id.channel_probe_subtext)).setText(probe); // mPopupWindow.dismiss(); return handled; } }); }