From b96ba599a11720d203f5ab133412714c9a290787 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Thu, 21 Jan 2021 12:29:16 +0300 Subject: [PATCH 001/101] Removes Team Id Check on the Authorization service --- .../chw/application/LmhAuthorizationService.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/LmhAuthorizationService.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/LmhAuthorizationService.java index 5558cd92b1..e40e9aa592 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/LmhAuthorizationService.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/LmhAuthorizationService.java @@ -25,9 +25,6 @@ public class LmhAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(map -> { - Object peerDeviceTeamId = peerDeviceMap.get(AllConstants.PeerToPeer.KEY_TEAM_ID); - if (peerDeviceTeamId instanceof String - && peerDeviceTeamId.equals(map.get(AllConstants.PeerToPeer.KEY_TEAM_ID))) { Object peerDeviceLocationId = peerDeviceMap.get(CoreConstants.PEER_TO_PEER.LOCATION_ID); Object myLocationId = authorizationDetails.get(CoreConstants.PEER_TO_PEER.LOCATION_ID); Object myPeerStatus = authorizationDetails.get(org.smartregister.p2p.util.Constants.AuthorizationKeys.PEER_STATUS); @@ -43,9 +40,6 @@ public void authorizeConnection(@NonNull final Map peerDeviceMap } else { rejectConnection(authorizationCallback); } - } else { - rejectConnection(authorizationCallback); - } }); } From a24e2918ba95427600c6cba714bb93c936013c1a Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Tue, 2 Feb 2021 12:45:37 +0300 Subject: [PATCH 002/101] V 0.1.7 --- opensrp-chw/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index 4ed973f8ab..24b3dbf658 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -256,7 +256,7 @@ android { dimension = 'baseDimension' applicationIdSuffix ".lmh" versionCode 2 - versionName "0.1.6" + versionName "0.1.7" buildConfigField "String", 'opensrp_url', '"https://lmh-liberia.smartregister.org/opensrp/"' buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/lmh/"' buildConfigField "String", 'opensrp_url_debug', '"https://lmh-stage.smartregister.org/opensrp/"' From 8e6a68acb42502fc6204b893e085ed61c39db14f Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Mon, 30 Aug 2021 19:13:34 +0300 Subject: [PATCH 003/101] Build Fixes --- .gitignore | 3 +- build.gradle | 1 + opensrp-chw/build.gradle | 43 ++++++++++++++++++- .../chw/activity/FamilyProfileActivity.java | 4 ++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e177761329..fdc5cb7425 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ project.properties .settings build/ jacoco.exec -opensrp-chw/ba/ \ No newline at end of file +opensrp-chw/ba/ +*google-services.json \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6d803a6c0f..f38fd9b309 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,7 @@ allprojects { maven { url "https://s3.amazonaws.com/repo.commonsware.com" } maven { url "https://dl.bintray.com/ona/rdt-capture" } maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases' } + maven { url "https://dl.bintray.com/ona/kujaku" } } } diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index 24b3dbf658..dd27d58362 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -15,12 +15,30 @@ allprojects { repositories { maven { url 'https://maven.google.com' } maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } - maven { url "http://dl.bintray.com/ona/kujaku" } + maven { + def githubProperties = new Properties() + if (rootProject.file("github.properties").exists()) { + githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) + } + + name = "GitHubPackages" + /* Configure path to the library hosted on GitHub Package Registry + * Replace UserID with package owner userID and REPOSITORY with the repository name + * e.g. ""https://maven.pkg.github.com/opensrp/opensrp-client-reporting"" + */ + url = uri("https://maven.pkg.github.com/onaio/kujaku") + credentials { + username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER") + password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY") + } + + } maven { url 'https://maven.fabric.io/public' } mavenLocal() } } + apply plugin: 'com.android.application' apply plugin: 'jacoco' apply plugin: 'com.github.kt3k.coveralls' @@ -42,8 +60,14 @@ android { checkReleaseBuilds false abortOnError false } + defaultConfig { + // Required when setting minSdkVersion to 20 or lower + multiDexEnabled true + } compileOptions { + coreLibraryDesugaringEnabled true + sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -133,6 +157,7 @@ android { exclude 'LICENSE.txt' exclude 'META-INF/LICENSE.md' exclude 'META-INF/NOTICE.md' + exclude 'META-INF/INDEX.LIST' } testOptions { @@ -275,6 +300,8 @@ android { } dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' + implementation('org.smartregister:opensrp-client-chw-core:1.5.25-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'appcompat-v7' @@ -283,7 +310,17 @@ dependencies { exclude group: 'androidx.constraintlayout', module: 'constraintlayout' exclude group: 'com.google.guava', module: 'guava' exclude group: 'com.rengwuxian.materialedittext', module: 'library' + exclude group: 'com.ibm.fhir', module: 'fhir-path' } + + implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.1.0' + implementation('io.ona.kujaku:library:0.9.0') { + exclude group: 'com.android.volley', module: 'volley' + exclude group: 'stax', module: 'stax-api' + } + // implementation 'com.ibm.fhir:fhir-model:4.7.0' + //implementation 'com.ibm.fhir:fhir-path:4.7.0' + //Do not upgrade to 1.1.0 due to compatibility issues implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.2.1' @@ -298,7 +335,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'org.mockito:mockito-android:3.0.0' - implementation 'com.github.lecho:hellocharts-android:v1.5.8' + implementation 'com.github.lecho:hellocharts-android:1.5.8@aar' testImplementation 'junit:junit:4.13' testImplementation 'org.mockito:mockito-core:3.1.0' @@ -306,6 +343,8 @@ dependencies { testImplementation 'org.robolectric:shadows-multidex:4.3.1' testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2' testImplementation 'androidx.test:core:1.3.0' + // testImplementation 'com.ibm.fhir:fhir-model:4.7.0' + // testImplementation 'com.ibm.fhir:fhir-path:4.7.0' } def flavors = android.productFlavors.collect { flavor -> flavor.name } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java index f6da6216d6..017c468919 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java @@ -224,4 +224,8 @@ public void goToChildProfileActivity(CommonPersonObjectClient patient, Bundle bu startActivity(intent); } + @Override + public void setEventDate(String s) { + + } } From d4c99d35a88201fa03712fdc1730d18df2f76588 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Mon, 30 Aug 2021 19:25:34 +0300 Subject: [PATCH 004/101] Sets Entity type to name to Capitalize first letter --- opensrp-chw/google-services.json | 533 ++++++++++++++++++ .../assets/json.form/child_enrollment.json | 2 + .../lmh/assets/json.form/family_register.json | 1 + 3 files changed, 536 insertions(+) create mode 100755 opensrp-chw/google-services.json diff --git a/opensrp-chw/google-services.json b/opensrp-chw/google-services.json new file mode 100755 index 0000000000..276e11f7a7 --- /dev/null +++ b/opensrp-chw/google-services.json @@ -0,0 +1,533 @@ +{ + "project_info": { + "project_number": "660700053041", + "firebase_url": "https://opensrp-production.firebaseio.com", + "project_id": "opensrp-production", + "storage_bucket": "opensrp-production.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:97e438dcfbb4acd2335f10", + "android_client_info": { + "package_name": "com.vijay.jsonwizard" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:724674edc53115c9335f10", + "android_client_info": { + "package_name": "org.smartregister.anc" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:10765ec82bfa2bca335f10", + "android_client_info": { + "package_name": "org.smartregister.chw" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:061090ac05eaac00335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.ba" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:21c6800c1c7ceaf6335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.chad" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:ab83358f3ed187ee335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.drc" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:99a5768b17d332e9335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.guinea" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:9510a3c9bf2de0d6335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.hf" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:719b69abb1fe5ca2335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.lmh" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:92db3a929633cfc4335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.miecd" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:9f0b81b71a73eef0335f10", + "android_client_info": { + "package_name": "org.smartregister.chw.togo" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:3ca8b0c59e657a7f335f10", + "android_client_info": { + "package_name": "org.smartregister.giz" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:ecf24af9d9bc830f335f10", + "android_client_info": { + "package_name": "org.smartregister.kip" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:0c2277c216b7bf3d335f10", + "android_client_info": { + "package_name": "org.smartregister.nativeform" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:90cb7e892b4fd2c7335f10", + "android_client_info": { + "package_name": "org.smartregister.path" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:3e4ab33eba6c035d335f10", + "android_client_info": { + "package_name": "org.smartregister.reveal" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:6190224faaf9083e335f10", + "android_client_info": { + "package_name": "org.smartregister.sample.fp" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:660700053041:android:069a3b159a5afcac", + "android_client_info": { + "package_name": "org.smartregister.wellnesspass" + } + }, + "oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/opensrp-chw/src/lmh/assets/json.form/child_enrollment.json b/opensrp-chw/src/lmh/assets/json.form/child_enrollment.json index ae831d2227..f08295823d 100644 --- a/opensrp-chw/src/lmh/assets/json.form/child_enrollment.json +++ b/opensrp-chw/src/lmh/assets/json.form/child_enrollment.json @@ -87,6 +87,7 @@ "openmrs_entity_id": "first_name", "openmrs_data_type": "text", "type": "edit_text", + "edit_type": "name", "hint": "First name", "expanded": false, "v_required": { @@ -105,6 +106,7 @@ "openmrs_entity_id": "middle_name", "openmrs_data_type": "text", "type": "edit_text", + "edit_type": "name", "hint": "Middle name", "expanded": false, "v_regex": { diff --git a/opensrp-chw/src/lmh/assets/json.form/family_register.json b/opensrp-chw/src/lmh/assets/json.form/family_register.json index a56a23f6d9..86eaed5248 100644 --- a/opensrp-chw/src/lmh/assets/json.form/family_register.json +++ b/opensrp-chw/src/lmh/assets/json.form/family_register.json @@ -95,6 +95,7 @@ "openmrs_entity": "person_address", "openmrs_entity_id": "cityVillage", "type": "edit_text", + "edit_type": "name", "hint": "Village/Town", "v_required": { "value": "true", From 7245389284c755385a00f2b32cd10d3959c24268 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 1 Sep 2021 11:25:30 +0300 Subject: [PATCH 005/101] Removes Phone Icon from LMH Flavor --- .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ .../custom_view/FamilyFloatingMenuFlv.java | 11 ++++++ .../src/lmh/res/layout/activity_login.xml | 2 ++ .../chw/activity/FamilyProfileActivity.java | 34 +++++++++++++++---- .../custom_view/ChwFamilyFloatingMenu.java | 32 +++++++++++++++++ .../DefaultFamilyFloatingMenuFlv.java | 11 ++++++ .../custom_view/FamilyFloatingMenuFlv.java | 6 ++++ 11 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 opensrp-chw/src/ba/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/chad/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/drc/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/guinea/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/liberia/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/main/java/org/smartregister/chw/custom_view/ChwFamilyFloatingMenu.java create mode 100644 opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultFamilyFloatingMenuFlv.java create mode 100644 opensrp-chw/src/togo/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java diff --git a/opensrp-chw/src/ba/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/ba/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/ba/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} diff --git a/opensrp-chw/src/chad/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/chad/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/chad/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} diff --git a/opensrp-chw/src/drc/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/drc/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/drc/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} diff --git a/opensrp-chw/src/guinea/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/guinea/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/guinea/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} diff --git a/opensrp-chw/src/liberia/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/liberia/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/liberia/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..f4748195b4 --- /dev/null +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,11 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { + @Override + public void setCallLayoutVisibility(View view) { + view.setVisibility(View.GONE); + } + +} diff --git a/opensrp-chw/src/lmh/res/layout/activity_login.xml b/opensrp-chw/src/lmh/res/layout/activity_login.xml index 168a27480d..1cd8e9de37 100644 --- a/opensrp-chw/src/lmh/res/layout/activity_login.xml +++ b/opensrp-chw/src/lmh/res/layout/activity_login.xml @@ -83,6 +83,7 @@ android:imeOptions="actionNext" android:inputType="text" android:lines="1" + android:text="chaone" android:paddingLeft="10dp" android:textColor="#666666" android:textColorHint="#bfbfbf" @@ -100,6 +101,7 @@ android:background="@drawable/rounded_corner_edit_text_bg" android:cursorVisible="true" android:ems="10" + android:text="Lmh12345" android:hint="@string/password" android:imeActionId="@integer/login" android:inputType="textPassword" diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java index 017c468919..05abe3d92b 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java @@ -1,9 +1,13 @@ package org.smartregister.chw.activity; +import static org.smartregister.chw.core.utils.Utils.passToolbarTitle; + import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.view.Gravity; +import android.widget.LinearLayout; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; @@ -18,7 +22,9 @@ import org.smartregister.chw.core.activity.CoreFamilyProfileActivity; import org.smartregister.chw.core.activity.CoreFamilyProfileMenuActivity; import org.smartregister.chw.core.activity.CoreFamilyRemoveMemberActivity; +import org.smartregister.chw.core.listener.FloatingMenuListener; import org.smartregister.chw.core.utils.CoreConstants; +import org.smartregister.chw.custom_view.ChwFamilyFloatingMenu; import org.smartregister.chw.dao.ChwChildDao; import org.smartregister.chw.fp.dao.FpDao; import org.smartregister.chw.fragment.FamilyProfileActivityFragment; @@ -38,11 +44,32 @@ import java.util.HashMap; -import static org.smartregister.chw.core.utils.Utils.passToolbarTitle; +import de.hdodenhof.circleimageview.CircleImageView; public class FamilyProfileActivity extends CoreFamilyProfileActivity { private BaseFamilyProfileDueFragment profileDueFragment; + @Override + public void setupViews() { + super.setupViews(); + + // Update profile border + CircleImageView profileView = findViewById(org.smartregister.chw.core.R.id.imageview_profile); + profileView.setBorderWidth(2); + + // add floating menu + familyFloatingMenu = new ChwFamilyFloatingMenu(this); + LinearLayout.LayoutParams linearLayoutParams = + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT); + familyFloatingMenu.setGravity(Gravity.BOTTOM | Gravity.RIGHT); + addContentView(familyFloatingMenu, linearLayoutParams); + familyFloatingMenu.setClickListener( + FloatingMenuListener.getInstance(this, presenter().familyBaseEntityId()) + ); + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); @@ -223,9 +250,4 @@ public void goToChildProfileActivity(CommonPersonObjectClient patient, Bundle bu intent.putExtra(org.smartregister.chw.anc.util.Constants.ANC_MEMBER_OBJECTS.MEMBER_PROFILE_OBJECT, memberObject); startActivity(intent); } - - @Override - public void setEventDate(String s) { - - } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/ChwFamilyFloatingMenu.java b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/ChwFamilyFloatingMenu.java new file mode 100644 index 0000000000..527b4455b0 --- /dev/null +++ b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/ChwFamilyFloatingMenu.java @@ -0,0 +1,32 @@ +package org.smartregister.chw.custom_view; + +import android.content.Context; +import android.view.View; + +import org.smartregister.chw.core.custom_views.FamilyFloatingMenu; + +public class ChwFamilyFloatingMenu extends FamilyFloatingMenu { + + private Flavor flavor = new FamilyFloatingMenuFlv(); + + public ChwFamilyFloatingMenu(Context context) { + super(context); + initUi(); + } + + @Override + public void initUi() { + flavor = new FamilyFloatingMenuFlv(); + super.initUi(); + } + + public void setCallLayoutVisibility() { + flavor.setCallLayoutVisibility(callLayout); + } + + + interface Flavor { + void setCallLayoutVisibility(View view); + } + +} diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultFamilyFloatingMenuFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultFamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..7694990cbf --- /dev/null +++ b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultFamilyFloatingMenuFlv.java @@ -0,0 +1,11 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class DefaultFamilyFloatingMenuFlv implements ChwFamilyFloatingMenu.Flavor { + + @Override + public void setCallLayoutVisibility(View view) { + view.setVisibility(View.VISIBLE); + } +} diff --git a/opensrp-chw/src/togo/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java b/opensrp-chw/src/togo/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java new file mode 100644 index 0000000000..18cfe97b27 --- /dev/null +++ b/opensrp-chw/src/togo/java/org/smartregister/chw/custom_view/FamilyFloatingMenuFlv.java @@ -0,0 +1,6 @@ +package org.smartregister.chw.custom_view; + +import android.view.View; + +public class FamilyFloatingMenuFlv extends DefaultFamilyFloatingMenuFlv { +} From 3036738b9f0290b5aef40f6b2fb384e2cc80c92a Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 1 Sep 2021 12:13:57 +0300 Subject: [PATCH 006/101] Clean up on branch --- opensrp-chw/google-services.json | 533 ------------------ .../src/lmh/res/layout/activity_login.xml | 2 - 2 files changed, 535 deletions(-) delete mode 100755 opensrp-chw/google-services.json diff --git a/opensrp-chw/google-services.json b/opensrp-chw/google-services.json deleted file mode 100755 index 276e11f7a7..0000000000 --- a/opensrp-chw/google-services.json +++ /dev/null @@ -1,533 +0,0 @@ -{ - "project_info": { - "project_number": "660700053041", - "firebase_url": "https://opensrp-production.firebaseio.com", - "project_id": "opensrp-production", - "storage_bucket": "opensrp-production.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:97e438dcfbb4acd2335f10", - "android_client_info": { - "package_name": "com.vijay.jsonwizard" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:724674edc53115c9335f10", - "android_client_info": { - "package_name": "org.smartregister.anc" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:10765ec82bfa2bca335f10", - "android_client_info": { - "package_name": "org.smartregister.chw" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:061090ac05eaac00335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.ba" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:21c6800c1c7ceaf6335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.chad" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:ab83358f3ed187ee335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.drc" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:99a5768b17d332e9335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.guinea" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:9510a3c9bf2de0d6335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.hf" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:719b69abb1fe5ca2335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.lmh" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:92db3a929633cfc4335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.miecd" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:9f0b81b71a73eef0335f10", - "android_client_info": { - "package_name": "org.smartregister.chw.togo" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:3ca8b0c59e657a7f335f10", - "android_client_info": { - "package_name": "org.smartregister.giz" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:ecf24af9d9bc830f335f10", - "android_client_info": { - "package_name": "org.smartregister.kip" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:0c2277c216b7bf3d335f10", - "android_client_info": { - "package_name": "org.smartregister.nativeform" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:90cb7e892b4fd2c7335f10", - "android_client_info": { - "package_name": "org.smartregister.path" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:3e4ab33eba6c035d335f10", - "android_client_info": { - "package_name": "org.smartregister.reveal" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:6190224faaf9083e335f10", - "android_client_info": { - "package_name": "org.smartregister.sample.fp" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:660700053041:android:069a3b159a5afcac", - "android_client_info": { - "package_name": "org.smartregister.wellnesspass" - } - }, - "oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCbfvDM4FK-vYBQHX_vJV7PzKNH9hcloGA" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "660700053041-2jjgtgu5kpbv9gui1en1058vqapjt84u.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/opensrp-chw/src/lmh/res/layout/activity_login.xml b/opensrp-chw/src/lmh/res/layout/activity_login.xml index 1cd8e9de37..168a27480d 100644 --- a/opensrp-chw/src/lmh/res/layout/activity_login.xml +++ b/opensrp-chw/src/lmh/res/layout/activity_login.xml @@ -83,7 +83,6 @@ android:imeOptions="actionNext" android:inputType="text" android:lines="1" - android:text="chaone" android:paddingLeft="10dp" android:textColor="#666666" android:textColorHint="#bfbfbf" @@ -101,7 +100,6 @@ android:background="@drawable/rounded_corner_edit_text_bg" android:cursorVisible="true" android:ems="10" - android:text="Lmh12345" android:hint="@string/password" android:imeActionId="@integer/login" android:inputType="textPassword" From c819869687e75bb2e4e52afe40404c0ba05a02bf Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 1 Sep 2021 16:05:51 +0300 Subject: [PATCH 007/101] Removes french Language switcher option --- .../chw/custom_view/NavigationMenuFlv.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/NavigationMenuFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/NavigationMenuFlv.java index 2615013bb8..443be8ac93 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/NavigationMenuFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/custom_view/NavigationMenuFlv.java @@ -1,6 +1,23 @@ package org.smartregister.chw.custom_view; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.Arrays; +import java.util.List; +import java.util.Locale; + public class NavigationMenuFlv extends DefaultNavigationMenuFlv { + + @Override + public List> getSupportedLanguages() { + return Arrays.asList(Pair.of("English", Locale.ENGLISH)); + } + + @Override + public boolean hasMultipleLanguages() { + return false; + } + @Override public boolean hasCommunityResponders() { return false; From 08aca36d53a26fbcef42e9a35e3fd325e701a4f2 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 1 Sep 2021 17:33:06 +0300 Subject: [PATCH 008/101] Removes french Language switcher option --- .../chw/custom_view/DefaultNavigationMenuFlv.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultNavigationMenuFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultNavigationMenuFlv.java index 6699180c2b..4265a05e3c 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultNavigationMenuFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/custom_view/DefaultNavigationMenuFlv.java @@ -32,7 +32,6 @@ public boolean hasServiceReport() { return false; } - @Override public Intent getStockReportIntent(Activity activity) { return null; @@ -58,4 +57,8 @@ public Intent getHIA2ReportActivityIntent(Activity activity) { return null; } + @Override + public boolean hasMultipleLanguages() { + return true; + } } From 3c07f39d255a9eec93db3a4390b53dbdc1a7fe17 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Thu, 2 Sep 2021 14:26:06 +0300 Subject: [PATCH 009/101] Fix Action text for children over 5 --- .../chw/actionhelper/ImmunizationActionHelper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java index 1024264f93..118eb02124 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java @@ -26,6 +26,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -48,7 +49,12 @@ public class ImmunizationActionHelper implements BaseAncHomeVisitAction.AncHomeV public ImmunizationActionHelper(Context context, List wrappers) { this.context = context; this.wrappers = wrappers; - List repo = VaccineRepo.getVaccines(CoreConstants.SERVICE_GROUPS.CHILD); + List serviceGroups = Arrays.asList(CoreConstants.SERVICE_GROUPS.CHILD, org.smartregister.chw.util.Constants.CHILD_OVER_5); + List repo = new ArrayList<>(); + for (String serviceGroup : serviceGroups) { + List childrenRepo = VaccineRepo.getVaccines(serviceGroup); + repo.addAll(childrenRepo); + } for (VaccineRepo.Vaccine v : repo) { vaccineMap.put(v.display().toLowerCase().replace(" ", "_"), v); } @@ -95,7 +101,7 @@ public void onPayloadReceived(String jsonPayload) { notDoneVaccines.clear(); completedVaccines.clear(); - if(jsonPayload == null) return; + if (jsonPayload == null) return; JSONObject jsonObject = new JSONObject(jsonPayload); From 752343a56a0406b7bc2ba59e9ddb5ce5bdff16e2 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Thu, 2 Sep 2021 17:21:42 +0300 Subject: [PATCH 010/101] Fixes the Child Registration Edit Text for LMH --- .../chw/activity/ChildProfileActivityFlv.java | 5 +++++ .../activity/AboveFiveChildProfileActivity.java | 4 ++++ .../chw/activity/ChildProfileActivity.java | 16 +++++++++++++++- .../activity/DefaultChildProfileActivityFlv.java | 6 ++++++ opensrp-chw/src/main/res/values/strings.xml | 3 +++ 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/ChildProfileActivityFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/ChildProfileActivityFlv.java index 6c7e72629d..5c43c7ef4b 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/ChildProfileActivityFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/activity/ChildProfileActivityFlv.java @@ -53,4 +53,9 @@ public void setVaccineHistoryView(String days, RelativeLayout layoutVaccineHisto public String getToolbarTitleName(MemberObject memberObject) { return memberObject.getFamilyName(); } + + @Override + public boolean usesEligibleChildText(){ + return true; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java index 229eb4e398..a4544bd484 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java @@ -104,6 +104,10 @@ public boolean onOptionsItemSelected(MenuItem item) { , ((AboveFiveChildProfilePresenter) presenter()).getFamilyHeadID(), ((AboveFiveChildProfilePresenter) presenter()).getPrimaryCareGiverID(), ChildRegisterActivity.class.getCanonicalName()); return true; + + case R.id.action_registration: + presenter().startFormForEdit(getString(R.string.edit_eligible_child_form_title, memberObject.getFirstName()), presenter().getChildClient()); + return true; default: break; } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java index 343a88bdb1..5de845d194 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java @@ -144,6 +144,15 @@ public void updateHasPhone(boolean hasPhone) { } } + private String getEligibleChildString(){ + if(flavor.usesEligibleChildText()){ + return getString(R.string.edit_eligible_child_form_title, memberObject.getFirstName()); + } + else { + return getString(org.smartregister.chw.core.R.string.edit_child_form_title, memberObject.getFirstName()); + } + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { @@ -154,8 +163,11 @@ public boolean onOptionsItemSelected(MenuItem item) { IndividualProfileRemoveActivity.startIndividualProfileActivity(ChildProfileActivity.this, presenter().getChildClient(), ((ChildProfilePresenter) presenter()).getFamilyID() , ((ChildProfilePresenter) presenter()).getFamilyHeadID(), ((ChildProfilePresenter) presenter()).getPrimaryCareGiverID(), ChildRegisterActivity.class.getCanonicalName()); - return true; + case R.id.action_registration: + presenter().startFormForEdit(getEligibleChildString(), presenter().getChildClient()); + return true; + default: break; } @@ -290,5 +302,7 @@ public interface Flavor { void setVaccineHistoryView(String days, RelativeLayout layoutVaccineHistoryRow, View viewVaccineHistoryRow, Context context); String getToolbarTitleName(MemberObject memberObject); + + boolean usesEligibleChildText(); } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/DefaultChildProfileActivityFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/DefaultChildProfileActivityFlv.java index a992e58480..9636cc2052 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/DefaultChildProfileActivityFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/DefaultChildProfileActivityFlv.java @@ -99,4 +99,10 @@ public void setVaccineHistoryView(String days, RelativeLayout layoutVaccineHisto public String getToolbarTitleName(MemberObject memberObject) { return memberObject.getFirstName(); } + + @Override + public boolean usesEligibleChildText(){ + return false; + } + } diff --git a/opensrp-chw/src/main/res/values/strings.xml b/opensrp-chw/src/main/res/values/strings.xml index 9a3f54abf6..0e6c3811f7 100644 --- a/opensrp-chw/src/main/res/values/strings.xml +++ b/opensrp-chw/src/main/res/values/strings.xml @@ -411,4 +411,7 @@ Family has nothing else due + + Edit eligible child %1$s\'s details + From a761a313b346c31e79a56187b19d541cf39742af Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Thu, 9 Sep 2021 12:14:04 +0300 Subject: [PATCH 011/101] Lmh show error on click of next in register family member form --- opensrp-chw/src/lmh/assets/json.form/family_register.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-chw/src/lmh/assets/json.form/family_register.json b/opensrp-chw/src/lmh/assets/json.form/family_register.json index 86eaed5248..a29d343916 100644 --- a/opensrp-chw/src/lmh/assets/json.form/family_register.json +++ b/opensrp-chw/src/lmh/assets/json.form/family_register.json @@ -1,5 +1,5 @@ { - "validate_on_submit": true, + "validate_on_submit": false, "show_errors_on_submit": false, "count": "2", "encounter_type": "Family Registration", From 65d0e1ca7e649216e987580d8d3656ffd59cf5f3 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Mon, 13 Sep 2021 14:45:35 +0300 Subject: [PATCH 012/101] lmh edit confirmation text cancel on edit --- opensrp-chw/src/lmh/res/values/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/opensrp-chw/src/lmh/res/values/strings.xml b/opensrp-chw/src/lmh/res/values/strings.xml index d311aa9ac6..00e11fd350 100644 --- a/opensrp-chw/src/lmh/res/values/strings.xml +++ b/opensrp-chw/src/lmh/res/values/strings.xml @@ -24,4 +24,5 @@ Rota %s adults and %s U11 children + Are you sure you want to go back? All data you have entered in this form will be cleared. \ No newline at end of file From c9a067c23907204dc7fa52e020b6b2c066b041e7 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Mon, 13 Sep 2021 18:58:35 +0300 Subject: [PATCH 013/101] Add Vaccine card for children under age of 5 --- .../chw/interactor/ChildHomeVisitInteractorFlv.java | 12 ++++++++---- .../DefaultChildHomeVisitInteractorFlv.java | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/interactor/ChildHomeVisitInteractorFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/interactor/ChildHomeVisitInteractorFlv.java index 2d9a84ea4d..5a1c82021d 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/interactor/ChildHomeVisitInteractorFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/interactor/ChildHomeVisitInteractorFlv.java @@ -15,11 +15,10 @@ public class ChildHomeVisitInteractorFlv extends DefaultChildHomeVisitInteractor protected int immunizationCeiling() { String gender = ChwChildDao.getChildGender(memberObject.getBaseEntityId()); - if(gender != null && gender.equalsIgnoreCase("Female")){ - if(memberObject.getAge() >= 9 && memberObject.getAge() <= 11) { + if (gender != null && gender.equalsIgnoreCase("Female")) { + if (memberObject.getAge() >= 9 && memberObject.getAge() <= 11) { return 132; - } - else { + } else { return 60; } } @@ -39,4 +38,9 @@ protected void bindEvents(Map serviceWrapperMap) throws } } + @Override + protected int vaccineCardCeiling() { + return 60; + } + } \ No newline at end of file diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java index 4e6e8ad290..5b062e7511 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java @@ -204,9 +204,14 @@ protected int immunizationCeiling() { return 24; } + protected int vaccineCardCeiling() { + return 24; + } + + protected void evaluateChildVaccineCard() throws Exception { // expires after 24 months. verify that vaccine card is not received - if (!new LocalDate().isAfter(new LocalDate(dob).plusMonths(24)) && !vaccineCardReceived) { + if (!new LocalDate().isAfter(new LocalDate(dob).plusMonths(vaccineCardCeiling())) && !vaccineCardReceived) { Map> details = getDetails(Constants.EventType.CHILD_VACCINE_CARD_RECEIVED); BaseAncHomeVisitAction vaccine_card = getBuilder(context.getString(R.string.vaccine_card_title)) From 529df0f36d6fc0df096c34d6f51b8f9f71b9f9a4 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Fri, 17 Sep 2021 14:58:38 +0300 Subject: [PATCH 014/101] Removes due today services for boys ages 9-10 --- .../chw/activity/AboveFiveChildProfileActivity.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java index a4544bd484..91729c341e 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java @@ -1,5 +1,7 @@ package org.smartregister.chw.activity; +import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM; + import android.app.Activity; import android.content.Intent; import android.view.Gravity; @@ -24,8 +26,6 @@ import java.util.Date; import java.util.List; -import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM; - public class AboveFiveChildProfileActivity extends CoreAboveFiveChildProfileActivity { public FamilyMemberFloatingMenu familyFloatingMenu; private List referralTypeModels = new ArrayList<>(); @@ -163,4 +163,10 @@ private void addChildReferralTypes() { } } + @Override + public void setDueTodayServices() { + layoutServiceDueRow.setVisibility(View.GONE); + textViewDueToday.setVisibility(View.GONE); + } + } From b62056db1377e85adb0de5084a2a5afef602b24a Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Fri, 17 Sep 2021 19:44:44 +0300 Subject: [PATCH 015/101] Remove vaccinations due screen when none are due --- .../smartregister/chw/activity/ChildProfileActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java index 5de845d194..99fec72381 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java @@ -18,6 +18,7 @@ import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.core.activity.CoreChildProfileActivity; +import org.smartregister.chw.core.activity.CoreFamilyRegisterActivity; import org.smartregister.chw.core.adapter.NotificationListAdapter; import org.smartregister.chw.core.listener.OnClickFloatingMenu; import org.smartregister.chw.core.listener.OnRetrieveNotifications; @@ -156,6 +157,11 @@ private String getEligibleChildString(){ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case android.R.id.home: + Intent intent = new Intent(this, ChildRegisterActivity.class); + startActivity(intent); + finish(); + return true; case R.id.action_malaria_registration: MalariaRegisterActivity.startMalariaRegistrationActivity(ChildProfileActivity.this, presenter().getChildClient().getCaseId(), ((ChildProfilePresenter) presenter()).getFamilyID()); return true; From c432e91fe95cfae223971ec307941c011764f8c6 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Mon, 20 Sep 2021 12:29:08 +0300 Subject: [PATCH 016/101] set BCG cutoff max-age of 1 year --- opensrp-chw/src/lmh/assets/vaccines.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opensrp-chw/src/lmh/assets/vaccines.json b/opensrp-chw/src/lmh/assets/vaccines.json index db3e82e5bf..51e6bb4559 100644 --- a/opensrp-chw/src/lmh/assets/vaccines.json +++ b/opensrp-chw/src/lmh/assets/vaccines.json @@ -53,13 +53,13 @@ { "reference": "dob", "offset": "+0d", - "window": "+5y" + "window": "+1y" } ], "expiry": [ { "reference": "dob", - "offset": "+5y" + "offset": "+1y" } ] } From 50ccf9a5f95c49a2cff1ab3a734027fdcc55fb23 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Mon, 20 Sep 2021 12:30:32 +0300 Subject: [PATCH 017/101] Fix period in between DOB and todays date --- .../chw/activity/FamilyProfileActivity.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java index 05abe3d92b..48df34f921 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java @@ -35,6 +35,7 @@ import org.smartregister.chw.presenter.FamilyProfilePresenter; import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; +import org.smartregister.domain.FetchStatus; import org.smartregister.family.adapter.ViewPagerAdapter; import org.smartregister.family.fragment.BaseFamilyProfileDueFragment; import org.smartregister.family.util.Constants; @@ -42,6 +43,8 @@ import org.smartregister.family.util.Utils; import org.smartregister.view.fragment.BaseRegisterFragment; +import java.time.LocalDate; +import java.time.Period; import java.util.HashMap; import de.hdodenhof.circleimageview.CircleImageView; @@ -225,8 +228,11 @@ private Intent getIntentForChildrenUnderFiveAndGirlsAgeNineToEleven(int age, Str private Intent getChildIntent(CommonPersonObjectClient patient) { String dobString = Utils.getValue(patient.getColumnmaps(), DBConstants.KEY.DOB, false); - - int age = (int) Math.floor(Days.daysBetween(new DateTime(dobString).toLocalDate(), new DateTime().toLocalDate()).getDays() / 365.4); + //Today's date + LocalDate today = LocalDate.now(); + LocalDate birthday = LocalDate.of(new DateTime(dobString).toLocalDate().getYear(), new DateTime(dobString).toLocalDate().getMonthOfYear(), new DateTime(dobString).toLocalDate().getDayOfMonth()); //Birth date + Period p = Period.between(birthday, today); + int age = p.getYears(); String gender = ChwChildDao.getChildGender(patient.entityId()); if (ChwApplication.getApplicationFlavor().showChildrenUnderFiveAndGirlsAgeNineToEleven()) { From 389c87fb955dd3c9b24cdf9f7fd5eb452a366b8b Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 22 Sep 2021 17:40:13 +0300 Subject: [PATCH 018/101] Removes unuused imports --- .../chw/activity/ChildProfileActivity.java | 22 +++++++++---------- .../chw/activity/FamilyProfileActivity.java | 2 -- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java index 99fec72381..e0ae79b165 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java @@ -1,5 +1,12 @@ package org.smartregister.chw.activity; +import static org.smartregister.chw.anc.util.Constants.ANC_MEMBER_OBJECTS.MEMBER_PROFILE_OBJECT; +import static org.smartregister.chw.core.utils.Utils.updateToolbarTitle; +import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM; +import static org.smartregister.chw.util.NotificationsUtil.handleNotificationRowClick; +import static org.smartregister.chw.util.NotificationsUtil.handleReceivedNotifications; +import static org.smartregister.opd.utils.OpdConstants.DateFormat.YYYY_MM_DD; + import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -18,7 +25,6 @@ import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.core.activity.CoreChildProfileActivity; -import org.smartregister.chw.core.activity.CoreFamilyRegisterActivity; import org.smartregister.chw.core.adapter.NotificationListAdapter; import org.smartregister.chw.core.listener.OnClickFloatingMenu; import org.smartregister.chw.core.listener.OnRetrieveNotifications; @@ -38,13 +44,6 @@ import java.util.Date; import java.util.List; -import static org.smartregister.chw.anc.util.Constants.ANC_MEMBER_OBJECTS.MEMBER_PROFILE_OBJECT; -import static org.smartregister.chw.core.utils.Utils.updateToolbarTitle; -import static org.smartregister.chw.util.Constants.MALARIA_REFERRAL_FORM; -import static org.smartregister.chw.util.NotificationsUtil.handleNotificationRowClick; -import static org.smartregister.chw.util.NotificationsUtil.handleReceivedNotifications; -import static org.smartregister.opd.utils.OpdConstants.DateFormat.YYYY_MM_DD; - public class ChildProfileActivity extends CoreChildProfileActivity implements OnRetrieveNotifications { public FamilyMemberFloatingMenu familyFloatingMenu; private Flavor flavor = new ChildProfileActivityFlv(); @@ -145,11 +144,10 @@ public void updateHasPhone(boolean hasPhone) { } } - private String getEligibleChildString(){ - if(flavor.usesEligibleChildText()){ + private String getEligibleChildString() { + if (flavor.usesEligibleChildText()) { return getString(R.string.edit_eligible_child_form_title, memberObject.getFirstName()); - } - else { + } else { return getString(org.smartregister.chw.core.R.string.edit_child_form_title, memberObject.getFirstName()); } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java index 48df34f921..628bbcc938 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java @@ -13,7 +13,6 @@ import androidx.viewpager.widget.ViewPager; import org.joda.time.DateTime; -import org.joda.time.Days; import org.smartregister.chw.anc.activity.BaseAncMemberProfileActivity; import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.application.ChwApplication; @@ -35,7 +34,6 @@ import org.smartregister.chw.presenter.FamilyProfilePresenter; import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; -import org.smartregister.domain.FetchStatus; import org.smartregister.family.adapter.ViewPagerAdapter; import org.smartregister.family.fragment.BaseFamilyProfileDueFragment; import org.smartregister.family.util.Constants; From 9025c9fd01b20547becc0474574ba7c57260c3d6 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 22 Sep 2021 17:40:38 +0300 Subject: [PATCH 019/101] Add test --- .../activity/FamilyProfileActivityTest.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java index 29f2aff917..3f03838fd8 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java @@ -22,7 +22,9 @@ import org.robolectric.util.ReflectionHelpers; import org.smartregister.Context; import org.smartregister.CoreLibrary; +import org.smartregister.chw.R; import org.smartregister.chw.application.ChwApplication; +import org.smartregister.chw.core.custom_views.FamilyFloatingMenu; import org.smartregister.chw.core.utils.CoreConstants; import org.smartregister.chw.presenter.FamilyProfilePresenter; import org.smartregister.domain.FetchStatus; @@ -35,6 +37,8 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import de.hdodenhof.circleimageview.CircleImageView; + @RunWith(RobolectricTestRunner.class) @Config(application = ChwApplication.class, sdk = 22) public class FamilyProfileActivityTest { @@ -201,4 +205,24 @@ public void testRefreshMemberFragment() throws Exception { Mockito.verify(spyActivity).refreshMemberList(FetchStatus.fetched); } + + @Test + public void testSetupViews() { + activity = Mockito.spy(FamilyProfileActivity.class); + //TextView titleTv = Mockito.mock(TextView.class); + // ListView listView = Mockito.mock(ListView.class); + CircleImageView circleImageView = Mockito.mock(CircleImageView.class); + FamilyFloatingMenu familyFloatingMenu = Mockito.mock(FamilyFloatingMenu.class); + + ReflectionHelpers.setField(activity, "familyFloatingMenu", familyFloatingMenu); + + Mockito.doReturn(circleImageView).when(activity).findViewById(R.id.imageview_profile); + + // Mockito.doReturn(listView).when(activity).findViewById(R.id.lv_reportRegister_groupings); + // Mockito.doReturn(titleTv).when(activity).findViewById(R.id.title); + + activity.setupViews(); + + Mockito.verify(circleImageView).setBorderWidth(2); + } } From abbdcaa61f7bc1613bc58d8f3d8df46518bda61f Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Sun, 26 Sep 2021 21:13:44 +0300 Subject: [PATCH 020/101] Adds AboveFiveChildProfileActivyTest --- opensrp-chw/build.gradle | 16 +- .../AboveFiveChildProfileActivity.java | 5 + .../AboveFiveChildProfileActivityTest.java | 147 ++++++++++++++++-- 3 files changed, 155 insertions(+), 13 deletions(-) diff --git a/opensrp-chw/build.gradle b/opensrp-chw/build.gradle index dd27d58362..8416ebf69f 100644 --- a/opensrp-chw/build.gradle +++ b/opensrp-chw/build.gradle @@ -165,9 +165,9 @@ android { returnDefaultValues = true includeAndroidResources = true } + unitTests.all { - systemProperty 'robolectric.enabledSdks', '28' - jvmArgs '-noverify' + jvmArgs "-Xmx3g" } } @@ -302,7 +302,7 @@ android { dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' - implementation('org.smartregister:opensrp-client-chw-core:1.5.25-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-chw-core:1.5.25-LMH-Beta-01-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'androidx.legacy', module: 'legacy-support-v4' @@ -311,6 +311,7 @@ dependencies { exclude group: 'com.google.guava', module: 'guava' exclude group: 'com.rengwuxian.materialedittext', module: 'library' exclude group: 'com.ibm.fhir', module: 'fhir-path' + exclude group: 'com.ibm.fhir', module: 'fhir-model' } implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.1.0' @@ -343,8 +344,15 @@ dependencies { testImplementation 'org.robolectric:shadows-multidex:4.3.1' testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2' testImplementation 'androidx.test:core:1.3.0' - // testImplementation 'com.ibm.fhir:fhir-model:4.7.0' + // testImplementation 'com.ibm.fhir:fhir-model:4.7.0' // testImplementation 'com.ibm.fhir:fhir-path:4.7.0' + + // unit test + def powerMockVersion = '2.0.7' + testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion" + testImplementation "org.powermock:powermock-module-junit4-rule:$powerMockVersion" + testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion" + testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion" } def flavors = android.productFlavors.collect { flavor -> flavor.name } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java index 91729c341e..d1693f035c 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java @@ -144,7 +144,12 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { startActivity(intent); finish(); } + execute(); + } + + protected void execute(){ ChwScheduleTaskExecutor.getInstance().execute(memberObject.getBaseEntityId(), CoreConstants.EventType.CHILD_HOME_VISIT, new Date()); + } private void addChildReferralTypes() { diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/activity/AboveFiveChildProfileActivityTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/activity/AboveFiveChildProfileActivityTest.java index a2d0149cf8..f43a79e557 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/activity/AboveFiveChildProfileActivityTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/activity/AboveFiveChildProfileActivityTest.java @@ -1,27 +1,50 @@ package org.smartregister.chw.activity; +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; import android.view.View; +import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; +import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; +import org.robolectric.android.controller.ActivityController; import org.robolectric.annotation.Config; import org.robolectric.util.ReflectionHelpers; -import org.smartregister.chw.BaseActivityTest; +import org.smartregister.Context; +import org.smartregister.CoreLibrary; +import org.smartregister.chw.R; +import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.application.ChwApplication; +import org.smartregister.chw.core.utils.CoreConstants; +import org.smartregister.chw.presenter.AboveFiveChildProfilePresenter; import org.smartregister.helper.ImageRenderHelper; import de.hdodenhof.circleimageview.CircleImageView; @RunWith(RobolectricTestRunner.class) @Config(application = ChwApplication.class, sdk = 22) -public class AboveFiveChildProfileActivityTest extends BaseActivityTest { +public class AboveFiveChildProfileActivityTest { + @Rule + public MockitoRule rule = MockitoJUnit.rule(); + + private AboveFiveChildProfileActivity activity; + private ActivityController controller; @Mock private RelativeLayout layoutLastVisitRow; @@ -31,14 +54,31 @@ public class AboveFiveChildProfileActivityTest extends BaseActivityTest getActivityClass() { - return AboveFiveChildProfileActivity.class; + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + controller = Robolectric.buildActivity(AboveFiveChildProfileActivity.class).create().start(); + activity = controller.get(); + + + Context context = Context.getInstance(); + CoreLibrary.init(context); + + //Auto login by default + String password = "pwd"; + context.session().start(context.session().lengthInMilliseconds()); + context.configuration().getDrishtiApplication().setPassword(password); + context.session().setPassword(password); + + MockitoAnnotations.initMocks(this); + controller = Robolectric.buildActivity(AboveFiveChildProfileActivity.class); + + activity = controller.get(); } @Test public void setProfileImageBorderTest() { - AboveFiveChildProfileActivity spyActivity = Mockito.spy(getActivity()); + AboveFiveChildProfileActivity spyActivity = Mockito.spy(AboveFiveChildProfileActivity.class); CircleImageView imageView = Mockito.spy(new CircleImageView(RuntimeEnvironment.application)); ReflectionHelpers.setField(spyActivity, "imageViewProfile", imageView); ReflectionHelpers.setField(spyActivity, "imageRenderHelper", imageRenderHelper); @@ -49,7 +89,7 @@ public void setProfileImageBorderTest() { @Test public void setParentNameViewGone() { - AboveFiveChildProfileActivity spyActivity = Mockito.spy(getActivity()); + AboveFiveChildProfileActivity spyActivity = Mockito.spy(AboveFiveChildProfileActivity.class); TextView textView = Mockito.spy(new TextView(RuntimeEnvironment.application)); ReflectionHelpers.setField(spyActivity, "textViewParentName", textView); spyActivity.setParentName("sdfs"); @@ -58,7 +98,7 @@ public void setParentNameViewGone() { @Test public void setLastVisitRowGone() { - AboveFiveChildProfileActivity spyActivity = Mockito.spy(getActivity()); + AboveFiveChildProfileActivity spyActivity = Mockito.spy(AboveFiveChildProfileActivity.class); TextView textViewLastVisit = Mockito.spy(new TextView(RuntimeEnvironment.application)); TextView textViewMedicalHistory = Mockito.spy(new TextView(RuntimeEnvironment.application)); ReflectionHelpers.setField(spyActivity, "layoutLastVisitRow", layoutLastVisitRow); @@ -71,11 +111,100 @@ public void setLastVisitRowGone() { @Test public void goneRecordVisitPanel() throws Exception { - AboveFiveChildProfileActivity spyActivity = Mockito.spy(getActivity()); + AboveFiveChildProfileActivity spyActivity = Mockito.spy(AboveFiveChildProfileActivity.class); View recordVisitPanel = Mockito.spy(new View(RuntimeEnvironment.application)); ReflectionHelpers.setField(spyActivity, "recordVisitPanel", recordVisitPanel); ReflectionHelpers.callInstanceMethod(spyActivity, "invisibleRecordVisitPanel"); Assert.assertEquals(View.GONE, recordVisitPanel.getVisibility()); } + @Test + public void testOnClick() { + View view = Mockito.mock(View.class); + ReflectionHelpers.setField(activity, "progressBar", Mockito.mock(ProgressBar.class)); + ReflectionHelpers.setField(activity, "tvEdit", Mockito.mock(TextView.class)); + + activity = Mockito.spy(activity); + AboveFiveChildProfilePresenter presenter = Mockito.mock(AboveFiveChildProfilePresenter.class); + Mockito.doReturn(presenter).when(activity).presenter(); + + // visit not done + Mockito.doReturn(org.smartregister.chw.core.R.id.textview_visit_not).when(view).getId(); + activity.onClick(view); + Mockito.verify(presenter).updateVisitNotDone(Mockito.anyLong()); + + // visit done + Mockito.doReturn(org.smartregister.chw.core.R.id.textview_undo).when(view).getId(); + activity.onClick(view); + Mockito.verify(presenter).updateVisitNotDone(0); + + Mockito.doReturn(org.smartregister.chw.core.R.id.family_has_row).when(view).getId(); + activity.onClick(view); + + ArgumentCaptor intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); + Mockito.verify(activity).startActivity(intentArgumentCaptor.capture()); + } + + + @Test + public void testOnActivityResult() throws Exception { + activity = Mockito.spy(activity); + AboveFiveChildProfilePresenter presenter = Mockito.mock(AboveFiveChildProfilePresenter.class); + Mockito.doReturn(presenter).when(activity).presenter(); + + int resultCode = Activity.RESULT_OK; + Intent data = Mockito.mock(Intent.class); + Bundle bundle = new Bundle(); + data.putExtras(data.getExtras()); + Mockito.doReturn(data).when(activity).getIntent(); + Mockito.doReturn(bundle).when(data).getExtras(); + + Mockito.doNothing().when(activity).execute(); + + + activity.onActivityResult(CoreConstants.ProfileActivityResults.CHANGE_COMPLETED, resultCode, data); + Mockito.verify(activity, Mockito.times(3)).finish(); + } + + @Test + public void testOnOptionsItemSelected() { + activity = Mockito.spy(activity); + AboveFiveChildProfilePresenter presenter = Mockito.mock(AboveFiveChildProfilePresenter.class); + Mockito.doReturn(presenter).when(activity).presenter(); + ReflectionHelpers.setField(activity, "memberObject", Mockito.mock(MemberObject.class)); + + + MenuItem item = Mockito.mock(MenuItem.class); + Mockito.doReturn(R.id.action_registration).when(item).getItemId(); + activity.onOptionsItemSelected(item); + Mockito.verify(presenter).startFormForEdit(Mockito.any(), Mockito.any()); + + Mockito.doReturn(android.R.id.home).when(item).getItemId(); + activity.onOptionsItemSelected(item); + Mockito.verify(activity).onBackPressed(); + + Mockito.doReturn(org.smartregister.chw.core.R.id.action_sick_child_form).when(item).getItemId(); + activity.onOptionsItemSelected(item); + Mockito.verify(presenter).startSickChildForm(Mockito.any()); + } + + + @Test + public void testInitializePresenter() { + activity.initializePresenter(); + Assert.assertNotNull(ReflectionHelpers.getField(activity, "presenter")); + } + + @Test + public void testSetDueTodayServices() { + activity = Mockito.spy(activity); + RelativeLayout relativeLayout = Mockito.spy(new RelativeLayout(RuntimeEnvironment.application)); + TextView textView = Mockito.spy(new TextView(RuntimeEnvironment.application)); + ReflectionHelpers.setField(activity, "layoutServiceDueRow", relativeLayout); + ReflectionHelpers.setField(activity, "textViewDueToday", textView); + activity.setDueTodayServices(); + Mockito.verify(relativeLayout).setVisibility(View.GONE); + Mockito.verify(textView).setVisibility(View.GONE); + } + } From 22dfbc973baf4474e8e6b9563000b5ee89c8687f Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Tue, 28 Sep 2021 15:27:59 +0300 Subject: [PATCH 021/101] Fix vaccine date due date on home visit --- .../BaseHomeVisitImmunizationFragmentFlv.java | 11 ++++++ .../ImmunizationActionHelper.java | 34 +++++++++++++++---- .../actionhelper/ImmunizationValidator.java | 1 + .../DefaultChildHomeVisitInteractorFlv.java | 4 ++- .../DefaultPncHomeVisitInteractorFlv.java | 8 ++++- .../activity/FamilyProfileActivityTest.java | 24 ------------- 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java index f1a505d05d..4111f3a5d9 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/fragment/BaseHomeVisitImmunizationFragmentFlv.java @@ -11,6 +11,7 @@ import org.smartregister.chw.anc.domain.VisitDetail; import org.smartregister.chw.anc.util.JsonFormUtils; import org.smartregister.chw.anc.util.NCUtils; +import org.smartregister.immunization.domain.VaccineWrapper; import org.smartregister.util.DatePickerUtils; import java.util.List; @@ -18,6 +19,8 @@ public class BaseHomeVisitImmunizationFragmentFlv extends DefaultBaseHomeVisitImmunizationFragment { + private List vaccineWrappers; + public static BaseHomeVisitImmunizationFragmentFlv getInstance(final BaseAncHomeVisitContract.VisitView view, String baseEntityID, Map> details, List vaccineDisplays) { return getInstance(view, baseEntityID, details, vaccineDisplays, true); } @@ -45,4 +48,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat DatePickerUtils.themeDatePicker(singleDatePicker, new char[]{'d', 'm', 'y'}); super.onViewCreated(view, savedInstanceState); } + + public void setVaccineWrappers(List vaccineWrappers) { + this.vaccineWrappers = vaccineWrappers; + } + + public List getVaccineWrappers() { + return vaccineWrappers; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java index 118eb02124..f3b7d68555 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationActionHelper.java @@ -2,6 +2,8 @@ import android.content.Context; +import androidx.core.util.Supplier; + import com.vijay.jsonwizard.constants.JsonFormConstants; import org.joda.time.LocalDate; @@ -37,8 +39,7 @@ public class ImmunizationActionHelper implements BaseAncHomeVisitAction.AncHomeVisitActionHelper { private Context context; - private List wrappers; - private LocalDate dueDate; + private Supplier> vaccineSupplier; private AlertStatus status; private List keys = new ArrayList<>(); @@ -46,9 +47,9 @@ public class ImmunizationActionHelper implements BaseAncHomeVisitAction.AncHomeV private List notDoneVaccines = new ArrayList<>(); private Map vaccineMap = new HashMap<>(); - public ImmunizationActionHelper(Context context, List wrappers) { + public ImmunizationActionHelper(Context context, Supplier> vaccineSupplier) { this.context = context; - this.wrappers = wrappers; + this.vaccineSupplier = vaccineSupplier; List serviceGroups = Arrays.asList(CoreConstants.SERVICE_GROUPS.CHILD, org.smartregister.chw.util.Constants.CHILD_OVER_5); List repo = new ArrayList<>(); for (String serviceGroup : serviceGroups) { @@ -65,7 +66,7 @@ private void initialize() { LocalDate dueDate = null; AlertStatus myStatus = null; - for (VaccineWrapper vaccineWrapper : wrappers) { + for (VaccineWrapper vaccineWrapper : vaccineSupplier.get()) { Alert alert = vaccineWrapper.getAlert(); if (myStatus == null || (alert != null && !alert.status().equals(AlertStatus.expired))) { @@ -81,10 +82,29 @@ private void initialize() { keys.add(NCUtils.removeSpaces(vaccineWrapper.getName())); } - this.dueDate = new LocalDate(dueDate); this.status = myStatus; } + private LocalDate getDueDate(){ + LocalDate dueDate = null; + AlertStatus myStatus = null; + + for (VaccineWrapper vaccineWrapper : vaccineSupplier.get()) { + Alert alert = vaccineWrapper.getAlert(); + + if (myStatus == null || (alert != null && !alert.status().equals(AlertStatus.expired))) { + myStatus = alert.status(); + } else if (alert != null && alert.status().equals(AlertStatus.urgent)) { + myStatus = alert.status(); + } + + if (dueDate == null) { + dueDate = new LocalDate(alert.startDate()); + } + } + return dueDate == null ? LocalDate.now() : dueDate; + } + @Override public void onJsonFormLoaded(String s, Context context, Map> map) { this.context = context; @@ -150,7 +170,7 @@ public String getPreProcessedSubTitle() { due = context.getString(R.string.overdue); } - return MessageFormat.format("{0} {1}", due, DateTimeFormat.forPattern("dd MMM yyyy").print(dueDate)); + return MessageFormat.format("{0} {1}", due, DateTimeFormat.forPattern("dd MMM yyyy").print(getDueDate())); } /** diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java index 798da170fc..13ba4f2ddb 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/actionhelper/ImmunizationValidator.java @@ -153,6 +153,7 @@ public void onChanged(String s) { List wrappers = VaccineScheduleUtil.recomputeSchedule(vaccineSchedules, anchorDate, vaccineGroup, allReceivedVaccines); List displays = generateDisplaysFromWrappers(wrappers, anchorDate.toDate()); + fragment.setVaccineWrappers(wrappers); // update the vaccines Map linkedHashMap = new LinkedHashMap<>(); diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java index 5b062e7511..46aa7a1b56 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultChildHomeVisitInteractorFlv.java @@ -4,6 +4,7 @@ import android.util.Pair; import androidx.annotation.VisibleForTesting; +import androidx.core.util.Supplier; import com.vijay.jsonwizard.constants.JsonFormConstants; @@ -272,6 +273,7 @@ protected void evaluateImmunization() throws Exception { fragment.setRelaxedDates(ChwApplication.getApplicationFlavor().relaxVisitDateRestrictions()); fragment.setMinimumDate(dob); } + fragment.setVaccineWrappers(wrappers); validator.addFragment(title, fragment, entry.getKey(), new DateTime(dob)); @@ -279,7 +281,7 @@ protected void evaluateImmunization() throws Exception { .withOptional(false) .withDetails(details) .withDestinationFragment(fragment) - .withHelper(new ImmunizationActionHelper(context, wrappers)) + .withHelper(new ImmunizationActionHelper(context, fragment::getVaccineWrappers)) .withDisabledMessage(context.getString(R.string.fill_earler_immunization)) .withValidator(validator) .build(); diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultPncHomeVisitInteractorFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultPncHomeVisitInteractorFlv.java index fc43c3d2be..02e69344a9 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultPncHomeVisitInteractorFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/interactor/DefaultPncHomeVisitInteractorFlv.java @@ -3,6 +3,7 @@ import android.content.Context; import androidx.annotation.VisibleForTesting; +import androidx.core.util.Supplier; import com.vijay.jsonwizard.constants.JsonFormConstants; @@ -290,7 +291,12 @@ protected void evaluateImmunization(Person baby) throws Exception { .withBaseEntityID(baby.getBaseEntityID()) .withProcessingMode(BaseAncHomeVisitAction.ProcessingMode.SEPARATE) .withDestinationFragment(BaseHomeVisitImmunizationFragment.getInstance(view, baby.getBaseEntityID(), details, displays)) - .withHelper(new ImmunizationActionHelper(context, wrappers)) + .withHelper(new ImmunizationActionHelper(context, new Supplier>() { + @Override + public List get() { + return wrappers; + } + })) .build(); actionList.put(MessageFormat.format(context.getString(R.string.pnc_immunization_at_birth), baby.getFullName()), action); } diff --git a/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java b/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java index 3f03838fd8..29f2aff917 100644 --- a/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java +++ b/opensrp-chw/src/test/java/org/smartregister/chw/activity/FamilyProfileActivityTest.java @@ -22,9 +22,7 @@ import org.robolectric.util.ReflectionHelpers; import org.smartregister.Context; import org.smartregister.CoreLibrary; -import org.smartregister.chw.R; import org.smartregister.chw.application.ChwApplication; -import org.smartregister.chw.core.custom_views.FamilyFloatingMenu; import org.smartregister.chw.core.utils.CoreConstants; import org.smartregister.chw.presenter.FamilyProfilePresenter; import org.smartregister.domain.FetchStatus; @@ -37,8 +35,6 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import de.hdodenhof.circleimageview.CircleImageView; - @RunWith(RobolectricTestRunner.class) @Config(application = ChwApplication.class, sdk = 22) public class FamilyProfileActivityTest { @@ -205,24 +201,4 @@ public void testRefreshMemberFragment() throws Exception { Mockito.verify(spyActivity).refreshMemberList(FetchStatus.fetched); } - - @Test - public void testSetupViews() { - activity = Mockito.spy(FamilyProfileActivity.class); - //TextView titleTv = Mockito.mock(TextView.class); - // ListView listView = Mockito.mock(ListView.class); - CircleImageView circleImageView = Mockito.mock(CircleImageView.class); - FamilyFloatingMenu familyFloatingMenu = Mockito.mock(FamilyFloatingMenu.class); - - ReflectionHelpers.setField(activity, "familyFloatingMenu", familyFloatingMenu); - - Mockito.doReturn(circleImageView).when(activity).findViewById(R.id.imageview_profile); - - // Mockito.doReturn(listView).when(activity).findViewById(R.id.lv_reportRegister_groupings); - // Mockito.doReturn(titleTv).when(activity).findViewById(R.id.title); - - activity.setupViews(); - - Mockito.verify(circleImageView).setBorderWidth(2); - } } From 7c42c15e4be46f55ac146d57aeb9388aea01fb20 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 29 Sep 2021 09:46:45 +0300 Subject: [PATCH 022/101] Changes All Children Text. Changes Sex on reister family member to radio button --- .../lmh/assets/json.form/family_register.json | 17 ++++++++++++----- .../chw/application/ChwApplicationFlv.java | 7 ++++++- .../chw/model/NavigationModelFlv.java | 2 +- opensrp-chw/src/lmh/res/values/strings.xml | 2 ++ .../chw/application/ChwApplication.java | 2 ++ .../application/DefaultChwApplicationFlv.java | 5 +++++ .../chw/fragment/ChildRegisterFragment.java | 14 ++++++++++++-- 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/opensrp-chw/src/lmh/assets/json.form/family_register.json b/opensrp-chw/src/lmh/assets/json.form/family_register.json index a29d343916..0fae48d1c9 100644 --- a/opensrp-chw/src/lmh/assets/json.form/family_register.json +++ b/opensrp-chw/src/lmh/assets/json.form/family_register.json @@ -258,14 +258,21 @@ "openmrs_entity_parent": "", "openmrs_entity": "person", "openmrs_entity_id": "gender", - "type": "spinner", + "type": "native_radio", + "label": "Sex", "hint": "Sex", - "values": [ - "Male", - "Female" + "options": [ + { + "key": "Male", + "text": "Male" + }, + { + "key": "Female", + "text": "Female" + } ], "v_required": { - "value": "true", + "value": true, "err": "Please enter the sex" } } diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index 071e41b4ce..d39962e13e 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -93,7 +93,7 @@ public boolean showChildrenUnder5() { @Override public boolean launchChildClientsAtLogin() { - return true; + return false; } @Override @@ -156,4 +156,9 @@ public boolean showChildrenAboveTwoDueStatus(){ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return true; } + + @Override + public boolean useAllChildrenTitle(){ + return true; + } } diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/model/NavigationModelFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/model/NavigationModelFlv.java index 13618faf6d..159d18c5c6 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/model/NavigationModelFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/model/NavigationModelFlv.java @@ -16,7 +16,7 @@ public List getNavigationItems() { if (navigationOptions.size() == 0) { navigationOptions.add(new NavigationOption(R.mipmap.sidemenu_families, R.mipmap.sidemenu_families_active, R.string.menu_all_families, Constants.DrawerMenu.ALL_FAMILIES, 0)); - navigationOptions.add(new NavigationOption(R.mipmap.sidemenu_children, R.mipmap.sidemenu_children_active, R.string.menu_child_clients, Constants.DrawerMenu.CHILD_CLIENTS, 0)); + navigationOptions.add(new NavigationOption(R.mipmap.sidemenu_children, R.mipmap.sidemenu_children_active, R.string.all_children_title, Constants.DrawerMenu.CHILD_CLIENTS, 0)); } return navigationOptions; diff --git a/opensrp-chw/src/lmh/res/values/strings.xml b/opensrp-chw/src/lmh/res/values/strings.xml index 00e11fd350..d86650eb94 100644 --- a/opensrp-chw/src/lmh/res/values/strings.xml +++ b/opensrp-chw/src/lmh/res/values/strings.xml @@ -25,4 +25,6 @@ %s adults and %s U11 children Are you sure you want to go back? All data you have entered in this form will be cleared. + Syncing records... + All Children \ No newline at end of file diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java index 3d3b62a00b..7f61139741 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java @@ -438,6 +438,8 @@ public interface Flavor { boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(); + boolean useAllChildrenTitle(); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java index 06e6dae369..80fe38badf 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java @@ -216,4 +216,9 @@ public boolean showLastNameOnChildProfile() { public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return false; } + + @Override + public boolean useAllChildrenTitle(){ + return false; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java index 75e8208061..3f63010708 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ChildRegisterFragment.java @@ -1,5 +1,7 @@ package org.smartregister.chw.fragment; +import static org.smartregister.chw.core.utils.ChildDBConstants.KEY.FAMILY_LAST_NAME; + import org.smartregister.chw.R; import org.smartregister.chw.activity.ChildHomeVisitActivity; import org.smartregister.chw.activity.ChildProfileActivity; @@ -19,8 +21,6 @@ import timber.log.Timber; -import static org.smartregister.chw.core.utils.ChildDBConstants.KEY.FAMILY_LAST_NAME; - public class ChildRegisterFragment extends CoreChildRegisterFragment { @Override @@ -73,4 +73,14 @@ public void setupViews(android.view.View view) { } } + @Override + protected int getToolBarTitle() { + if (!ChwApplication.getApplicationFlavor().useAllChildrenTitle()) { + return org.smartregister.chw.core.R.string.child_register_title; + } else { + return R.string.all_children_title; + } + } + + } From b6c2f84a86635369aef9a25d147ba439732726f6 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Wed, 29 Sep 2021 15:46:29 +0300 Subject: [PATCH 023/101] Removes due only toggle button from family register --- .../chw/application/ChwApplicationFlv.java | 5 +++++ .../chw/application/ChwApplication.java | 2 ++ .../application/DefaultChwApplicationFlv.java | 5 +++++ .../chw/fragment/FamilyRegisterFragment.java | 19 +++++++++++++++---- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index d39962e13e..6391a64be4 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -161,4 +161,9 @@ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ public boolean useAllChildrenTitle(){ return true; } + + @Override + public boolean showDueFilterToggle(){ + return false; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java index 7f61139741..bbd3a61032 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java @@ -440,6 +440,8 @@ public interface Flavor { boolean useAllChildrenTitle(); + boolean showDueFilterToggle(); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java index 80fe38badf..03f1f67a3a 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java @@ -221,4 +221,9 @@ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ public boolean useAllChildrenTitle(){ return false; } + + @Override + public boolean showDueFilterToggle(){ + return true; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/FamilyRegisterFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/FamilyRegisterFragment.java index c6a2325707..434e9688d2 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/FamilyRegisterFragment.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/FamilyRegisterFragment.java @@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils; import org.smartregister.chw.R; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.core.fragment.CoreFamilyRegisterFragment; import org.smartregister.chw.core.provider.CoreRegisterProvider; import org.smartregister.chw.core.utils.CoreConstants; @@ -52,11 +53,21 @@ protected String dueFilterAndSortQuery() { return query; } - private String getFilterString(String filters){ - if(StringUtils.isBlank(filters)) + private String getFilterString(String filters) { + if (StringUtils.isBlank(filters)) return ""; - return " and (" + CoreConstants.TABLE_NAME.FAMILY + "." + DBConstants.KEY.FIRST_NAME + " like '%" + filters + "%' or " - + CoreConstants.TABLE_NAME.FAMILY + "." + DBConstants.KEY.LAST_NAME + " like '%" + filters + "%')"; + return " and (" + CoreConstants.TABLE_NAME.FAMILY + "." + DBConstants.KEY.FIRST_NAME + " like '%" + filters + "%' or " + + CoreConstants.TABLE_NAME.FAMILY + "." + DBConstants.KEY.LAST_NAME + " like '%" + filters + "%')"; + } + + @Override + public void setupViews(View view) { + super.setupViews(view); + if (ChwApplication.getApplicationFlavor().showDueFilterToggle()) { + dueOnlyLayout.setVisibility(View.VISIBLE); + } else { + dueOnlyLayout.setVisibility(View.GONE); + } } } From 678ccc8f3cc8087253f4d67aab2ea5a481a117e3 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Thu, 30 Sep 2021 12:22:21 +0300 Subject: [PATCH 024/101] add descriptions for report labels --- .../chw/application/ChwApplicationFlv.java | 10 ++++ .../drawable/ic_navigate_next_grey_24dp.xml | 9 +++ .../lmh/res/layout/reports_fragment_item.xml | 49 ++++++++++++++++ opensrp-chw/src/lmh/res/values/strings.xml | 4 ++ .../chw/application/ChwApplication.java | 4 ++ .../application/DefaultChwApplicationFlv.java | 10 ++++ .../smartregister/chw/domain/ReportType.java | 19 ++++++- .../chw/fragment/ReportsFragment.java | 20 +++++-- .../chw/viewholder/ReportViewHolder.java | 11 ++++ .../drawable/ic_navigate_next_black_24dp.xml | 10 ++-- .../src/main/res/layout/reports_fragment.xml | 2 +- .../main/res/layout/reports_fragment_item.xml | 56 ++++++++++++++----- 12 files changed, 178 insertions(+), 26 deletions(-) create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml create mode 100644 opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index 071e41b4ce..2390e5d8b0 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -156,4 +156,14 @@ public boolean showChildrenAboveTwoDueStatus(){ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return true; } + + @Override + public boolean showReportsDescription() { + return true; + } + + @Override + public boolean showReportsDivider() { + return true; + } } diff --git a/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml new file mode 100644 index 0000000000..c809dbee8f --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml new file mode 100644 index 0000000000..7484b7756a --- /dev/null +++ b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + diff --git a/opensrp-chw/src/lmh/res/values/strings.xml b/opensrp-chw/src/lmh/res/values/strings.xml index 00e11fd350..f6df6d046d 100644 --- a/opensrp-chw/src/lmh/res/values/strings.xml +++ b/opensrp-chw/src/lmh/res/values/strings.xml @@ -25,4 +25,8 @@ %s adults and %s U11 children Are you sure you want to go back? All data you have entered in this form will be cleared. + + List of children who can take the vaccines at a date in the future + Number of vaccine doses needed for children who can take the vaccine at a date in the future + Number on vaccines provided and child deaths in my area \ No newline at end of file diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java index 3d3b62a00b..406bcff066 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java @@ -438,6 +438,10 @@ public interface Flavor { boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(); + boolean showReportsDescription(); + + boolean showReportsDivider(); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java index 06e6dae369..7521b3a90b 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java @@ -216,4 +216,14 @@ public boolean showLastNameOnChildProfile() { public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return false; } + + @Override + public boolean showReportsDescription() { + return false; + } + + @Override + public boolean showReportsDivider() { + return false; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java index 130202568d..3179bd8aa5 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java @@ -4,14 +4,29 @@ public class ReportType implements ListContract.Identifiable { - private String id; - private String name; + private final String id; + private final String name; + private String description; public ReportType(String id, String name) { this.id = id; this.name = name; } + public ReportType(String id, String name, String description){ + this.id = id; + this.name = name; + this.description = description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + @Override public String getID() { return id; diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java index 2ce8808407..135b9bbecd 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java @@ -8,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -15,6 +16,7 @@ import org.smartregister.chw.activity.FragmentBaseActivity; import org.smartregister.chw.adapter.ListableAdapter; import org.smartregister.chw.adapter.ReportsFragmentAdapter; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.contract.ListContract; import org.smartregister.chw.domain.ReportType; import org.smartregister.chw.presenter.ListPresenter; @@ -43,9 +45,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, presenter.fetchList(() -> { List list = new ArrayList<>(); - list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children))); - list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed))); - list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity))); + if (ChwApplication.getApplicationFlavor().showReportsDescription()){ + list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children), getString(R.string.eligible_children_description))); + list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed), getString(R.string.doses_needed_description))); + list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity), getString(R.string.community_activity_description))); + }else { + list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children))); + list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed))); + list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity))); + } return list; }); @@ -57,9 +65,13 @@ public void bindLayout() { RecyclerView recyclerView = view.findViewById(R.id.recyclerView); recyclerView.setHasFixedSize(false); - RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); + LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(layoutManager); + if (ChwApplication.getApplicationFlavor().showReportsDivider()){ + recyclerView.addItemDecoration(new DividerItemDecoration(requireContext(), layoutManager.getOrientation())); + } + progressBar = view.findViewById(R.id.progress_bar); progressBar.setVisibility(View.GONE); diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java index 38aae34a6e..07df1c1741 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java @@ -6,28 +6,39 @@ import androidx.annotation.NonNull; import org.smartregister.chw.R; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.contract.ListContract; import org.smartregister.chw.domain.ReportType; public class ReportViewHolder extends ListableViewHolder { private TextView tvName; + private TextView tvDesc; private View currentView; public ReportViewHolder(@NonNull View itemView) { super(itemView); currentView = itemView; tvName = itemView.findViewById(R.id.tvName); + if (ChwApplication.getApplicationFlavor().showReportsDescription()) { + tvDesc = itemView.findViewById(R.id.tvDesc); + } } @Override public void bindView(ReportType reportType, ListContract.View view) { tvName.setText(reportType.getName()); + if (tvDesc != null){ + tvDesc.setText(reportType.getDescription()); + } currentView.setOnClickListener(v -> view.onListItemClicked(reportType, v.getId())); } @Override public void resetView() { tvName.setText(""); + if (tvDesc != null){ + tvDesc.setText(""); + } } } diff --git a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml index 24835127dd..125885ad41 100644 --- a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml +++ b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" /> diff --git a/opensrp-chw/src/main/res/layout/reports_fragment.xml b/opensrp-chw/src/main/res/layout/reports_fragment.xml index f641ccdcea..b74cfa6a88 100644 --- a/opensrp-chw/src/main/res/layout/reports_fragment.xml +++ b/opensrp-chw/src/main/res/layout/reports_fragment.xml @@ -24,7 +24,7 @@ - + android:paddingRight="25dp" + android:paddingBottom="20dp"> - + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/ivNext" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + android:layout_height="30dp" + android:src="@drawable/ic_navigate_next_black_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + From 3d2ec9349910668e71be30a67ba0fc85e17bff65 Mon Sep 17 00:00:00 2001 From: paulinembabu Date: Thu, 30 Sep 2021 12:47:50 +0300 Subject: [PATCH 025/101] Show Progress Dialog on Sync --- .../chw/activity/FamilyRegisterActivity.java | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java index effd2a622e..0257f7a7c4 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java @@ -1,11 +1,14 @@ package org.smartregister.chw.activity; import android.app.Activity; +import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; +import android.util.Log; import com.google.android.material.bottomnavigation.BottomNavigationView; +import org.smartregister.chw.R; import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.core.activity.CoreFamilyRegisterActivity; import org.smartregister.chw.core.custom_views.NavigationMenu; @@ -13,10 +16,15 @@ import org.smartregister.chw.listener.ChwBottomNavigationListener; import org.smartregister.chw.util.Constants; import org.smartregister.chw.util.Utils; +import org.smartregister.domain.FetchStatus; import org.smartregister.helper.BottomNavigationHelper; +import org.smartregister.receiver.SyncStatusBroadcastReceiver; import org.smartregister.view.fragment.BaseRegisterFragment; -public class FamilyRegisterActivity extends CoreFamilyRegisterActivity { +import timber.log.Timber; + +public class FamilyRegisterActivity extends CoreFamilyRegisterActivity implements SyncStatusBroadcastReceiver.SyncStatusListener { + private ProgressDialog progressDialog; public static void startFamilyRegisterForm(Activity activity) { Intent intent = new Intent(activity, FamilyRegisterActivity.class); @@ -46,10 +54,65 @@ protected void onCreate(Bundle savedInstanceState) { if (action != null && action.equals(Constants.ACTION.START_REGISTRATION)) { startRegistration(); } + try { + SyncStatusBroadcastReceiver.getInstance().addSyncStatusListener(this); + } + catch (Exception e){ + Timber.e(e); + } } @Override protected BaseRegisterFragment getRegisterFragment() { return new FamilyRegisterFragment(); } + + private void initializeProgressDialog() { + progressDialog = new ProgressDialog(this); + progressDialog.setCancelable(true); + progressDialog.setTitle(getString(R.string.syncing_records)); + } + + private void showProgressDialog() { + try { + if (progressDialog == null) { + initializeProgressDialog(); + } + + progressDialog.show(); + } catch (Exception e) { + Timber.e(Log.getStackTraceString(e)); + } + } + + public void hideProgressDialog() { + try { + if (progressDialog != null) { + progressDialog.dismiss(); + } + } catch (Exception e) { + Timber.e(Log.getStackTraceString(e)); + } + } + + @Override + public void onSyncStart() { + showProgressDialog(); + } + + @Override + public void onSyncInProgress(FetchStatus fetchStatus) { + showProgressDialog(); + } + + @Override + public void onSyncComplete(FetchStatus fetchStatus) { + hideProgressDialog(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + SyncStatusBroadcastReceiver.getInstance().removeSyncStatusListener(this); + } } \ No newline at end of file From ed4625fa99fa8e92b2893e47c2b1c68cdf2658a5 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Mon, 4 Oct 2021 15:29:23 +0300 Subject: [PATCH 026/101] make different lmh ui screen for bluetooth sync (#1913) --- .../res/drawable/ic_transfer_data_receive.xml | 10 ++ .../res/drawable/ic_transfer_data_send.xml | 10 ++ .../drawable/p2p_card_text_color_selector.xml | 5 + .../lmh/res/layout/fragment_mode_select.xml | 161 ++++++++++++++++++ opensrp-chw/src/lmh/res/values/strings.xml | 3 + 5 files changed, 189 insertions(+) create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml create mode 100644 opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml create mode 100644 opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml new file mode 100644 index 0000000000..e1a5381c8c --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml @@ -0,0 +1,10 @@ + + + diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml new file mode 100644 index 0000000000..558afc034d --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml @@ -0,0 +1,10 @@ + + + diff --git a/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml new file mode 100644 index 0000000000..c58a8cb97e --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml new file mode 100644 index 0000000000..f04c2bb05e --- /dev/null +++ b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + +