From 5ca373e3d0afdbc61b289d19ae6264848758303c Mon Sep 17 00:00:00 2001 From: Simon Njoroge Date: Wed, 18 May 2022 14:02:56 +0300 Subject: [PATCH 1/2] Prevent duplicate growth chart dialogs from loading --- gradle.properties | 2 +- .../activity/BaseChildImmunizationActivity.java | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index d80774c66..04f7dbcbe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.8.2-SNAPSHOT +VERSION_NAME=0.8.3-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Child Library diff --git a/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java b/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java index 0c8288788..af86df8ac 100644 --- a/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java +++ b/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java @@ -1354,8 +1354,6 @@ private void showGrowthDialog(View view) { RecordGrowthDialogFragment recordWeightDialogFragment = RecordGrowthDialogFragment.newInstance(dob, weightWrapper, heightWrapper); recordWeightDialogFragment.show(fragmentTransaction, DIALOG_TAG); } - - } @Override @@ -1679,17 +1677,19 @@ public void showGrowthDialogFragment(Map growthMonitoring) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag(BaseChildImmunizationActivity.DIALOG_TAG); if (prev != null) { - fragmentTransaction.remove(prev); + // fragmentTransaction.remove(prev); + return; } fragmentTransaction.addToBackStack(null); + showProgressDialog(getString(R.string.loading), getString(R.string.loading_form_message)); + List weights = new ArrayList<>(); List heights = new ArrayList<>(); if (growthMonitoring == null || growthMonitoring.isEmpty()) { Utils.showToast(this, getString(R.string.record_growth_details)); } else { - if (growthMonitoring.containsKey(Constants.WEIGHT)) { weights = growthMonitoring.get(Constants.WEIGHT); } @@ -1697,19 +1697,18 @@ public void showGrowthDialogFragment(Map growthMonitoring) { if (growthMonitoring.containsKey(Constants.HEIGHT)) { heights = growthMonitoring.get(Constants.HEIGHT); } - - } GrowthDialogFragment growthDialogFragment = GrowthDialogFragment.newInstance(childDetails, weights, heights); growthDialogFragment.show(fragmentTransaction, BaseChildImmunizationActivity.DIALOG_TAG); + + hideProgressDialog(); } //////////////////////////////////////////////////////////////// // Inner classes //////////////////////////////////////////////////////////////// - public void updateScheduleDate() { String dobString = Utils.getValue(childDetails.getColumnmaps(), Constants.KEY.DOB, false); DateTime dateTime = Utils.dobStringToDateTime(dobString); From c5a6e8e5c2b9eb7971f85fce7b557dfa033bfe80 Mon Sep 17 00:00:00 2001 From: Simon Njoroge Date: Wed, 18 May 2022 15:00:02 +0300 Subject: [PATCH 2/2] Code cleanup --- .../child/activity/BaseChildImmunizationActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java b/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java index af86df8ac..572ddea47 100644 --- a/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java +++ b/opensrp-child/src/main/java/org/smartregister/child/activity/BaseChildImmunizationActivity.java @@ -1677,7 +1677,6 @@ public void showGrowthDialogFragment(Map growthMonitoring) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag(BaseChildImmunizationActivity.DIALOG_TAG); if (prev != null) { - // fragmentTransaction.remove(prev); return; } fragmentTransaction.addToBackStack(null);