mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-26 17:21:31 +02:00
Widget: Only signal new data only when syncing activity data (not on fetching logs etc), do the same for Mi Band 1
This commit is contained in:
parent
a3d9aadde0
commit
89c7066d32
@ -19,13 +19,11 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations;
|
||||
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -128,9 +126,6 @@ public abstract class AbstractFetchOperation extends AbstractHuamiOperation {
|
||||
GB.updateTransferNotification(null, "", false, 100, getContext());
|
||||
operationFinished();
|
||||
unsetBusy();
|
||||
|
||||
Intent intent = new Intent(GBApplication.ACTION_NEW_DATA);
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,6 +85,7 @@ public class FetchActivityOperation extends AbstractFetchOperation {
|
||||
}
|
||||
|
||||
super.handleActivityFetchFinish(success);
|
||||
GB.signalActivityDataFinish();
|
||||
}
|
||||
|
||||
private boolean needsAnotherFetch(GregorianCalendar lastSyncTimestamp) {
|
||||
|
@ -49,9 +49,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
|
||||
//import java.util.concurrent.Executors;
|
||||
//import java.util.concurrent.ScheduledExecutorService;
|
||||
//import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
* An operation that fetches activity data. For every fetch, a new operation must
|
||||
@ -71,7 +68,7 @@ public class FetchActivityOperation extends AbstractMiBand1Operation {
|
||||
private final boolean hasPacketCounter;
|
||||
|
||||
private class ActivityStruct {
|
||||
private int maxDataPacketLength = 20;
|
||||
private int maxDataPacketLength;
|
||||
private int lastNotifiedProgress;
|
||||
private final byte[] activityDataHolder;
|
||||
private final int activityDataHolderSize;
|
||||
@ -197,6 +194,7 @@ public class FetchActivityOperation extends AbstractMiBand1Operation {
|
||||
activityStruct = null;
|
||||
operationFinished();
|
||||
unsetBusy();
|
||||
GB.signalActivityDataFinish();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,8 @@ import java.nio.ByteOrder;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBEnvironment;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
@ -492,4 +494,9 @@ public class GB {
|
||||
throw new AssertionError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static void signalActivityDataFinish() {
|
||||
Intent intent = new Intent(GBApplication.ACTION_NEW_DATA);
|
||||
LocalBroadcastManager.getInstance(GBApplication.getContext()).sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user