Merge pull request #144 from Philoul/LoopDialog

Replace Loop Menu by a dialog
This commit is contained in:
Milos Kozak 2020-12-27 20:55:58 +01:00 committed by GitHub
commit 4238e9cab3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 842 additions and 245 deletions

View file

@ -109,6 +109,7 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog
@ContributesAndroidInjector abstract fun contributesChooseTriggerDialog(): ChooseTriggerDialog
@ContributesAndroidInjector abstract fun contributesInsulinDialog(): InsulinDialog
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
@ContributesAndroidInjector abstract fun contributesProfileSwitchDialog(): ProfileSwitchDialog
@ContributesAndroidInjector abstract fun contributesTempBasalDialog(): TempBasalDialog

View file

@ -0,0 +1,356 @@
package info.nightscout.androidaps.dialogs
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.databinding.DialogLoopBinding
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import javax.inject.Inject
class LoopDialog : DaggerDialogFragment() {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var mainApp: MainApp
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var loopPlugin: LoopPlugin
@Inject lateinit var objectivesPlugin: ObjectivesPlugin
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var constraintChecker: ConstraintChecker
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var configBuilderPlugin: ConfigBuilderPlugin
private var disposable: CompositeDisposable = CompositeDisposable()
private var showOkCancel: Boolean = true
private var _binding: DialogLoopBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onSaveInstanceState(savedInstanceState: Bundle) {
super.onSaveInstanceState(savedInstanceState)
savedInstanceState.putInt("showOkCancel", if (showOkCancel) 1 else 0)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
// load data from bundle
(savedInstanceState ?: arguments)?.let { bundle ->
showOkCancel = bundle.getInt("showOkCancel", 1) == 1
}
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
isCancelable = true
dialog?.setCanceledOnTouchOutside(false)
_binding = DialogLoopBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
updateGUI("LoopDialogOnViewCreated")
binding.overviewCloseloop.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewLgsloop.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewOpenloop.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisable.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewEnable.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewResume.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewReconnect.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewSuspend1h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewSuspend2h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewSuspend3h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewSuspend10h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisconnect15m.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisconnect30m.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisconnect1h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisconnect2h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
binding.overviewDisconnect3h.setOnClickListener { if(showOkCancel) onClick_OkCancelEnabled(it) else onClick(it); dismiss() }
// cancel button
binding.cancel.setOnClickListener { dismiss() }
// bus
disposable.add(rxBus
.toObservable(EventNewOpenLoopNotification::class.java)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
activity?.runOnUiThread { updateGUI("EventNewOpenLoopNotification") }
}, { fabricPrivacy.logException(it) })
)
}
override fun onDestroyView() {
super.onDestroyView()
disposable.clear()
}
fun updateGUI(from: String) {
aapsLogger.debug("UpdateGUI from $from")
val pumpDescription: PumpDescription = activePlugin.activePump.pumpDescription
val closedLoopAllowed = objectivesPlugin.isClosedLoopAllowed(Constraint(true))
val lgsEnabled = objectivesPlugin.isLgsAllowed(Constraint(true))
var APSmode = sp.getString(R.string.key_aps_mode, "open")
if (profileFunction.isProfileValid("LoopDialogUpdateGUI")) {
if (loopPlugin.isEnabled(PluginType.LOOP)) {
if (closedLoopAllowed.value()) {
binding.overviewCloseloop.visibility = if (APSmode == "closed") View.GONE else View.VISIBLE
binding.overviewLgsloop.visibility = if (APSmode == "lgs") View.GONE else View.VISIBLE
binding.overviewOpenloop.visibility = if (APSmode == "open") View.GONE else View.VISIBLE
} else if (lgsEnabled.value() ) {
binding.overviewCloseloop.visibility = View.GONE
binding.overviewLgsloop.visibility = if (APSmode == "lgs") View.GONE else View.VISIBLE
binding.overviewOpenloop.visibility = if (APSmode == "open") View.GONE else View.VISIBLE
} else {
binding.overviewCloseloop.visibility = View.GONE
binding.overviewLgsloop.visibility = View.GONE
binding.overviewOpenloop.visibility = View.GONE
}
binding.overviewEnable.visibility = View.GONE //sp.getBoolean(R.string.key_usesuperbolus, false).toVisibility()
binding.overviewDisable.visibility = View.VISIBLE
if (!loopPlugin.isSuspended) {
binding.overviewSuspendHeader.text=resourceHelper.gs(R.string.suspendloop)
binding.overviewResume.visibility = View.GONE
binding.overviewSuspendButtons.visibility=View.VISIBLE
binding.overviewSuspend.visibility=View.VISIBLE
} else {
if (!loopPlugin.isDisconnected) {
binding.overviewSuspendHeader.text = resourceHelper.gs(R.string.resumeloop)
binding.overviewResume.visibility = View.VISIBLE
binding.overviewSuspendButtons.visibility=View.GONE
binding.overviewSuspend.visibility=View.VISIBLE
} else
binding.overviewSuspend.visibility = View.GONE
}
} else {
binding.overviewEnable.visibility = View.VISIBLE
binding.overviewDisable.visibility = View.GONE
binding.overviewSuspend.visibility = View.GONE
}
if (!loopPlugin.isDisconnected) {
binding.overviewPumpHeader.text = resourceHelper.gs(R.string.disconnectpump)
binding.overviewDisconnect15m.visibility = if (pumpDescription.tempDurationStep15mAllowed) View.VISIBLE else View.GONE
binding.overviewDisconnect30m.visibility = if (pumpDescription.tempDurationStep30mAllowed) View.VISIBLE else View.GONE
binding.overviewDisconnectButtons.visibility = View.VISIBLE
binding.overviewReconnect.visibility = View.GONE
} else {
binding.overviewPumpHeader.text = resourceHelper.gs(R.string.reconnect)
binding.overviewDisconnectButtons.visibility = View.GONE
binding.overviewReconnect.visibility = View.VISIBLE
}
}
val profile = profileFunction.getProfile()
val profileStore = activePlugin.activeProfileInterface.profile
if (profile == null || profileStore == null) {
ToastUtils.showToastInUiThread(mainApp, resourceHelper.gs(R.string.noprofile))
dismiss()
return
}
}
fun onClick_OkCancelEnabled(v: View): Boolean {
var description = ""
when(v.id) {
R.id.overview_closeloop -> description = resourceHelper.gs(R.string.closedloop)
R.id.overview_lgsloop -> description = resourceHelper.gs(R.string.lowglucosesuspend)
R.id.overview_openloop -> description = resourceHelper.gs(R.string.openloop)
R.id.overview_disable -> description = resourceHelper.gs(R.string.disableloop)
R.id.overview_enable -> description = resourceHelper.gs(R.string.enableloop)
R.id.overview_resume -> description = resourceHelper.gs(R.string.resume)
R.id.overview_reconnect -> description = resourceHelper.gs(R.string.reconnect)
R.id.overview_suspend_1h -> description = resourceHelper.gs(R.string.suspendloopfor1h)
R.id.overview_suspend_2h -> description = resourceHelper.gs(R.string.suspendloopfor2h)
R.id.overview_suspend_3h -> description = resourceHelper.gs(R.string.suspendloopfor3h)
R.id.overview_suspend_10h -> description = resourceHelper.gs(R.string.suspendloopfor10h)
R.id.overview_disconnect_15m -> description = resourceHelper.gs(R.string.disconnectpumpfor15m)
R.id.overview_disconnect_30m -> description = resourceHelper.gs(R.string.disconnectpumpfor30m)
R.id.overview_disconnect_1h -> description = resourceHelper.gs(R.string.disconnectpumpfor1h)
R.id.overview_disconnect_2h -> description = resourceHelper.gs(R.string.disconnectpumpfor2h)
R.id.overview_disconnect_3h -> description = resourceHelper.gs(R.string.disconnectpumpfor3h)
}
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.confirm), description, Runnable {
onClick(v)
})
}
return true
}
fun onClick(v: View): Boolean {
val profile = profileFunction.getProfile() ?: return true
when (v.id) {
R.id.overview_closeloop -> {
sp.putString(R.string.key_aps_mode, "closed")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.closedloop)))
}
R.id.overview_lgsloop -> {
sp.putString(R.string.key_aps_mode, "lgs")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
}
R.id.overview_openloop -> {
sp.putString(R.string.key_aps_mode, "open")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
}
R.id.overview_disable -> {
aapsLogger.debug("USER ENTRY: LOOP DISABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
configBuilderPlugin.storeSettings("DisablingLoop")
rxBus.send(EventRefreshOverview("suspendmenu"))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
ToastUtils.showToastInUiThread(context, resourceHelper.gs(R.string.tempbasaldeliveryerror))
}
}
})
loopPlugin.createOfflineEvent(24 * 60) // upload 24h, we don't know real duration
return true
}
R.id.overview_enable -> {
aapsLogger.debug("USER ENTRY: LOOP ENABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
configBuilderPlugin.storeSettings("EnablingLoop")
rxBus.send(EventRefreshOverview("suspendmenu"))
loopPlugin.createOfflineEvent(0)
return true
}
R.id.overview_resume, R.id.overview_reconnect -> {
aapsLogger.debug("USER ENTRY: RESUME")
loopPlugin.suspendTo(0L)
rxBus.send(EventRefreshOverview("suspendmenu"))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", result.comment)
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context?.startActivity(i)
}
}
})
sp.putBoolean(R.string.key_objectiveusereconnect, true)
loopPlugin.createOfflineEvent(0)
return true
}
R.id.overview_suspend_1h -> {
aapsLogger.debug("USER ENTRY: SUSPEND 1h")
loopPlugin.suspendLoop(60)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_2h -> {
aapsLogger.debug("USER ENTRY: SUSPEND 2h")
loopPlugin.suspendLoop(120)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_3h -> {
aapsLogger.debug("USER ENTRY: SUSPEND 3h")
loopPlugin.suspendLoop(180)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_suspend_10h -> {
aapsLogger.debug("USER ENTRY: SUSPEND 10h")
loopPlugin.suspendLoop(600)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_15m -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 15m")
loopPlugin.disconnectPump(15, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_30m -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 30m")
loopPlugin.disconnectPump(30, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_1h -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 1h")
loopPlugin.disconnectPump(60, profile)
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_2h -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 2h")
loopPlugin.disconnectPump(120, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
R.id.overview_disconnect_3h -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 3h")
loopPlugin.disconnectPump(180, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
}
return false
}
override fun show(manager: FragmentManager, tag: String?) {
try {
manager.beginTransaction().let {
it.add(this, tag)
it.commitAllowingStateLoss()
}
} catch (e: IllegalStateException) {
aapsLogger.debug(e.localizedMessage)
}
}
}

View file

@ -163,6 +163,12 @@ class ObjectivesPlugin @Inject constructor(
return value
}
fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
if (!objectives[MAXBASAL_OBJECTIVE].isStarted)
value.set(aapsLogger, false, String.format(resourceHelper.gs(R.string.objectivenotstarted), MAXBASAL_OBJECTIVE + 1), this)
return value
}
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
if (!objectives[MAXIOB_ZERO_CL_OBJECTIVE].isStarted)
value.set(aapsLogger, false, String.format(resourceHelper.gs(R.string.objectivenotstarted), MAXIOB_ZERO_CL_OBJECTIVE + 1), this)

View file

@ -11,10 +11,7 @@ import android.graphics.drawable.AnimationDrawable
import android.os.Bundle
import android.os.Handler
import android.util.DisplayMetrics
import android.view.ContextMenu
import android.view.ContextMenu.ContextMenuInfo
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.View.OnLongClickListener
import android.view.ViewGroup
@ -183,8 +180,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overviewMenus.setupChartMenu(overview_chartMenuButton)
prepareGraphs()
overviewMenus.setupPopupMenu(overview_apsmode, requireContext(), childFragmentManager)
//overviewMenus.setupPopupMenu(overview_activeprofile, requireContext(), childFragmentManager)
overview_activeprofile?.setOnClickListener(this)
overview_activeprofile?.setOnLongClickListener(this)
overview_temptarget?.setOnClickListener(this)
@ -198,6 +193,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overview_carbsbutton?.setOnClickListener(this)
overview_quickwizardbutton?.setOnClickListener(this)
overview_quickwizardbutton?.setOnLongClickListener(this)
overview_apsmode?.setOnClickListener(this)
overview_apsmode?.setOnLongClickListener(this)
overview_activeprofile?.setOnLongClickListener(this)
}
@ -344,6 +340,14 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
}
}
R.id.overview_apsmode -> {
val args = Bundle()
args.putInt("showOkCancel", 1) // 1-> true
val pvd = LoopDialog()
pvd.arguments = args
pvd.show(childFragmentManager, "Overview")
}
}
}
}
@ -368,9 +372,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
startActivity(Intent(v.context, QuickWizardListActivity::class.java))
return true
}
R.id.overview_apsmode -> {
OverviewMenus.showOKCancel = false
v.performClick()
R.id.overview_apsmode -> {
val args = Bundle()
args.putInt("showOkCancel", 0) // 0-> false
val pvd = LoopDialog()
pvd.arguments = args
pvd.show(childFragmentManager, "Overview")
}
R.id.overview_temptarget -> v.performClick()
R.id.overview_activeprofile -> activity?.let { activity -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { ProfileSwitchDialog().show(childFragmentManager, "Overview") })}

View file

@ -1,43 +1,20 @@
package info.nightscout.androidaps.plugins.general.overview
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.ImageButton
import androidx.annotation.ColorRes
import androidx.annotation.StringRes
import androidx.appcompat.widget.PopupMenu
import androidx.fragment.app.FragmentManager
import com.google.gson.Gson
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.db.TempTarget
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.dialogs.TempTargetDialog
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -50,13 +27,7 @@ class OverviewMenus @Inject constructor(
private val resourceHelper: ResourceHelper,
private val sp: SP,
private val rxBus: RxBusWrapper,
private val context: Context,
private val buildHelper: BuildHelper,
private val defaultValueHelper: DefaultValueHelper,
private val activePlugin: ActivePluginProvider,
private val profileFunction: ProfileFunction,
private val commandQueue: CommandQueueProvider,
private val configBuilderPlugin: ConfigBuilderPlugin,
private val loopPlugin: LoopPlugin,
private val config: Config
) {
@ -75,7 +46,6 @@ class OverviewMenus @Inject constructor(
companion object {
const val MAX_GRAPHS = 5 // including main
var showOKCancel = true
}
fun enabledTypes(graph: Int): String {
@ -176,211 +146,4 @@ class OverviewMenus @Inject constructor(
}
}
fun setupPopupMenu(v: View, context: Context, manager: FragmentManager) {
v.setOnClickListener {
val popup = PopupMenu(v.context, v)
when (v.id) {
R.id.overview_apsmode -> {
val pumpDescription: PumpDescription = activePlugin.activePump.pumpDescription
if (profileFunction.isProfileValid("ContextMenuCreation")) {
val item = popup.menu.add(Menu.NONE,1,Menu.NONE,resourceHelper.gs(R.string.loop)) // title
val title = item.title
val s = SpannableString(title)
s.setSpan( ForegroundColorSpan(resourceHelper.gc(R.color.colorAccent)), 0, s.length, 0)
item.setTitle(s)
if (loopPlugin.isEnabled(PluginType.LOOP)) {
popup.menu.add(resourceHelper.gs(R.string.disableloop))
if (!loopPlugin.isSuspended) {
popup.menu.add(resourceHelper.gs(R.string.suspendloopfor1h))
popup.menu.add(resourceHelper.gs(R.string.suspendloopfor2h))
popup.menu.add(resourceHelper.gs(R.string.suspendloopfor3h))
popup.menu.add(resourceHelper.gs(R.string.suspendloopfor10h))
} else {
if (!loopPlugin.isDisconnected) {
popup.menu.add(resourceHelper.gs(R.string.resume))
}
}
}
if (!loopPlugin.isEnabled(PluginType.LOOP)) {
popup.menu.add(resourceHelper.gs(R.string.enableloop))
}
if (!loopPlugin.isDisconnected) {
if (pumpDescription.tempDurationStep15mAllowed) popup.menu.add(resourceHelper.gs(R.string.disconnectpumpfor15m))
if (pumpDescription.tempDurationStep30mAllowed) popup.menu.add(resourceHelper.gs(R.string.disconnectpumpfor30m))
popup.menu.add(resourceHelper.gs(R.string.disconnectpumpfor1h))
popup.menu.add(resourceHelper.gs(R.string.disconnectpumpfor2h))
popup.menu.add(resourceHelper.gs(R.string.disconnectpumpfor3h))
} else {
popup.menu.add(resourceHelper.gs(R.string.reconnect))
}
}
}
R.id.overview_activeprofile -> {
val item = popup.menu.add(Menu.NONE,1,Menu.NONE,resourceHelper.gs(R.string.profile)) // title
val title = item.title
val s = SpannableString(title)
s.setSpan(ForegroundColorSpan(resourceHelper.gc(R.color.colorAccent)), 0, s.length, 0)
item.setTitle(s)
popup.menu.add(resourceHelper.gs(R.string.viewprofile))
if (activePlugin.activeProfileInterface.profile != null) {
popup.menu.add(resourceHelper.gs(R.string.careportal_profileswitch))
}
}
}
popup.setOnMenuItemClickListener {
if (it.itemId != 1) {
if (showOKCancel) {
when (it.title) {
resourceHelper.gs(R.string.careportal_profileswitch),
resourceHelper.gs(R.string.viewprofile) -> onItemSelected(it, manager)
else -> {
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.confirm), it.title.toString(),
Runnable {
onItemSelected(it, manager)
})
}
}
} else {
onItemSelected(it, manager)
}
}
return@setOnMenuItemClickListener true
}
popup.setOnDismissListener { showOKCancel = true }
popup.show()
}
}
fun onItemSelected(item: MenuItem, manager: FragmentManager): Boolean {
val profile = profileFunction.getProfile() ?: return true
when (item.title) {
resourceHelper.gs(R.string.disableloop) -> {
aapsLogger.debug("USER ENTRY: LOOP DISABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
loopPlugin.setFragmentVisible(PluginType.LOOP, false)
configBuilderPlugin.storeSettings("DisablingLoop")
rxBus.send(EventRefreshOverview("suspendmenu"))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
ToastUtils.showToastInUiThread(context, resourceHelper.gs(R.string.tempbasaldeliveryerror))
}
}
})
loopPlugin.createOfflineEvent(24 * 60) // upload 24h, we don't know real duration
return true
}
resourceHelper.gs(R.string.enableloop) -> {
aapsLogger.debug("USER ENTRY: LOOP ENABLED")
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
configBuilderPlugin.storeSettings("EnablingLoop")
rxBus.send(EventRefreshOverview("suspendmenu"))
loopPlugin.createOfflineEvent(0)
return true
}
resourceHelper.gs(R.string.resume), resourceHelper.gs(R.string.reconnect) -> {
aapsLogger.debug("USER ENTRY: RESUME")
loopPlugin.suspendTo(0L)
rxBus.send(EventRefreshOverview("suspendmenu"))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
val i = Intent(context, ErrorHelperActivity::class.java)
i.putExtra("soundid", R.raw.boluserror)
i.putExtra("status", result.comment)
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(i)
}
}
})
sp.putBoolean(R.string.key_objectiveusereconnect, true)
loopPlugin.createOfflineEvent(0)
return true
}
resourceHelper.gs(R.string.suspendloopfor1h) -> {
aapsLogger.debug("USER ENTRY: SUSPEND 1h")
loopPlugin.suspendLoop(60)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.suspendloopfor2h) -> {
aapsLogger.debug("USER ENTRY: SUSPEND 2h")
loopPlugin.suspendLoop(120)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.suspendloopfor3h) -> {
aapsLogger.debug("USER ENTRY: SUSPEND 3h")
loopPlugin.suspendLoop(180)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.suspendloopfor10h) -> {
aapsLogger.debug("USER ENTRY: SUSPEND 10h")
loopPlugin.suspendLoop(600)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.disconnectpumpfor15m) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 15m")
loopPlugin.disconnectPump(15, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.disconnectpumpfor30m) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 30m")
loopPlugin.disconnectPump(30, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.disconnectpumpfor1h) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 1h")
loopPlugin.disconnectPump(60, profile)
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.disconnectpumpfor2h) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 2h")
loopPlugin.disconnectPump(120, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.disconnectpumpfor3h) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 3h")
loopPlugin.disconnectPump(180, profile)
rxBus.send(EventRefreshOverview("suspendmenu"))
return true
}
resourceHelper.gs(R.string.careportal_profileswitch) -> {
ProfileSwitchDialog().show(manager, "Overview")
}
resourceHelper.gs(R.string.viewprofile) -> {
val args = Bundle()
args.putLong("time", DateUtil.now())
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
val pvd = ProfileViewerDialog()
pvd.arguments = args
pvd.show(manager, "ProfileViewDialog")
}
}
return false
}
}

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M24,9.343l-5.781,-3.968l-1.328,6.688l2.102,-1.757c0.014,0.056 0.03,0.111 0.043,0.168c0.116,0.512 0.183,1.042 0.183,1.589c0,3.952 -3.204,7.156 -7.156,7.156c-3.952,0 -7.156,-3.204 -7.156,-7.156c0,-3.952 3.204,-7.156 7.156,-7.156c1.072,0 2.085,0.242 2.998,0.665c0.325,0.151 0.639,0.321 0.936,0.517l0.002,-0.002l-0.352,-1.784l1.876,-0.538c-1.567,-1.033 -3.442,-1.639 -5.46,-1.639c-5.488,0 -9.937,4.449 -9.937,9.938c0,5.488 4.449,9.937 9.937,9.937C17.551,22 22,17.551 22,12.063c0,-0.759 -0.093,-1.496 -0.254,-2.206c-0.04,-0.176 -0.085,-0.35 -0.134,-0.523L24,9.343L24,9.343z"
android:fillColor="#939393"/>
<path
android:pathData="M14.868,22.154c0.794,0 1.49,-0.418 1.973,-1.054l-0.001,-3.926c-0.482,-0.634 -1.177,-1.052 -1.969,-1.052l-5.612,-0.001c-0.793,0 -1.487,0.416 -1.97,1.05l-0.004,3.926c0.482,0.636 1.178,1.055 1.972,1.055"
android:fillColor="#939393"/>
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M24,9.343l-5.781,-3.968l-1.328,6.688l2.102,-1.757c0.014,0.056 0.03,0.111 0.043,0.168c0.116,0.512 0.183,1.042 0.183,1.589c0,3.952 -3.204,7.156 -7.156,7.156c-3.952,0 -7.156,-3.204 -7.156,-7.156c0,-3.952 3.204,-7.156 7.156,-7.156c1.072,0 2.085,0.242 2.998,0.665c0.325,0.151 0.639,0.321 0.936,0.517l0.002,-0.002l-0.352,-1.784l1.876,-0.538c-1.567,-1.033 -3.442,-1.639 -5.46,-1.639c-5.488,0 -9.937,4.449 -9.937,9.938c0,5.488 4.449,9.937 9.937,9.937C17.551,22 22,17.551 22,12.063c0,-0.759 -0.093,-1.496 -0.254,-2.206c-0.04,-0.176 -0.085,-0.35 -0.134,-0.523L24,9.343L24,9.343z"
android:fillColor="#00C03E"/>
<path
android:pathData="M9.401,8.391l6.599,3.609l-6.599,3.609z"
android:fillColor="#00C03E"/>
</vector>

