Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/lmh_fix_reports_ui' into lmh-mov…
Browse files Browse the repository at this point in the history
…e-navigation-to-side
  • Loading branch information
LZRS committed Oct 4, 2021
2 parents 575ffb7 + 9dd595c commit c8afc0a
Show file tree
Hide file tree
Showing 23 changed files with 476 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,18 @@ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){
public boolean showBottomNavigation() {
return false;
}

@Override
public boolean disableChildRegistrationTitleGoBack() {
return true;
}

public boolean showReportsDescription() {
return true;
}

@Override
public boolean showReportsDivider() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import org.smartregister.chw.anc.contract.BaseAncHomeVisitContract;
import org.smartregister.chw.anc.domain.VaccineDisplay;
Expand Down Expand Up @@ -42,7 +44,17 @@ public static BaseHomeVisitImmunizationFragmentFlv getInstance(final BaseAncHome

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
DatePickerUtils.themeDatePicker(singleDatePicker, new char[]{'d', 'm', 'y'});
callDatePickerUtilsThemeDatePicker(singleDatePicker, new char[]{'d', 'm', 'y'});
super.onViewCreated(view, savedInstanceState);
}

@VisibleForTesting
void callDatePickerUtilsThemeDatePicker(DatePicker datePicker, char[] ymdOrder){
DatePickerUtils.themeDatePicker(datePicker, ymdOrder);
}

@Override
protected void setDatePickerTheme(DatePicker picker) {
callDatePickerUtilsThemeDatePicker(picker, new char[]{'d', 'm', 'y'});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF757575"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
</vector>
10 changes: 10 additions & 0 deletions opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="36dp"
android:height="36dp"
android:viewportWidth="24"
android:viewportHeight="25">
<path
android:pathData="M17.2929,17.0529C17.4804,16.8654 17.7348,16.76 18,16.76C18.2652,16.76 18.5196,16.8654 18.7071,17.0529C18.8946,17.2404 19,17.4948 19,17.76V20.5C19,21.2956 18.6839,22.0587 18.1213,22.6213C17.5587,23.1839 16.7956,23.5 16,23.5H6C5.2043,23.5 4.4413,23.1839 3.8787,22.6213C3.3161,22.0587 3,21.2956 3,20.5V4.5C3,3.7043 3.3161,2.9413 3.8787,2.3787C4.4413,1.8161 5.2043,1.5 6,1.5H16C16.7956,1.5 17.5587,1.8161 18.1213,2.3787C18.6839,2.9413 19,3.7043 19,4.5V4.72V4.93C19,5.1952 18.8946,5.4496 18.7071,5.6371C18.5196,5.8246 18.2652,5.93 18,5.93C17.7348,5.93 17.4804,5.8246 17.2929,5.6371C17.1054,5.4496 17,5.1952 17,4.93V4.5V4.36C16.9983,4.2353 16.9702,4.1124 16.9174,3.9994C16.8646,3.8864 16.7884,3.7859 16.6939,3.7046C16.5993,3.6233 16.4886,3.5629 16.3689,3.5277C16.2493,3.4924 16.1235,3.483 16,3.5H6C5.8765,3.483 5.7507,3.4924 5.6311,3.5277C5.5114,3.5629 5.4007,3.6233 5.3061,3.7046C5.2116,3.7859 5.1354,3.8864 5.0826,3.9994C5.0298,4.1124 5.0017,4.2353 5,4.36V18.12C5.0032,18.2442 5.0324,18.3663 5.0857,18.4786C5.139,18.5908 5.2152,18.6906 5.3094,18.7716C5.4036,18.8527 5.5137,18.913 5.6326,18.9489C5.7516,18.9848 5.8767,18.9954 6,18.98H16C16.1217,18.9953 16.2452,18.9853 16.3628,18.9506C16.4804,18.9159 16.5896,18.8573 16.6835,18.7784C16.7774,18.6996 16.854,18.6021 16.9084,18.4923C16.9629,18.3824 16.9941,18.2625 17,18.14V17.76C17,17.4948 17.1054,17.2404 17.2929,17.0529ZM11.3829,22.1367C11.5037,22.085 11.6119,22.0076 11.7,21.91C11.7976,21.8219 11.875,21.7137 11.9268,21.5929C11.9785,21.4721 12.0035,21.3414 12,21.21C11.9883,20.948 11.8817,20.6992 11.7,20.51C11.5131,20.3268 11.2618,20.2241 11,20.2241C10.7382,20.2241 10.4869,20.3268 10.3,20.51C10.25,20.56 10.225,20.61 10.2,20.66C10.175,20.71 10.15,20.76 10.1,20.81C10.0205,20.9273 9.985,21.069 10,21.21C9.9965,21.3414 10.0215,21.4721 10.0733,21.5929C10.125,21.7137 10.2024,21.8219 10.3,21.91C10.4,22.01 10.5,22.11 10.6,22.11C10.7173,22.1895 10.859,22.225 11,22.21C11.1314,22.2135 11.2621,22.1885 11.3829,22.1367ZM14.1601,10.5H20.0001C20.113,10.4738 20.2304,10.4733 20.3435,10.4988C20.4566,10.5243 20.5625,10.5749 20.6533,10.647C20.7441,10.7191 20.8175,10.8108 20.8679,10.9152C20.9183,11.0196 20.9445,11.1341 20.9445,11.25C20.9445,11.366 20.9183,11.4804 20.8679,11.5848C20.8175,11.6892 20.7441,11.7809 20.6533,11.853C20.5625,11.9251 20.4566,11.9758 20.3435,12.0012C20.2304,12.0267 20.113,12.0263 20.0001,12H14.1501L16.1501,14C16.2274,14.0703 16.2892,14.156 16.3315,14.2516C16.3738,14.3471 16.3956,14.4505 16.3956,14.555C16.3956,14.6595 16.3738,14.7629 16.3315,14.8585C16.2892,14.954 16.2274,15.0397 16.1501,15.11C16.0816,15.1885 15.997,15.2515 15.9022,15.2946C15.8073,15.3377 15.7043,15.36 15.6001,15.36C15.4959,15.36 15.3929,15.3377 15.298,15.2946C15.2032,15.2515 15.1186,15.1885 15.0501,15.11L11.7301,11.79C11.6468,11.7216 11.5901,11.626 11.5701,11.52C11.5098,11.3382 11.5098,11.1418 11.5701,10.96C11.5901,10.854 11.6468,10.7585 11.7301,10.69L15.0601,7.39C15.1286,7.3115 15.2132,7.2486 15.308,7.2055C15.4029,7.1623 15.5059,7.14 15.6101,7.14C15.7143,7.14 15.8173,7.1623 15.9122,7.2055C16.007,7.2486 16.0916,7.3115 16.1601,7.39C16.2374,7.4603 16.2992,7.546 16.3415,7.6416C16.3838,7.7371 16.4056,7.8405 16.4056,7.945C16.4056,8.0495 16.3838,8.1529 16.3415,8.2485C16.2992,8.344 16.2374,8.4297 16.1601,8.5L14.1601,10.5Z"
android:fillColor="#006EB8"
android:fillType="evenOdd"/>
</vector>
10 changes: 10 additions & 0 deletions opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="36dp"
android:height="36dp"
android:viewportWidth="24"
android:viewportHeight="25">
<path
android:pathData="M21,10.55V10.71C21,10.9752 20.8946,11.2296 20.7071,11.4171C20.5196,11.6046 20.2652,11.71 20,11.71C19.7348,11.71 19.4804,11.6046 19.2929,11.4171C19.1054,11.2296 19,10.9752 19,10.71V10.5V9.5H14C13.7348,9.5 13.4804,9.3946 13.2929,9.2071C13.1054,9.0196 13,8.7652 13,8.5V3.5H6C5.7348,3.5 5.4804,3.6054 5.2929,3.7929C5.1054,3.9804 5,4.2348 5,4.5V20.5C5.0088,20.7519 5.1123,20.9912 5.29,21.17C5.3826,21.2645 5.4931,21.3397 5.6149,21.3912C5.7368,21.4427 5.8677,21.4694 6,21.47H18C18.2638,21.4662 18.5154,21.3584 18.7,21.17C18.8813,20.9928 18.9886,20.7533 19,20.5C19,20.2348 19.1054,19.9804 19.2929,19.7929C19.4804,19.6054 19.7348,19.5 20,19.5C20.2652,19.5 20.5196,19.6054 20.7071,19.7929C20.8946,19.9804 21,20.2348 21,20.5V20.7C21.0047,20.7599 21.0047,20.8201 21,20.88C20.907,21.6081 20.5504,22.2769 19.9975,22.7597C19.4447,23.2425 18.734,23.5059 18,23.5H6C5.2043,23.5 4.4413,23.1839 3.8787,22.6213C3.3161,22.0587 3,21.2956 3,20.5V4.5C3,3.7043 3.3161,2.9413 3.8787,2.3787C4.4413,1.8161 5.2043,1.5 6,1.5H14C14.2575,1.501 14.5046,1.6013 14.69,1.78L20.69,7.78C20.7894,7.8762 20.8677,7.992 20.92,8.12C20.9712,8.2402 20.9984,8.3693 21,8.5V10.55ZM15,4.92V7.5H17.58L15,4.92ZM15.9817,19.5914C15.8861,19.5491 15.8004,19.4873 15.7301,19.41C15.6569,19.3407 15.5984,19.2573 15.5581,19.1649C15.5178,19.0725 15.4965,18.9729 15.4956,18.8721C15.4947,18.7713 15.5141,18.6713 15.5526,18.5781C15.5912,18.485 15.6482,18.4006 15.7201,18.33L17.7201,16.33H11.8601C11.7583,16.3327 11.6569,16.3147 11.5622,16.277C11.4676,16.2392 11.3816,16.1826 11.3095,16.1106C11.2375,16.0385 11.1808,15.9525 11.1431,15.8578C11.1054,15.7632 11.0874,15.6618 11.0901,15.56C11.0874,15.4576 11.1054,15.3558 11.143,15.2606C11.1806,15.1654 11.2371,15.0788 11.309,15.006C11.3809,14.9331 11.4668,14.8755 11.5615,14.8367C11.6562,14.7979 11.7578,14.7786 11.8601,14.78H17.7301L15.7301,12.78C15.5829,12.6328 15.5002,12.4331 15.5002,12.225C15.5002,12.0168 15.5829,11.8171 15.7301,11.67C15.8773,11.5228 16.077,11.4401 16.2851,11.4401C16.4933,11.4401 16.6929,11.5228 16.8401,11.67L20.1501,14.99C20.2401,15.0541 20.3012,15.1511 20.3201,15.26C20.3715,15.4397 20.3715,15.6302 20.3201,15.81C20.312,15.8656 20.2927,15.9191 20.2635,15.9672C20.2343,16.0153 20.1958,16.057 20.1501,16.09L16.8401,19.41C16.7698,19.4873 16.6841,19.5491 16.5886,19.5914C16.493,19.6337 16.3896,19.6555 16.2851,19.6555C16.1806,19.6555 16.0772,19.6337 15.9817,19.5914Z"
android:fillColor="#006EB8"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="@android:color/white"/>
<item android:color="#006EB8"/>
</selector>
161 changes: 161 additions & 0 deletions opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:background="#f3f3f3">

<ImageView
android:id="@+id/image_icon_share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_icon_share"
android:padding="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<FrameLayout
android:id="@+id/card_p2pModeSelectActivity_send"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image_icon_share">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:contentPaddingTop="10dp"
app:contentPaddingBottom="8dp"
app:contentPaddingLeft="16dp"
app:contentPaddingRight="16dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_send_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_transfer_data_send"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/image_send_icon"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_data"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@drawable/p2p_card_text_color_selector" />

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tap_to_send_data"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle" />

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.cardview.widget.CardView>

<Button
android:id="@+id/btn_p2pModeSelectActivity_send"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:visibility="visible" />

</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/card_p2pModeSelectActivity_send">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:contentPaddingTop="10dp"
app:contentPaddingBottom="8dp"
app:contentPaddingLeft="16dp"
app:contentPaddingRight="16dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_receive_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:src="@drawable/ic_transfer_data_receive"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="8dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/image_receive_icon"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/receive_data"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@drawable/p2p_card_text_color_selector" />

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tap_to_receive_data"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle" />

</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.cardview.widget.CardView>

<Button
android:id="@+id/btn_p2pModeSelectActivity_receive"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:visibility="visible" />
</FrameLayout>


</androidx.constraintlayout.widget.ConstraintLayout>
49 changes: 49 additions & 0 deletions opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp">

<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivNext"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textSize="18sp"
tools:text="@string/eligible_children" />

<TextView
android:id="@+id/tvDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginTop="4dp"
tools:text="@string/eligible_children_description" />

</LinearLayout>

<ImageView
android:id="@+id/ivNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:src="@drawable/ic_navigate_next_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
7 changes: 7 additions & 0 deletions opensrp-chw/src/lmh/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@
<string name="device_to_device">Transfer Data</string>
<string name="menu_child_clients">All Children</string>
<string name="menu_add_new_family">Add New Family</string>

<string name="peer_to_peer_activity_title">Transfer Data</string>
<string name="tap_to_receive_data">Tap to start receiving data from nearby device</string>
<string name="tap_to_send_data">Tap to start sending data to nearby device</string>
<string name="eligible_children_description">List of children who can take the vaccines at a date in the future</string>
<string name="doses_needed_description">Number of vaccine doses needed for children who can take the vaccine at a date in the future</string>
<string name="community_activity_description">Number on vaccines provided and child deaths in my area</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ImmunizationValidator(
) {
vaccineSchedules = VisitVaccineUtil.getSchedule(vaccinesGroups, specialVaccines, vaccineCategory);
for (org.smartregister.immunization.domain.Vaccine vaccine : vaccines) {
administeredVaccines.put(vaccine.getName(), vaccine.getDate());
administeredVaccines.put(vaccine.getName().toLowerCase(), vaccine.getDate());
}
}

Expand Down Expand Up @@ -134,8 +134,14 @@ public void onChanged(String s) {
// add all the received vaccines in the map
if (prevFragment != null) {
for (VaccineDisplay display : prevFragment.getVaccineDisplays().values()) {
if (display.getValid())
receivedVacs.put(display.getVaccineWrapper().getName(), display.getDateGiven());
String displayName = display.getVaccineWrapper().getName().toLowerCase();
if (display.getValid()) {
receivedVacs.put(displayName, display.getDateGiven());
} else if (receivedVacs.containsKey(displayName)
&& !display.getValid() // If not valid, remove from administered vaccines
) {
receivedVacs.remove(displayName);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ public interface Flavor {

boolean showBottomNavigation();

boolean disableChildRegistrationTitleGoBack();

boolean showReportsDescription();

boolean showReportsDivider();

}

}
Loading

0 comments on commit c8afc0a

Please sign in to comment.