Overview fragment based on eopatch layout

This commit is contained in:
jbr7rr 2023-03-02 18:32:30 +01:00
parent 43515f7b17
commit 8f6dfbdf88
12 changed files with 303 additions and 302 deletions

View file

@ -0,0 +1,26 @@
package info.nightscout.pump.medtrum.bindingadapters
import android.view.View
import java.util.concurrent.atomic.AtomicBoolean
class OnSafeClickListener(
private val clickListener: View.OnClickListener,
private val intervalMs: Long = MIN_CLICK_INTERVAL
) : View.OnClickListener {
private var canClick = AtomicBoolean(true)
override fun onClick(v: View?) {
if (canClick.getAndSet(false)) {
v?.run {
postDelayed({
canClick.set(true)
}, intervalMs)
clickListener.onClick(v)
}
}
}
companion object {
// 중복 클릭 방지 시간 설정
private const val MIN_CLICK_INTERVAL: Long = 1000
}
}

View file

@ -0,0 +1,29 @@
package info.nightscout.pump.medtrum.bindingadapters
import android.view.View
import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.databinding.BindingAdapter
import info.nightscout.pump.medtrum.extension.setVisibleOrGone
@BindingAdapter("android:visibility")
fun setVisibility(view: View, visible: Boolean) {
view.setVisibleOrGone(visible)
}
@BindingAdapter("visibleOrGone")
fun setVisibleOrGone(view: View, visibleOrGone: Boolean) {
view.setVisibleOrGone(visibleOrGone)
}
@BindingAdapter("onSafeClick")
fun View.setOnSafeClickListener(clickListener: View.OnClickListener?) {
clickListener?.also {
setOnClickListener(OnSafeClickListener(it))
} ?: setOnClickListener(null)
}
@BindingAdapter("textColor")
fun setTextColor(view: TextView, @ColorRes colorResId: Int) {
view.setTextColor(view.context.getColor(colorResId))
}

View file

@ -7,11 +7,9 @@ import dagger.Module
import dagger.Provides import dagger.Provides
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap import dagger.multibindings.IntoMap
// import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.OverviewViewModel
import info.nightscout.pump.medtrum.services.MedtrumService import info.nightscout.pump.medtrum.services.MedtrumService
import info.nightscout.pump.medtrum.ui.MedtrumOverviewFragment import info.nightscout.pump.medtrum.ui.MedtrumOverviewFragment
import info.nightscout.pump.medtrum.ui.viewmodel.OverviewViewModel import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumOverviewViewModel
// import info.nightscout.pump.medtrum.ui.viewmodel.ViewModel
import info.nightscout.pump.medtrum.ui.viewmodel.ViewModelFactory import info.nightscout.pump.medtrum.ui.viewmodel.ViewModelFactory
import info.nightscout.pump.medtrum.ui.viewmodel.ViewModelKey import info.nightscout.pump.medtrum.ui.viewmodel.ViewModelKey
import javax.inject.Provider import javax.inject.Provider
@ -33,8 +31,8 @@ abstract class MedtrumModule {
@Binds @Binds
@IntoMap @IntoMap
@MedtrumPluginQualifier @MedtrumPluginQualifier
@ViewModelKey(OverviewViewModel::class) @ViewModelKey(MedtrumOverviewViewModel::class)
internal abstract fun bindsOverviewViewmodel(viewModel: OverviewViewModel): ViewModel internal abstract fun bindsMedtrumOverviewViewmodel(viewModel: MedtrumOverviewViewModel): ViewModel
// FRAGMENTS // FRAGMENTS
@ContributesAndroidInjector @ContributesAndroidInjector

View file

@ -0,0 +1,34 @@
package info.nightscout.pump.medtrum.extension
import android.view.View
fun View?.visible() = this?.run { visibility = View.VISIBLE }
fun View?.visible(vararg views: View?) {
visible()
for (view in views)
view.visible()
}
fun View?.invisible() = this?.run { visibility = View.INVISIBLE }
fun View?.invisible(vararg views: View?) {
invisible()
for (view in views)
view.invisible()
}
fun View?.gone() = this?.run { visibility = View.GONE }
fun View?.gone(vararg views: View?) {
gone()
for (view in views)
view.gone()
}
fun View?.setVisibleOrGone(visibleOrGone: Boolean, vararg views: View?) {
for (view in views)
if (visibleOrGone) view.visible() else view.gone()
}
fun View?.setVisibleOrGone(visibleOrGone: Boolean) = setVisibleOrGone(visibleOrGone, this)

View file

@ -0,0 +1,58 @@
package info.nightscout.pump.medtrum.ui
import android.content.Intent
import android.os.Bundle
import androidx.activity.result.ActivityResultLauncher
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModelProvider
import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.core.ui.R
import info.nightscout.pump.medtrum.di.MedtrumPluginQualifier
import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
import info.nightscout.rx.AapsSchedulers
import io.reactivex.rxjava3.disposables.CompositeDisposable
import javax.inject.Inject
abstract class MedtrumBaseActivity<B : ViewDataBinding> : DaggerAppCompatActivity(), MedtrumBaseNavigator {
@Inject
@MedtrumPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory
@Inject lateinit var aapsSchedulers: AapsSchedulers
protected lateinit var binding: B
private val compositeDisposable = CompositeDisposable()
protected lateinit var getResult: ActivityResultLauncher<Intent>
@LayoutRes
abstract fun getLayoutId(): Int
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setTheme(R.style.AppTheme_NoActionBar)
binding = DataBindingUtil.setContentView(this, getLayoutId())
binding.lifecycleOwner = this
}
override fun back() {
if(supportFragmentManager.backStackEntryCount == 0) {
finish()
} else {
supportFragmentManager.popBackStack()
}
}
override fun finish(finishAffinity: Boolean) {
if(finishAffinity) {
finishAffinity()
} else {
finish()
}
}
}

