Confirmation dialog before activation
This commit is contained in:
parent
895cf54a17
commit
ac8b5b4a05
|
@ -3,6 +3,7 @@ package info.nightscout.pump.medtrum.ui
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.pump.medtrum.R
|
||||
import info.nightscout.pump.medtrum.code.PatchStep
|
||||
|
@ -11,11 +12,13 @@ import info.nightscout.pump.medtrum.ui.MedtrumBaseFragment
|
|||
import info.nightscout.pump.medtrum.ui.viewmodel.MedtrumViewModel
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
class MedtrumStartDeactivationFragment : MedtrumBaseFragment<FragmentMedtrumStartDeactivationBinding>() {
|
||||
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -32,6 +35,13 @@ class MedtrumStartDeactivationFragment : MedtrumBaseFragment<FragmentMedtrumStar
|
|||
viewModel?.apply {
|
||||
updateSetupStep(MedtrumViewModel.SetupStep.START_DEACTIVATION)
|
||||
}
|
||||
btnPositive.setOnClickListener {
|
||||
OKDialog.showConfirmation(requireActivity(), rh.gs(R.string.medtrum_deactivate_pump_confirm)) {
|
||||
viewModel?.apply {
|
||||
moveStep(PatchStep.DEACTIVATE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,8 +81,7 @@
|
|||
android:text="@string/next"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_negative"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:onSafeClick="@{() -> viewModel.moveStep(PatchStep.DEACTIVATE)}" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
<string name="press_OK_to_return">Press <b>OK</b> to return to main screen.</string>
|
||||
|
||||
<string name="deactivate_sure">Are you sure that you want to deactivate the current patch?</string>
|
||||
<string name="medtrum_deactivate_pump_confirm">Are you sure? This action cannot be reversed!!</string>
|
||||
<string name="press_next_or_cancel">Press <b>Next</b> to deactivate or <b>Cancel</b> to return to main screen.</string>
|
||||
<string name="deactivating_pump">Deactivating patch. Please Wait.</string>
|
||||
<string name="deactivating_error">Failed to deactivate, press <b>Next</b> to forget patch.</string>
|
||||
|
|
Loading…
Reference in a new issue