Incomplete TidepoolFragment with kotlin-android-extension.
This commit is contained in:
parent
1b0d6ff413
commit
ab96e62ded
1 changed files with 20 additions and 13 deletions
|
@ -4,25 +4,30 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ScrollView
|
||||||
import com.squareup.otto.Subscribe
|
import com.squareup.otto.Subscribe
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment
|
import info.nightscout.androidaps.plugins.common.SubscriberFragment
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI
|
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientUpdateGUI
|
||||||
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.utils.SP
|
||||||
import kotlinx.android.synthetic.main.tidepool_fragment.*
|
import kotlinx.android.synthetic.main.tidepool_fragment.*
|
||||||
|
|
||||||
class TidepoolFragment : SubscriberFragment() {
|
class TidepoolFragment : SubscriberFragment() {
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
savedInstanceState: Bundle?): View? {
|
return inflater.inflate(R.layout.tidepool_fragment, container, false)
|
||||||
val view = inflater.inflate(R.layout.tidepool_fragment, container, false)
|
}
|
||||||
|
|
||||||
tidepool_login.setOnClickListener {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
TidepoolUploader.doLogin()
|
super.onViewCreated(view, savedInstanceState)
|
||||||
}
|
tidepool_login.setOnClickListener { TidepoolUploader.doLogin(false) }
|
||||||
tidepool_removeall.setOnClickListener { }
|
tidepool_uploadnow.setOnClickListener { RxBus.send(EventTidepoolDoUpload()) }
|
||||||
tidepool_uploadnow.setOnClickListener { }
|
tidepool_removeall.setOnClickListener { RxBus.send(EventTidepoolResetData()) }
|
||||||
return view
|
tidepool_resertstart.setOnClickListener { SP.putLong(R.string.key_tidepool_last_end, 0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -31,10 +36,12 @@ class TidepoolFragment : SubscriberFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateGUI() {
|
override fun updateGUI() {
|
||||||
val activity = activity
|
this.activity?.runOnUiThread {
|
||||||
activity?.runOnUiThread {
|
TidepoolPlugin.updateLog()
|
||||||
// TidepoolPlugin.updateLog()
|
tidepool_log.text = TidepoolPlugin.textLog
|
||||||
// tidepool_log.text = TidepoolPlugin.textLog
|
tidepool_status.text = TidepoolUploader.connectionStatus.name
|
||||||
|
tidepool_log.text = TidepoolPlugin.textLog
|
||||||
|
tidepool_logscrollview.fullScroll(ScrollView.FOCUS_DOWN)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue