SmsCommunicatorOtpActivity -> jetpack
This commit is contained in:
parent
2e58bfc829
commit
026d6039dc
|
@ -7,6 +7,7 @@ import android.view.ViewGroup
|
|||
import android.widget.ScrollView
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.TidepoolFragmentBinding
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolDoUpload
|
||||
|
@ -29,16 +30,23 @@ class TidepoolFragment : DaggerFragment() {
|
|||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.tidepool_fragment, container, false)
|
||||
private var _binding: TidepoolFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
_binding = TidepoolFragmentBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
tidepool_login.setOnClickListener { tidepoolUploader.doLogin(false) }
|
||||
tidepool_uploadnow.setOnClickListener { rxBus.send(EventTidepoolDoUpload()) }
|
||||
tidepool_removeall.setOnClickListener { rxBus.send(EventTidepoolResetData()) }
|
||||
tidepool_resertstart.setOnClickListener { sp.putLong(R.string.key_tidepool_last_end, 0) }
|
||||
binding.login.setOnClickListener { tidepoolUploader.doLogin(false) }
|
||||
binding.uploadnow.setOnClickListener { rxBus.send(EventTidepoolDoUpload()) }
|
||||
binding.removeall.setOnClickListener { rxBus.send(EventTidepoolResetData()) }
|
||||
binding.resertstart.setOnClickListener { sp.putLong(R.string.key_tidepool_last_end, 0) }
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
@ -48,11 +56,12 @@ class TidepoolFragment : DaggerFragment() {
|
|||
.toObservable(EventTidepoolUpdateGUI::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
if (_binding == null) return@subscribe
|
||||
tidepoolPlugin.updateLog()
|
||||
tidepool_log?.text = tidepoolPlugin.textLog
|
||||
tidepool_status?.text = tidepoolUploader.connectionStatus.name
|
||||
tidepool_log?.text = tidepoolPlugin.textLog
|
||||
tidepool_logscrollview?.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
binding.log.text = tidepoolPlugin.textLog
|
||||
binding.status.text = tidepoolUploader.connectionStatus.name
|
||||
binding.log.text = tidepoolPlugin.textLog
|
||||
binding.logscrollview.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
}, { fabricPrivacy.logException(it) })
|
||||
}
|
||||
|
||||
|
@ -61,4 +70,12 @@ class TidepoolFragment : DaggerFragment() {
|
|||
super.onPause()
|
||||
disposable.clear()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tidepool_status"
|
||||
android:id="@+id/status"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
|
@ -15,45 +15,45 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_login"
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Login"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_status" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_uploadnow"
|
||||
android:id="@+id/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" />
|
||||
app:layout_constraintStart_toEndOf="@+id/login"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_removeall"
|
||||
android:id="@+id/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" />
|
||||
app:layout_constraintStart_toEndOf="@+id/uploadnow"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tidepool_resertstart"
|
||||
android:id="@+id/resertstart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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" />
|
||||
app:layout_constraintStart_toEndOf="@+id/removeall"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/tidepool_logscrollview"
|
||||
android:id="@+id/logscrollview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
|
@ -61,11 +61,11 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tidepool_login"
|
||||
app:layout_constraintTop_toBottomOf="@+id/login"
|
||||
app:layout_constraintVertical_bias="0.023">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tidepool_log"
|
||||
android:id="@+id/log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="-- logs --" />
|
||||
|
|
Loading…
Reference in a new issue