LocalProfileFragment -> jetpack

This commit is contained in:
Milos Kozak 2021-02-02 21:53:57 +01:00
parent 29e33a68c2
commit 61871a924b
2 changed files with 88 additions and 81 deletions

View file

@ -12,11 +12,11 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@ -24,11 +24,11 @@ import info.nightscout.androidaps.utils.extensions.plusAssign
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.localprofile_fragment.*
import java.text.DecimalFormat import java.text.DecimalFormat
import javax.inject.Inject import javax.inject.Inject
class LocalProfileFragment : DaggerFragment() { class LocalProfileFragment : DaggerFragment() {
@Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var resourceHelper: ResourceHelper
@ -52,8 +52,8 @@ class LocalProfileFragment : DaggerFragment() {
override fun afterTextChanged(s: Editable) {} override fun afterTextChanged(s: Editable) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
localProfilePlugin.currentProfile()?.dia = SafeParse.stringToDouble(localprofile_dia.text.toString()) localProfilePlugin.currentProfile()?.dia = SafeParse.stringToDouble(binding.dia.text.toString())
localProfilePlugin.currentProfile()?.name = localprofile_name.text.toString() localProfilePlugin.currentProfile()?.name = binding.name.text.toString()
doEdit() doEdit()
} }
} }
@ -64,36 +64,42 @@ class LocalProfileFragment : DaggerFragment() {
return "" + DecimalFormatter.to2Decimal(sum) + resourceHelper.gs(R.string.insulin_unit_shortname) return "" + DecimalFormatter.to2Decimal(sum) + resourceHelper.gs(R.string.insulin_unit_shortname)
} }
private var _binding: LocalprofileFragmentBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? { savedInstanceState: Bundle?): View {
return inflater.inflate(R.layout.localprofile_fragment, container, false) _binding = LocalprofileFragmentBinding.inflate(inflater, container, false)
return binding.root
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
// activate DIA tab // activate DIA tab
processVisibilityOnClick(dia_tab) binding.diaPlaceholder.visibility = View.VISIBLE
localprofile_dia_placeholder.visibility = View.VISIBLE
// setup listeners // setup listeners
dia_tab.setOnClickListener { binding.diaTab.setOnClickListener {
processVisibilityOnClick(it) processVisibilityOnClick(it)
localprofile_dia_placeholder.visibility = View.VISIBLE binding.diaPlaceholder.visibility = View.VISIBLE
} }
ic_tab.setOnClickListener { binding.icTab.setOnClickListener {
processVisibilityOnClick(it) processVisibilityOnClick(it)
localprofile_ic.visibility = View.VISIBLE binding.ic.visibility = View.VISIBLE
} }
isf_tab.setOnClickListener { binding.isfTab.setOnClickListener {
processVisibilityOnClick(it) processVisibilityOnClick(it)
localprofile_isf.visibility = View.VISIBLE binding.isf.visibility = View.VISIBLE
} }
basal_tab.setOnClickListener { binding.basalTab.setOnClickListener {
processVisibilityOnClick(it) processVisibilityOnClick(it)
localprofile_basal.visibility = View.VISIBLE binding.basal.visibility = View.VISIBLE
} }
target_tab.setOnClickListener { binding.targetTab.setOnClickListener {
processVisibilityOnClick(it) processVisibilityOnClick(it)
localprofile_target.visibility = View.VISIBLE binding.target.visibility = View.VISIBLE
} }
} }
@ -103,23 +109,23 @@ class LocalProfileFragment : DaggerFragment() {
val currentProfile = localProfilePlugin.currentProfile() ?: return val currentProfile = localProfilePlugin.currentProfile() ?: return
val units = if (currentProfile.mgdl) Constants.MGDL else Constants.MMOL val units = if (currentProfile.mgdl) Constants.MGDL else Constants.MMOL
localprofile_name.removeTextChangedListener(textWatch) binding.name.removeTextChangedListener(textWatch)
localprofile_name.setText(currentProfile.name) binding.name.setText(currentProfile.name)
localprofile_name.addTextChangedListener(textWatch) binding.name.addTextChangedListener(textWatch)
localprofile_dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch) binding.dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, binding.save, textWatch)
localprofile_dia.tag = "LP_DIA" binding.dia.tag = "LP_DIA"
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) { if (units == Constants.MGDL) {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
} else { } else {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.target, "TARGET", resourceHelper.gs(R.string.target_label), currentProfile.targetLow, currentProfile.targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
} }
// Spinner // Spinner
spinner = SpinnerHelper(view?.findViewById(R.id.localprofile_spinner)) spinner = SpinnerHelper(binding.spinner)
val profileList: ArrayList<CharSequence> = localProfilePlugin.profile?.getProfileList() val profileList: ArrayList<CharSequence> = localProfilePlugin.profile?.getProfileList()
?: ArrayList() ?: ArrayList()
context?.let { context -> context?.let { context ->
@ -134,10 +140,10 @@ class LocalProfileFragment : DaggerFragment() {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (localProfilePlugin.isEdited) { if (localProfilePlugin.isEdited) {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.doyouwantswitchprofile), Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.doyouwantswitchprofile), {
localProfilePlugin.currentProfileIndex = position localProfilePlugin.currentProfileIndex = position
build() build()
}, Runnable { }, {
spinner?.setSelection(localProfilePlugin.currentProfileIndex) spinner?.setSelection(localProfilePlugin.currentProfileIndex)
}) })
} }
@ -148,7 +154,7 @@ class LocalProfileFragment : DaggerFragment() {
} }
}) })
localprofile_profile_add.setOnClickListener { binding.profileAdd.setOnClickListener {
if (localProfilePlugin.isEdited) { if (localProfilePlugin.isEdited) {
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) } activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
} else { } else {
@ -157,7 +163,7 @@ class LocalProfileFragment : DaggerFragment() {
} }
} }
localprofile_profile_clone.setOnClickListener { binding.profileClone.setOnClickListener {
if (localProfilePlugin.isEdited) { if (localProfilePlugin.isEdited) {
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) } activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
} else { } else {
@ -166,9 +172,9 @@ class LocalProfileFragment : DaggerFragment() {
} }
} }
localprofile_profile_remove.setOnClickListener { binding.profileRemove.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
localProfilePlugin.removeCurrentProfile() localProfilePlugin.removeCurrentProfile()
build() build()
}, null) }, null)
@ -176,23 +182,23 @@ class LocalProfileFragment : DaggerFragment() {
} }
// this is probably not possible because it leads to invalid profile // this is probably not possible because it leads to invalid profile
// if (!pumpDescription.isTempBasalCapable) localprofile_basal.visibility = View.GONE // if (!pumpDescription.isTempBasalCapable) binding.basal.visibility = View.GONE
@Suppress("SetTextI18n") @Suppress("SetTextI18n")
localprofile_units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (currentProfile.mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol)) binding.units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (currentProfile.mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol))
localprofile_profileswitch.setOnClickListener { binding.profileswitch.setOnClickListener {
ProfileSwitchDialog() ProfileSwitchDialog()
.also { it.arguments = Bundle().also { bundle -> bundle.putInt("profileIndex", localProfilePlugin.currentProfileIndex) } } .also { it.arguments = Bundle().also { bundle -> bundle.putInt("profileIndex", localProfilePlugin.currentProfileIndex) } }
.show(childFragmentManager, "NewNSTreatmentDialog") .show(childFragmentManager, "NewNSTreatmentDialog")
} }
localprofile_reset.setOnClickListener { binding.reset.setOnClickListener {
localProfilePlugin.loadSettings() localProfilePlugin.loadSettings()
build() build()
} }
localprofile_save.setOnClickListener { binding.save.setOnClickListener {
if (!localProfilePlugin.isValidEditState()) { if (!localProfilePlugin.isValidEditState()) {
return@setOnClickListener //Should not happen as saveButton should not be visible if not valid return@setOnClickListener //Should not happen as saveButton should not be visible if not valid
} }
@ -219,13 +225,19 @@ class LocalProfileFragment : DaggerFragment() {
disposable.clear() disposable.clear()
} }
@Synchronized
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
fun doEdit() { fun doEdit() {
localProfilePlugin.isEdited = true localProfilePlugin.isEdited = true
updateGUI() updateGUI()
} }
fun updateGUI() { fun updateGUI() {
if (localprofile_profileswitch == null) return if (_binding == null) return
val isValid = localProfilePlugin.isValidEditState() val isValid = localProfilePlugin.isValidEditState()
val isEdited = localProfilePlugin.isEdited val isEdited = localProfilePlugin.isEdited
if (isValid) { if (isValid) {
@ -233,37 +245,37 @@ class LocalProfileFragment : DaggerFragment() {
if (isEdited) { if (isEdited) {
//edited profile -> save first //edited profile -> save first
localprofile_profileswitch.visibility = View.GONE binding.profileswitch.visibility = View.GONE
localprofile_save.visibility = View.VISIBLE binding.save.visibility = View.VISIBLE
} else { } else {
localprofile_profileswitch.visibility = View.VISIBLE binding.profileswitch.visibility = View.VISIBLE
localprofile_save.visibility = View.GONE binding.save.visibility = View.GONE
} }
} else { } else {
this.view?.setBackgroundColor(resourceHelper.gc(R.color.error_background)) this.view?.setBackgroundColor(resourceHelper.gc(R.color.error_background))
localprofile_profileswitch.visibility = View.GONE binding.profileswitch.visibility = View.GONE
localprofile_save.visibility = View.GONE //don't save an invalid profile binding.save.visibility = View.GONE //don't save an invalid profile
} }
//Show reset button if data was edited //Show reset button if data was edited
if (isEdited) { if (isEdited) {
localprofile_reset.visibility = View.VISIBLE binding.reset.visibility = View.VISIBLE
} else { } else {
localprofile_reset.visibility = View.GONE binding.reset.visibility = View.GONE
} }
} }
private fun processVisibilityOnClick(selected: View) { private fun processVisibilityOnClick(selected: View) {
dia_tab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.diaTab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
ic_tab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.icTab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
isf_tab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.isfTab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
basal_tab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.basalTab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
target_tab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.targetTab.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground))
selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected)) selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected))
localprofile_dia_placeholder.visibility = View.GONE binding.diaPlaceholder.visibility = View.GONE
localprofile_ic.visibility = View.GONE binding.ic.visibility = View.GONE
localprofile_isf.visibility = View.GONE binding.isf.visibility = View.GONE
localprofile_basal.visibility = View.GONE binding.basal.visibility = View.GONE
localprofile_target.visibility = View.GONE binding.target.visibility = View.GONE
} }
} }