View file

@ -0,0 +1,66 @@
package info.nightscout.pump.medtrum.ui
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.CallSuper
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModelProvider
import dagger.android.support.DaggerFragment
import info.nightscout.pump.medtrum.di.MedtrumPluginQualifier
import io.reactivex.rxjava3.disposables.CompositeDisposable
import javax.inject.Inject
abstract class MedtrumBaseFragment<B : ViewDataBinding> : DaggerFragment(), MedtrumBaseNavigator {
@Inject
@MedtrumPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory
protected var baseActivity: MedtrumBaseActivity<*>? = null
protected lateinit var binding: B
private val compositeDisposable = CompositeDisposable()
@LayoutRes
abstract fun getLayoutId(): Int
@CallSuper
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is MedtrumBaseActivity<*>) {
baseActivity = context
}
}
@CallSuper
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = DataBindingUtil.inflate(inflater, getLayoutId(), container, false)
binding.lifecycleOwner = viewLifecycleOwner
return binding.root
}
@CallSuper
override fun onDestroy() {
super.onDestroy()
compositeDisposable.dispose()
}
@CallSuper
override fun onDetach() {
super.onDetach()
baseActivity = null
}
override fun back() {
baseActivity?.back()
}
override fun finish(finishAffinity: Boolean) {
baseActivity?.finish(finishAffinity)
}
}

View file

