mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 09:31:59 +01:00
Flipper Zero: added duration to Intent API
This commit is contained in:
parent
a5ed37ab79
commit
570670fb28
@ -58,8 +58,10 @@ public class FlipperZeroSupport extends FlipperZeroBaseSupport{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long millis = intent.getExtras().getInt("EXTRA_DURATION", 1000);
|
||||||
|
|
||||||
GB.toast(String.format("playing %s file", appName), Toast.LENGTH_SHORT, GB.INFO);
|
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);
|
Intent response = new Intent(ACTION_PLAY_DONE);
|
||||||
getContext().sendBroadcast(response);
|
getContext().sendBroadcast(response);
|
||||||
@ -184,14 +186,14 @@ public class FlipperZeroSupport extends FlipperZeroBaseSupport{
|
|||||||
openApp("Infrared");
|
openApp("Infrared");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playFile(String appName, String filePath){
|
private void playFile(String appName, String filePath, long durationMillis){
|
||||||
openApp(appName);
|
openApp(appName);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(1000);
|
||||||
appLoadFile(filePath);
|
appLoadFile(filePath);
|
||||||
Thread.sleep(500);
|
Thread.sleep(1000);
|
||||||
appButtonPress();
|
appButtonPress();
|
||||||
Thread.sleep(500);
|
Thread.sleep(durationMillis);
|
||||||
appButtonRelease();
|
appButtonRelease();
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
appExitRequest();
|
appExitRequest();
|
||||||
|
Loading…
Reference in New Issue
Block a user