Skip to content

Commit

Permalink
Release 0.5.5
Browse files Browse the repository at this point in the history
Merge branch 'develop'
  • Loading branch information
ifoche committed May 4, 2018
2 parents 91492bb + 31a4bd8 commit fe164e9
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 21 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ https://github.com/dhis2/dhis2-android-trackercapture/releases

# Testing
If you want to try the application out with a demo database, you can use the following:
- Server: https://apps.dhis2.org/demo
- Server: https://play.dhis2.org/demo
- Username: android
- Password: Android123

# How to Download and Set up in Android Studio
# How to Download and Set up the development environment in Android Studio

To successfully build and run this project, the dhis2-android-sdk is required.

The dhis2-android-sdk project https://github.com/dhis2/dhis2-android-sdk folder should be in a subfolder called named sdk inside dhis2-android-trackercapture. It is configured as a git submodule, so it will be automatically include when cloned using --recursive.
The dhis2-android-sdk project https://github.com/dhis2/dhis2-android-sdk folder should be in a subfolder named sdk inside dhis2-android-trackercapture. It is configured as a git submodule, so it will be automatically included when cloned using --recursive.

To be compatible with 2.25/2.26/2.27 & 2.28 servers, use 2.23-legacy branch in dhis2-android-trackercapture and tracker-capture branch in dhis2-android-sdk repositories.
Currently, the compatibility is guaranteed with 2.27, 2.28 and 2.29 servers, use develop branch in dhis2-android-trackercapture and tracker-capture branch in dhis2-android-sdk repositories.

When cloning from zero, it's strongly recommended to do it as follows:

