WIP on adding navigation between Omnipod fragments in replace Pod wizard
This commit is contained in:
parent
ee9079fdcf
commit
ca4d809f41
|
@ -354,6 +354,12 @@ 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'
|
||||
|
|
|
@ -13,7 +13,8 @@ buildscript {
|
|||
coroutinesVersion = '1.3.7'
|
||||
activityVersion = '1.2.0-alpha06'
|
||||
fragmentVersion = '1.3.0-alpha07'
|
||||
ormLiteVersion = "4.46"
|
||||
ormLiteVersion = '4.46'
|
||||
nav_version = '2.3.0'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
|
|
|
@ -75,6 +75,7 @@ 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'
|
||||
|
@ -86,12 +87,10 @@ dependencies {
|
|||
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
|
||||
|
||||
// Omnipod - start
|
||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||
implementation 'net.danlew:android.joda:2.10.6'
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
implementation(name: "com.atech-software.android.library.wizardpager-1.1.4", ext: "aar")
|
||||
// Omnipod - end
|
||||
|
||||
implementation "com.google.dagger:dagger-android:$dagger_version"
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger_version"
|
||||
|
@ -100,6 +99,12 @@ dependencies {
|
|||
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
|
||||
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"
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
testImplementation "org.mockito:mockito-core:2.8.47"
|
||||
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
|
||||
|
|
|
@ -7,8 +7,8 @@ import dagger.Module
|
|||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import dagger.multibindings.IntoMap
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.WizardFragment1
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.WizardViewModel1
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.WizardFragment1
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.viewmodel.WizardViewModel1
|
||||
import javax.inject.Provider
|
||||
|
||||
@Module
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManage
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.model.FullInitPodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.model.RemovePodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.model.ShortInitPodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.WizardActivity
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
|
@ -56,6 +57,11 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
initPodAction()
|
||||
}
|
||||
|
||||
initpod_init_pod_new.setOnClickListener {
|
||||
val myIntent = Intent(this@PodManagementActivity, WizardActivity::class.java)
|
||||
this@PodManagementActivity.startActivity(myIntent)
|
||||
}
|
||||
|
||||
initpod_remove_pod.setOnClickListener {
|
||||
deactivatePodAction()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ class WizardActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.omnipod_wizard_activity) // TODO: replace with DataBindingUtil.setContentView
|
||||
setContentView(R.layout.omnipod_replace_pod_wizard_activity) // TODO: replace with DataBindingUtil.setContentView
|
||||
}
|
||||
}
|
|
@ -1,16 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dagger.OmnipodPluginQualifier
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.viewmodel.WizardViewModel1
|
||||
import javax.inject.Inject
|
||||
|
||||
class WizardFragment1 : DaggerFragment() {
|
||||
|
@ -33,13 +32,13 @@ class WizardFragment1 : DaggerFragment() {
|
|||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? = inflater.inflate(R.layout.omnipod_wizard_fragment1, container, false)
|
||||
): View? = inflater.inflate(R.layout.omnipod_replace_pod_wizard_info_page_fragment, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
view.findViewById<Button>(R.id.test_button)?.setOnClickListener {
|
||||
viewModel.onButtonPressedForTesting()
|
||||
}
|
||||
//view.findViewById<Button>(R.id.test_button)?.setOnClickListener {
|
||||
// viewModel.onButtonPressedForTesting()
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||
|
||||
abstract class ActionFragmentBase : DaggerFragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? = inflater.inflate(R.layout.omnipod_replace_pod_wizard_action_page_fragment, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
view.findViewById<TextView>(R.id.omnipod_wizard_action_page_text)?.text = getText()
|
||||
}
|
||||
|
||||
abstract fun getText(): String
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action
|
||||
|
||||
class DeactivatePodActionFragment : ActionFragmentBase() {
|
||||
override fun getText(): String = "[deactivate Pod]"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action
|
||||
|
||||
class InsertCannulaActionFragment : ActionFragmentBase() {
|
||||
override fun getText(): String = "[insert cannula]"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action
|
||||
|
||||
class PairAndPrimePodActionFragment : ActionFragmentBase() {
|
||||
override fun getText(): String = "[pair and prime Pod]"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info
|
||||
|
||||
class AttachPodInfoFragment : InfoFragmentBase() {
|
||||
override fun getText(): String = "Attach the Pod"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info
|
||||
|
||||
class DeactivatePodInfoFragment : InfoFragmentBase() {
|
||||
override fun getText(): String = "Deactivate the Pod"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info
|
||||
|
||||
class FillPodInfoFragment : InfoFragmentBase() {
|
||||
override fun getText(): String = "Fill the Pod"
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info;
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||
|
||||
abstract class InfoFragmentBase : DaggerFragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? = inflater.inflate(R.layout.omnipod_replace_pod_wizard_info_page_fragment, container, false)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
view.findViewById<TextView>(R.id.omnipod_wizard_info_page_text)?.text = getText();
|
||||
}
|
||||
|
||||
abstract fun getText(): String
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info
|
||||
|
||||
class PodDeactivatedInfoFragment : InfoFragmentBase() {
|
||||
override fun getText(): String = "Pod has been deactivated"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info
|
||||
|
||||
class PodReplacedInfoFragment : InfoFragmentBase() {
|
||||
override fun getText(): String = "the Pod has been replaced"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2
|
||||
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.viewmodel
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
|
@ -15,7 +15,6 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
|
@ -73,7 +72,26 @@
|
|||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="" />
|
||||
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/initpod_init_pod_new"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_cp_pump_canula"
|
||||
android:text="@string/omnipod_button_replace_pod"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
|
@ -94,7 +112,6 @@
|
|||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
|
@ -115,7 +132,6 @@
|
|||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/omnipod_wizard_action_page_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/omnipod_replace_pod_wizard_navigation_graph"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/omnipod_wizard_info_page_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- TODO: replace with nav host fragment (or FragmentContainerView) -->
|
||||
<fragment
|
||||
android:id="@+id/test_fragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.WizardFragment1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- TODO: replace with something useful -->
|
||||
<Button
|
||||
android:id="@+id/test_button"
|
||||
android:text="Test test"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/omnipod_replace_pod_navigation_graph"
|
||||
app:startDestination="@id/deactivatePodInfoFragment">
|
||||
<fragment
|
||||
android:id="@+id/deactivatePodInfoFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.DeactivatePodInfoFragment"
|
||||
android:label="DeactivatePodInfoFragment" >
|
||||
<action
|
||||
android:id="@+id/action_deactivatePodInfoFragment_to_deactivatePodActionFragment"
|
||||
app:destination="@id/deactivatePodActionFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/deactivatePodActionFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.DeactivatePodActionFragment"
|
||||
android:label="DeactivatePodActionFragment" >
|
||||
<action
|
||||
android:id="@+id/action_deactivatePodActionFragment_to_podDeactivatedInfoFragment"
|
||||
app:destination="@id/podDeactivatedInfoFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/podDeactivatedInfoFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.PodDeactivatedInfoFragment"
|
||||
android:label="PodDeactivatedInfoFragment" >
|
||||
<action
|
||||
android:id="@+id/action_podDeactivatedInfoFragment_to_fillPodInfoFragment"
|
||||
app:destination="@id/fillPodInfoFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/fillPodInfoFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.FillPodInfoFragment"
|
||||
android:label="FillPodInfoFragment" >
|
||||
<action
|
||||
android:id="@+id/action_fillPodInfoFragment_to_pairAndPrimePodActionFragment"
|
||||
app:destination="@id/pairAndPrimePodActionFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/pairAndPrimePodActionFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.PairAndPrimePodActionFragment"
|
||||
android:label="PairAndPrimePodActionFragment" >
|
||||
<action
|
||||
android:id="@+id/action_pairAndPrimePodActionFragment_to_attachPodInfoFragment"
|
||||
app:destination="@id/attachPodInfoFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/attachPodInfoFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.AttachPodInfoFragment"
|
||||
android:label="AttachPodInfoFragment" >
|
||||
<action
|
||||
android:id="@+id/action_attachPodInfoFragment_to_insertCannulaActionFragment"
|
||||
app:destination="@id/insertCannulaActionFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/insertCannulaActionFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.action.InsertCannulaActionFragment"
|
||||
android:label="InsertCannulaActionFragment" >
|
||||
<action
|
||||
android:id="@+id/action_insertCannulaActionFragment_to_podReplacedInfoFragment"
|
||||
app:destination="@id/podReplacedInfoFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/podReplacedInfoFragment"
|
||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard2.fragment.info.PodReplacedInfoFragment"
|
||||
android:label="PodReplacedInfoFragment" />
|
||||
</navigation>
|
|
@ -189,6 +189,7 @@
|
|||
|
||||
<!-- Omnipod - Buttons -->
|
||||
<string name="omnipod_button_init_pod">Init Pod</string>
|
||||
<string name="omnipod_button_replace_pod">Replace Pod (NEW)</string>
|
||||
<string name="omnipod_button_deactivate_pod">Deactivate Pod</string>
|
||||
<string name="omnipod_button_discard_pod">Discard Pod</string>
|
||||
<string name="omnipod_button_set_time">Set time</string>
|
||||
|
|
Loading…
Reference in a new issue