WIP on adding navigation between Omnipod fragments in replace Pod wizard

This commit is contained in:
Bart Sopers 2020-09-26 20:01:09 +02:00
parent ca4d809f41
commit 779124f8b9
6 changed files with 48 additions and 25 deletions

View file

@ -354,12 +354,6 @@ dependencies {
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' 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 //WorkManager
implementation 'androidx.work:work-runtime:2.3.4' implementation 'androidx.work:work-runtime:2.3.4'
implementation 'androidx.work:work-runtime-ktx:2.3.4' implementation 'androidx.work:work-runtime-ktx:2.3.4'

View file

@ -75,7 +75,6 @@ dependencies {
implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.core:core-ktx:1.2.0'
implementation "androidx.preference:preference-ktx:1.1.1" implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.activity:activity-ktx:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}"
implementation "androidx.fragment:fragment:${fragmentVersion}"
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3' implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3'
@ -100,8 +99,6 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version"
// Navigation // 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-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

View file

@ -7,7 +7,14 @@ import dagger.Module
import dagger.Provides import dagger.Provides
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap 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 info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.viewmodel.WizardViewModel1
import javax.inject.Provider import javax.inject.Provider
@ -29,18 +36,41 @@ abstract class OmnipodWizardModule {
@OmnipodPluginQualifier @OmnipodPluginQualifier
@ViewModelKey(WizardViewModel1::class) @ViewModelKey(WizardViewModel1::class)
internal abstract fun bindWizardViewModel1(viewModel: WizardViewModel1): ViewModel internal abstract fun bindWizardViewModel1(viewModel: WizardViewModel1): ViewModel
// Add the rest of the view models // Add the rest of the view models
// #### FRAGMENTS ############################################################################## // #### FRAGMENTS ##############################################################################
@FragmentScope @FragmentScope
@ContributesAndroidInjector @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
} }

View file

@ -5,17 +5,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment" android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:defaultNavHost="true" app:defaultNavHost="true"
app:navGraph="@navigation/omnipod_replace_pod_wizard_navigation_graph"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/omnipod_replace_pod_wizard_navigation_graph" />
</LinearLayout> </LinearLayout>

View file

@ -4,13 +4,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/omnipod_wizard_info_page_text" android:id="@+id/omnipod_wizard_info_page_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -42,6 +42,9 @@
<action <action
android:id="@+id/action_pairAndPrimePodActionFragment_to_attachPodInfoFragment" android:id="@+id/action_pairAndPrimePodActionFragment_to_attachPodInfoFragment"
app:destination="@id/attachPodInfoFragment" /> app:destination="@id/attachPodInfoFragment" />
<action
android:id="@+id/action_pairAndPrimePodActionFragment_to_deactivatePodInfoFragment"
app:destination="@id/deactivatePodInfoFragment" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/attachPodInfoFragment" android:id="@+id/attachPodInfoFragment"
@ -58,6 +61,9 @@
<action <action
android:id="@+id/action_insertCannulaActionFragment_to_podReplacedInfoFragment" android:id="@+id/action_insertCannulaActionFragment_to_podReplacedInfoFragment"
app:destination="@id/podReplacedInfoFragment" /> app:destination="@id/podReplacedInfoFragment" />
<action
android:id="@+id/action_insertCannulaActionFragment_to_deactivatePodInfoFragment"
app:destination="@id/deactivatePodInfoFragment" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/podReplacedInfoFragment" android:id="@+id/podReplacedInfoFragment"