diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt index 50a11f4f3e..af9b1aa8cb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsFragment.kt @@ -47,19 +47,19 @@ class TreatmentsFragment : DaggerFragment() { setFragment(TreatmentsBolusFragment()) setBackgroundColorOnSelected(it) } - binding.extendedboluses.setOnClickListener { + binding.extendedBoluses.setOnClickListener { setFragment(TreatmentsExtendedBolusesFragment()) setBackgroundColorOnSelected(it) } - binding.tempbasals.setOnClickListener { + binding.tempBasals.setOnClickListener { setFragment(TreatmentsTemporaryBasalsFragment()) setBackgroundColorOnSelected(it) } - binding.temptargets.setOnClickListener { + binding.tempTargets.setOnClickListener { setFragment(TreatmentsTempTargetFragment()) setBackgroundColorOnSelected(it) } - binding.profileswitches.setOnClickListener { + binding.profileSwitches.setOnClickListener { setFragment(TreatmentsProfileSwitchFragment()) setBackgroundColorOnSelected(it) } @@ -103,16 +103,16 @@ class TreatmentsFragment : DaggerFragment() { private fun setBackgroundColorOnSelected(selected: View) { binding.treatments.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) - binding.extendedboluses.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) - binding.tempbasals.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) - binding.temptargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) - binding.profileswitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) + binding.extendedBoluses.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) + binding.tempBasals.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) + binding.tempTargets.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) + binding.profileSwitches.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) binding.careportal.setBackgroundColor(resourceHelper.gc(R.color.defaultbackground)) selected.setBackgroundColor(resourceHelper.gc(R.color.tabBgColorSelected)) } private fun updateGui() { if (_binding == null) return - binding.extendedboluses.visibility = (activePlugin.activePump.pumpDescription.isExtendedBolusCapable || treatmentsPlugin.extendedBolusesFromHistory.size() > 0).toVisibility() + binding.extendedBoluses.visibility = (activePlugin.activePump.pumpDescription.isExtendedBolusCapable || treatmentsPlugin.extendedBolusesFromHistory.size() > 0).toVisibility() } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt index 5aa694b269..447a2206c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsBolusFragment.kt @@ -62,7 +62,7 @@ class TreatmentsBolusFragment : DaggerFragment() { binding.recyclerview.setHasFixedSize(true) binding.recyclerview.layoutManager = LinearLayoutManager(view.context) binding.recyclerview.adapter = RecyclerViewAdapter(treatmentsPlugin.treatmentsFromHistory) - binding.reshreshFromNightscout.setOnClickListener { + binding.refreshFromNightscout.setOnClickListener { activity?.let { activity -> OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") { treatmentsPlugin.service.resetTreatments() @@ -86,7 +86,7 @@ class TreatmentsBolusFragment : DaggerFragment() { } } val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) || !buildHelper.isEngineeringMode() - if (nsUploadOnly) binding.reshreshFromNightscout.visibility = View.GONE + if (nsUploadOnly) binding.refreshFromNightscout.visibility = View.GONE } @Synchronized diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt index 819b548bed..f3b0a28ae0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsCareportalFragment.kt @@ -88,7 +88,8 @@ class TreatmentsCareportalFragment : DaggerFragment() { if (nsUploadOnly) binding.refreshFromNightscout.visibility = View.GONE } - @Synchronized override fun onResume() { + @Synchronized + override fun onResume() { super.onResume() disposable.add(rxBus .toObservable(EventCareportalEventChange::class.java) @@ -98,7 +99,8 @@ class TreatmentsCareportalFragment : DaggerFragment() { updateGui() } - @Synchronized override fun onPause() { + @Synchronized + override fun onPause() { super.onPause() disposable.clear() } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt index 15fa1a4692..e4a43027d8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt @@ -105,9 +105,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() { inner class RecyclerProfileViewAdapter(private var profileSwitchList: List) : RecyclerView.Adapter() { - override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder { - return ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false)) - } + override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ProfileSwitchViewHolder = + ProfileSwitchViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_profileswitch_item, viewGroup, false)) override fun onBindViewHolder(holder: ProfileSwitchViewHolder, position: Int) { val profileSwitch = profileSwitchList[position] @@ -132,7 +131,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() { return profileSwitchList.size } - inner class ProfileSwitchViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView){ + inner class ProfileSwitchViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) { val binding = TreatmentsProfileswitchItemBinding.bind(itemView) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java deleted file mode 100644 index 3fb386b6e5..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.java +++ /dev/null @@ -1,212 +0,0 @@ -package info.nightscout.androidaps.plugins.treatments.fragments; - -import android.graphics.Paint; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.cardview.widget.CardView; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import javax.inject.Inject; - -import dagger.android.support.DaggerFragment; -import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.data.Intervals; -import info.nightscout.androidaps.db.Source; -import info.nightscout.androidaps.db.TempTarget; -import info.nightscout.androidaps.events.EventTempTargetChange; -import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.interfaces.ProfileFunction; -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; -import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue; -import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; -import info.nightscout.androidaps.utils.DateUtil; -import info.nightscout.androidaps.utils.DecimalFormatter; -import info.nightscout.androidaps.utils.FabricPrivacy; -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; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.CompositeDisposable; - -/** - * Created by mike on 13/01/17. - */ - -public class TreatmentsTempTargetFragment extends DaggerFragment { - @Inject TreatmentsPlugin treatmentsPlugin; - @Inject SP sp; - @Inject RxBusWrapper rxBus; - @Inject ProfileFunction profileFunction; - @Inject ResourceHelper resourceHelper; - @Inject NSUpload nsUpload; - @Inject UploadQueue uploadQueue; - @Inject FabricPrivacy fabricPrivacy; - @Inject DateUtil dateUtil; - @Inject BuildHelper buildHelper; - - private final CompositeDisposable disposable = new CompositeDisposable(); - - private RecyclerView recyclerView; - - public class RecyclerViewAdapter extends RecyclerView.Adapter { - - Intervals tempTargetList; - TempTarget currentlyActiveTarget; - - RecyclerViewAdapter(Intervals TempTargetList) { - this.tempTargetList = TempTargetList; - currentlyActiveTarget = tempTargetList.getValueByInterval(System.currentTimeMillis()); - } - - @NonNull - @Override - public TempTargetsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { - View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.treatments_temptarget_item, viewGroup, false); - return new TempTargetsViewHolder(v); - } - - @Override - public void onBindViewHolder(TempTargetsViewHolder holder, int position) { - String units = profileFunction.getUnits(); - TempTarget tempTarget = tempTargetList.getReversed(position); - holder.ph.setVisibility(tempTarget.source == Source.PUMP ? View.VISIBLE : View.GONE); - holder.ns.setVisibility(NSUpload.isIdValid(tempTarget._id) ? View.VISIBLE : View.GONE); - if (!tempTarget.isEndingEvent()) { - holder.date.setText(dateUtil.dateAndTimeString(tempTarget.date) + " - " + dateUtil.timeString(tempTarget.originalEnd())); - holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.durationInMinutes) + " min"); - holder.low.setText(tempTarget.lowValueToUnitsToString(units)); - holder.high.setText(tempTarget.highValueToUnitsToString(units)); - holder.reason.setText(tempTarget.reason); - } else { - holder.date.setText(dateUtil.dateAndTimeString(tempTarget.date)); - holder.duration.setText(R.string.cancel); - holder.low.setText(""); - holder.high.setText(""); - holder.reason.setText(""); - holder.reasonLabel.setText(""); - holder.reasonColon.setText(""); - } - if (tempTarget.isInProgress() && tempTarget == currentlyActiveTarget) { - holder.date.setTextColor(resourceHelper.gc(R.color.colorActive)); - } else if (tempTarget.date > DateUtil.now()) { - holder.date.setTextColor(resourceHelper.gc(R.color.colorScheduled)); - } else { - holder.date.setTextColor(holder.reasonColon.getCurrentTextColor()); - } - holder.remove.setTag(tempTarget); - } - - @Override - public int getItemCount() { - return tempTargetList.size(); - } - - @Override - public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) { - super.onAttachedToRecyclerView(recyclerView); - } - - class TempTargetsViewHolder extends RecyclerView.ViewHolder { - CardView cv; - TextView date; - TextView duration; - TextView low; - TextView high; - TextView reason; - TextView reasonLabel; - TextView reasonColon; - TextView remove; - TextView ph; - TextView ns; - - TempTargetsViewHolder(View itemView) { - super(itemView); - cv = itemView.findViewById(R.id.temptargetrange_cardview); - date = itemView.findViewById(R.id.temptargetrange_date); - duration = itemView.findViewById(R.id.temptargetrange_duration); - low = itemView.findViewById(R.id.temptargetrange_low); - high = itemView.findViewById(R.id.temptargetrange_high); - reason = itemView.findViewById(R.id.temptargetrange_reason); - reasonLabel = itemView.findViewById(R.id.temptargetrange_reason_label); - reasonColon = itemView.findViewById(R.id.temptargetrange_reason_colon); - ph = itemView.findViewById(R.id.pump_sign); - ns = itemView.findViewById(R.id.ns_sign); - remove = itemView.findViewById(R.id.temptargetrange_remove); - remove.setOnClickListener(v -> { - final TempTarget tempTarget = (TempTarget) v.getTag(); - OKDialog.showConfirmation(getContext(), resourceHelper.gs(R.string.removerecord), - resourceHelper.gs(R.string.careportal_temporarytarget) + ": " + tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper) + - "\n" + dateUtil.dateAndTimeString(tempTarget.date), - (dialog, id) -> { - final String _id = tempTarget._id; - if (NSUpload.isIdValid(_id)) { - nsUpload.removeCareportalEntryFromNS(_id); - } else { - uploadQueue.removeID("dbAdd", _id); - } - MainApp.getDbHelper().delete(tempTarget); - }, null); - }); - remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - } - } - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.treatments_temptarget_fragment, container, false); - - recyclerView = view.findViewById(R.id.temptargetrange_recyclerview); - recyclerView.setHasFixedSize(true); - LinearLayoutManager llm = new LinearLayoutManager(view.getContext()); - recyclerView.setLayoutManager(llm); - - RecyclerViewAdapter adapter = new RecyclerViewAdapter(treatmentsPlugin.getTempTargetsFromHistory()); - recyclerView.setAdapter(adapter); - - Button refreshFromNS = view.findViewById(R.id.temptargetrange_refreshfromnightscout); - refreshFromNS.setOnClickListener(v -> - OKDialog.showConfirmation(getContext(), resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", () -> { - MainApp.getDbHelper().resetTempTargets(); - rxBus.send(new EventNSClientRestart()); - })); - - boolean nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) || !buildHelper.isEngineeringMode(); - if (nsUploadOnly) - refreshFromNS.setVisibility(View.GONE); - - return view; - } - - @Override - public synchronized void onResume() { - super.onResume(); - disposable.add(rxBus - .toObservable(EventTempTargetChange.class) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(event -> updateGui(), fabricPrivacy::logException) - ); - updateGui(); - } - - @Override - public synchronized void onPause() { - super.onPause(); - disposable.clear(); - } - - private void updateGui() { - recyclerView.swapAdapter(new RecyclerViewAdapter(treatmentsPlugin.getTempTargetsFromHistory()), false); - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt new file mode 100644 index 0000000000..52c97eb0aa --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTempTargetFragment.kt @@ -0,0 +1,172 @@ +package info.nightscout.androidaps.plugins.treatments.fragments + +import android.annotation.SuppressLint +import android.content.DialogInterface +import android.graphics.Paint +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import dagger.android.support.DaggerFragment +import info.nightscout.androidaps.MainApp +import info.nightscout.androidaps.R +import info.nightscout.androidaps.data.Intervals +import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding +import info.nightscout.androidaps.databinding.TreatmentsTemptargetItemBinding +import info.nightscout.androidaps.db.Source +import info.nightscout.androidaps.db.TempTarget +import info.nightscout.androidaps.events.EventTempTargetChange +import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.plugins.general.nsclient.NSUpload +import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue +import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart +import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder +import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation +import info.nightscout.androidaps.utils.buildHelper.BuildHelper +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 TreatmentsTempTargetFragment : DaggerFragment() { + + @Inject lateinit var activePlugin: ActivePluginProvider + @Inject lateinit var sp: SP + @Inject lateinit var rxBus: RxBusWrapper + @Inject lateinit var profileFunction: ProfileFunction + @Inject lateinit var resourceHelper: ResourceHelper + @Inject lateinit var nsUpload: NSUpload + @Inject lateinit var uploadQueue: UploadQueue + @Inject lateinit var fabricPrivacy: FabricPrivacy + @Inject lateinit var dateUtil: DateUtil + @Inject lateinit var buildHelper: BuildHelper + + private val disposable = CompositeDisposable() + + private var _binding: TreatmentsTemptargetFragmentBinding? = null + + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = + TreatmentsTemptargetFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + binding.recyclerview.setHasFixedSize(true) + binding.recyclerview.layoutManager = LinearLayoutManager(view.context) + binding.recyclerview.adapter = RecyclerViewAdapter(activePlugin.activeTreatments.tempTargetsFromHistory) + binding.refreshFromNightscout.setOnClickListener { + context?.let { context -> + showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", { + MainApp.getDbHelper().resetTempTargets() + rxBus.send(EventNSClientRestart()) + }) + } + } + val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) || !buildHelper.isEngineeringMode() + if (nsUploadOnly) binding.refreshFromNightscout.visibility = View.GONE + } + + @Synchronized + override fun onResume() { + super.onResume() + disposable.add(rxBus + .toObservable(EventTempTargetChange::class.java) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe({ updateGui() }, fabricPrivacy::logException) + ) + updateGui() + } + + @Synchronized + override fun onPause() { + super.onPause() + disposable.clear() + } + + @Synchronized + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + private fun updateGui() { + if (_binding == null) return + binding.recyclerview.swapAdapter(RecyclerViewAdapter(activePlugin.activeTreatments.tempTargetsFromHistory), false) + } + + inner class RecyclerViewAdapter internal constructor(var tempTargetList: Intervals) : RecyclerView.Adapter() { + + var currentlyActiveTarget: TempTarget? = tempTargetList.getValueByInterval(System.currentTimeMillis()) + + override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): TempTargetsViewHolder = + TempTargetsViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_temptarget_item, viewGroup, false)) + + @SuppressLint("SetTextI18n") + override fun onBindViewHolder(holder: TempTargetsViewHolder, position: Int) { + val units = profileFunction.getUnits() + val tempTarget = tempTargetList.getReversed(position) + holder.binding.ph.visibility = if (tempTarget.source == Source.PUMP) View.VISIBLE else View.GONE + holder.binding.ns.visibility = if (NSUpload.isIdValid(tempTarget._id)) View.VISIBLE else View.GONE + if (!tempTarget.isEndingEvent) { + holder.binding.date.text = dateUtil.dateAndTimeString(tempTarget.date) + " - " + dateUtil.timeString(tempTarget.originalEnd()) + holder.binding.duration.text = resourceHelper.gs(R.string.format_mins, tempTarget.durationInMinutes) + holder.binding.low.text = tempTarget.lowValueToUnitsToString(units) + holder.binding.high.text = tempTarget.highValueToUnitsToString(units) + holder.binding.reason.text = tempTarget.reason + } else { + holder.binding.date.text = dateUtil.dateAndTimeString(tempTarget.date) + holder.binding.duration.setText(R.string.cancel) + holder.binding.low.text = "" + holder.binding.high.text = "" + holder.binding.reason.text = "" + holder.binding.reasonLabel.text = "" + holder.binding.reasonColon.text = "" + } + if (tempTarget.isInProgress && tempTarget === currentlyActiveTarget) { + holder.binding.date.setTextColor(resourceHelper.gc(R.color.colorActive)) + } else if (tempTarget.date > DateUtil.now()) { + holder.binding.date.setTextColor(resourceHelper.gc(R.color.colorScheduled)) + } else { + holder.binding.date.setTextColor(holder.binding.reasonColon.currentTextColor) + } + holder.binding.remove.tag = tempTarget + } + + override fun getItemCount(): Int = tempTargetList.size() + + inner class TempTargetsViewHolder(view: View) : RecyclerView.ViewHolder(view) { + + val binding = TreatmentsTemptargetItemBinding.bind(view) + + init { + binding.remove.setOnClickListener { v: View -> + val tempTarget = v.tag as TempTarget + context?.let { context -> + showConfirmation(context, resourceHelper.gs(R.string.removerecord), + """ + ${resourceHelper.gs(R.string.careportal_temporarytarget)}: ${tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper)} + ${dateUtil.dateAndTimeString(tempTarget.date)} + """.trimIndent(), + { _: DialogInterface?, _: Int -> + val id = tempTarget._id + if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id) + else uploadQueue.removeID("dbAdd", id) + + MainApp.getDbHelper().delete(tempTarget) + }, null) + } + } + binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt index 9877ad00da..45abbff111 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -88,10 +88,8 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() { inner class RecyclerViewAdapter internal constructor(private var tempBasalList: Intervals) : RecyclerView.Adapter() { - override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): TempBasalsViewHolder { - val v = LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_tempbasals_item, viewGroup, false) - return TempBasalsViewHolder(v) - } + override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): TempBasalsViewHolder = + TempBasalsViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_tempbasals_item, viewGroup, false)) override fun onBindViewHolder(holder: TempBasalsViewHolder, position: Int) { val tempBasal = tempBasalList.getReversed(position) diff --git a/app/src/main/res/layout/treatments_bolus_fragment.xml b/app/src/main/res/layout/treatments_bolus_fragment.xml index feb54e2752..e1690c3bcf 100644 --- a/app/src/main/res/layout/treatments_bolus_fragment.xml +++ b/app/src/main/res/layout/treatments_bolus_fragment.xml @@ -17,7 +17,8 @@ android:layout_height="wrap_content" android:paddingStart="10dp" android:text="@string/treatments_iobtotal_label_string" - android:textAppearance="?android:attr/textAppearanceSmall" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:ignore="RtlSymmetry" /> + android:textStyle="bold" + tools:ignore="RtlSymmetry" /> + android:textAppearance="?android:attr/textAppearanceSmall" + tools:ignore="RtlSymmetry" /> + android:textStyle="bold" + tools:ignore="RtlSymmetry" /> @@ -49,22 +53,24 @@ android:layout_height="wrap_content" android:orientation="horizontal"> -