QuickWizard -> ui module
This commit is contained in:
parent
83984c8162
commit
0243c56b65
17 changed files with 71 additions and 66 deletions
|
@ -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) {
|
||||
|
|
|
@ -21,6 +21,7 @@ interface UiInteraction {
|
|||
val singleFragmentActivity: Class<*>
|
||||
val preferencesActivity: Class<*>
|
||||
val myPreferenceFragment: Class<*>
|
||||
val quickWizardListActivity: Class<*>
|
||||
|
||||
val prefGeneral: Int
|
||||
/**
|
||||
|
|
|
@ -503,6 +503,7 @@
|
|||
<string name="wizard_explain_tt">TempT: %1$s</string>
|
||||
<string name="wizard_explain_tt_to">%1$s to %2$s</string>
|
||||
<string name="wizard_pump_not_available">No pump available!</string>
|
||||
<string name="quickwizard">QuickWizard</string>
|
||||
|
||||
|
||||
<!-- Preferences-->
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
android:name=".maintenance.activities.PrefImportListActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name="info.nightscout.configuration.activities.SingleFragmentActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
</application>
|
||||
</manifest>
|
|
@ -22,16 +22,6 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="info.nightscout.plugins.general.overview.activities.QuickWizardListActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name="info.nightscout.plugins.general.persistentNotification.DummyService" />
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -242,15 +242,9 @@
|
|||
<string name="a11y_bg_outdated">outdated</string>
|
||||
<string name="set_basal_question">Accept new temp basal:</string>
|
||||
<string name="overview_cgm">CGM</string>
|
||||
<string name="quickwizard">QuickWizard</string>
|
||||
<string name="a11y_only_on_watch">only on watch</string>
|
||||
<string name="a11y_only_on_phone">only on phone</string>
|
||||
<string name="overview">Overview</string>
|
||||
<string name="overview_shortname">HOME</string>
|
||||
<string name="description_overview">Displays the current state of your loop and buttons for most common actions</string>
|
||||
<string name="overview_editquickwizard_usecob">COB calculation</string>
|
||||
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
|
||||
<string name="overview_editquickwizard_usepercentage">Percentage calculation</string>
|
||||
<string name="overview_buttons_selection">Buttons</string>
|
||||
<string name="show_calibration_button_summary">Sends a calibration to xDrip+ or open BYODA calibration dialog</string>
|
||||
<string name="show_cgm_button_summary">Opens xDrip+ or BYODA, back buttons returns to AAPS</string>
|
||||
|
@ -264,25 +258,6 @@
|
|||
<string name="uploader">Uploader</string>
|
||||
<string name="data_status">BG data status</string>
|
||||
<string name="quickwizard_settings">QuickWizard settings</string>
|
||||
<string name="overview_edit_quickwizard_button_text">Button text:</string>
|
||||
<string name="overview_edit_quickwizard_carbs">Carbs:</string>
|
||||
<string name="overview_edit_quickwizard_valid">Valid:</string>
|
||||
<string name="overview_edit_quickwizard_list_activity_add">Add</string>
|
||||
<string name="overview_quickwizard_item_edit_button">Edit</string>
|
||||
<string name="overview_edit_quickwizard_show_on_device">Show entry on device:</string>
|
||||
<string name="overview_edit_quickwizard_use_bg">BG calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_bolus_iob">Bolus IOB calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_basal_iob">Basal IOB calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_trend">Trend calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_superbolus">Superbolus calculation</string>
|
||||
<string name="overview_edit_quickwizard_percentage">Percentage</string>
|
||||
<string name="device_all">All</string>
|
||||
<string name="device_phone">Phone</string>
|
||||
<string name="device_watch">Watch</string>
|
||||
<string name="positive_only">Positive only</string>
|
||||
<string name="negative_only">Negative only</string>
|
||||
<string name="app_default">Application default</string>
|
||||
<string name="a11y_drag_and_drop_handle">drag and drop handle</string>
|
||||
<string name="keep_screen_on_title">Keep screen on</string>
|
||||
<string name="keep_screen_on_summary">Prevent Android to turn screen off. It will consume lot of energy when not plugged to power outlet.</string>
|
||||
<string name="treatments">Treatments</string>
|
||||
|
|
|
@ -52,9 +52,15 @@
|
|||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name="info.nightscout.configuration.activities.SingleFragmentActivity"
|
||||
android:name="info.nightscout.ui.activities.QuickWizardListActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
|
|
|
@ -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<QuickWizardEntry>
|
||||
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<RecyclerViewAdapter.QuickWizardEntryViewHolder>(), 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)
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.plugins.general.overview.events
|
||||
package info.nightscout.ui.events
|
||||
|
||||
import info.nightscout.rx.events.Event
|
||||
|
|
@ -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">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
|
@ -4,7 +4,7 @@
|
|||
style="@style/StyleDialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog">
|
||||
tools:context="info.nightscout.ui.dialogs.EditQuickWizardDialog">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -368,7 +368,7 @@
|
|||
android:ems="10"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"/>
|
||||
android:maxLength="3" />
|
||||
|
||||
<include
|
||||
android:id="@+id/okcancel"
|
|
@ -148,4 +148,31 @@
|
|||
<!-- BolusProgressDialog-->
|
||||
<string name="stop_pressed">STOP PRESSED</string>
|
||||
|
||||
<!--QuickWizard-->
|
||||
<string name="a11y_only_on_watch">only on watch</string>
|
||||
<string name="a11y_only_on_phone">only on phone</string>
|
||||
<string name="quickwizard_settings">QuickWizard settings</string>
|
||||
<string name="overview_edit_quickwizard_button_text">Button text:</string>
|
||||
<string name="overview_edit_quickwizard_carbs">Carbs:</string>
|
||||
<string name="overview_edit_quickwizard_valid">Valid:</string>
|
||||
<string name="overview_edit_quickwizard_list_activity_add">Add</string>
|
||||
<string name="overview_quickwizard_item_edit_button">Edit</string>
|
||||
<string name="overview_edit_quickwizard_show_on_device">Show entry on device:</string>
|
||||
<string name="overview_edit_quickwizard_use_bg">BG calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_bolus_iob">Bolus IOB calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_basal_iob">Basal IOB calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_trend">Trend calculation</string>
|
||||
<string name="overview_edit_quickwizard_use_superbolus">Superbolus calculation</string>
|
||||
<string name="overview_edit_quickwizard_percentage">Percentage</string>
|
||||
<string name="device_all">All</string>
|
||||
<string name="device_phone">Phone</string>
|
||||
<string name="device_watch">Watch</string>
|
||||
<string name="positive_only">Positive only</string>
|
||||
<string name="negative_only">Negative only</string>
|
||||
<string name="overview_editquickwizard_usecob">COB calculation</string>
|
||||
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
|
||||
<string name="overview_editquickwizard_usepercentage">Percentage calculation</string>
|
||||
<string name="app_default">Application default</string>
|
||||
<string name="a11y_drag_and_drop_handle">drag and drop handle</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue