Scrollview

This commit is contained in:
Milos Kozak 2019-06-07 15:40:05 +02:00
parent a7451c9b16
commit 7d6ed94491
3 changed files with 19 additions and 11 deletions

View file

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TextView;
import com.squareup.otto.Subscribe;
@ -21,6 +22,7 @@ import info.nightscout.androidaps.utils.SP;
public class TidepoolJavaFragment extends SubscriberFragment {
private TextView logTextView;
private TextView statusTextView;
private ScrollView scrollView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -34,6 +36,7 @@ public class TidepoolJavaFragment extends SubscriberFragment {
logTextView = view.findViewById(R.id.tidepool_log);
statusTextView = view.findViewById(R.id.tidepool_status);
scrollView = view.findViewById(R.id.tidepool_logscrollview);
return view;
}
@ -51,6 +54,7 @@ public class TidepoolJavaFragment extends SubscriberFragment {
TidepoolPlugin.INSTANCE.updateLog();
statusTextView.setText(TidepoolUploader.INSTANCE.getConnectionStatus().name());
logTextView.setText(TidepoolPlugin.INSTANCE.getTextLog());
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
});
}
}

View file

@ -49,6 +49,7 @@ object TidepoolPlugin : PluginBase(PluginDescription()
}
override fun onStart() {
super.onStart()
disposable += RxBus
.toObservable(EventTidepoolDoUpload::class.java)
.subscribe({ event -> doUpload() }, {})
@ -90,7 +91,6 @@ object TidepoolPlugin : PluginBase(PluginDescription()
.toObservable(EventNetworkChange::class.java)
.subscribe({}, {}) // TODO start upload on wifi connect
super.onStart()
}
override fun onStop() {

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_height="match_parent">
@ -53,18 +52,23 @@
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 --"
<ScrollView
android:id="@+id/tidepool_logscrollview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tidepool_login"
app:layout_constraintVertical_bias="0.023" />
app:layout_constraintVertical_bias="0.023">
<TextView
android:id="@+id/tidepool_log"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="-- logs --" />
</ScrollView>
</android.support.constraint.ConstraintLayout>