View file

@ -26,7 +26,7 @@
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner <Spinner
android:id="@+id/localprofile_spinner" android:id="@+id/spinner"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -43,7 +43,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/localprofile_units" android:id="@+id/units"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -58,7 +58,7 @@
android:layout_weight="1" /> android:layout_weight="1" />
<ImageView <ImageView
android:id="@+id/localprofile_profile_add" android:id="@+id/profile_add"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -67,7 +67,7 @@
app:srcCompat="@drawable/ic_add" /> app:srcCompat="@drawable/ic_add" />
<ImageView <ImageView
android:id="@+id/localprofile_profile_clone" android:id="@+id/profile_clone"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -76,7 +76,7 @@
app:srcCompat="@drawable/ic_clone" /> app:srcCompat="@drawable/ic_clone" />
<ImageView <ImageView
android:id="@+id/localprofile_profile_remove" android:id="@+id/profile_remove"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -99,7 +99,6 @@
android:id="@+id/dia_tab" android:id="@+id/dia_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/dia_short" android:text="@string/dia_short"
android:textAlignment="center" android:textAlignment="center"
@ -110,7 +109,6 @@
android:id="@+id/ic_tab" android:id="@+id/ic_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/ic_short" android:text="@string/ic_short"
android:textAlignment="center" android:textAlignment="center"
@ -121,7 +119,6 @@
android:id="@+id/isf_tab" android:id="@+id/isf_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/isf_short" android:text="@string/isf_short"
android:textAlignment="center" android:textAlignment="center"
@ -132,7 +129,6 @@
android:id="@+id/basal_tab" android:id="@+id/basal_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/basal_short" android:text="@string/basal_short"
android:textAlignment="center" android:textAlignment="center"
@ -143,7 +139,6 @@
android:id="@+id/target_tab" android:id="@+id/target_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/target_short" android:text="@string/target_short"
android:textAlignment="center" android:textAlignment="center"
@ -152,7 +147,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/localprofile_dia_placeholder" android:id="@+id/dia_placeholder"
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">
@ -168,12 +163,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:labelFor="@+id/localprofile_name" android:labelFor="@+id/name"
android:text="@string/profile_name" android:text="@string/profile_name"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText <EditText
android:id="@+id/localprofile_name" android:id="@+id/name"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
@ -200,7 +195,7 @@
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<info.nightscout.androidaps.utils.ui.NumberPicker <info.nightscout.androidaps.utils.ui.NumberPicker
android:id="@+id/localprofile_dia" android:id="@+id/dia"
android:layout_width="130dp" android:layout_width="130dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
@ -218,28 +213,28 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/localprofile_ic" android:id="@+id/ic"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="vertical" /> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/localprofile_isf" android:id="@+id/isf"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="vertical" /> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/localprofile_basal" android:id="@+id/basal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:orientation="vertical" /> android:orientation="vertical" />
<LinearLayout <LinearLayout
android:id="@+id/localprofile_target" android:id="@+id/target"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
@ -248,7 +243,7 @@
</LinearLayout> </LinearLayout>
<Button <Button
android:id="@+id/localprofile_profileswitch" android:id="@+id/profileswitch"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
@ -270,7 +265,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
android:id="@+id/localprofile_reset" android:id="@+id/reset"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -286,7 +281,7 @@
android:text="@string/reset" /> android:text="@string/reset" />
<Button <Button
android:id="@+id/localprofile_save" android:id="@+id/save"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"