layout improvement
This commit is contained in:
parent
ba0b7ec83d
commit
5dbdd5e437
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.utils.SP;
|
|||
|
||||
public class TidepoolJavaFragment extends SubscriberFragment {
|
||||
private TextView logTextView;
|
||||
private TextView statusTextView;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -43,6 +44,7 @@ public class TidepoolJavaFragment extends SubscriberFragment {
|
|||
});
|
||||
|
||||
logTextView = view.findViewById(R.id.tidepool_log);
|
||||
statusTextView = view.findViewById(R.id.tidepool_status);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -58,6 +60,7 @@ public class TidepoolJavaFragment extends SubscriberFragment {
|
|||
if (activity != null)
|
||||
activity.runOnUiThread(() -> {
|
||||
TidepoolPlugin.INSTANCE.updateLog();
|
||||
statusTextView.setText(TidepoolUploader.INSTANCE.getConnectionStatus().name());
|
||||
logTextView.setText(TidepoolPlugin.INSTANCE.getTextLog());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
|||
|
||||
private val listLog = ArrayList<EventTidepoolStatus>()
|
||||
var textLog = Html.fromHtml("")
|
||||
var status = ""
|
||||
|
||||
var paused: Boolean = false
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ object TidepoolUploader {
|
|||
|
||||
}
|
||||
|
||||
private fun status(status: String) {
|
||||
fun status(status: String) {
|
||||
if (L.isEnabled(L.TIDEPOOL))
|
||||
log.debug("New status: $status")
|
||||
MainApp.bus().post(EventTidepoolStatus(status))
|
||||
|
|
|
@ -35,9 +35,9 @@ object UploadChunk {
|
|||
|
||||
operator fun get(start: Long, end: Long): String {
|
||||
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Syncing data between: " + DateUtil.dateAndTimeFullString(start) + " -> " + DateUtil.dateAndTimeFullString(end))
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Syncing data between: " + DateUtil.dateAndTimeString(start) + " -> " + DateUtil.dateAndTimeString(end))
|
||||
if (end <= start) {
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("End is <= start: " + DateUtil.dateAndTimeFullString(start) + " " + DateUtil.dateAndTimeFullString(end))
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("End is <= start: " + DateUtil.dateAndTimeString(start) + " " + DateUtil.dateAndTimeString(end))
|
||||
return ""
|
||||
}
|
||||
if (end - start > MAX_UPLOAD_SIZE) {
|
||||
|
@ -64,9 +64,11 @@ object UploadChunk {
|
|||
fun setLastEnd(time: Long) {
|
||||
if (time > getLastEnd()) {
|
||||
SP.putLong(R.string.key_tidepool_last_end, time)
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Updating last end to: " + DateUtil.dateAndTimeFullString(time))
|
||||
val friendlyEnd = DateUtil.dateAndTimeString(time)
|
||||
TidepoolUploader.status("Marking uploaded data up to $friendlyEnd")
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Updating last end to: " + DateUtil.dateAndTimeString(time))
|
||||
} 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.dateAndTimeString(time) + " vs " + DateUtil.dateAndTimeString(getLastEnd()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -10,49 +9,62 @@
|
|||
android:id="@+id/tidepool_status"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="-"
|
||||
tools:layout_editor_absoluteX="1dp"
|
||||
tools:layout_editor_absoluteY="32dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_uploadnow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Upload now"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_login"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_removeall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Remove all"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_uploadnow"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tidepool_log"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="-- logs --"
|
||||
tools:layout_editor_absoluteX="1dp"
|
||||
tools:layout_editor_absoluteY="128dp" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Login"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_uploadnow"
|
||||
android:layout_width="113dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Upload now"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_login"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_removeall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Remove all"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_uploadnow"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_resertstart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="308dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Reset start"
|
||||
app:layout_constraintStart_toEndOf="@+id/tidepool_removeall"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tidepool_log"
|
||||
android:layout_width="395dp"
|
||||
android:layout_height="608dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="603dp"
|
||||
android:text="-- logs --"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_login"
|
||||
app:layout_constraintVertical_bias="0.023" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
Loading…
Reference in a new issue