From 779124f8b9bcf65a0b3ca5d0f0b89fc0ca40da74 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sat, 26 Sep 2020 20:01:09 +0200 Subject: [PATCH] WIP on adding navigation between Omnipod fragments in replace Pod wizard --- app/build.gradle | 6 --- omnipod/build.gradle | 3 -- .../omnipod/dagger/OmnipodWizardModule.kt | 42 ++++++++++++++++--- .../omnipod_replace_pod_wizard_activity.xml | 6 +-- ..._replace_pod_wizard_info_page_fragment.xml | 10 ++--- ...od_replace_pod_wizard_navigation_graph.xml | 6 +++ 6 files changed, 48 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index be67687bda..1b2b39485a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -354,12 +354,6 @@ dependencies { androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' - // Navigation - implementation "androidx.navigation:navigation-fragment:$nav_version" - implementation "androidx.navigation:navigation-ui:$nav_version" - implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" - implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - //WorkManager implementation 'androidx.work:work-runtime:2.3.4' implementation 'androidx.work:work-runtime-ktx:2.3.4' diff --git a/omnipod/build.gradle b/omnipod/build.gradle index ab5129a293..948b9f17dc 100644 --- a/omnipod/build.gradle +++ b/omnipod/build.gradle @@ -75,7 +75,6 @@ dependencies { implementation 'androidx.core:core-ktx:1.2.0' implementation "androidx.preference:preference-ktx:1.1.1" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment:${fragmentVersion}" implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3' @@ -100,8 +99,6 @@ dependencies { kapt "com.google.dagger:dagger-compiler:$dagger_version" // Navigation - implementation "androidx.navigation:navigation-fragment:$nav_version" - implementation "androidx.navigation:navigation-ui:$nav_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dagger/OmnipodWizardModule.kt b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dagger/OmnipodWizardModule.kt index 95103a4003..fb7beb86c4 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dagger/OmnipodWizardModule.kt +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dagger/OmnipodWizardModule.kt @@ -7,7 +7,14 @@ import dagger.Module import dagger.Provides import dagger.android.ContributesAndroidInjector import dagger.multibindings.IntoMap -import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.WizardFragment1 +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.DeactivatePodActionFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.InsertCannulaActionFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.PairAndPrimePodActionFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.AttachPodInfoFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.DeactivatePodInfoFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.FillPodInfoFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.PodDeactivatedInfoFragment +import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.PodReplacedInfoFragment import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.viewmodel.WizardViewModel1 import javax.inject.Provider @@ -29,18 +36,41 @@ abstract class OmnipodWizardModule { @OmnipodPluginQualifier @ViewModelKey(WizardViewModel1::class) internal abstract fun bindWizardViewModel1(viewModel: WizardViewModel1): ViewModel - // Add the rest of the view models - - // #### FRAGMENTS ############################################################################## @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesWizardFragment1(): WizardFragment1 + internal abstract fun contributesDeactivatePodActionFragment(): DeactivatePodActionFragment - // Add the rest of the fragments + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesInsertCannulaActionFragment(): InsertCannulaActionFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesPairAndPrimePodActionFragment(): PairAndPrimePodActionFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesAttachPodInfoFragment(): AttachPodInfoFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesDeactivatePodInfoFragment(): DeactivatePodInfoFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesFillPodInfoFragment(): FillPodInfoFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesPodDeactivatedInfoFragment(): PodDeactivatedInfoFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesPodReplacedInfoFragment(): PodReplacedInfoFragment } diff --git a/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_activity.xml b/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_activity.xml index c0a752743b..ab6fd649e5 100644 --- a/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_activity.xml +++ b/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_activity.xml @@ -5,17 +5,17 @@ android:layout_height="match_parent" android:orientation="vertical"> - + app:layout_constraintTop_toTopOf="parent" + app:navGraph="@navigation/omnipod_replace_pod_wizard_navigation_graph" /> \ No newline at end of file diff --git a/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_info_page_fragment.xml b/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_info_page_fragment.xml index 8c460e45ed..0e3eb63df9 100644 --- a/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_info_page_fragment.xml +++ b/omnipod/src/main/res/layout/omnipod_replace_pod_wizard_info_page_fragment.xml @@ -4,13 +4,9 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - + android:layout_height="wrap_content" /> \ No newline at end of file diff --git a/omnipod/src/main/res/navigation/omnipod_replace_pod_wizard_navigation_graph.xml b/omnipod/src/main/res/navigation/omnipod_replace_pod_wizard_navigation_graph.xml index 0594a0057e..347c8d9426 100644 --- a/omnipod/src/main/res/navigation/omnipod_replace_pod_wizard_navigation_graph.xml +++ b/omnipod/src/main/res/navigation/omnipod_replace_pod_wizard_navigation_graph.xml @@ -42,6 +42,9 @@ + +