use of android.widget.PopupMenu in project xabber-android by redsolution.
the class ContactListFragment method onAccountMenuClick.
@Override
public void onAccountMenuClick(View view, final String account) {
PopupMenu popup = new PopupMenu(getActivity(), view);
popup.inflate(R.menu.account);
ContextMenuHelper.setUpAccountMenu(getActivity(), adapter, account, popup.getMenu());
popup.show();
}
use of android.widget.PopupMenu in project xabber-android by redsolution.
the class AccountInfoEditorFragment method changeAvatar.
private void changeAvatar() {
PopupMenu menu = new PopupMenu(getActivity(), changeAvatarButton);
menu.inflate(R.menu.change_avatar);
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_choose_from_gallery:
onChooseFromGalleryClick();
return true;
case R.id.action_take_photo:
onTakePhotoClick();
return true;
case R.id.action_remove_avatar:
removeAvatar();
return true;
default:
return false;
}
}
});
menu.show();
}
use of android.widget.PopupMenu in project RxBinding by JakeWharton.
the class RxPopupMenuTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View anchor = new View(this);
setContentView(anchor);
popupMenu = new PopupMenu(this, anchor);
}
use of android.widget.PopupMenu in project Gadgetbridge by Freeyourgadget.
the class AbstractAppManagerFragment method openPopupMenu.
public boolean openPopupMenu(View view, int position) {
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.getMenuInflater().inflate(R.menu.appmanager_context, popupMenu.getMenu());
Menu menu = popupMenu.getMenu();
final GBDeviceApp selectedApp = appList.get(position);
if (!selectedApp.isInCache()) {
menu.removeItem(R.id.appmanager_app_reinstall);
menu.removeItem(R.id.appmanager_app_delete_cache);
}
if (!PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
menu.removeItem(R.id.appmanager_health_activate);
menu.removeItem(R.id.appmanager_health_deactivate);
}
if (!PebbleProtocol.UUID_WORKOUT.equals(selectedApp.getUUID())) {
menu.removeItem(R.id.appmanager_hrm_activate);
menu.removeItem(R.id.appmanager_hrm_deactivate);
}
if (!PebbleProtocol.UUID_WEATHER.equals(selectedApp.getUUID())) {
menu.removeItem(R.id.appmanager_weather_activate);
menu.removeItem(R.id.appmanager_weather_deactivate);
menu.removeItem(R.id.appmanager_weather_install_provider);
}
if (selectedApp.getType() == GBDeviceApp.Type.APP_SYSTEM || selectedApp.getType() == GBDeviceApp.Type.WATCHFACE_SYSTEM) {
menu.removeItem(R.id.appmanager_app_delete);
}
if (!selectedApp.isConfigurable()) {
menu.removeItem(R.id.appmanager_app_configure);
}
if (PebbleProtocol.UUID_WEATHER.equals(selectedApp.getUUID())) {
PackageManager pm = getActivity().getPackageManager();
try {
pm.getPackageInfo("ru.gelin.android.weather.notification", PackageManager.GET_ACTIVITIES);
menu.removeItem(R.id.appmanager_weather_install_provider);
} catch (PackageManager.NameNotFoundException e) {
menu.removeItem(R.id.appmanager_weather_activate);
menu.removeItem(R.id.appmanager_weather_deactivate);
}
}
switch(selectedApp.getType()) {
case WATCHFACE:
case APP_GENERIC:
case APP_ACTIVITYTRACKER:
break;
default:
menu.removeItem(R.id.appmanager_app_openinstore);
}
//menu.setHeaderTitle(selectedApp.getName());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
return onContextItemSelected(item, selectedApp);
}
});
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
popupMenu.show();
return true;
}
use of android.widget.PopupMenu in project android_frameworks_base by ParanoidAndroid.
the class BaseStatusBar method getNotificationLongClicker.
protected View.OnLongClickListener getNotificationLongClicker() {
return new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
NotificationData.Entry entry = (NotificationData.Entry) v.getTag();
if (entry.notification == null)
return false;
StatusBarNotification sbn = entry.notification;
final String packageNameF = sbn.getPackageName();
final PendingIntent contentIntent = sbn.getNotification().contentIntent;
boolean expanded = Settings.System.getInt(mContext.getContentResolver(), Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1;
if (packageNameF == null)
return false;
if (v.getWindowToken() == null)
return false;
//Long click menu broken on PIE mode...pop up menu is useless (auto-launch on long click)
if (expanded) {
launchFloating(contentIntent);
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
return true;
}
mNotificationBlamePopup = new PopupMenu(mContext, v);
mNotificationBlamePopup.getMenuInflater().inflate(R.menu.notification_popup_menu, mNotificationBlamePopup.getMenu());
mNotificationBlamePopup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.notification_inspect_item) {
startApplicationDetailsActivity(packageNameF);
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
} else if (item.getItemId() == R.id.notification_floating_item) {
launchFloating(contentIntent);
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
} else {
return false;
}
return true;
}
});
mNotificationBlamePopup.setOnDismissListener(new PopupMenu.OnDismissListener() {
@Override
public void onDismiss(PopupMenu popupMenu) {
mNotificationBlamePopup = null;
}
});
mNotificationBlamePopup.show();
return true;
}
};
}
Aggregations