View file

@ -0,0 +1,408 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:minWidth="300dp"
android:orientation="vertical"
tools:context=".dialogs.LoopDialog">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/dialog_title_background"
android:orientation="horizontal"
android:padding="5dp">
<ImageView
android:id="@+id/loop_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/boluswizard"
app:srcCompat="@drawable/ic_loop_closed" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/loop"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="@+id/spacer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/overview_loop_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/loop"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:id="@+id/overview_loop_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_closeloop"
style="?android:attr/buttonStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableTop="@drawable/ic_loop_closed"
android:text="@string/closedloop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_lgsloop"
style="?android:attr/buttonStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableTop="@drawable/ic_loop_lgs"
android:text="@string/lowglucosesuspend"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_openloop"
style="?android:attr/buttonStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableTop="@drawable/ic_loop_open"
android:text="@string/openloop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_enable"
style="?android:attr/buttonStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableTop="@drawable/ic_loop_resume"
android:text="@string/enableloop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disable"
style="?android:attr/buttonStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableTop="@drawable/ic_loop_disabled"
android:text="@string/disableloop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/listdelimiter" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_suspend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/overview_suspend_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/suspendloop"
android:textAppearance="?android:attr/textAppearanceLarge" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_resume"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_loop_resume"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/resumeloop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/overview_suspend_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_1h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_paused"
android:text="@string/duration1h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_2h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_paused"
android:text="@string/duration2h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_3h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_paused"
android:text="@string/duration3h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_10h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_paused"
android:text="@string/duration10h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/listdelimiter" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/overview_pump_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/disconnectpump"
android:textAppearance="?android:attr/textAppearanceLarge" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_reconnect"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_loop_reconnect"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/reconnect"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/overview_disconnect_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_15m"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_disconnected"
android:text="@string/duration15m"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_30m"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_disconnected"
android:text="@string/duration30m"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_1h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_disconnected"
android:text="@string/duration1h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_2h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_disconnected"
android:text="@string/duration2h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_3h"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
android:layout_weight="0.5"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:drawableTop="@drawable/ic_loop_disconnected"
android:text="@string/duration3h"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/listdelimiter" />
<Button
android:id="@+id/cancel"
style="@style/mdtp_ActionButton.Text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/mdtp_cancel"
android:padding="10dp"
android:textAlignment="textEnd" />
</LinearLayout>
</ScrollView>

