From 570670fb28552368914c8c30ad53be2c38232d8e Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 9 Sep 2022 04:54:10 +0200 Subject: [PATCH] Flipper Zero: added duration to Intent API --- .../flipper/zero/support/FlipperZeroSupport.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroSupport.java index 57c1b41bd..2616dd28d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroSupport.java @@ -58,8 +58,10 @@ public class FlipperZeroSupport extends FlipperZeroBaseSupport{ return; } + long millis = intent.getExtras().getInt("EXTRA_DURATION", 1000); + GB.toast(String.format("playing %s file", appName), Toast.LENGTH_SHORT, GB.INFO); - playFile(appName, filePath); + playFile(appName, filePath, millis); Intent response = new Intent(ACTION_PLAY_DONE); getContext().sendBroadcast(response); @@ -184,14 +186,14 @@ public class FlipperZeroSupport extends FlipperZeroBaseSupport{ openApp("Infrared"); } - private void playFile(String appName, String filePath){ + private void playFile(String appName, String filePath, long durationMillis){ openApp(appName); try { - Thread.sleep(500); + Thread.sleep(1000); appLoadFile(filePath); - Thread.sleep(500); + Thread.sleep(1000); appButtonPress(); - Thread.sleep(500); + Thread.sleep(durationMillis); appButtonRelease(); Thread.sleep(1000); appExitRequest();