Skip to content

Commit

Permalink
Merge branch 'master' into translation-fixes-ba
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
hamza-vd committed Dec 14, 2020
2 parents 644bb81 + 52c9d69 commit 6ca327b
Show file tree
Hide file tree
Showing 72 changed files with 1,778 additions and 544 deletions.
1 change: 1 addition & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ file_filter = opensrp-chw-core/src/main/res/values-<lang>/strings.xml
source_file = opensrp-chw-core/src/main/res/values/strings.xml
source_lang = en
type = ANDROID

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.5.22-SNAPSHOT
VERSION_NAME=2.0.7-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Chw Core Library
Expand Down
20 changes: 10 additions & 10 deletions opensrp-chw-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ dependencies {
exclude group: 'xpp3', module: 'xpp3'
}

api('org.smartregister:opensrp-client-native-form:1.14.5.5-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-native-form:1.14.5.5-disable_hwid-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'cardview-v7'
Expand All @@ -138,7 +138,7 @@ dependencies {

compileOnly 'com.ibm.fhir:fhir-model:4.2.3'

api('org.smartregister:opensrp-client-core:1.15.4-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-core:4.0.4-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
exclude group: 'com.google.guava', module: 'guava'
Expand All @@ -149,15 +149,15 @@ dependencies {
exclude group: 'com.ibm.fhir', module: 'fhir-model'
}
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

api('org.smartregister:opensrp-client-configurable-views:1.1.5-SNAPSHOT@aar') {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'com.android.support', module: 'appcompat-v7'
}

api('org.smartregister:opensrp-client-family:1.3.1-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-family:2.0.1-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 @@ -190,23 +190,25 @@ dependencies {
exclude group: 'com.github.lecho', module: 'hellocharts-android'
}

api('org.smartregister:opensrp-client-chw-anc:1.1.2-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-chw-anc:2.0.0-SNAPSHOT@aar') {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
exclude group: 'org.smartregister', module: 'opensrp-client-configurable-views'
exclude group: 'org.smartregister', module: 'opensrp-client-immunization'
exclude group: 'org.smartregister', module: 'opensrp-client-family'
}

api('org.smartregister:opensrp-client-chw-pnc:1.0.3-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-chw-pnc:2.0.0-SNAPSHOT@aar') {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-chw-anc'
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
exclude group: 'org.smartregister', module: 'opensrp-client-configurable-views'
exclude group: 'org.smartregister', module: 'opensrp-client-immunization'
exclude group: 'org.smartregister', module: 'opensrp-client-family'
}

api('org.smartregister:opensrp-client-chw-malaria:1.2.18-SNAPSHOT@aar') {
Expand Down Expand Up @@ -251,7 +253,7 @@ dependencies {
api 'com.evernote:android-job:1.2.6'
api 'org.greenrobot:eventbus:3.1.1'

api("org.smartregister:android-p2p-sync:0.3.8-apha1-SNAPSHOT") {
api("org.smartregister:android-p2p-sync:0.3.8-aplha4-SNAPSHOT") {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'com.android.support', module: 'appcompat-v7'
Expand All @@ -260,9 +262,7 @@ dependencies {
exclude group: 'com.rengwuxian.materialedittext', module: 'library'
}

api('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true
}
api 'com.google.firebase:firebase-crashlytics:17.3.0'

androidTestImplementation 'org.mockito:mockito-android:3.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
Expand Down
3 changes: 3 additions & 0 deletions opensrp-chw-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application>
<activity android:name=".activity.impl.CoreAncMemberProfileActivityImpl" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected void getReferralDetails() {
updateProblemDisplay();
String clientAge = (Utils.getTranslatedDate(Utils.getDuration(Utils.getValue(getPersonObjectClient().getColumnmaps(), DBConstants.KEY.DOB, false)), getBaseContext()));
clientName.setText(getString(R.string.client_name_age_suffix, name, clientAge));
referralDate.setText(org.smartregister.chw.core.utils.Utils.dd_MMM_yyyy.format(getTask().getExecutionStartDate().toDate()));
referralDate.setText(org.smartregister.chw.core.utils.Utils.dd_MMM_yyyy.format(getTask().getExecutionPeriod().getStart().toDate()));

//For PNC get children belonging to the woman
String childrenForPncWoman = getChildrenForPncWoman(getPersonObjectClient().entityId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.smartregister.chw.core.activity;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;

import androidx.annotation.Nullable;
Expand All @@ -17,9 +17,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
}

@Override
protected void attachBaseContext(Context base) {
protected void attachBaseContext(android.content.Context base) {
// get language from prefs
String lang = LangUtils.getLanguage(base.getApplicationContext());
super.attachBaseContext(LangUtils.setAppLocale(base, lang));
Configuration newConfiguration = LangUtils.setAppLocale(base, lang);

super.attachBaseContext(base);

applyOverrideConfiguration(newConfiguration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.smartregister.opd.presenter.BaseOpdRegisterActivityPresenter;
import org.smartregister.view.fragment.BaseRegisterFragment;

import java.util.Map;

public class CoreAllClientsRegisterActivity extends BaseOpdRegisterActivity {

@Override
Expand Down Expand Up @@ -52,6 +54,11 @@ protected void onResumption() {
}
}

@Override
public void startFormActivity(String s, String s1, Map<String, String> map) {
// to do
}

@Override
public void switchToBaseFragment() {
Intent intent = new Intent(this, CoreFamilyRegisterActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void onClick(View view) {
}

private int getMonthsDifference(LocalDate date1, LocalDate date2) {
return Months.monthsBetween( date1.withDayOfMonth(1), date2.withDayOfMonth(1)).getMonths();
return Months.monthsBetween(date1.withDayOfMonth(1), date2.withDayOfMonth(1)).getMonths();
}

private boolean isVisitThisMonth(LocalDate lastVisitDate, LocalDate todayDate) {
Expand Down Expand Up @@ -260,7 +260,8 @@ public void setupViews() {
protected void initializeNotificationReferralRecyclerView() {
notificationAndReferralLayout = findViewById(R.id.notification_and_referral_row);
notificationAndReferralRecyclerView = findViewById(R.id.notification_and_referral_recycler_view);
notificationAndReferralRecyclerView.setLayoutManager(new LinearLayoutManager(this));
if (notificationAndReferralRecyclerView != null)
notificationAndReferralRecyclerView.setLayoutManager(new LinearLayoutManager(this));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ public void redrawHeader(MemberObject memberObject) {
tvTitle.setText(MessageFormat.format("{0}, {1} {2}", memberObject.getFullName(), getDuration(memberObject.getDob()), getString(R.string.home_visit_suffix)));
}

/*
@Override
protected void attachBaseContext(Context base) {
// get language from prefs
String lang = LangUtils.getLanguage(base.getApplicationContext());
super.attachBaseContext(LangUtils.setAppLocale(base, lang));
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import timber.log.Timber;

Expand Down Expand Up @@ -86,6 +87,11 @@ protected void onResumption() {
}
}

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

@Override
public void startFormActivity(String formName, String entityId, String metaData) {
try {
Expand Down Expand Up @@ -158,6 +164,6 @@ public void openFamilyListView() {

@Override
public void startRegistration() {
startFormActivity(Utils.metadata().familyRegister.formName, null, null);
startFormActivity(Utils.metadata().familyRegister.formName, null, "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == CoreConstants.RQ_CODE.STORAGE_PERMISIONS && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (requestCode == CoreConstants.RQ_CODE.STORAGE_PERMISIONS && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
NavigationMenu navigationMenu = NavigationMenu.getInstance(this, null, null);
if (navigationMenu != null) {
navigationMenu.startP2PActivity(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
public abstract class DefaultAncMedicalHistoryActivityFlv implements CoreAncMedicalHistoryActivity.Flavor {

protected LinearLayout linearLayoutAncCard;
protected LinearLayout linearLayoutDeliveryKit;
protected LinearLayout linearLayoutHealthFacilityVisit;
protected LinearLayout linearLayoutHealthFacilityVisitDetails;
protected LayoutInflater inflater;
Expand All @@ -33,6 +34,7 @@ public abstract class DefaultAncMedicalHistoryActivityFlv implements CoreAncMedi
private LinearLayout linearLayoutIPTp, linearLayoutIPTpDetails;
private TextView customFontTextViewLastVisit;
private TextView customFontTextViewAncCard;
private TextView customFontTextViewDeliveryKit;

@Override
public View bindViews(Activity activity) {
Expand All @@ -41,6 +43,7 @@ public View bindViews(Activity activity) {

linearLayoutLastVisit = view.findViewById(R.id.linearLayoutLastVisit);
linearLayoutAncCard = view.findViewById(R.id.linearLayoutAncCard);
linearLayoutDeliveryKit = view.findViewById(R.id.linearLayoutDeliveryKit);
linearLayoutHealthFacilityVisit = view.findViewById(R.id.linearLayoutHealthFacilityVisit);
linearLayoutHealthFacilityVisitDetails = view.findViewById(R.id.linearLayoutHealthFacilityVisitDetails);
linearLayoutTTImmunization = view.findViewById(R.id.linearLayoutTTImmunization);
Expand All @@ -49,6 +52,7 @@ public View bindViews(Activity activity) {
linearLayoutIPTpDetails = view.findViewById(R.id.linearLayoutIPTpDetails);
customFontTextViewLastVisit = view.findViewById(R.id.customFontTextViewLastVisit);
customFontTextViewAncCard = view.findViewById(R.id.customFontTextViewAncCard);
customFontTextViewDeliveryKit = view.findViewById(R.id.customFontTextViewDeliveryKit);
return view;
}

Expand All @@ -59,6 +63,7 @@ public void processViewData(List<Visit> visits, Context context) {

int days = 0;
String has_card = "No";
String has_delivery_kit = "No";
List<Map<String, String>> hf_visits = new ArrayList<>();
Map<String, String> immunizations = new HashMap<>();
Map<String, String> services = new HashMap<>();
Expand All @@ -80,6 +85,15 @@ public void processViewData(List<Visit> visits, Context context) {

}

// delivery kiy
if (has_delivery_kit.equalsIgnoreCase("No")) {
List<VisitDetail> details = visits.get(x).getVisitDetails().get("delivery_kit");
if (details != null && StringUtils.isNotBlank(details.get(0).getHumanReadable())) {
has_delivery_kit = details.get(0).getHumanReadable();
}

}


String[] hf_params = {"anc_hf_visit_date", "weight", "sys_bp", "dia_bp", "hb_level", "ifa_received", "tests_done"};
extractHFVisit(visits, hf_params, hf_visits, x, context);
Expand All @@ -91,6 +105,7 @@ public void processViewData(List<Visit> visits, Context context) {

processLastVisit(days, context);
processAncCard(has_card, context);
processDeliveryKit(has_delivery_kit, context);
processHealthFacilityVisit(hf_visits, context);
processTTImmunization(immunizations, context);
processIPTp(services, context);
Expand Down Expand Up @@ -183,6 +198,11 @@ protected void processAncCard(String has_card, Context context) {
customFontTextViewAncCard.setText(MessageFormat.format("{0}: {1}", context.getString(R.string.anc_home_visit_anc_card_received), getTranslatedText(context, has_card.toLowerCase())));
}

protected void processDeliveryKit(String has_delivery_kit, Context context) {
linearLayoutDeliveryKit.setVisibility(View.VISIBLE);
customFontTextViewDeliveryKit.setText(MessageFormat.format("{0}: {1}", context.getString(R.string.anc_home_visit_delivery_kit_received), getTranslatedText(context, has_delivery_kit.toLowerCase())));
}

protected void processHealthFacilityVisit(List<Map<String, String>> hf_visits, Context context) {
if (hf_visits != null && hf_visits.size() > 0) {
linearLayoutHealthFacilityVisit.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public abstract class DefaultChildMedicalHistoryActivityFlv implements CoreChild
protected List<Visit> visits;
protected Map<String, List<Visit>> visitMap = new LinkedHashMap<>();
protected Map<String, List<Vaccine>> vaccineMap = new LinkedHashMap<>();
private Context context;
protected Context context;
private LinearLayout parentView;
private SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
protected SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());

@Override
public View bindViews(Activity activity) {
Expand Down Expand Up @@ -271,7 +271,7 @@ private VisitDetailsFormatter getDewormingFormatter() {
};
}

private VisitDetailsFormatter getDieataryFormatter() {
protected VisitDetailsFormatter getDieataryFormatter() {
return (title, details, visitDate) -> {
String diet_diversity = NCUtils.getText(details);
String value = "";
Expand Down Expand Up @@ -423,7 +423,7 @@ private void medicalHistory(List<MedicalHistory> medicalHistories, String type,
}
}

private interface VisitDetailsFormatter {
protected interface VisitDetailsFormatter {
String format(String title, List<VisitDetail> details, Date visitDate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
for (int j = 0; j < fieldsArray.length(); j++) {
JSONObject fieldJsonObject = fieldsArray.getJSONObject(j);
String key = fieldJsonObject.getString(KEY);
String value = fieldJsonObject.getString(VALUE);
String value = !fieldJsonObject.has(VALUE) ? "" : fieldJsonObject.getString(VALUE);
result.put(key, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import org.apache.commons.lang3.StringUtils;
import org.smartregister.chw.core.R;
import org.smartregister.chw.core.listener.NavigationListener;
import org.smartregister.chw.core.model.NavigationOption;
Expand All @@ -23,27 +24,25 @@
public class NavigationAdapter extends RecyclerView.Adapter<NavigationAdapter.MyViewHolder> {

private List<NavigationOption> navigationOptionList;
private String selectedView = CoreConstants.DrawerMenu.ALL_FAMILIES;
private View.OnClickListener onClickListener;
private Context context;
private Map<String, Class> registeredActivities;
private NavigationAdapterHost host;

public NavigationAdapter(List<NavigationOption> navigationOptions, Activity context, Map<String, Class> registeredActivities) {
public NavigationAdapter(List<NavigationOption> navigationOptions, Activity context, Map<String, Class> registeredActivities, NavigationAdapterHost host) {
this.navigationOptionList = navigationOptions;
this.context = context;
this.onClickListener = new NavigationListener(context, this);
this.registeredActivities = registeredActivities;
this.host = host;
}

public String getSelectedView() {
if (selectedView == null || selectedView.equals(""))
setSelectedView(CoreConstants.DrawerMenu.ALL_FAMILIES);

return selectedView;
return StringUtils.isBlank(host.getSelectedView()) ? CoreConstants.DrawerMenu.ALL_FAMILIES : host.getSelectedView();
}

public void setSelectedView(String selectedView) {
this.selectedView = selectedView;
host.setSelectedView(selectedView);
this.notifyDataSetChanged();
}

Expand All @@ -65,7 +64,7 @@ public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.getView().setTag(model.getMenuTitle());


if (selectedView != null && selectedView.equals(model.getMenuTitle())) {
if (host.getSelectedView().equals(model.getMenuTitle())) {
holder.tvCount.setTextColor(context.getResources().getColor(R.color.navigation_item_selected));
holder.tvName.setTextColor(context.getResources().getColor(R.color.navigation_item_selected));
holder.ivIcon.setImageResource(model.getResourceActiveID());
Expand Down
Loading

0 comments on commit 6ca327b

Please sign in to comment.