```
git clone --recursive -b 2.23-legacy [email protected]:dhis2/dhis2-android-trackercapture.git
git clone --recursive -b develop [email protected]:dhis2/dhis2-android-trackercapture.git
cd dhis2-android-trackercapture/sdk
git checkout tracker-capture
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public EnrollmentDataEntryFragmentForm query(Context context) {

dataEntryRows.add(
new EnrollmentDatePickerRow(currentEnrollment.getProgram().getEnrollmentDateLabel(),
currentEnrollment));
currentEnrollment, true));

if (currentEnrollment.getProgram().getDisplayIncidentDate()) {
dataEntryRows.add(
new IncidentDatePickerRow(currentEnrollment.getProgram().getIncidentDateLabel(),
currentEnrollment));
currentEnrollment, true));
}

for (ProgramTrackedEntityAttribute ptea : programTrackedEntityAttributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void showWarningHiddenValuesDialog(Fragment fragment, ArrayList<String> a
.newInstance(fragment.getString(org.hisp.dhis.android.sdk.R.string.warning_hidefieldwithvalue), trackedEntityAttributeNames
);
enrollmentDataEntryFragment.setValidationErrorDialog(validationErrorDialog);
if (fragment.isAdded()) {
if (fragment.isAdded() && fragment.isVisible()) {
enrollmentDataEntryFragment.getValidationErrorDialog().show(fragment.getChildFragmentManager());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public EnrollmentDateFragmentForm query(Context context) {
return fragmentForm;

List<Row> dataEntryRows = new ArrayList<>();
dataEntryRows.add(new EnrollmentDatePickerRow(enrollment.getProgram().getEnrollmentDateLabel(), enrollment));
dataEntryRows.add(new EnrollmentDatePickerRow(enrollment.getProgram().getEnrollmentDateLabel(), enrollment, false));

if (enrollment.getProgram().getDisplayIncidentDate()) {
dataEntryRows.add(new IncidentDatePickerRow(enrollment.getProgram().getIncidentDateLabel(), enrollment));
dataEntryRows.add(new IncidentDatePickerRow(enrollment.getProgram().getIncidentDateLabel(), enrollment, true));
}

fragmentForm.setEnrollment(enrollment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public class ProgramOverviewFragment extends AbsProgramRuleFragment implements V
private ImageButton followupButton;
private ImageButton profileButton;
private ImageView enrollmentServerStatus;
private TextView enrollmentServerStatusText;
private Button completeButton;
private Button reOpenButton;
private Button terminateButton;
Expand Down Expand Up @@ -306,6 +307,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
registerForContextMenu(listView);

enrollmentServerStatus = (ImageView) header.findViewById(R.id.enrollmentstatus);
enrollmentServerStatusText = (TextView) header.findViewById(R.id.enrollmentstatus_text);
enrollmentLayout = (LinearLayout) header.findViewById(R.id.enrollmentLayout);
enrollmentDateLabel = (TextView) header.findViewById(R.id.dateOfEnrollmentLabel);
enrollmentDateValue = (TextView) header.findViewById(R.id.dateOfEnrollmentValue);
Expand Down Expand Up @@ -565,10 +567,13 @@ public void onLoadFinished(Loader<ProgramOverviewFragmentForm> loader,

if (failedItem != null && failedItem.getHttpStatusCode() >= 0) {
enrollmentServerStatus.setImageResource(R.drawable.ic_event_error);
enrollmentServerStatusText.setText(R.string.event_error);
} else if (!mForm.getEnrollment().isFromServer()) {
enrollmentServerStatus.setImageResource(R.drawable.ic_legacy_offline);
enrollmentServerStatusText.setText(R.string.event_offline);
} else {
enrollmentServerStatus.setImageResource(R.drawable.ic_from_server);
enrollmentServerStatusText.setText(R.string.event_sent);
}

refreshRelationshipButton.setEnabled(mForm.getEnrollment().isFromServer());
Expand Down Expand Up @@ -598,10 +603,12 @@ public void onLoadFinished(Loader<ProgramOverviewFragmentForm> loader,
}

final Map<Long, FailedItem> failedEvents = getFailedEvents();

for (IndicatorRow indicatorRow : mForm.getProgramIndicatorRows().values()) {
View view = indicatorRow.getView(getChildFragmentManager(),
getLayoutInflater(getArguments()), null, programIndicatorLayout);
if(indicatorRow.getIndicator().isDisplayInForm()){
programIndicatorCardView.setVisibility(View.VISIBLE);
}
programIndicatorLayout.addView(view);
}

Expand Down Expand Up @@ -672,6 +679,7 @@ private void initializeEventsViews(LinearLayout programEventsLayout) {
}

private void initializeIndicatorViews(LinearLayout programIndicatorLayout) {
programIndicatorCardView.setVisibility(View.GONE);
programIndicatorLayout.removeAllViews();
FlowLayout keyValueLayout = (FlowLayout) programIndicatorCardView.findViewById(
R.id.keyvaluelayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void showWarningHiddenValuesDialog(Fragment fragment, ArrayList<String> a
.newInstance(fragment.getString(org.hisp.dhis.android.sdk.R.string.warning_hidefieldwithvalue), trackedEntityAttributeNames
);
mTrackedEntityInstanceDataEntryFragment.setValidationErrorDialog(validationErrorDialog);
if (fragment.isAdded()) {
if (fragment.isAdded() && fragment.isVisible()) {
mTrackedEntityInstanceDataEntryFragment.getValidationErrorDialog().show(fragment.getChildFragmentManager());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void showWarningHiddenValuesDialog(Fragment parentFragment, ArrayList<Str
parentFragment.getString(org.hisp.dhis.android.sdk.R.string.warning_hidefieldwithvalue),
dataElementNames);
fragment.setValidationErrorDialog(validationErrorDialog);
if (parentFragment.isAdded()) {
if (parentFragment.isAdded() && parentFragment.isVisible()) {
fragment.getValidationErrorDialog().show(parentFragment.getChildFragmentManager());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit;
import org.hisp.dhis.android.sdk.utils.Utils;
import org.hisp.dhis.android.sdk.utils.support.DateUtils;
import org.hisp.dhis.android.trackercapture.R;
import org.joda.time.LocalDate;

public class ProgramStageEventRow implements ProgramStageRow {
Expand All @@ -66,6 +67,7 @@ public View getView(LayoutInflater inflater, View convertView, ViewGroup contain
TextView orgUnit;
TextView eventDateTextView;
ImageButton statusButton = null;
TextView statusText;

if (convertView != null && convertView.getTag() instanceof EventViewHolder) {
view = convertView;
Expand All @@ -75,8 +77,10 @@ public View getView(LayoutInflater inflater, View convertView, ViewGroup contain
orgUnit = (TextView) root.findViewById(org.hisp.dhis.android.sdk.R.id.organisationunit);
eventDateTextView = (TextView) root.findViewById(org.hisp.dhis.android.sdk.R.id.date);
statusButton = (ImageButton) root.findViewById(org.hisp.dhis.android.sdk.R.id.statusButton);
statusText = (TextView) root.findViewById(org.hisp.dhis.android.sdk.R.id.statusText);

holder = new EventViewHolder(orgUnit, eventDateTextView, statusButton, new OnProgramStageEventInternalClickListener());
holder = new EventViewHolder(orgUnit, eventDateTextView, statusButton,
new OnProgramStageEventInternalClickListener(), statusText);

root.findViewById(org.hisp.dhis.android.sdk.R.id.eventbackground).setOnClickListener(holder.listener);
root.findViewById(
Expand All @@ -93,6 +97,7 @@ public View getView(LayoutInflater inflater, View convertView, ViewGroup contain
holder.statusButton.setVisibility(View.VISIBLE);
holder.statusButton.setBackgroundResource(org.hisp.dhis.android.sdk.R.drawable.ic_event_error);
holder.statusButton.setTag(org.hisp.dhis.android.sdk.R.drawable.ic_event_error);
holder.statusText.setText(R.string.event_error);
holder.listener.setStatusButton(statusButton);
holder.listener.setStatus(OnRowClick.ITEM_STATUS.ERROR);
holder.statusButton.setOnClickListener(holder.listener);
Expand All @@ -101,6 +106,7 @@ public View getView(LayoutInflater inflater, View convertView, ViewGroup contain
holder.statusButton.setVisibility(View.VISIBLE);
holder.statusButton.setBackgroundResource(org.hisp.dhis.android.sdk.R.drawable.ic_legacy_offline);
holder.statusButton.setTag(org.hisp.dhis.android.sdk.R.drawable.ic_legacy_offline);
holder.statusText.setText(R.string.event_offline);
holder.listener.setStatusButton(statusButton);
holder.listener.setStatus(OnRowClick.ITEM_STATUS.OFFLINE);
holder.statusButton.setOnClickListener(holder.listener);
Expand All @@ -109,6 +115,7 @@ public View getView(LayoutInflater inflater, View convertView, ViewGroup contain
holder.statusButton.setVisibility(View.VISIBLE);
holder.statusButton.setBackgroundResource(org.hisp.dhis.android.sdk.R.drawable.ic_from_server);
holder.statusButton.setTag(org.hisp.dhis.android.sdk.R.drawable.ic_from_server);
holder.statusText.setText(R.string.event_sent);
holder.listener.setStatusButton(statusButton);
holder.listener.setStatus(OnRowClick.ITEM_STATUS.SENT);
holder.statusButton.setOnClickListener(holder.listener);
Expand Down Expand Up @@ -173,14 +180,17 @@ private static class EventViewHolder {
public final TextView orgUnit;
public final TextView date;
public final ImageButton statusButton;
public final TextView statusText;
public final OnProgramStageEventInternalClickListener listener;

private EventViewHolder(TextView orgUnit,
TextView date, ImageButton statusButton, OnProgramStageEventInternalClickListener listener) {
TextView date, ImageButton statusButton,
OnProgramStageEventInternalClickListener listener, TextView statusText) {
this.orgUnit = orgUnit;
this.date = date;
this.statusButton = statusButton;
this.listener = listener;
this.statusText = statusText;
}
}

Expand Down
16 changes: 14 additions & 2 deletions app/src/main/res/layout/fragment_programoverview_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,24 @@
android:text="@string/enrollment"
android:textSize="@dimen/medium_text_size" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="vertical">
<ImageView
android:id="@+id/enrollmentstatus"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:src="@drawable/ic_offline" />
android:src="@drawable/ic_offline"
android:layout_gravity="center"/>
<TextView
android:id="@+id/enrollmentstatus_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_offline"
android:textSize="16sp"/>
</LinearLayout>

</LinearLayout>

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ext {
minSdkVersion = 15
compileSdkVersion = 23
targetSdkVersion = 23
versionCode = 61
versionName = "0.5.3"
versionCode = 63
versionName = "0.5.5"

configuration = [
package : "org.hisp.dhis.android.trackercapture",
Expand All @@ -43,8 +43,8 @@ ext {
minSdkVersion : 15,
compileSdkVersion: 23,
targetSdkVersion : 23,
versionCode : 58,
versionName : "0.5.0"
versionCode : 63,
versionName : "0.5.5"
]

libraries = [
Expand Down

0 comments on commit fe164e9

Please sign in to comment.