mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Fix activity fetching getting stuck when double tapping #333
This commit is contained in:
parent
76dcb8f828
commit
f0da25c49b
@ -102,8 +102,8 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
|
|||||||
swipeLayout.setRefreshing(true);
|
swipeLayout.setRefreshing(true);
|
||||||
} else {
|
} else {
|
||||||
boolean wasBusy = swipeLayout.isRefreshing();
|
boolean wasBusy = swipeLayout.isRefreshing();
|
||||||
if (wasBusy) {
|
|
||||||
swipeLayout.setRefreshing(false);
|
swipeLayout.setRefreshing(false);
|
||||||
|
if (wasBusy) {
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(REFRESH));
|
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(REFRESH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,11 @@ public abstract class AbstractBTLEOperation<T extends AbstractBTLEDeviceSupport>
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void unsetBusy() {
|
protected void unsetBusy() {
|
||||||
|
if (getDevice().isBusy()) {
|
||||||
getDevice().unsetBusyTask();
|
getDevice().unsetBusyTask();
|
||||||
getDevice().sendDeviceUpdateIntent(getContext());
|
getDevice().sendDeviceUpdateIntent(getContext());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOperationRunning() {
|
public boolean isOperationRunning() {
|
||||||
return operationStatus == OperationStatus.RUNNING;
|
return operationStatus == OperationStatus.RUNNING;
|
||||||
|
@ -18,6 +18,7 @@ public abstract class AbstractMiBandOperation extends AbstractBTLEOperation<MiBa
|
|||||||
@Override
|
@Override
|
||||||
protected void prePerform() throws IOException {
|
protected void prePerform() throws IOException {
|
||||||
super.prePerform();
|
super.prePerform();
|
||||||
|
getDevice().setBusyTask("fetch activity data"); // mark as busy quickly to avoid interruptions from the outside
|
||||||
TransactionBuilder builder = performInitialized("disabling some notifications");
|
TransactionBuilder builder = performInitialized("disabling some notifications");
|
||||||
enableOtherNotifications(builder, false);
|
enableOtherNotifications(builder, false);
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
@ -27,6 +28,7 @@ public abstract class AbstractMiBandOperation extends AbstractBTLEOperation<MiBa
|
|||||||
protected void operationFinished() {
|
protected void operationFinished() {
|
||||||
operationStatus = OperationStatus.FINISHED;
|
operationStatus = OperationStatus.FINISHED;
|
||||||
if (getDevice() != null && getDevice().isConnected()) {
|
if (getDevice() != null && getDevice().isConnected()) {
|
||||||
|
unsetBusy();
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("reenabling disabled notifications");
|
TransactionBuilder builder = performInitialized("reenabling disabled notifications");
|
||||||
enableOtherNotifications(builder, true);
|
enableOtherNotifications(builder, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user