Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC-1062 Multiple instances of Register Patient activity #983

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openmrs-android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ plugins {
}

android {
compileSdkVersion 29
compileSdkVersion 31
buildToolsVersion "29.0.2"

defaultConfig {
minSdkVersion 17
targetSdkVersion 29
targetSdkVersion 31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for changing the targetSdkVersion?

versionCode 1
versionName "1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class DashboardActivity : ACBaseActivity() {
doubleBackToExitPressedOnce = false
}
}
internal var isNavigationInProgress = false


override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -103,6 +104,11 @@ class DashboardActivity : ACBaseActivity() {
dashboardFragment?.bindDrawableResources()
}

override fun onStop() {
super.onStop()
isNavigationInProgress = false
}

override fun onBackPressed() {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ package org.openmrs.mobile.activities.dashboard

import android.graphics.Bitmap
import android.os.Bundle
import android.util.Log
import android.util.SparseArray
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.navigation.NavDirections
import androidx.navigation.fragment.findNavController
import com.github.amlcurran.showcaseview.OnShowcaseEventListener
import com.github.amlcurran.showcaseview.ShowcaseView
Expand Down Expand Up @@ -177,7 +179,7 @@ class DashboardFragment : BaseFragment(), View.OnClickListener {
val directionToActiveVisits = DashboardFragmentDirections.actionDashboardFragmentToActiveVisitsActivity()
when (v.id) {
R.id.findPatientView -> findNavController().navigate(directionToFindPatent)
R.id.registryPatientView -> findNavController().navigate(directionToRegister)
R.id.registryPatientView -> navigateToScreen(directionToRegister)
R.id.captureVitalsView -> findNavController().navigate(directionToFormEntry)
R.id.activeVisitsView -> findNavController().navigate(directionToActiveVisits)
R.id.dashboardProviderManagementView -> findNavController().navigate(directionToProviderManager)
Expand All @@ -186,6 +188,13 @@ class DashboardFragment : BaseFragment(), View.OnClickListener {
}
}

private fun navigateToScreen(destination: NavDirections) {
if (!(activity as DashboardActivity).isNavigationInProgress) {
(activity as DashboardActivity).isNavigationInProgress = true
findNavController().navigate(destination)
}
}

private fun changeColorOfDashboardIcons() {
with(binding) {
val greenColorResId = R.color.green
Expand Down