diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt index a258e0d1ab..23fb25308c 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt @@ -14,8 +14,6 @@ import info.nightscout.androidaps.activities.MyPreferenceFragment import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.configuration.activities.SingleFragmentActivity import info.nightscout.core.events.EventNewNotification -import info.nightscout.ui.services.AlarmSoundService -import info.nightscout.ui.services.AlarmSoundServiceHelper import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.nsclient.NSAlarm @@ -24,6 +22,7 @@ import info.nightscout.plugins.general.overview.notifications.NotificationWithAc import info.nightscout.rx.bus.RxBus import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity +import info.nightscout.ui.activities.QuickWizardListActivity import info.nightscout.ui.activities.TDDStatsActivity import info.nightscout.ui.dialogs.BolusProgressDialog import info.nightscout.ui.dialogs.CalibrationDialog @@ -39,6 +38,8 @@ import info.nightscout.ui.dialogs.TempBasalDialog import info.nightscout.ui.dialogs.TempTargetDialog import info.nightscout.ui.dialogs.TreatmentDialog import info.nightscout.ui.dialogs.WizardDialog +import info.nightscout.ui.services.AlarmSoundService +import info.nightscout.ui.services.AlarmSoundServiceHelper import info.nightscout.ui.widget.Widget import javax.inject.Inject @@ -57,6 +58,7 @@ class UiInteractionImpl @Inject constructor( override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java override val preferencesActivity: Class<*> = PreferencesActivity::class.java override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java + override val quickWizardListActivity: Class<*> = QuickWizardListActivity::class.java override val prefGeneral: Int = R.xml.pref_general override fun runAlarm(status: String, title: String, @RawRes soundId: Int) { diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt index e2867cb3da..2081e83ca1 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/ui/UiInteraction.kt @@ -21,6 +21,7 @@ interface UiInteraction { val singleFragmentActivity: Class<*> val preferencesActivity: Class<*> val myPreferenceFragment: Class<*> + val quickWizardListActivity: Class<*> val prefGeneral: Int /** diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index fff892689b..4f5f9b7ff3 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -503,6 +503,7 @@ TempT: %1$s %1$s to %2$s No pump available! + QuickWizard diff --git a/plugins/configuration/src/main/AndroidManifest.xml b/plugins/configuration/src/main/AndroidManifest.xml index 1dd38056cf..2d2811718b 100644 --- a/plugins/configuration/src/main/AndroidManifest.xml +++ b/plugins/configuration/src/main/AndroidManifest.xml @@ -18,6 +18,10 @@ android:name=".maintenance.activities.PrefImportListActivity" android:exported="false" android:theme="@style/AppTheme" /> + \ No newline at end of file diff --git a/plugins/main/src/main/AndroidManifest.xml b/plugins/main/src/main/AndroidManifest.xml index 1bcf09f595..6d24217b2e 100644 --- a/plugins/main/src/main/AndroidManifest.xml +++ b/plugins/main/src/main/AndroidManifest.xml @@ -22,16 +22,6 @@ - - - - - - - diff --git a/plugins/main/src/main/java/info/nightscout/plugins/di/OverviewModule.kt b/plugins/main/src/main/java/info/nightscout/plugins/di/OverviewModule.kt index a969da26bc..30ed8c5ea0 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/di/OverviewModule.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/di/OverviewModule.kt @@ -6,8 +6,6 @@ import dagger.android.ContributesAndroidInjector import info.nightscout.interfaces.overview.OverviewMenus import info.nightscout.plugins.general.overview.OverviewFragment import info.nightscout.plugins.general.overview.OverviewMenusImpl -import info.nightscout.plugins.general.overview.activities.QuickWizardListActivity -import info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog import info.nightscout.plugins.general.overview.graphData.GraphData import info.nightscout.plugins.general.overview.notifications.DismissNotificationService import info.nightscout.plugins.general.overview.notifications.NotificationWithAction @@ -21,8 +19,6 @@ import info.nightscout.plugins.general.overview.notifications.NotificationWithAc abstract class OverviewModule { @ContributesAndroidInjector abstract fun contributesDismissNotificationService(): DismissNotificationService - @ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity - @ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog @ContributesAndroidInjector abstract fun contributesOverviewFragment(): OverviewFragment @ContributesAndroidInjector abstract fun notificationWithActionInjector(): NotificationWithAction @ContributesAndroidInjector abstract fun graphDataInjector(): GraphData diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt index 558db4681e..0484df25ff 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt @@ -71,7 +71,6 @@ import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.interfaces.utils.TrendCalculator import info.nightscout.plugins.R import info.nightscout.plugins.databinding.OverviewFragmentBinding -import info.nightscout.plugins.general.overview.activities.QuickWizardListActivity import info.nightscout.plugins.general.overview.graphData.GraphData import info.nightscout.plugins.general.overview.notifications.NotificationStore import info.nightscout.plugins.general.overview.notifications.events.EventUpdateOverviewNotification @@ -478,7 +477,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList override fun onLongClick(v: View): Boolean { when (v.id) { R.id.quick_wizard_button -> { - startActivity(Intent(v.context, QuickWizardListActivity::class.java)) + startActivity(Intent(v.context, uiInteraction.quickWizardListActivity)) return true } diff --git a/plugins/main/src/main/res/values/strings.xml b/plugins/main/src/main/res/values/strings.xml index 13f8e27c09..380d3be372 100644 --- a/plugins/main/src/main/res/values/strings.xml +++ b/plugins/main/src/main/res/values/strings.xml @@ -242,15 +242,9 @@ outdated Accept new temp basal: CGM - QuickWizard - only on watch - only on phone Overview HOME Displays the current state of your loop and buttons for most common actions - COB calculation - Temporary target calculation - Percentage calculation Buttons Sends a calibration to xDrip+ or open BYODA calibration dialog Opens xDrip+ or BYODA, back buttons returns to AAPS @@ -264,25 +258,6 @@ Uploader BG data status QuickWizard settings - Button text: - Carbs: - Valid: - Add - Edit - Show entry on device: - BG calculation - Bolus IOB calculation - Basal IOB calculation - Trend calculation - Superbolus calculation - Percentage - All - Phone - Watch - Positive only - Negative only - Application default - drag and drop handle Keep screen on Prevent Android to turn screen off. It will consume lot of energy when not plugged to power outlet. Treatments diff --git a/ui/src/main/AndroidManifest.xml b/ui/src/main/AndroidManifest.xml index 6df2670b1f..12f051996e 100644 --- a/ui/src/main/AndroidManifest.xml +++ b/ui/src/main/AndroidManifest.xml @@ -52,9 +52,15 @@ android:exported="false" android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme"> + + + + + + diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/activities/QuickWizardListActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/QuickWizardListActivity.kt similarity index 91% rename from plugins/main/src/main/java/info/nightscout/plugins/general/overview/activities/QuickWizardListActivity.kt rename to ui/src/main/java/info/nightscout/ui/activities/QuickWizardListActivity.kt index 1ff088066c..3d36002f44 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/activities/QuickWizardListActivity.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/QuickWizardListActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.plugins.general.overview.activities +package info.nightscout.ui.activities import android.annotation.SuppressLint import android.os.Bundle @@ -23,17 +23,17 @@ import info.nightscout.core.wizard.QuickWizardEntry import info.nightscout.interfaces.dragHelpers.ItemTouchHelperAdapter import info.nightscout.interfaces.dragHelpers.OnStartDragListener import info.nightscout.interfaces.dragHelpers.SimpleItemTouchHelperCallback -import info.nightscout.plugins.R -import info.nightscout.plugins.databinding.OverviewQuickwizardlistActivityBinding -import info.nightscout.plugins.databinding.OverviewQuickwizardlistItemBinding -import info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog -import info.nightscout.plugins.general.overview.events.EventQuickWizardChange import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.shared.extensions.toVisibility import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil +import info.nightscout.ui.R +import info.nightscout.ui.databinding.ActivityQuickwizardListBinding +import info.nightscout.ui.databinding.QuickwizardListItemBinding +import info.nightscout.ui.dialogs.EditQuickWizardDialog +import info.nightscout.ui.events.EventQuickWizardChange import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import javax.inject.Inject @@ -51,7 +51,7 @@ class QuickWizardListActivity : DaggerAppCompatActivity(), OnStartDragListener { private var disposable: CompositeDisposable = CompositeDisposable() private lateinit var actionHelper: ActionModeHelper private val itemTouchHelper = ItemTouchHelper(SimpleItemTouchHelperCallback()) - private lateinit var binding: OverviewQuickwizardlistActivityBinding + private lateinit var binding: ActivityQuickwizardListBinding override fun onStartDrag(viewHolder: RecyclerView.ViewHolder) { itemTouchHelper.startDrag(viewHolder) @@ -59,10 +59,10 @@ class QuickWizardListActivity : DaggerAppCompatActivity(), OnStartDragListener { private inner class RecyclerViewAdapter(var fragmentManager: FragmentManager) : RecyclerView.Adapter(), ItemTouchHelperAdapter { - private inner class QuickWizardEntryViewHolder(val binding: OverviewQuickwizardlistItemBinding) : RecyclerView.ViewHolder(binding.root) + private inner class QuickWizardEntryViewHolder(val binding: QuickwizardListItemBinding) : RecyclerView.ViewHolder(binding.root) override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuickWizardEntryViewHolder { - val binding = OverviewQuickwizardlistItemBinding.inflate(LayoutInflater.from(parent.context), parent, false) + val binding = QuickwizardListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false) return QuickWizardEntryViewHolder(binding) } @@ -129,7 +129,7 @@ class QuickWizardListActivity : DaggerAppCompatActivity(), OnStartDragListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = OverviewQuickwizardlistActivityBinding.inflate(layoutInflater) + binding = ActivityQuickwizardListBinding.inflate(layoutInflater) setContentView(binding.root) actionHelper = ActionModeHelper(rh, this, null) @@ -137,7 +137,7 @@ class QuickWizardListActivity : DaggerAppCompatActivity(), OnStartDragListener { actionHelper.setOnRemoveHandler { removeSelected(it) } actionHelper.enableSort = true - title = rh.gs(R.string.quickwizard) + title = rh.gs(info.nightscout.core.ui.R.string.quickwizard) supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) diff --git a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt index 47158c0980..e00e2e2e6f 100644 --- a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt +++ b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt @@ -5,6 +5,7 @@ import dagger.android.ContributesAndroidInjector import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity import info.nightscout.ui.activities.ProfileHelperActivity +import info.nightscout.ui.activities.QuickWizardListActivity import info.nightscout.ui.activities.StatsActivity import info.nightscout.ui.activities.SurveyActivity import info.nightscout.ui.activities.TDDStatsActivity @@ -21,6 +22,7 @@ import info.nightscout.ui.dialogs.BolusProgressDialog import info.nightscout.ui.dialogs.CalibrationDialog import info.nightscout.ui.dialogs.CarbsDialog import info.nightscout.ui.dialogs.CareDialog +import info.nightscout.ui.dialogs.EditQuickWizardDialog import info.nightscout.ui.dialogs.ExtendedBolusDialog import info.nightscout.ui.dialogs.FillDialog import info.nightscout.ui.dialogs.InsulinDialog @@ -61,6 +63,8 @@ abstract class UiModule { @ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog @ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog @ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog + @ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity + @ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog @ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity @ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/dialogs/EditQuickWizardDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/EditQuickWizardDialog.kt similarity index 95% rename from plugins/main/src/main/java/info/nightscout/plugins/general/overview/dialogs/EditQuickWizardDialog.kt rename to ui/src/main/java/info/nightscout/ui/dialogs/EditQuickWizardDialog.kt index 217b5adc92..1eabd0fd50 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/dialogs/EditQuickWizardDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/EditQuickWizardDialog.kt @@ -1,4 +1,4 @@ -package info.nightscout.plugins.general.overview.dialogs +package info.nightscout.ui.dialogs import android.os.Bundle import android.text.format.DateFormat @@ -15,15 +15,15 @@ import info.nightscout.core.ui.extensions.setEnableForChildren import info.nightscout.core.ui.extensions.setSelection import info.nightscout.core.wizard.QuickWizard import info.nightscout.core.wizard.QuickWizardEntry -import info.nightscout.plugins.R -import info.nightscout.plugins.databinding.OverviewEditquickwizardDialogBinding -import info.nightscout.plugins.general.overview.events.EventQuickWizardChange import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.SafeParse import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import info.nightscout.shared.utils.T +import info.nightscout.ui.R +import info.nightscout.ui.databinding.DialogEditQuickwizardBinding +import info.nightscout.ui.events.EventQuickWizardChange import org.json.JSONException import javax.inject.Inject @@ -39,7 +39,7 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener { private var fromSeconds: Int = 0 private var toSeconds: Int = 0 - private var _binding: OverviewEditquickwizardDialogBinding? = null + private var _binding: DialogEditQuickwizardBinding? = null // This property is only valid between onCreateView and onDestroyView. private val binding get() = _binding!! @@ -52,7 +52,7 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener { dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) isCancelable = true dialog?.setCanceledOnTouchOutside(false) - _binding = OverviewEditquickwizardDialogBinding.inflate(inflater, container, false) + _binding = DialogEditQuickwizardBinding.inflate(inflater, container, false) return binding.root } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/events/EventQuickWizardChange.kt b/ui/src/main/java/info/nightscout/ui/events/EventQuickWizardChange.kt similarity index 58% rename from plugins/main/src/main/java/info/nightscout/plugins/general/overview/events/EventQuickWizardChange.kt rename to ui/src/main/java/info/nightscout/ui/events/EventQuickWizardChange.kt index 543da400e4..34de86d2fa 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/events/EventQuickWizardChange.kt +++ b/ui/src/main/java/info/nightscout/ui/events/EventQuickWizardChange.kt @@ -1,4 +1,4 @@ -package info.nightscout.plugins.general.overview.events +package info.nightscout.ui.events import info.nightscout.rx.events.Event diff --git a/plugins/main/src/main/res/layout/overview_quickwizardlist_activity.xml b/ui/src/main/res/layout/activity_quickwizard_list.xml similarity index 91% rename from plugins/main/src/main/res/layout/overview_quickwizardlist_activity.xml rename to ui/src/main/res/layout/activity_quickwizard_list.xml index dcb18bd1b0..7c91cc6b21 100644 --- a/plugins/main/src/main/res/layout/overview_quickwizardlist_activity.xml +++ b/ui/src/main/res/layout/activity_quickwizard_list.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" - tools:context="info.nightscout.plugins.general.overview.activities.QuickWizardListActivity"> + tools:context="info.nightscout.plugins.info.nightscout.ui.activities.QuickWizardListActivity"> + tools:context="info.nightscout.ui.dialogs.EditQuickWizardDialog"> + android:maxLength="3" /> STOP PRESSED + + only on watch + only on phone + QuickWizard settings + Button text: + Carbs: + Valid: + Add + Edit + Show entry on device: + BG calculation + Bolus IOB calculation + Basal IOB calculation + Trend calculation + Superbolus calculation + Percentage + All + Phone + Watch + Positive only + Negative only + COB calculation + Temporary target calculation + Percentage calculation + Application default + drag and drop handle +