@ -1,6 +1,6 @@
package info.nightscout.pump.medtrum.ui package info.nightscout.pump.medtrum.ui
interface BaseNavigator { interface MedtrumBaseNavigator {
fun back() fun back()
fun finish(finishAffinity: Boolean = false) fun finish(finishAffinity: Boolean = false)

View file

@ -1,101 +1,67 @@
package info.nightscout.pump.medtrum.ui package info.nightscout.pump.medtrum.ui
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.HandlerThread
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import androidx.activity.result.ActivityResultLauncher
import dagger.android.support.DaggerFragment import androidx.activity.result.contract.ActivityResultContracts
import info.nightscout.core.extensions.toStringFull import androidx.lifecycle.ViewModelProvider
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.pump.medtrum.databinding.MedtrumOverviewFragmentBinding import info.nightscout.pump.medtrum.databinding.MedtrumOverviewFragmentBinding
import info.nightscout.pump.medtrum.events.EventMedtrumPumpUpdateGui import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumOverviewViewModel
import info.nightscout.pump.medtrum.MedtrumPlugin import info.nightscout.pump.medtrum.R
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventExtendedBolusChange import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.events.EventTempBasalChange
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject import javax.inject.Inject
class MedtrumOverviewFragment : DaggerFragment() { class MedtrumOverviewFragment : MedtrumBaseFragment<MedtrumOverviewFragmentBinding>() {
@Inject lateinit var rxBus: RxBus @Inject lateinit var rxBus: RxBus
@Inject lateinit var rh: ResourceHelper
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var MedtrumPlugin: MedtrumPlugin
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var iobCobCalculator: IobCobCalculator
@Inject lateinit var aapsSchedulers: AapsSchedulers @Inject lateinit var aapsSchedulers: AapsSchedulers
@Inject lateinit var aapsLogger: AAPSLogger
private lateinit var resultLauncherForResume: ActivityResultLauncher<Intent>
private lateinit var resultLauncherForPause: ActivityResultLauncher<Intent>
private val disposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
private lateinit var refreshLoop: Runnable override fun getLayoutId(): Int = R.layout.medtrum_overview_fragment
private var handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
private var _binding: MedtrumOverviewFragmentBinding? = null override fun onDestroy() {
super.onDestroy()
// This property is only valid between onCreateView and disposable.clear()
// onDestroyView. }
private val binding get() = _binding!!
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = super.onViewCreated(view, savedInstanceState)
MedtrumOverviewFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root
binding.apply {
@Synchronized viewmodel = ViewModelProvider(this@MedtrumOverviewFragment, viewModelFactory).get(MedtrumOverviewViewModel::class.java)
override fun onResume() { viewmodel?.apply {
super.onResume() // TODO Handle events here, see eopatch eventhandler
disposable += rxBus }
.toObservable(EventMedtrumPumpUpdateGui::class.java)
.observeOn(aapsSchedulers.main) resultLauncherForResume = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
.subscribe({ updateGui() }, fabricPrivacy::logException) when (it.resultCode) {
disposable += rxBus // TODO Handle events here, see eopatch eventhandler
.toObservable(EventTempBasalChange::class.java) }
.observeOn(aapsSchedulers.main) }
.subscribe({ updateGui() }, fabricPrivacy::logException)
disposable += rxBus resultLauncherForPause = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
.toObservable(EventExtendedBolusChange::class.java) when (it.resultCode) {
.observeOn(aapsSchedulers.main) // TODO Handle events here, see eopatch eventhandler
.subscribe({ updateGui() }, fabricPrivacy::logException) }
refreshLoop = Runnable { }
activity?.runOnUiThread { updateGui() } }
handler.postDelayed(refreshLoop, T.mins(1).msecs())
}
handler.postDelayed(refreshLoop, T.mins(1).msecs())
updateGui()
} }
@Synchronized
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
disposable.clear() // TODO
handler.removeCallbacksAndMessages(null)
} }
@Synchronized override fun onResume() {
override fun onDestroyView() { super.onResume()
super.onDestroyView() // TODO
_binding = null
} }
}
@Synchronized
private fun updateGui() {
if (_binding == null) return
val profile = profileFunction.getProfile() ?: return
binding.baseBasalRate.text = rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, MedtrumPlugin.baseBasalRate)
binding.tempbasal.text = iobCobCalculator.getTempBasal(dateUtil.now())?.toStringFull(profile, dateUtil)
?: ""
binding.battery.text = rh.gs(info.nightscout.core.ui.R.string.format_percent, 0) // TODO
binding.reservoir.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, 0.0) // TODO
binding.serialNumber.text = MedtrumPlugin.serialNumber()
}
}

View file

