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

Add getBatteryPollingIntervalMinutes to DevicePrefs

This commit is contained in:
Martin.JM 2024-07-04 23:54:37 +02:00 committed by José Rebelo
parent 953d26ed71
commit 7e0e3fa661
2 changed files with 6 additions and 2 deletions

View File

@ -2044,8 +2044,8 @@ public class HuaweiSupportProvider {
}
public boolean startBatteryRunnerDelayed() {
String interval_minutes = GBApplication.getDeviceSpecificSharedPrefs(deviceMac).getString(DeviceSettingsPreferenceConst.PREF_BATTERY_POLLING_INTERVAL, "15");
int interval = Integer.parseInt(interval_minutes) * 60 * 1000;
int interval_minutes = GBApplication.getDevicePrefs(deviceMac).getBatteryPollingIntervalMinutes();
int interval = interval_minutes * 60 * 1000;
LOG.debug("Starting battery runner delayed by {} ({} minutes)", interval, interval_minutes);
handler.removeCallbacks(batteryRunner);
return handler.postDelayed(batteryRunner, interval);

View File

@ -32,6 +32,10 @@ public class DevicePrefs extends Prefs {
return getInt(PREF_BATTERY_NOTIFY_FULL_THRESHOLD + batteryConfig.getBatteryIndex(), batteryConfig.getDefaultFullThreshold());
}
public int getBatteryPollingIntervalMinutes() {
return getInt(PREF_BATTERY_POLLING_INTERVAL, 15);
}
public boolean getFetchUnknownFiles() {
return getBoolean("fetch_unknown_files", false);
}