Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update CHW with configurable registers & profiles functionality #1720

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jul 21 15:57:20 EAT 2020
#Fri Feb 26 21:53:31 EAT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
9 changes: 5 additions & 4 deletions opensrp-chw/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'org.apache.commons:commons-lang3:3.10'
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
}
Expand Down Expand Up @@ -191,8 +191,8 @@ android {

configurations.all {
resolutionStrategy {
force 'androidx.appcompat:appcompat:1.0.2'
force 'com.google.android.material:material:1.0.0'
force 'androidx.appcompat:appcompat:1.2.0'
force 'com.google.android.material:material:1.2.0'
}
}

Expand Down Expand Up @@ -320,11 +320,12 @@ android {
}

dependencies {
implementation('org.smartregister:opensrp-client-chw-core:2.0.23-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-chw-core:2.0.24.1-GS-PREVIEW-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'androidx.legacy', module: 'legacy-support-v4'
exclude group: 'androidx.appcompat', module: 'appcompat'
exclude group: 'com.google.android.material', module: 'material'
exclude group: 'androidx.constraintlayout', module: 'constraintlayout'
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.rengwuxian.materialedittext', module: 'library'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.smartregister.chw.presenter.ChildRegisterFragmentPresenter;
import org.smartregister.chw.provider.ChildRegisterProvider;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.configurableviews.model.View;
import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter;
import org.smartregister.family.util.Utils;
import org.smartregister.view.activity.BaseRegisterActivity;
import org.smartregister.view.contract.IView;

import java.util.Set;

Expand Down Expand Up @@ -44,7 +44,7 @@ public void goToChildDetailActivity(CommonPersonObjectClient patient, boolean la
}

@Override
public void initializeAdapter(Set<View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
ChildRegisterProvider childRegisterProvider = new ChildRegisterProvider(getActivity(), commonRepository(), visibleColumns, registerActionHandler, paginationViewHandler);
clientAdapter = new RecyclerViewPaginatedAdapter(null, childRegisterProvider, context().commonrepository(this.tablename));
clientAdapter.setCurrentlimit(20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import org.smartregister.chw.presenter.FamilyProfileActivityPresenter;
import org.smartregister.chw.provider.FamilyActivityRegisterProvider;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.configurableviews.model.View;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.family.adapter.FamilyRecyclerViewCustomAdapter;
import org.smartregister.family.fragment.BaseFamilyProfileActivityFragment;
import org.smartregister.family.util.Constants;
import org.smartregister.family.util.Utils;
import org.smartregister.view.contract.IView;

import java.util.HashMap;
import java.util.Set;
Expand All @@ -40,7 +40,7 @@ public static BaseFamilyProfileActivityFragment newInstance(Bundle bundle) {
}

@Override
public void initializeAdapter(Set<View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
FamilyActivityRegisterProvider familyActivityRegisterProvider = new FamilyActivityRegisterProvider(getActivity(), commonRepository(), visibleColumns, registerActionHandler, paginationViewHandler);
clientAdapter = new FamilyRecyclerViewCustomAdapter(null, familyActivityRegisterProvider, context().commonrepository(this.tablename), Utils.metadata().familyActivityRegister.showPagination);
clientAdapter.setCurrentlimit(Utils.metadata().familyActivityRegister.currentLimit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.smartregister.family.util.Utils;
import org.smartregister.util.FormUtils;
import org.smartregister.util.JsonFormUtils;
import org.smartregister.view.contract.IView;

import java.util.HashMap;
import java.util.Set;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void setupViews(View view) {
}

@Override
public void initializeAdapter(Set<org.smartregister.configurableviews.model.View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
ChwDueRegisterProvider chwDueRegisterProvider = new ChwDueRegisterProvider(this.getActivity(), this.commonRepository(), visibleColumns, this.registerActionHandler, this.paginationViewHandler);
this.clientAdapter = new FamilyRecyclerViewCustomAdapter(null, chwDueRegisterProvider, this.context().commonrepository(this.tablename), Utils.metadata().familyDueRegister.showPagination);
this.clientAdapter.setCurrentlimit(Utils.metadata().familyDueRegister.currentLimit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.family.fragment.BaseFamilyProfileMemberFragment;
import org.smartregister.family.util.Constants;
import org.smartregister.view.contract.IView;

import java.util.Set;

Expand All @@ -33,7 +34,7 @@ public static BaseFamilyProfileMemberFragment newInstance(Bundle bundle) {
}

@Override
public void initializeAdapter(Set<org.smartregister.configurableviews.model.View> visibleColumns, String familyHead, String primaryCaregiver) {
public void initializeAdapter(Set<IView> visibleColumns, String familyHead, String primaryCaregiver) {
ChwMemberRegisterProvider chwMemberRegisterProvider = new ChwMemberRegisterProvider(this.getActivity(), this.commonRepository(), visibleColumns, this.registerActionHandler, this.paginationViewHandler, familyHead, primaryCaregiver);
this.clientAdapter = new RecyclerViewPaginatedAdapter(null, chwMemberRegisterProvider, this.context().commonrepository(this.tablename));
this.clientAdapter.setCurrentlimit(20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import org.smartregister.chw.core.provider.CoreRegisterProvider;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.provider.FamilyRegisterProvider;
import org.smartregister.chw.util.Utils;
import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.family.util.DBConstants;
import org.smartregister.view.contract.IView;

import java.util.Set;

Expand All @@ -20,7 +20,7 @@
public class FamilyRegisterFragment extends CoreFamilyRegisterFragment {

@Override
public void initializeAdapter(Set<org.smartregister.configurableviews.model.View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
CoreRegisterProvider chwRegisterProvider = new FamilyRegisterProvider(getActivity(), commonRepository(), visibleColumns, registerActionHandler, paginationViewHandler);
clientAdapter = new RecyclerViewPaginatedAdapter(null, chwRegisterProvider, context().commonrepository(this.tablename));
clientAdapter.setCurrentlimit(20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import androidx.loader.content.Loader;

import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.smartregister.chw.R;
import org.smartregister.chw.activity.MalariaFollowUpVisitActivity;
import org.smartregister.chw.anc.util.DBConstants;
Expand All @@ -30,6 +29,7 @@
import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.view.activity.BaseRegisterActivity;
import org.smartregister.view.contract.IView;
import org.smartregister.view.customcontrols.CustomFontTextView;

import java.text.MessageFormat;
Expand All @@ -47,7 +47,7 @@ public class ReferralRegisterFragment extends BaseReferralRegisterFragment {
private boolean dueFilterActive = false;

@Override
public void initializeAdapter(@Nullable Set<? extends org.smartregister.configurableviews.model.View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
ReferralRegisterProvider referralRegisterProvider = new ReferralRegisterProvider(getActivity(), paginationViewHandler, registerActionHandler, visibleColumns);
clientAdapter = new RecyclerViewPaginatedAdapter(null, referralRegisterProvider, context().commonrepository(this.tablename));
clientAdapter.setCurrentlimit(20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Triple;
import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.chw.core.custom_views.NavigationMenu;
import org.smartregister.chw.core.presenter.CoreAllClientsRegisterPresenter;
Expand Down Expand Up @@ -86,15 +87,20 @@ public void onUniqueIdFetched(Triple<String, String, String> triple, String enti
}


public void startForm(String formName, String entityId, String metadata, String currentLocationId) throws Exception {
public void startForm(String formName, String entityId, String metadata, String currentLocationId) {

if (StringUtils.isBlank(entityId)) {
Triple<String, String, String> triple = Triple.of(formName, metadata, currentLocationId);
interactor.getNextUniqueId(triple, this);
return;
}

JSONObject form = model.getFormAsJson(formName, entityId, currentLocationId);
JSONObject form = null;
try {
form = model.getFormAsJson(formName, entityId, currentLocationId);
} catch (JSONException e) {
e.printStackTrace();
}
if (getView() != null)
getView().startFormActivity(form);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import org.smartregister.chw.referral.util.DBConstants;
import org.smartregister.chw.util.ChwDBConstants;
import org.smartregister.chw.util.Constants;
import org.smartregister.view.contract.BaseRegisterFragmentContract;

import static org.smartregister.chw.referral.util.Constants.ReferralType;
import static org.smartregister.chw.referral.util.Constants.Tables;

public class ReferralFollowupFragmentPresenter extends BaseReferralRegisterFragmentPresenter {

public ReferralFollowupFragmentPresenter(BaseReferralRegisterFragmentContract.View view, BaseReferralRegisterFragmentContract.Model model, String viewConfigurationIdentifier) {
public ReferralFollowupFragmentPresenter(BaseRegisterFragmentContract.View view, BaseReferralRegisterFragmentContract.Model model, String viewConfigurationIdentifier) {
super(view, model, viewConfigurationIdentifier);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.smartregister.chw.R;
import org.smartregister.chw.core.utils.ChwDBConstants;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.fragment.ReferralRegisterFragment;
import org.smartregister.chw.referral.contract.BaseReferralRegisterFragmentContract;
import org.smartregister.chw.referral.presenter.BaseReferralRegisterFragmentPresenter;
import org.smartregister.chw.referral.util.DBConstants;
Expand All @@ -14,7 +15,7 @@

public class ReferralRegisterFragmentPresenter extends BaseReferralRegisterFragmentPresenter {

public ReferralRegisterFragmentPresenter(BaseReferralRegisterFragmentContract.View view, BaseReferralRegisterFragmentContract.Model model, String viewConfigurationIdentifier) {
public ReferralRegisterFragmentPresenter(ReferralRegisterFragment view, BaseReferralRegisterFragmentContract.Model model, String viewConfigurationIdentifier) {
super(view, model, viewConfigurationIdentifier);
}

Expand Down