View file

@ -472,11 +472,18 @@
<string name="suspendloopfor3h">Suspend loop for 3h</string>
<string name="suspendloopfor10h">Suspend loop for 10 h</string>
<string name="suspendloopforXmin">Suspend loop for %1$d min</string>
<string name="disconnectpump">Disconnect pump</string>
<string name="disconnectpumpfor15m">Disconnect pump for 15 min</string>
<string name="disconnectpumpfor30m">Disconnect pump for 30 min</string>
<string name="disconnectpumpfor1h">Disconnect pump for 1 h</string>
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
<string name="duration15m">15 mins</string>
<string name="duration30m">30 mins</string>
<string name="duration1h">1 hour</string>
<string name="duration2h">2 hours</string>
<string name="duration3h">3 hours</string>
<string name="duration10h">10 hours</string>
<string name="resume">Resume</string>
<string name="reconnect">Reconnect Pump</string>
<string name="smscommunicator_wrongduration">Wrong duration</string>

13
icons/loop_reconnect.svg Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px"
height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<g id="loop_reconnect">
<path fill="#939393" d="M24,9.343l-5.781-3.968l-1.328,6.688l2.102-1.757c0.014,0.056,0.03,0.111,0.043,0.168
c0.116,0.512,0.183,1.042,0.183,1.589c0,3.952-3.204,7.156-7.156,7.156c-3.952,0-7.156-3.204-7.156-7.156
c0-3.952,3.204-7.156,7.156-7.156c1.072,0,2.085,0.242,2.998,0.665c0.325,0.151,0.639,0.321,0.936,0.517l0.002-0.002l-0.352-1.784
l1.876-0.538c-1.567-1.033-3.442-1.639-5.46-1.639c-5.488,0-9.937,4.449-9.937,9.938c0,5.488,4.449,9.937,9.937,9.937
C17.551,22,22,17.551,22,12.063c0-0.759-0.093-1.496-0.254-2.206c-0.04-0.176-0.085-0.35-0.134-0.523L24,9.343L24,9.343z"/>
<path fill="#939393" d="M14.868,22.154c0.794,0,1.49-0.418,1.973-1.054l-0.001-3.926c-0.482-0.634-1.177-1.052-1.969-1.052
l-5.612-0.001c-0.793,0-1.487,0.416-1.97,1.05l-0.004,3.926c0.482,0.636,1.178,1.055,1.972,1.055"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

12
icons/loop_resume.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px"
height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<g id="loop_resume">
<path fill="#00C03E" d="M24,9.343l-5.781-3.968l-1.328,6.688l2.102-1.757c0.014,0.056,0.03,0.111,0.043,0.168
c0.116,0.512,0.183,1.042,0.183,1.589c0,3.952-3.204,7.156-7.156,7.156c-3.952,0-7.156-3.204-7.156-7.156
c0-3.952,3.204-7.156,7.156-7.156c1.072,0,2.085,0.242,2.998,0.665c0.325,0.151,0.639,0.321,0.936,0.517l0.002-0.002l-0.352-1.784
l1.876-0.538c-1.567-1.033-3.442-1.639-5.46-1.639c-5.488,0-9.937,4.449-9.937,9.938c0,5.488,4.449,9.937,9.937,9.937
C17.551,22,22,17.551,22,12.063c0-0.759-0.093-1.496-0.254-2.206c-0.04-0.176-0.085-0.35-0.134-0.523L24,9.343L24,9.343z"/>
<polygon fill="#00C03E" points="9.401,8.391 16,12 9.401,15.609 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 937 B