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 Malaria register implementation #90

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.0.2'
}
}

Expand All @@ -33,8 +33,8 @@ subprojects {

group = 'org.smartregister'

ext.androidToolsBuildGradle = '3.1.4'
ext.androidBuildToolsVersion = '28.0.3'
ext.androidToolsBuildGradle = '4.0.2'
ext.androidBuildToolsVersion = '29.0.3'
ext.androidMinSdkVersion = 18
ext.androidCompileSdkVersion = 28
ext.androidTargetSdkVersion = 28
Expand All @@ -51,6 +51,7 @@ subprojects {
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://cloudant.github.io/cloudant-sync-eap/repository" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases'}
mavenLocal()
}

Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.2.19-SNAPSHOT
VERSION_NAME=1.3.0.1-GS-PREVIEW-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client CHW Malaria Library
Expand All @@ -14,3 +14,6 @@ POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev
POM_SETTING_NAME=OpenSRP Client Chw malaria
POM_SETTING_ARTIFACT_ID=opensrp-client-chw-malaria
POM_SETTING_PACKAGING=aar
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx2048m
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
16 changes: 9 additions & 7 deletions opensrp-chw-malaria/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.0.2'
}
}

Expand Down Expand Up @@ -77,6 +77,8 @@ android {

}

android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
Expand All @@ -88,22 +90,22 @@ allprojects {
}
}
dependencies {
implementation('org.smartregister:opensrp-client-core:1.11.5-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:4.2.4.1-GS-PREVIEW-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.apache.httpcomponents', module: 'httpmime'
}

implementation('org.smartregister:opensrp-client-native-form:1.9.1-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-native-form:1.14.5.0-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'cardview-v7'
}

implementation('org.smartregister:opensrp-client-configurable-views:1.1.5-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-configurable-views:1.2.0-GS-PREVIEW-SNAPSHOT@aar') {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
Expand Down Expand Up @@ -153,9 +155,9 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
sourceDirectories.setFrom([mainSrc])
classDirectories.setFrom([debugTree])
executionData.setFrom(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
Expand All @@ -18,6 +14,11 @@
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Period;
Expand Down Expand Up @@ -316,6 +317,7 @@ private String formatTime(Date dateTime) {

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.REQUEST_CODE_GET_JSON && resultCode == RESULT_OK) {
profilePresenter.saveForm(data.getStringExtra(Constants.JSON_FORM_EXTRA.JSON));
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.MenuRes;
import android.support.design.bottomnavigation.LabelVisibilityMode;
import android.support.v4.app.Fragment;

import androidx.annotation.MenuRes;
import androidx.fragment.app.Fragment;

import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.vijay.jsonwizard.constants.JsonFormConstants;
import com.vijay.jsonwizard.domain.Form;

Expand Down Expand Up @@ -36,6 +37,7 @@
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;

import timber.log.Timber;

Expand All @@ -61,13 +63,13 @@ protected void onCreate(Bundle savedInstanceState) {
*/
protected void onStartActivityWithAction() {
if (FORM_NAME != null && ACTION != null) {
startFormActivity(FORM_NAME, BASE_ENTITY_ID, null);
startFormActivity(FORM_NAME, BASE_ENTITY_ID, (String) null);
}
}

@Override
public void startRegistration() {
startFormActivity(FORM_NAME, null, null);
startFormActivity(FORM_NAME, null, (String) null);
}

@Override
Expand Down Expand Up @@ -153,13 +155,19 @@ protected Fragment[] getOtherFragments() {
return new Fragment[0];
}

@Override
public void startFormActivity(String s, String s1, Map<String, String> map) {
// Abstract method implementation
}

@Override
public MalariaRegisterContract.Presenter presenter() {
return (MalariaRegisterContract.Presenter) presenter;
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == Constants.REQUEST_CODE_GET_JSON) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface View extends BaseRegisterContract.View {

interface Presenter extends BaseRegisterContract.Presenter {

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

void saveForm(String jsonString);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public interface MalariaRegisterFragmentContract {

interface View extends BaseRegisterFragmentContract.View {

void initializeAdapter(Set<org.smartregister.configurableviews.model.View> visibleColumns);

Presenter presenter();
}

Expand All @@ -26,14 +24,10 @@ interface Presenter extends BaseRegisterFragmentContract.Presenter {
String getDueFilterCondition();
}

interface Model {
interface Model extends BaseRegisterFragmentContract.Model{

RegisterConfiguration defaultRegisterConfiguration();

ViewConfiguration getViewConfiguration(String viewConfigurationIdentifier);

Set<org.smartregister.configurableviews.model.View> getRegisterActiveColumns(String viewConfigurationIdentifier);

String countSelect(String tableName, String mainCondition);

String mainSelect(String tableName, String mainCondition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import android.app.Activity;
import android.content.Context;
import android.support.design.widget.FloatingActionButton;
import android.view.View;
import android.widget.LinearLayout;

import com.google.android.material.floatingactionbutton.FloatingActionButton;

import org.smartregister.chw.malaria.domain.MemberObject;
import org.smartregister.chw.malaria.fragment.BaseMalariaCallDialogFragment;
import org.smartregister.malaria.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import org.smartregister.chw.malaria.model.BaseMalariaRegisterFragmentModel;
import org.smartregister.chw.malaria.presenter.BaseMalariaRegisterFragmentPresenter;
import org.smartregister.commonregistry.CommonPersonObjectClient;
import org.smartregister.configurableviews.model.View;
import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter;
import org.smartregister.malaria.R;
import org.smartregister.provider.MalariaRegisterProvider;
import org.smartregister.view.contract.IView;
import org.smartregister.view.customcontrols.CustomFontTextView;
import org.smartregister.view.customcontrols.FontVariant;
import org.smartregister.view.fragment.BaseRegisterFragment;
Expand All @@ -24,7 +24,7 @@ public class BaseMalariaRegisterFragment extends BaseRegisterFragment implements
public static final String FOLLOW_UP_VISIT = "follow_up_visit";

@Override
public void initializeAdapter(Set<View> visibleColumns) {
public void initializeAdapter(Set<IView> visibleColumns) {
MalariaRegisterProvider malariaRegisterProvider = new MalariaRegisterProvider(getActivity(), paginationViewHandler, registerActionHandler, visibleColumns);
clientAdapter = new RecyclerViewPaginatedAdapter(null, malariaRegisterProvider, context().commonrepository(this.tablename));
clientAdapter.setCurrentlimit(20);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.smartregister.chw.malaria.interactor;

import android.support.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;

import org.smartregister.chw.malaria.contract.MalariaProfileContract;
import org.smartregister.chw.malaria.domain.MemberObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.smartregister.chw.malaria.interactor;

import android.support.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;

import org.smartregister.chw.malaria.contract.MalariaRegisterContract;
import org.smartregister.chw.malaria.util.AppExecutors;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.smartregister.chw.malaria.listener;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.view.MenuItem;

import androidx.annotation.NonNull;

import org.smartregister.listener.BottomNavigationListener;
import org.smartregister.malaria.R;
import org.smartregister.view.activity.BaseRegisterActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package org.smartregister.chw.malaria.model;

import org.json.JSONArray;
import org.smartregister.chw.malaria.MalariaLibrary;
import org.smartregister.chw.malaria.contract.MalariaRegisterFragmentContract;
import org.smartregister.chw.malaria.util.ConfigHelper;
import org.smartregister.configurableviews.ConfigurableViewsLibrary;
import org.smartregister.configurableviews.model.RegisterConfiguration;
import org.smartregister.configurableviews.model.View;
import org.smartregister.configurableviews.model.ViewConfiguration;
import org.smartregister.cursoradapter.SmartRegisterQueryBuilder;
import org.smartregister.domain.Response;
import org.smartregister.view.contract.IField;
import org.smartregister.view.contract.IView;
import org.smartregister.view.contract.IViewConfiguration;

import java.util.List;
import java.util.Set;

public class BaseMalariaRegisterFragmentModel implements MalariaRegisterFragmentContract.Model {
Expand All @@ -19,12 +24,12 @@ public RegisterConfiguration defaultRegisterConfiguration() {
}

@Override
public ViewConfiguration getViewConfiguration(String viewConfigurationIdentifier) {
public IViewConfiguration getViewConfiguration(String viewConfigurationIdentifier) {
return ConfigurableViewsLibrary.getInstance().getConfigurableViewsHelper().getViewConfiguration(viewConfigurationIdentifier);
}

@Override
public Set<View> getRegisterActiveColumns(String viewConfigurationIdentifier) {
public Set<IView> getRegisterActiveColumns(String viewConfigurationIdentifier) {
return ConfigurableViewsLibrary.getInstance().getConfigurableViewsHelper().getRegisterActiveColumns(viewConfigurationIdentifier);
}

Expand All @@ -42,6 +47,21 @@ public String mainSelect(String tableName, String mainCondition) {
return queryBUilder.mainCondition(mainCondition);
}

@Override
public String getFilterText(List<IField> list, String s) {
return null;
}

@Override
public String getSortText(IField iField) {
return null;
}

@Override
public JSONArray getJsonArray(Response<String> response) {
return null;
}

protected String[] mainColumns(String tableName) {
String[] columns = new String[]{
tableName + ".relationalid"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.smartregister.chw.malaria.presenter;

import android.content.Context;
import android.support.annotation.Nullable;

import androidx.annotation.Nullable;

import org.smartregister.chw.malaria.contract.MalariaProfileContract;
import org.smartregister.chw.malaria.domain.MemberObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.smartregister.configurableviews.model.RegisterConfiguration;
import org.smartregister.configurableviews.model.View;
import org.smartregister.configurableviews.model.ViewConfiguration;
import org.smartregister.view.contract.IView;
import org.smartregister.view.contract.IViewConfiguration;

import java.lang.ref.WeakReference;
import java.util.List;
Expand All @@ -24,7 +26,7 @@ public class BaseMalariaRegisterFragmentPresenter implements MalariaRegisterFrag

protected RegisterConfiguration config;

protected Set<View> visibleColumns = new TreeSet<>();
protected Set<IView> visibleColumns = new TreeSet<>();
protected String viewConfigurationIdentifier;

public BaseMalariaRegisterFragmentPresenter(MalariaRegisterFragmentContract.View view, MalariaRegisterFragmentContract.Model model, String viewConfigurationIdentifier) {
Expand All @@ -50,7 +52,7 @@ public void processViewConfigurations() {
return;
}

ViewConfiguration viewConfiguration = model.getViewConfiguration(viewConfigurationIdentifier);
IViewConfiguration viewConfiguration = model.getViewConfiguration(viewConfigurationIdentifier);
if (viewConfiguration != null) {
config = (RegisterConfiguration) viewConfiguration.getMetadata();
this.visibleColumns = model.getRegisterActiveColumns(viewConfigurationIdentifier);
Expand Down
Loading