Merge pull request #1908 from Andries-Smit/feat/local-profile-select-active
Feat: local profile select active
This commit is contained in:
commit
336b079875
1 changed files with 11 additions and 4 deletions
|
@ -23,6 +23,7 @@ import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
||||||
|
@ -52,6 +53,7 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
||||||
|
@Inject lateinit var profileFunction: ProfileFunction
|
||||||
@Inject lateinit var hardLimits: HardLimits
|
@Inject lateinit var hardLimits: HardLimits
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@ -117,6 +119,11 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
})
|
})
|
||||||
binding.diaLabel.labelFor = binding.dia.editTextId
|
binding.diaLabel.labelFor = binding.dia.editTextId
|
||||||
binding.unlock.setOnClickListener { queryProtection() }
|
binding.unlock.setOnClickListener { queryProtection() }
|
||||||
|
|
||||||
|
val profiles = localProfilePlugin.profile?.getProfileList() ?: ArrayList()
|
||||||
|
val activeProfile = profileFunction.getProfileName()
|
||||||
|
val profileIndex = profiles.indexOf(activeProfile)
|
||||||
|
localProfilePlugin.currentProfileIndex = if (profileIndex >= 0) profileIndex else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun build() {
|
fun build() {
|
||||||
|
|
Loading…
Reference in a new issue