From 678ccc8f3cc8087253f4d67aab2ea5a481a117e3 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Thu, 30 Sep 2021 12:22:21 +0300 Subject: [PATCH 01/28] add descriptions for report labels --- .../chw/application/ChwApplicationFlv.java | 10 ++++ .../drawable/ic_navigate_next_grey_24dp.xml | 9 +++ .../lmh/res/layout/reports_fragment_item.xml | 49 ++++++++++++++++ opensrp-chw/src/lmh/res/values/strings.xml | 4 ++ .../chw/application/ChwApplication.java | 4 ++ .../application/DefaultChwApplicationFlv.java | 10 ++++ .../smartregister/chw/domain/ReportType.java | 19 ++++++- .../chw/fragment/ReportsFragment.java | 20 +++++-- .../chw/viewholder/ReportViewHolder.java | 11 ++++ .../drawable/ic_navigate_next_black_24dp.xml | 10 ++-- .../src/main/res/layout/reports_fragment.xml | 2 +- .../main/res/layout/reports_fragment_item.xml | 56 ++++++++++++++----- 12 files changed, 178 insertions(+), 26 deletions(-) create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml create mode 100644 opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index 071e41b4ce..2390e5d8b0 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -156,4 +156,14 @@ public boolean showChildrenAboveTwoDueStatus(){ public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return true; } + + @Override + public boolean showReportsDescription() { + return true; + } + + @Override + public boolean showReportsDivider() { + return true; + } } diff --git a/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml new file mode 100644 index 0000000000..c809dbee8f --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_navigate_next_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml new file mode 100644 index 0000000000..7484b7756a --- /dev/null +++ b/opensrp-chw/src/lmh/res/layout/reports_fragment_item.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + diff --git a/opensrp-chw/src/lmh/res/values/strings.xml b/opensrp-chw/src/lmh/res/values/strings.xml index 00e11fd350..f6df6d046d 100644 --- a/opensrp-chw/src/lmh/res/values/strings.xml +++ b/opensrp-chw/src/lmh/res/values/strings.xml @@ -25,4 +25,8 @@ %s adults and %s U11 children Are you sure you want to go back? All data you have entered in this form will be cleared. + + List of children who can take the vaccines at a date in the future + Number of vaccine doses needed for children who can take the vaccine at a date in the future + Number on vaccines provided and child deaths in my area \ No newline at end of file diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java index 3d3b62a00b..406bcff066 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java @@ -438,6 +438,10 @@ public interface Flavor { boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(); + boolean showReportsDescription(); + + boolean showReportsDivider(); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java index 06e6dae369..7521b3a90b 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java @@ -216,4 +216,14 @@ public boolean showLastNameOnChildProfile() { public boolean showIconsForChildrenUnderTwoAndGirlsAgeNineToEleven(){ return false; } + + @Override + public boolean showReportsDescription() { + return false; + } + + @Override + public boolean showReportsDivider() { + return false; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java index 130202568d..3179bd8aa5 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/domain/ReportType.java @@ -4,14 +4,29 @@ public class ReportType implements ListContract.Identifiable { - private String id; - private String name; + private final String id; + private final String name; + private String description; public ReportType(String id, String name) { this.id = id; this.name = name; } + public ReportType(String id, String name, String description){ + this.id = id; + this.name = name; + this.description = description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + @Override public String getID() { return id; diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java index 2ce8808407..135b9bbecd 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/fragment/ReportsFragment.java @@ -8,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -15,6 +16,7 @@ import org.smartregister.chw.activity.FragmentBaseActivity; import org.smartregister.chw.adapter.ListableAdapter; import org.smartregister.chw.adapter.ReportsFragmentAdapter; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.contract.ListContract; import org.smartregister.chw.domain.ReportType; import org.smartregister.chw.presenter.ListPresenter; @@ -43,9 +45,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, presenter.fetchList(() -> { List list = new ArrayList<>(); - list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children))); - list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed))); - list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity))); + if (ChwApplication.getApplicationFlavor().showReportsDescription()){ + list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children), getString(R.string.eligible_children_description))); + list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed), getString(R.string.doses_needed_description))); + list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity), getString(R.string.community_activity_description))); + }else { + list.add(new ReportType(getString(R.string.eligible_children), getString(R.string.eligible_children))); + list.add(new ReportType(getString(R.string.doses_needed), getString(R.string.doses_needed))); + list.add(new ReportType(getString(R.string.community_activity), getString(R.string.community_activity))); + } return list; }); @@ -57,9 +65,13 @@ public void bindLayout() { RecyclerView recyclerView = view.findViewById(R.id.recyclerView); recyclerView.setHasFixedSize(false); - RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); + LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(layoutManager); + if (ChwApplication.getApplicationFlavor().showReportsDivider()){ + recyclerView.addItemDecoration(new DividerItemDecoration(requireContext(), layoutManager.getOrientation())); + } + progressBar = view.findViewById(R.id.progress_bar); progressBar.setVisibility(View.GONE); diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java index 38aae34a6e..07df1c1741 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/viewholder/ReportViewHolder.java @@ -6,28 +6,39 @@ import androidx.annotation.NonNull; import org.smartregister.chw.R; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.contract.ListContract; import org.smartregister.chw.domain.ReportType; public class ReportViewHolder extends ListableViewHolder { private TextView tvName; + private TextView tvDesc; private View currentView; public ReportViewHolder(@NonNull View itemView) { super(itemView); currentView = itemView; tvName = itemView.findViewById(R.id.tvName); + if (ChwApplication.getApplicationFlavor().showReportsDescription()) { + tvDesc = itemView.findViewById(R.id.tvDesc); + } } @Override public void bindView(ReportType reportType, ListContract.View view) { tvName.setText(reportType.getName()); + if (tvDesc != null){ + tvDesc.setText(reportType.getDescription()); + } currentView.setOnClickListener(v -> view.onListItemClicked(reportType, v.getId())); } @Override public void resetView() { tvName.setText(""); + if (tvDesc != null){ + tvDesc.setText(""); + } } } diff --git a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml index 24835127dd..125885ad41 100644 --- a/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml +++ b/opensrp-chw/src/main/res/drawable/ic_navigate_next_black_24dp.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" /> diff --git a/opensrp-chw/src/main/res/layout/reports_fragment.xml b/opensrp-chw/src/main/res/layout/reports_fragment.xml index f641ccdcea..b74cfa6a88 100644 --- a/opensrp-chw/src/main/res/layout/reports_fragment.xml +++ b/opensrp-chw/src/main/res/layout/reports_fragment.xml @@ -24,7 +24,7 @@ - + android:paddingRight="25dp" + android:paddingBottom="20dp"> - + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/ivNext" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + android:layout_height="30dp" + android:src="@drawable/ic_navigate_next_black_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + From ed4625fa99fa8e92b2893e47c2b1c68cdf2658a5 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Mon, 4 Oct 2021 15:29:23 +0300 Subject: [PATCH 02/28] make different lmh ui screen for bluetooth sync (#1913) --- .../res/drawable/ic_transfer_data_receive.xml | 10 ++ .../res/drawable/ic_transfer_data_send.xml | 10 ++ .../drawable/p2p_card_text_color_selector.xml | 5 + .../lmh/res/layout/fragment_mode_select.xml | 161 ++++++++++++++++++ opensrp-chw/src/lmh/res/values/strings.xml | 3 + 5 files changed, 189 insertions(+) create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml create mode 100644 opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml create mode 100644 opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml create mode 100644 opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml new file mode 100644 index 0000000000..e1a5381c8c --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_receive.xml @@ -0,0 +1,10 @@ + + + diff --git a/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml new file mode 100644 index 0000000000..558afc034d --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/ic_transfer_data_send.xml @@ -0,0 +1,10 @@ + + + diff --git a/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml new file mode 100644 index 0000000000..c58a8cb97e --- /dev/null +++ b/opensrp-chw/src/lmh/res/drawable/p2p_card_text_color_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml new file mode 100644 index 0000000000..f04c2bb05e --- /dev/null +++ b/opensrp-chw/src/lmh/res/layout/fragment_mode_select.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + +