preferences, button
This commit is contained in:
parent
4a07e01b7d
commit
e32801ca6b
5 changed files with 12 additions and 3 deletions
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin;
|
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin;
|
||||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin;
|
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin;
|
||||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
||||||
|
@ -182,6 +183,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginType.INSULIN);
|
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginType.INSULIN);
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL);
|
addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL);
|
||||||
|
addPreferencesFromResourceIfEnabled(TidepoolPlugin.INSTANCE, PluginType.GENERAL);
|
||||||
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL);
|
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.pref_others);
|
addPreferencesFromResource(R.xml.pref_others);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader;
|
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader;
|
||||||
|
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload;
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData;
|
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData;
|
||||||
|
|
||||||
public class TidepoolJavaFragment extends SubscriberFragment {
|
public class TidepoolJavaFragment extends SubscriberFragment {
|
||||||
|
@ -22,6 +23,10 @@ public class TidepoolJavaFragment extends SubscriberFragment {
|
||||||
login.setOnClickListener(v -> {
|
login.setOnClickListener(v -> {
|
||||||
TidepoolUploader.INSTANCE.doLogin();
|
TidepoolUploader.INSTANCE.doLogin();
|
||||||
});
|
});
|
||||||
|
Button uploadnow = view.findViewById(R.id.tidepool_uploadnow);
|
||||||
|
uploadnow.setOnClickListener(v -> {
|
||||||
|
MainApp.bus().post(new EventTidepoolDoUpload());
|
||||||
|
});
|
||||||
Button removeall = view.findViewById(R.id.tidepool_removeall);
|
Button removeall = view.findViewById(R.id.tidepool_removeall);
|
||||||
removeall.setOnClickListener(v -> {
|
removeall.setOnClickListener(v -> {
|
||||||
MainApp.bus().post(new EventTidepoolResetData());
|
MainApp.bus().post(new EventTidepoolResetData());
|
||||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.interfaces.PluginType
|
||||||
import info.nightscout.androidaps.logging.L
|
import info.nightscout.androidaps.logging.L
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.comm.Session
|
import info.nightscout.androidaps.plugins.general.tidepool.comm.Session
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader
|
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader
|
||||||
|
import info.nightscout.androidaps.plugins.general.tidepool.comm.UploadChunk
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload
|
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData
|
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.utils.RateLimit
|
import info.nightscout.androidaps.plugins.general.tidepool.utils.RateLimit
|
||||||
|
@ -70,6 +71,7 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
||||||
session = TidepoolUploader.doLogin()
|
session = TidepoolUploader.doLogin()
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
TidepoolUploader.deleteDataSet(session!!)
|
TidepoolUploader.deleteDataSet(session!!)
|
||||||
|
SP.putLong(R.string.key_tidepool_last_end, 0)
|
||||||
TidepoolUploader.doLogin()
|
TidepoolUploader.doLogin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,7 @@ object UploadChunk {
|
||||||
|
|
||||||
fun setLastEnd(time: Long) {
|
fun setLastEnd(time: Long) {
|
||||||
if (time > getLastEnd()) {
|
if (time > getLastEnd()) {
|
||||||
//TODO SP.putLong(R.string.key_tidepool_last_end, time)
|
SP.putLong(R.string.key_tidepool_last_end, time)
|
||||||
SP.putLong(R.string.key_tidepool_last_end, 0)
|
|
||||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Updating last end to: " + DateUtil.dateAndTimeFullString(time))
|
if (L.isEnabled(L.TIDEPOOL)) log.debug("Updating last end to: " + DateUtil.dateAndTimeFullString(time))
|
||||||
} else {
|
} else {
|
||||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Cannot set last end to: " + DateUtil.dateAndTimeFullString(time) + " vs " + DateUtil.dateAndTimeFullString(getLastEnd()))
|
if (L.isEnabled(L.TIDEPOOL)) log.debug("Cannot set last end to: " + DateUtil.dateAndTimeFullString(time) + " vs " + DateUtil.dateAndTimeFullString(getLastEnd()))
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
android:summary=""
|
android:summary=""
|
||||||
android:title="@string/title_tidepool_window_latency" />
|
android:title="@string/title_tidepool_window_latency" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="true"
|
||||||
|
android:enabled="false"
|
||||||
android:key="@string/key_tidepool_dev_servers"
|
android:key="@string/key_tidepool_dev_servers"
|
||||||
android:summary="@string/summary_tidepool_dev_servers"
|
android:summary="@string/summary_tidepool_dev_servers"
|
||||||
android:title="@string/title_tidepool_dev_servers" />
|
android:title="@string/title_tidepool_dev_servers" />
|
||||||
|
|
Loading…
Reference in a new issue