From 5ca4816b017a162541f7f9bace1a42025b4f5a8b Mon Sep 17 00:00:00 2001 From: dakhnod Date: Tue, 31 Dec 2019 03:13:31 +0100 Subject: [PATCH] added menu handling --- .../service/devices/qhybrid/QHybridSupport.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java index 6c32b6a70..b73013cad 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java @@ -84,6 +84,8 @@ public class QHybridSupport extends QHybridBaseSupport { public static final String QHYBRID_COMMAND_NOTIFICATION = "qhybrid_command_notification"; public static final String QHYBRID_COMMAND_UPDATE_SETTINGS = "nodomain.freeyourgadget.gadgetbridge.Q_UPDATE_SETTINGS"; public static final String QHYBRID_COMMAND_OVERWRITE_BUTTONS = "nodomain.freeyourgadget.gadgetbridge.Q_OVERWRITE_BUTTONS"; + public static final String QHYBRID_COMMAND_SET_MENU_MESSAGE = "nodomain.freeyourgadget.gadgetbridge.Q_SET_MENU_MESSAGE"; + public static final String QHYBRID_COMMAND_SEND_MENU_ITEMS = "nodomain.freeyourgadget.gadgetbridge.Q_SEND_MENU_ITEMS"; private static final String QHYBRID_ACTION_SET_ACTIVITY_HAND = "nodomain.freeyourgadget.gadgetbridge.Q_SET_ACTIVITY_HAND"; @@ -93,6 +95,7 @@ public class QHybridSupport extends QHybridBaseSupport { public static final String QHYBRID_EVENT_BUTTON_PRESS = "nodomain.freeyourgadget.gadgetbridge.Q_BUTTON_PRESSED"; public static final String QHYBRID_EVENT_MULTI_BUTTON_PRESS = "nodomain.freeyourgadget.gadgetbridge.Q_MULTI_BUTTON_PRESSED"; + public static final String QHYBRID_EVENT_COMMUTE_MENU = "nodomain.freeyourgadget.gadgetbridge.Q_COMMUTE_MENU"; public static final String ITEM_STEP_GOAL = "STEP_GOAL"; public static final String ITEM_STEP_COUNT = "STEP_COUNT"; @@ -132,6 +135,7 @@ public class QHybridSupport extends QHybridBaseSupport { commandFilter.addAction(QHYBRID_COMMAND_UPDATE_SETTINGS); commandFilter.addAction(QHYBRID_COMMAND_OVERWRITE_BUTTONS); commandFilter.addAction(QHYBRID_COMMAND_NOTIFICATION_CONFIG_CHANGED); + commandFilter.addAction(QHYBRID_COMMAND_SEND_MENU_ITEMS); BroadcastReceiver commandReceiver = new BroadcastReceiver() { @Override @@ -224,6 +228,7 @@ public class QHybridSupport extends QHybridBaseSupport { IntentFilter globalFilter = new IntentFilter(); globalFilter.addAction(QHYBRID_ACTION_SET_ACTIVITY_HAND); + globalFilter.addAction(QHYBRID_COMMAND_SET_MENU_MESSAGE); BroadcastReceiver globalCommandReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -247,6 +252,14 @@ public class QHybridSupport extends QHybridBaseSupport { } break; } + case QHYBRID_COMMAND_SET_MENU_MESSAGE: { + String message = String.valueOf(intent.getExtras().get("EXTRA_MESSAGE")); + boolean finished = Boolean.valueOf(String.valueOf(intent.getExtras().get("EXTRA_FINISHED"))); + + watchAdapter.setCommuteMenuMessage(message, finished); + + break; + } } } };