1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Fix pull-down to refresh for some devices

This commit is contained in:
José Rebelo 2024-08-22 23:03:05 +01:00
parent f19782ef55
commit 3ca9e59fd7

View File

@ -90,6 +90,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
@ -258,11 +259,8 @@ public class ControlCenterv2 extends AppCompatActivity
// Set pull-down-to-refresh action
swipeLayout = findViewById(R.id.dashboard_swipe_layout);
swipeLayout.setOnRefreshListener(() -> {
// Signal DeviceCommunicationService to fetch activity for all connected devices
Intent intent = new Intent(getApplicationContext(), DeviceCommunicationService.class);
intent.setAction(DeviceService.ACTION_FETCH_RECORDED_DATA)
.putExtra(DeviceService.EXTRA_RECORDED_DATA_TYPES, ActivityKind.ACTIVITY);
startService(intent);
// Fetch activity for all connected devices
GBApplication.deviceService().onFetchRecordedData(RecordedDataTypes.TYPE_SYNC);
// Hide 'refreshing' animation immediately if no health devices are connected
List<GBDevice> devices1 = GBApplication.app().getDeviceManager().getDevices();
for (GBDevice dev : devices1) {