From f3dc0225ec4228affa96a5744b4b6abd70c36ba0 Mon Sep 17 00:00:00 2001 From: dakhnod Date: Wed, 4 Dec 2019 00:18:12 +0100 Subject: [PATCH] fixed string switch --- .../gadgetbridge/devices/qhybrid/ConfigActivity.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java index 5b7c68742..07e39e6bf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java @@ -201,13 +201,13 @@ public class ConfigActivity extends AbstractGBActivity { @Override public boolean onItemLongClick(final AdapterView adapterView, View view, final int i, long l) { PopupMenu menu = new PopupMenu(ConfigActivity.this, view); - menu.getMenu().add("edit"); - menu.getMenu().add("delete"); + menu.getMenu().add(0, 0, 0, "edit"); + menu.getMenu().add(0, 1, 1, "delete"); menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { - switch (menuItem.getTitle().toString()) { - case "edit": { + switch (menuItem.getItemId()) { + case 0: { TimePicker picker = new TimePicker(ConfigActivity.this, (NotificationConfiguration) adapterView.getItemAtPosition(i)); picker.finishListener = new TimePicker.OnFinishListener() { @Override @@ -240,7 +240,7 @@ public class ConfigActivity extends AbstractGBActivity { setControl(true, picker.getSettings()); break; } - case "delete": { + case 1: { try { helper.deleteNotificationConfiguration((NotificationConfiguration) adapterView.getItemAtPosition(i)); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED));