reset time button
This commit is contained in:
parent
e32801ca6b
commit
8ea5968f4d
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.plugins.common.SubscriberFragment;
|
|||
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.utils.SP;
|
||||
|
||||
public class TidepoolJavaFragment extends SubscriberFragment {
|
||||
@Override
|
||||
|
@ -20,17 +21,19 @@ public class TidepoolJavaFragment extends SubscriberFragment {
|
|||
View view = inflater.inflate(R.layout.tidepool_fragment, container, false);
|
||||
|
||||
Button login = view.findViewById(R.id.tidepool_login);
|
||||
login.setOnClickListener(v -> {
|
||||
login.setOnClickListener(v1 -> {
|
||||
TidepoolUploader.INSTANCE.doLogin();
|
||||
});
|
||||
Button uploadnow = view.findViewById(R.id.tidepool_uploadnow);
|
||||
uploadnow.setOnClickListener(v -> {
|
||||
MainApp.bus().post(new EventTidepoolDoUpload());
|
||||
});
|
||||
uploadnow.setOnClickListener(v2 -> MainApp.bus().post(new EventTidepoolDoUpload()));
|
||||
Button removeall = view.findViewById(R.id.tidepool_removeall);
|
||||
removeall.setOnClickListener(v -> {
|
||||
removeall.setOnClickListener(v3 -> {
|
||||
MainApp.bus().post(new EventTidepoolResetData());
|
||||
});
|
||||
Button resetStart = view.findViewById(R.id.tidepool_resertstart);
|
||||
resetStart.setOnClickListener(v4 -> {
|
||||
SP.putLong(R.string.key_tidepool_last_end, 0);
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.general.tidepool
|
||||
|
||||
import android.text.Html
|
||||
import com.squareup.otto.Subscribe
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
|
@ -11,13 +12,14 @@ import info.nightscout.androidaps.interfaces.PluginType
|
|||
import info.nightscout.androidaps.logging.L
|
||||
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.UploadChunk
|
||||
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.EventTidepoolStatus
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.utils.RateLimit
|
||||
import info.nightscout.androidaps.receivers.ChargingStateReceiver
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.*
|
||||
|
||||
object TidepoolPlugin : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
|
@ -32,6 +34,13 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
|||
|
||||
var session: Session? = null
|
||||
|
||||
private val listLog = ArrayList<EventTidepoolStatus>()
|
||||
internal var textLog = Html.fromHtml("")
|
||||
|
||||
var paused: Boolean = false
|
||||
internal var autoscroll: Boolean = false
|
||||
|
||||
var status = ""
|
||||
override fun onStart() {
|
||||
MainApp.bus().register(this)
|
||||
super.onStart()
|
||||
|
|
|
@ -113,9 +113,9 @@ object UploadChunk {
|
|||
val end = DateUtil.now()
|
||||
|
||||
val bgReadingList = MainApp.getDbHelper().getBgreadingsDataFromTime(start, end, false)
|
||||
return if (bgReadingList != null && bgReadingList.size > 0) {
|
||||
return if (bgReadingList.size > 0)
|
||||
bgReadingList[0].date
|
||||
} else -1
|
||||
else -1
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
android:id="@+id/tidepool_uploadnow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:text="Upload now"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_login"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
@ -27,7 +26,6 @@
|
|||
android:id="@+id/tidepool_removeall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="Remove all"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_uploadnow"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
@ -48,4 +46,13 @@
|
|||
android:text="Login"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_resertstart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="308dp"
|
||||
android:text="Reset start"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
</android.support.constraint.ConstraintLayout>
|
Loading…
Reference in a new issue