From f0da25c49b6d9b1e78c58c64d6f8d1a40e924e70 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 28 Jun 2016 23:07:24 +0200 Subject: [PATCH] Fix activity fetching getting stuck when double tapping #333 --- .../gadgetbridge/activities/charts/ChartsActivity.java | 2 +- .../gadgetbridge/service/btle/AbstractBTLEOperation.java | 6 ++++-- .../devices/miband/operations/AbstractMiBandOperation.java | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java index f09fca794..292202cca 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java @@ -102,8 +102,8 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts swipeLayout.setRefreshing(true); } else { boolean wasBusy = swipeLayout.isRefreshing(); + swipeLayout.setRefreshing(false); if (wasBusy) { - swipeLayout.setRefreshing(false); LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(REFRESH)); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEOperation.java index 258199ad8..7747567d2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEOperation.java @@ -105,8 +105,10 @@ public abstract class AbstractBTLEOperation } protected void unsetBusy() { - getDevice().unsetBusyTask(); - getDevice().sendDeviceUpdateIntent(getContext()); + if (getDevice().isBusy()) { + getDevice().unsetBusyTask(); + getDevice().sendDeviceUpdateIntent(getContext()); + } } public boolean isOperationRunning() { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/AbstractMiBandOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/AbstractMiBandOperation.java index 2f6577d7f..971a63d40 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/AbstractMiBandOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/AbstractMiBandOperation.java @@ -18,6 +18,7 @@ public abstract class AbstractMiBandOperation extends AbstractBTLEOperation