@ -1,12 +1,12 @@
package info.nightscout.pump.medtrum.ui.viewmodel package info.nightscout.pump.medtrum.ui.viewmodel
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import info.nightscout.pump.medtrum.ui.BaseNavigator import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable import io.reactivex.rxjava3.disposables.Disposable
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
abstract class BaseViewModel<N : BaseNavigator> : ViewModel() { abstract class BaseViewModel<N : MedtrumBaseNavigator> : ViewModel() {
private var _navigator: WeakReference<N?>? = null private var _navigator: WeakReference<N?>? = null
var navigator: N? var navigator: N?

View file

@ -1,19 +1,21 @@
package info.nightscout.pump.medtrum.ui.viewmodel package info.nightscout.pump.medtrum.ui.viewmodel
import info.nightscout.pump.medtrum.ui.BaseNavigator import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
import info.nightscout.pump.medtrum.ui.viewmodel.BaseViewModel import info.nightscout.pump.medtrum.ui.viewmodel.BaseViewModel
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import javax.inject.Inject import javax.inject.Inject
class OverviewViewModel @Inject constructor( class MedtrumOverviewViewModel @Inject constructor(
private val aapsLogger: AAPSLogger private val aapsLogger: AAPSLogger
) : BaseViewModel<BaseNavigator>() { ) : BaseViewModel<MedtrumBaseNavigator>() {
val isPatchActivated : Boolean val isPatchActivated : Boolean
get() = false // TODO get() = false // TODO
val isPatchConnected: Boolean val isPatchConnected: Boolean
get() = false // TODO get() = false // TODO
val bleStatus : String
get() ="" //TODO
init { init {
// TODO // TODO

View file

@ -5,7 +5,7 @@
<data> <data>
<variable <variable
name="viewmodel" name="viewmodel"
type="info.nightscout.pump.medtrum.ui.viewmodel.OverviewViewModel"/> type="info.nightscout.pump.medtrum.ui.viewmodel.MedtrumOverviewViewModel"/>
</data> </data>
<RelativeLayout <RelativeLayout
@ -16,88 +16,55 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/medtrum_overview_buttons" android:layout_above="@+id/medtrum_overview_buttons"
android:fillViewport="true" android:fillViewport="true">
tools:context=".MedtrumOverviewFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="@string/medtrum_pump_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:orientation="horizontal"
android:focusable="true" android:paddingTop="2dp"
android:orientation="horizontal"> android:paddingBottom="5dp"
android:visibility="gone">
<TextView <TextView
android:id="@+id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginLeft="5dp"
android:paddingStart="0dp" android:layout_marginRight="5dp"
android:paddingEnd="5dp" android:gravity="center_vertical|center_horizontal"
android:text="@string/base_basal_rate_label" android:text="@string/initializing"
android:textAlignment="viewEnd" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text=":"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/base_basal_rate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="5dp"
android:paddingEnd="0dp"
android:textAlignment="viewStart"
android:textSize="14sp"
tools:text="0.38 U/h" />
</LinearLayout> </LinearLayout>
<View <View
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="2dip" android:layout_height="2dip"
android:layout_marginStart="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginEnd="20dp" android:layout_marginRight="20dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" /> android:background="@color/list_delimiter" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="true"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1.5"
android:paddingStart="0dp" android:gravity="end"
android:paddingStart="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:text="@string/tempbasal_label" android:text="@string/medtrum_ble_status"
android:textAlignment="viewEnd" android:textSize="16sp" />
android:textSize="14sp" />
<TextView <TextView
android:layout_width="5dp" android:layout_width="5dp"
@ -106,166 +73,20 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text=":" android:text="@string/colon"
android:textSize="14sp" android:textSize="16sp" />
tools:ignore="HardcodedText" />
<TextView <com.joanzapata.iconify.widget.IconTextView
android:id="@+id/tempbasal" android:id="@+id/medtrum_ble_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="0dp"
android:textAlignment="viewStart"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="0dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:text="@string/battery_label" android:text="@{viewmodel.bleStatus}"
android:textAlignment="viewEnd" android:textColor="@android:color/white"
android:textSize="14sp" /> android:textSize="16sp" />
<TextView
android:layout_width="5dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text=":"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="5dp"
android:paddingEnd="0dp"
android:textAlignment="viewStart"
android:textSize="14sp"
tools:text="50%" />
</LinearLayout>
<!-- Reservoir -->
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="0dp"
android:paddingEnd="5dp"
android:text="@string/reservoir_label"
android:textAlignment="viewEnd"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text=":"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/reservoir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="5dp"
android:paddingEnd="0dp"
android:textAlignment="viewStart"
android:textSize="14sp" />
</LinearLayout>
<!-- Pump Serial -->
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="0dp"
android:paddingEnd="5dp"
android:text="@string/serial_number"
android:textAlignment="viewEnd"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text=":"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/serial_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="5dp"
android:paddingEnd="0dp"
android:textAlignment="viewStart"
android:textSize="14sp" />
</LinearLayout> </LinearLayout>
@ -286,8 +107,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/string_new_patch" android:text="@string/string_new_patch"
android:enabled="@{!viewmodel.isPatchActivated}"/> android:enabled="@{!viewmodel.isPatchActivated}"
<!-- TODO NEEDS BINDING app:onSafeClick="@{() -> viewmodel.onClickActivation()}"/>--> app:onSafeClick="@{() -> viewmodel.onClickActivation()}"/>
<Button <Button
android:id="@+id/button2" android:id="@+id/button2"
@ -296,8 +117,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/string_stop_patch" android:text="@string/string_stop_patch"
android:enabled="@{viewmodel.isPatchActivated}"/> android:enabled="@{viewmodel.isPatchActivated}"
<!-- TODO NEEDS BINDING app:onSafeClick="@{() -> viewmodel.onClickDeactivation()}"/>--> app:onSafeClick="@{() -> viewmodel.onClickDeactivation()}"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -4,12 +4,13 @@
<string name="key_snInput" translatable="false">snInput</string> <string name="key_snInput" translatable="false">snInput</string>
<string name="key_medtrumpump_settings" translatable="false">medtrumpump_settings</string> <string name="key_medtrumpump_settings" translatable="false">medtrumpump_settings</string>
<string name="medtrum">Medtrum</string> <string name="medtrum">Medtrum</string>
<string name="medtrum_pump_shortname">MEDTRUM</string> <string name="medtrum_pump_shortname">MEDTRUM</string>
<string name="medtrum_pump_description">Medtrum Nano</string> <string name="medtrum_pump_description">Medtrum Nano</string>
<string name="medtrum_pump_label">MEDTRUM</string>
<string name="medtrumpump_settings">Medtrum pump settings</string> <string name="medtrumpump_settings">Medtrum pump settings</string>
<!-- overview fragment -->
<string name="medtrum_ble_status">BLE Status</string>
<string name="snInput_title">SN</string> <string name="snInput_title">SN</string>
<string name="snInput_summary">Serial number pump base</string> <string name="snInput_summary">Serial number pump base</string>