Skip to content

Commit

Permalink
Merge 984d21c into 644ca55
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin committed Feb 6, 2020
2 parents 644ca55 + 984d21c commit 3401419
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 120 deletions.
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.4.39-SNAPSHOT
VERSION_NAME=1.4.40-SNAPSHOT
VERSION_CODE=2
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Immunization
Expand Down
12 changes: 8 additions & 4 deletions opensrp-immunization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:$androidToolsBuildGradle"
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3'
}
}

Expand All @@ -17,7 +17,7 @@ apply plugin: 'com.github.kt3k.coveralls'


jacoco {
toolVersion = "0.8.0"
toolVersion = "0.8.5"
}

allprojects {
Expand Down Expand Up @@ -81,6 +81,10 @@ android {
includeAndroidResources = true
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}


Expand All @@ -89,12 +93,12 @@ tasks.withType(Test) {
}

dependencies {
implementation('org.smartregister:opensrp-client-core:1.8.16-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:1.8.25-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
}

implementation('org.smartregister:opensrp-client-native-form:1.7.0-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-native-form:1.7.15-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import android.widget.TextView;
import android.widget.Toast;

import com.vijay.jsonwizard.utils.DatePickerUtils;
import com.vijay.jsonwizard.utils.NativeFormsProperties;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
Expand All @@ -35,14 +35,15 @@
import org.smartregister.immunization.util.ImageUtils;
import org.smartregister.immunization.util.Utils;
import org.smartregister.immunization.util.VaccinatorUtils;
import org.smartregister.util.DatePickerUtils;
import org.smartregister.util.OpenSRPImageLoader;
import org.smartregister.view.activity.DrishtiApplication;

import java.io.Serializable;
import java.util.Calendar;
import java.util.List;

@SuppressLint ("ValidFragment")
@SuppressLint("ValidFragment")
public class ServiceDialogFragment extends DialogFragment {
public static final String DIALOG_TAG = "ServiceDialogFragment";
public static final String WRAPPER_TAG = "tag";
Expand All @@ -53,6 +54,7 @@ public class ServiceDialogFragment extends DialogFragment {
private boolean disableConstraints;
private DateTime dcToday;
private DialogInterface.OnDismissListener onDismissListener;
private boolean isNumericDatePicker = Utils.isPropertyTrue(NativeFormsProperties.KEY.WIDGET_DATEPICKER_IS_NUMERIC);

public static ServiceDialogFragment newInstance(
List<ServiceRecord> issuedServices,
Expand Down Expand Up @@ -105,14 +107,10 @@ public void setDateOfBirth(DateTime dateOfBirth) {
/**
* This method updates the allowed date ranges in the views
*
* @param givenToday
* The 'Given done today' button
* @param givenEarlier
* The 'Given earlier' button
* @param set
* The 'Set' Button
* @param earlierDatePicker
* Date picker for selecting a previous date for a vaccine
* @param givenToday The 'Given done today' button
* @param givenEarlier The 'Given earlier' button
* @param set The 'Set' Button
* @param earlierDatePicker Date picker for selecting a previous date for a vaccine
*/
private void updateDateRanges(Button givenToday, Button givenEarlier, Button set, DatePicker earlierDatePicker) {
if (tag == null || tag.getDob() == null || tag.getServiceType() == null || issuedServices == null) {
Expand Down Expand Up @@ -151,7 +149,7 @@ private void updateDateRanges(Button givenToday, Button givenEarlier, Button set
earlierDatePicker.setVisibility(View.VISIBLE);
set.setVisibility(View.VISIBLE);

DatePickerUtils.themeDatePicker(earlierDatePicker, new char[] {'d', 'm', 'y'});
DatePickerUtils.themeDatePicker(earlierDatePicker, new char[]{'d', 'm', 'y'});
}

earlierDatePicker.setMinDate(minDate.getMillis());
Expand All @@ -169,8 +167,7 @@ private void updateDateRanges(Button givenToday, Button givenEarlier, Button set
/**
* This method updates the allowed date ranges in the views
*
* @param datePicker
* Date picker for selecting a previous date for a vaccine
* @param datePicker Date picker for selecting a previous date for a vaccine
*/
private void updateDateRanges(DatePicker datePicker, Button set) {
if (tag == null || tag.getDob() == null || tag.getServiceType() == null || issuedServices == null) {
Expand Down Expand Up @@ -415,7 +412,7 @@ public void onClick(View v) {

// step 2
final DatePicker itnDatePicker = step2.findViewById(R.id.itn_date_picker);
DatePickerUtils.themeDatePicker(itnDatePicker, new char[] {'d', 'm', 'y'});
DatePickerUtils.themeDatePicker(itnDatePicker, new char[]{'d', 'm', 'y'});

Button recordItn = step2.findViewById(R.id.record_itn);
recordItn.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -493,7 +490,7 @@ public void onClick(View v) {
} else {
defaultActions.setVisibility(View.VISIBLE);

final DatePicker earlierDatePicker = defaultActions.findViewById(R.id.earlier_date_picker);
final DatePicker earlierDatePicker = defaultActions.findViewById(isNumericDatePicker ? R.id.earlier_date_picker_numeric : R.id.earlier_date_picker);

final Button set = defaultActions.findViewById(R.id.set);
set.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -542,7 +539,7 @@ public void onClick(View view) {
earlierDatePicker.setVisibility(View.VISIBLE);
set.setVisibility(View.VISIBLE);

DatePickerUtils.themeDatePicker(earlierDatePicker, new char[] {'d', 'm', 'y'});
DatePickerUtils.themeDatePicker(earlierDatePicker, new char[]{'d', 'm', 'y'});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.widget.TextView;
import android.widget.Toast;

import com.vijay.jsonwizard.utils.NativeFormsProperties;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.smartregister.immunization.R;
Expand Down Expand Up @@ -49,6 +51,7 @@ public class ServiceEditDialogFragment extends DialogFragment {
private DateTime dateOfBirth;
private boolean disableConstraints;
private DateTime dcToday;
private boolean isNumericDatePicker = Utils.isPropertyTrue(NativeFormsProperties.KEY.WIDGET_DATEPICKER_IS_NUMERIC);

private ServiceEditDialogFragment(List<ServiceRecord> issuedServices, ServiceWrapper tag, View viewGroup) {
this.issuedServices = issuedServices;
Expand Down Expand Up @@ -174,7 +177,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}
}

final DatePicker earlierDatePicker = dialogView.findViewById(R.id.earlier_date_picker);
final DatePicker earlierDatePicker = dialogView.findViewById(isNumericDatePicker ? R.id.earlier_date_picker_numeric : R.id.earlier_date_picker);

String color = tag.getColor();
Button status = dialogView.findViewById(R.id.status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import com.vijay.jsonwizard.customviews.CheckBox;
import com.vijay.jsonwizard.customviews.RadioButton;
import com.vijay.jsonwizard.utils.DatePickerUtils;
import com.vijay.jsonwizard.utils.NativeFormsProperties;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
Expand All @@ -40,6 +40,7 @@
import org.smartregister.immunization.util.ImageUtils;
import org.smartregister.immunization.util.Utils;
import org.smartregister.immunization.util.VaccinatorUtils;
import org.smartregister.util.DatePickerUtils;
import org.smartregister.util.OpenSRPImageLoader;
import org.smartregister.view.activity.DrishtiApplication;

Expand All @@ -62,6 +63,7 @@ public class VaccinationDialogFragment extends DialogFragment {
private DialogInterface.OnDismissListener onDismissListener;
private Integer defaultImageResourceID;
private Integer defaultErrorImageResourceID;
private boolean isNumericDatePicker = Utils.isPropertyTrue(NativeFormsProperties.KEY.WIDGET_DATEPICKER_IS_NUMERIC);

public static VaccinationDialogFragment newInstance(Date dateOfBirth,
List<Vaccine> issuedVaccines,
Expand Down Expand Up @@ -352,7 +354,7 @@ public void onClick(View v) {
}
}

final DatePicker earlierDatePicker = dialogView.findViewById(R.id.earlier_date_picker);
final DatePicker earlierDatePicker = dialogView.findViewById(isNumericDatePicker ? R.id.earlier_date_picker_numeric : R.id.earlier_date_picker);

String color = tags.get(0).getColor();
Button status = dialogView.findViewById(R.id.status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.widget.TextView;
import android.widget.Toast;

import com.vijay.jsonwizard.utils.NativeFormsProperties;

import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.smartregister.domain.AlertStatus;
Expand Down Expand Up @@ -56,6 +58,7 @@ public class VaccinationEditDialogFragment extends DialogFragment {
private Calendar dcToday;
private Integer defaultImageResourceID;
private Integer defaultErrorImageResourceID;
private boolean isNumericDatePicker = Utils.isPropertyTrue(NativeFormsProperties.KEY.WIDGET_DATEPICKER_IS_NUMERIC);

private VaccinationEditDialogFragment(
Context context, Date dateOfBirth,
Expand Down Expand Up @@ -226,7 +229,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}
}

final DatePicker earlierDatePicker = dialogView.findViewById(R.id.earlier_date_picker);
final DatePicker earlierDatePicker = dialogView.findViewById(isNumericDatePicker ? R.id.earlier_date_picker_numeric : R.id.earlier_date_picker);

String color = tags.get(0).getColor();
Button status = dialogView.findViewById(R.id.status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.util.Log;

import org.apache.commons.lang3.StringUtils;
import org.smartregister.CoreLibrary;
import org.smartregister.immunization.ImmunizationLibrary;
import org.smartregister.immunization.db.VaccineRepo;
import org.smartregister.immunization.domain.GroupVaccineCount;
Expand Down Expand Up @@ -182,4 +183,12 @@ private static void processDefaultVaccineGroupCount(VaccineRepo.Vaccine repoVacc
ImmunizationLibrary.getInstance().getVaccineCacheMap().get(category).groupVaccineCountMap.put(repoGroup, groupVaccineCount);
}
}

/**
* Returns boolean for boolean values configured in the app.properties file
* **/
public static boolean isPropertyTrue(String key) {

return CoreLibrary.getInstance().context().getAppProperties().hasProperty(key) && CoreLibrary.getInstance().context().getAppProperties().getPropertyBoolean(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,12 @@ private void updateStateUi() {
StatusTV.setText(DATE_FORMAT.format(getDateDue()));
break;
case EXPIRED:
if(ImmunizationLibrary.getInstance().isAllowExpiredVaccineEntry()){
setBackgroundResource(R.drawable.vaccine_card_background_white);
statusIV.setBackgroundResource(R.drawable.vaccine_card_background_red);
StatusTV.setTextColor(context.getResources().getColor(R.color.white));
} else {
setBackgroundResource(R.drawable.vaccine_card_background_white);
statusIV.setBackgroundResource(R.drawable.vaccine_card_background_white);
StatusTV.setTextColor(context.getResources().getColor(R.color.silver));
}
setBackgroundResource(R.drawable.vaccine_card_background_white);
statusIV.setBackgroundResource(R.drawable.vaccine_card_background_white);
undoB.setVisibility(INVISIBLE);
nameTV.setText(getVaccineName());
StatusTV.setText(context.getResources().getString(R.string.expired));
StatusTV.setTextColor(context.getResources().getColor(R.color.silver));
break;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.joda.time.DateTime;
import org.smartregister.domain.Alert;
import org.smartregister.immunization.ImmunizationLibrary;
import org.smartregister.immunization.R;
import org.smartregister.immunization.domain.State;
import org.smartregister.immunization.domain.VaccineWrapper;
Expand Down Expand Up @@ -57,7 +56,7 @@ private void init(Context context) {

//Init date formatters here to allow for dynamic language switching
DATE_FORMAT = new SimpleDateFormat("dd/MM/yy", Locale.ENGLISH);
SHORT_DATE_FORMAT = new SimpleDateFormat("dd/MM",Locale.ENGLISH);
SHORT_DATE_FORMAT = new SimpleDateFormat("dd/MM", Locale.ENGLISH);
}

public VaccineCard(Context context, AttributeSet attrs) {
Expand Down Expand Up @@ -228,17 +227,13 @@ private void updateStateUi() {
}
break;
case EXPIRED:
if(ImmunizationLibrary.getInstance().isAllowExpiredVaccineEntry()){
setBackgroundResource(R.drawable.vaccine_card_background_red);
nameTV.setTextColor(context.getResources().getColor(android.R.color.white));
} else {
setBackgroundResource(R.drawable.vaccine_card_background_white);
nameTV.setTextColor(context.getResources().getColor(R.color.silver));
}

setBackgroundResource(R.drawable.vaccine_card_background_white);
nameTV.setTextColor(context.getResources().getColor(R.color.silver));
statusIV.setVisibility(GONE);
undoB.setVisibility(GONE);
nameTV.setVisibility(VISIBLE);
nameTV.setText(context.getResources().getString(R.string.expired_colon,getVaccineName()));
nameTV.setText(context.getResources().getString(R.string.expired_colon, getVaccineName()));
break;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/btn_margin_bottom"
android:layout_marginStart="@dimen/btn_margin_left"
android:layout_marginEnd="@dimen/btn_margin_right"
android:layout_marginBottom="@dimen/btn_margin_bottom"
android:background="@drawable/vaccination_today_bg"
android:paddingBottom="@dimen/btn_padding_bottom"
android:paddingTop="@dimen/btn_padding_top"
android:paddingBottom="@dimen/btn_padding_bottom"
android:text=""
android:textAllCaps="false"
android:textAppearance="?android:textAppearanceSmall"
Expand All @@ -27,12 +27,12 @@
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/btn_margin_bottom"
android:layout_marginStart="@dimen/btn_margin_left"
android:layout_marginEnd="@dimen/btn_margin_right"
android:layout_marginBottom="@dimen/btn_margin_bottom"
android:background="@drawable/vaccination_earlier_bg"
android:paddingBottom="@dimen/btn_padding_bottom"
android:paddingTop="@dimen/btn_padding_top"
android:paddingBottom="@dimen/btn_padding_bottom"
android:text=""
android:textAllCaps="false"
android:textAppearance="?android:textAppearanceSmall"
Expand All @@ -41,9 +41,18 @@

<DatePicker
android:id="@+id/earlier_date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false"
android:descendantFocusability="blocksDescendants"
android:visibility="gone" />

<com.vijay.jsonwizard.customviews.NumericDatePicker
android:id="@+id/earlier_date_picker_numeric"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false"
android:descendantFocusability="blocksDescendants"
android:visibility="gone" />
Expand All @@ -64,8 +73,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingBottom="@dimen/btn_padding_bottom"
android:paddingTop="@dimen/btn_padding_top"
android:paddingBottom="@dimen/btn_padding_bottom"
android:text="@string/cancel"
android:textAllCaps="false"
android:textAppearance="?android:textAppearanceSmall"
Expand All @@ -78,8 +87,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingBottom="@dimen/btn_padding_bottom"
android:paddingTop="@dimen/btn_padding_top"
android:paddingBottom="@dimen/btn_padding_bottom"
android:text="@string/set"
android:textAllCaps="false"
android:textAppearance="?android:textAppearanceSmall"
Expand Down

0 comments on commit 3401419

Please sign in to comment.