mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +01:00
Add getLiveActivityFragmentPulseInterval() to DeviceCoordinator
This commit is contained in:
parent
8bb9a36a68
commit
d46a30aaf2
@ -308,7 +308,7 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
|
||||
enableRealtimeTracking(true);
|
||||
}
|
||||
|
||||
private ScheduledExecutorService startActivityPulse() {
|
||||
private ScheduledExecutorService startActivityPulse(int interval) {
|
||||
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
|
||||
service.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
@ -323,7 +323,7 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 0, getPulseIntervalMillis(), TimeUnit.MILLISECONDS);
|
||||
}, 0, interval, TimeUnit.MILLISECONDS);
|
||||
return service;
|
||||
}
|
||||
|
||||
@ -356,10 +356,6 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
|
||||
GBApplication.deviceService(getChartsHost().getDevice()).onEnableRealtimeHeartRateMeasurement(true);
|
||||
}
|
||||
|
||||
private int getPulseIntervalMillis() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMadeVisibleInActivity() {
|
||||
super.onMadeVisibleInActivity();
|
||||
@ -385,7 +381,7 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
|
||||
if (getActivity() != null) {
|
||||
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
pulseScheduler = startActivityPulse();
|
||||
pulseScheduler = startActivityPulse(getChartsHost().getDevice().getDeviceCoordinator().getLiveActivityFragmentPulseInterval());
|
||||
} else {
|
||||
stopActivityPulse();
|
||||
if (getActivity() != null) {
|
||||
|
@ -905,6 +905,11 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
||||
return new AbstractNotificationPattern[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLiveActivityFragmentPulseInterval() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateAuthKey(final String authKey) {
|
||||
return !(authKey.getBytes().length < 34 || !authKey.startsWith("0x"));
|
||||
|
@ -177,6 +177,8 @@ public interface DeviceCoordinator {
|
||||
@Nullable
|
||||
Class<? extends Activity> getCalibrationActivity();
|
||||
|
||||
int getLiveActivityFragmentPulseInterval();
|
||||
|
||||
/**
|
||||
* Returns true if activity data fetching is supported by the device
|
||||
* (with this coordinator).
|
||||
|
Loading…
Reference in New Issue
Block a user