Merge pull request #1833 from jotomo/tidepool-fragement
Tidepool fragement
This commit is contained in:
commit
1cb0f27254
|
@ -281,6 +281,7 @@ dependencies {
|
|||
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
|
||||
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
|
||||
|
||||
// new for tidepool
|
||||
|
|
|
@ -4,25 +4,30 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ScrollView
|
||||
import com.squareup.otto.Subscribe
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.common.SubscriberFragment
|
||||
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.events.EventTidepoolDoUpload
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolResetData
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import kotlinx.android.synthetic.main.tidepool_fragment.*
|
||||
|
||||
class TidepoolFragment : SubscriberFragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.tidepool_fragment, container, false)
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.tidepool_fragment, container, false)
|
||||
}
|
||||
|
||||
tidepool_login.setOnClickListener {
|
||||
TidepoolUploader.doLogin()
|
||||
}
|
||||
tidepool_removeall.setOnClickListener { }
|
||||
tidepool_uploadnow.setOnClickListener { }
|
||||
return view
|
||||
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) }
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -31,10 +36,12 @@ class TidepoolFragment : SubscriberFragment() {
|
|||
}
|
||||
|
||||
override fun updateGUI() {
|
||||
val activity = activity
|
||||
activity?.runOnUiThread {
|
||||
// TidepoolPlugin.updateLog()
|
||||
// tidepool_log.text = TidepoolPlugin.textLog
|
||||
this.activity?.runOnUiThread {
|
||||
TidepoolPlugin.updateLog()
|
||||
tidepool_log.text = TidepoolPlugin.textLog
|
||||
tidepool_status.text = TidepoolUploader.connectionStatus.name
|
||||
tidepool_log.text = TidepoolPlugin.textLog
|
||||
tidepool_logscrollview.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
|||
.mainType(PluginType.GENERAL)
|
||||
.pluginName(R.string.tidepool)
|
||||
.shortName(R.string.tidepool_shortname)
|
||||
.fragmentClass(TidepoolJavaFragment::class.java.name)
|
||||
.fragmentClass(TidepoolFragment::class.qualifiedName)
|
||||
.preferencesId(R.xml.pref_tidepool)
|
||||
.description(R.string.description_tidepool)
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue