Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
f9806162e1
|
@ -1,6 +1,6 @@
|
||||||
# AndroidAPS
|
# AndroidAPS
|
||||||
|
|
||||||
* Check the wiki: http://wiki.androidaps.org
|
* Check the wiki: https://androidaps.readthedocs.io
|
||||||
* Everyone who’s been looping with AndroidAPS needs to fill out the form after 3 days of looping https://docs.google.com/forms/d/14KcMjlINPMJHVt28MDRupa4sz4DDIooI4SrW0P3HSN8/viewform?c=0&w=1
|
* Everyone who’s been looping with AndroidAPS needs to fill out the form after 3 days of looping https://docs.google.com/forms/d/14KcMjlINPMJHVt28MDRupa4sz4DDIooI4SrW0P3HSN8/viewform?c=0&w=1
|
||||||
|
|
||||||
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
|
@ -63,31 +63,31 @@ class MaintenancePlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo replace this with a call on startup of the application, specifically to remove
|
//todo replace this with a call on startup of the application, specifically to remove
|
||||||
// unnecessary garbage from the log exports
|
// unnecessary garbage from the log exports
|
||||||
fun deleteLogs() {
|
fun deleteLogs() {
|
||||||
val logDirectory = LoggerUtils.getLogDirectory()
|
LoggerUtils.getLogDirectory()?.let { logDirectory ->
|
||||||
val logDir = File(logDirectory)
|
val logDir = File(logDirectory)
|
||||||
val files = logDir.listFiles { _: File?, name: String ->
|
val files = logDir.listFiles { _: File?, name: String ->
|
||||||
(name.startsWith("AndroidAPS")
|
(name.startsWith("AndroidAPS") && name.endsWith(".zip"))
|
||||||
&& name.endsWith(".zip"))
|
|
||||||
}
|
|
||||||
Arrays.sort(files) { f1: File, f2: File -> f1.name.compareTo(f2.name) }
|
|
||||||
var delFiles = listOf(*files)
|
|
||||||
val amount = sp.getInt(R.string.key_logshipper_amount, 2)
|
|
||||||
val keepIndex = amount - 1
|
|
||||||
if (keepIndex < delFiles.size) {
|
|
||||||
delFiles = delFiles.subList(keepIndex, delFiles.size)
|
|
||||||
for (file in delFiles) {
|
|
||||||
file.delete()
|
|
||||||
}
|
}
|
||||||
}
|
Arrays.sort(files) { f1: File, f2: File -> f1.name.compareTo(f2.name) }
|
||||||
val exportDir = File(logDirectory, "exports")
|
var delFiles = listOf(*files)
|
||||||
if (exportDir.exists()) {
|
val amount = sp.getInt(R.string.key_logshipper_amount, 2)
|
||||||
val expFiles = exportDir.listFiles()
|
val keepIndex = amount - 1
|
||||||
for (file in expFiles) {
|
if (keepIndex < delFiles.size) {
|
||||||
file.delete()
|
delFiles = delFiles.subList(keepIndex, delFiles.size)
|
||||||
|
for (file in delFiles) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val exportDir = File(logDirectory, "exports")
|
||||||
|
if (exportDir.exists()) {
|
||||||
|
val expFiles = exportDir.listFiles()
|
||||||
|
for (file in expFiles) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
exportDir.delete()
|
||||||
}
|
}
|
||||||
exportDir.delete()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@ abstract class AbstractSensitivityPlugin(
|
||||||
pluginDescription: PluginDescription,
|
pluginDescription: PluginDescription,
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
aapsLogger: AAPSLogger,
|
aapsLogger: AAPSLogger,
|
||||||
resourceHelper:
|
resourceHelper: ResourceHelper,
|
||||||
ResourceHelper,
|
|
||||||
val sp: SP
|
val sp: SP
|
||||||
) : PluginBase(pluginDescription, aapsLogger, resourceHelper, injector), SensitivityInterface {
|
) : PluginBase(pluginDescription, aapsLogger, resourceHelper, injector), SensitivityInterface {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
||||||
|
|
||||||
private SP sp;
|
|
||||||
private ProfileFunction profileFunction;
|
private ProfileFunction profileFunction;
|
||||||
private DateUtil dateUtil;
|
private DateUtil dateUtil;
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
||||||
.description(R.string.description_sensitivity_aaps),
|
.description(R.string.description_sensitivity_aaps),
|
||||||
injector, aapsLogger, resourceHelper, sp
|
injector, aapsLogger, resourceHelper, sp
|
||||||
);
|
);
|
||||||
this.sp = sp;
|
|
||||||
this.profileFunction = profileFunction;
|
this.profileFunction = profileFunction;
|
||||||
this.dateUtil = dateUtil;
|
this.dateUtil = dateUtil;
|
||||||
}
|
}
|
||||||
|
@ -66,12 +64,12 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
||||||
public AutosensResult detectSensitivity(IobCobCalculatorInterface iobCobCalculatorPlugin, long fromTime, long toTime) {
|
public AutosensResult detectSensitivity(IobCobCalculatorInterface iobCobCalculatorPlugin, long fromTime, long toTime) {
|
||||||
LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable();
|
LongSparseArray<AutosensData> autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable();
|
||||||
|
|
||||||
String age = sp.getString(R.string.key_age, "");
|
String age = getSp().getString(R.string.key_age, "");
|
||||||
int defaultHours = 24;
|
int defaultHours = 24;
|
||||||
if (age.equals(getResourceHelper().gs(R.string.key_adult))) defaultHours = 24;
|
if (age.equals(getResourceHelper().gs(R.string.key_adult))) defaultHours = 24;
|
||||||
if (age.equals(getResourceHelper().gs(R.string.key_teenage))) defaultHours = 4;
|
if (age.equals(getResourceHelper().gs(R.string.key_teenage))) defaultHours = 4;
|
||||||
if (age.equals(getResourceHelper().gs(R.string.key_child))) defaultHours = 4;
|
if (age.equals(getResourceHelper().gs(R.string.key_child))) defaultHours = 4;
|
||||||
int hoursForDetection = sp.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
int hoursForDetection = getSp().getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
||||||
|
|
||||||
Profile profile = profileFunction.getProfile();
|
Profile profile = profileFunction.getProfile();
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CareportalEvent(NSMbg mbg) {
|
public CareportalEvent(NSMbg mbg) {
|
||||||
|
this();
|
||||||
date = mbg.date;
|
date = mbg.date;
|
||||||
eventType = MBG;
|
eventType = MBG;
|
||||||
json = mbg.json;
|
json = mbg.json;
|
||||||
|
|
Loading…
Reference in a new issue