From dbaba4377dde732e17175786933e6e3661749c84 Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 13:27:34 +0300 Subject: [PATCH 01/23] malaria profile setup --- .../activity/BaseMalariaProfileActivity.java | 72 ++++++++ .../activity/BaseMalariaRegisterActivity.java | 18 +- .../contract/MalariaProfileContract.java | 22 +++ .../fragment/BaseMalariaRegisterFragment.java | 27 ++- .../presenter/MalariaProfilePresenter.java | 21 +++ .../provider/MalariaRegisterProvider.java | 6 +- .../main/res/drawable/record_btn_selector.xml | 8 + .../res/layout/activity_malaria_profile.xml | 160 ++++++++++++++++++ .../src/main/res/layout/view_record_visit.xml | 43 +++++ .../src/main/res/menu/profile_menu.xml | 12 ++ .../src/main/res/values/colors.xml | 5 + .../src/main/res/values/strings.xml | 3 +- .../src/main/res/values/styles.xml | 9 + 13 files changed, 394 insertions(+), 12 deletions(-) create mode 100644 opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java create mode 100644 opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java create mode 100644 opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/presenter/MalariaProfilePresenter.java create mode 100644 opensrp-chw-malaria/src/main/res/drawable/record_btn_selector.xml create mode 100644 opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml create mode 100644 opensrp-chw-malaria/src/main/res/layout/view_record_visit.xml create mode 100644 opensrp-chw-malaria/src/main/res/menu/profile_menu.xml create mode 100644 opensrp-chw-malaria/src/main/res/values/styles.xml diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java new file mode 100644 index 0000000..d57dd1d --- /dev/null +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java @@ -0,0 +1,72 @@ +package org.smartregister.chw.malaria.activity; + +import android.content.Context; +import android.content.Intent; +import android.support.v4.view.ViewPager; +import org.smartregister.chw.malaria.contract.MalariaProfileContract; +import org.smartregister.commonregistry.CommonPersonObject; +import org.smartregister.malaria.R; +import org.smartregister.view.activity.BaseProfileActivity; + +import java.lang.ref.WeakReference; + +public class BaseMalariaProfileActivity extends BaseProfileActivity implements MalariaProfileContract.View, MalariaProfileContract.Presenter { + private Context context; + private WeakReference view; + + @Override + protected void onCreation() { + super.onCreation(); + setContentView(R.layout.activity_malaria_profile); + } + + @Override + public Context getContext() { + return context; + } + + @Override + public MalariaProfileContract.View getView() { + if(view != null) { + return view.get(); + } else { + return null; + } + } + + @Override + public void getProfileData(CommonPersonObject client) { + //feed the view with the processed data + } + + @Override + public MalariaProfileContract.Presenter presenter() { + return null; + } + + @Override + public void startProfileActivity(Intent intent) { + //process the intent and get the person object + } + + @Override + public void fetchProfileData(Intent intent) { + //process profile data from the intent + } + + + @Override + protected void initializePresenter() { + + } + + @Override + protected ViewPager setupViewPager(ViewPager viewPager) { + return null; + } + + @Override + protected void fetchProfileData() { + + } +} diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java index ad4f3b6..88f7283 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java @@ -7,6 +7,8 @@ import android.support.design.bottomnavigation.LabelVisibilityMode; import android.support.v4.app.Fragment; import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; import android.widget.Toast; import com.vijay.jsonwizard.constants.JsonFormConstants; @@ -148,10 +150,10 @@ protected void registerBottomNavigation() { if (bottomNavigationView != null) { bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED); - bottomNavigationView.getMenu().removeItem(R.id.action_clients); + bottomNavigationView.getMenu().removeItem(org.smartregister.R.id.action_clients); bottomNavigationView.getMenu().removeItem(R.id.action_register); - bottomNavigationView.getMenu().removeItem(R.id.action_search); - bottomNavigationView.getMenu().removeItem(R.id.action_library); + bottomNavigationView.getMenu().removeItem(org.smartregister.R.id.action_search); + bottomNavigationView.getMenu().removeItem(org.smartregister.R.id.action_library); bottomNavigationView.inflateMenu(getMenuResource()); bottomNavigationHelper.disableShiftMode(bottomNavigationView); @@ -162,6 +164,16 @@ protected void registerBottomNavigation() { } } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + menu.findItem(R.id.action_profile); + inflater.inflate(R.menu.profile_menu, menu); + return super.onCreateOptionsMenu(menu); + } + + + @MenuRes public int getMenuResource() { return R.menu.bottom_nav_family_menu; diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java new file mode 100644 index 0000000..d77123e --- /dev/null +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java @@ -0,0 +1,22 @@ +package org.smartregister.chw.malaria.contract; + +import android.content.Context; +import android.content.Intent; +import org.smartregister.commonregistry.CommonPersonObject; + +public interface MalariaProfileContract { + interface View { + Context getContext(); + MalariaProfileContract.View getView(); + void getProfileData(CommonPersonObject client); + + } + + interface Presenter { + MalariaProfileContract.Presenter presenter(); + + void startProfileActivity(Intent intent); + + void fetchProfileData(Intent intent); + } +} \ No newline at end of file diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java index 9cb06a5..768ec4e 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java @@ -1,12 +1,16 @@ package org.smartregister.chw.malaria.fragment; +import android.content.Intent; import android.widget.ImageView; import android.widget.TextView; +import org.smartregister.chw.malaria.activity.BaseMalariaProfileActivity; +import org.smartregister.chw.malaria.contract.MalariaProfileContract; import org.smartregister.chw.malaria.contract.MalariaRegisterFragmentContract; import org.smartregister.chw.malaria.model.BaseMalariaRegisterFragmentModel; import org.smartregister.chw.malaria.presenter.BaseMalariaRegisterFragmentPresenter; import org.smartregister.chw.malaria.provider.MalariaRegisterProvider; +import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.configurableviews.model.View; import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter; import org.smartregister.malaria.R; @@ -20,7 +24,7 @@ public class BaseMalariaRegisterFragment extends BaseRegisterFragment implements MalariaRegisterFragmentContract.View { @Override public void initializeAdapter(Set visibleColumns) { - MalariaRegisterProvider malariaRegisterProvider = new MalariaRegisterProvider(getActivity(), paginationViewHandler,visibleColumns,commonRepository()); + MalariaRegisterProvider malariaRegisterProvider = new MalariaRegisterProvider(getActivity(), paginationViewHandler,registerActionHandler, visibleColumns,commonRepository()); clientAdapter = new RecyclerViewPaginatedAdapter(null, malariaRegisterProvider, context().commonrepository(this.tablename)); clientAdapter.setCurrentlimit(20); clientsView.setAdapter(clientAdapter); @@ -31,13 +35,13 @@ public void setupViews(android.view.View view) { super.setupViews(view); // Update top left icon - qrCodeScanImageView = view.findViewById(R.id.scanQrCode); + qrCodeScanImageView = view.findViewById(org.smartregister.R.id.scanQrCode); if (qrCodeScanImageView != null) { qrCodeScanImageView.setVisibility(android.view.View.GONE); } // Update Search bar - android.view.View searchBarLayout = view.findViewById(R.id.search_bar_layout); + android.view.View searchBarLayout = view.findViewById(org.smartregister.R.id.search_bar_layout); searchBarLayout.setBackgroundResource(R.color.customAppThemeBlue); if (getSearchView() != null) { @@ -46,13 +50,13 @@ public void setupViews(android.view.View view) { } // Update sort filter - TextView filterView = view.findViewById(R.id.filter_text_view); + TextView filterView = view.findViewById(org.smartregister.R.id.filter_text_view); if (filterView != null) { filterView.setText(getString(R.string.sort)); } // Update title name - ImageView logo = view.findViewById(R.id.opensrp_logo_image_view); + ImageView logo = view.findViewById(org.smartregister.R.id.opensrp_logo_image_view); if (logo != null) { logo.setVisibility(android.view.View.GONE); } @@ -108,6 +112,19 @@ protected void startRegistration() { @Override protected void onViewClicked(android.view.View view) { // implement onclick actions + if(view.getTag() instanceof CommonPersonObjectClient && view.getId() == R.id.due_button) { + goToClient((CommonPersonObjectClient) client); + } + } + + protected void goToClient(CommonPersonObjectClient client) { + Intent intent = new Intent(getActivity(), BaseMalariaProfileActivity.class); + intent.putExtra("client", client); + malariaProfilePresenter().startProfileActivity(intent); + } + + private MalariaProfileContract.Presenter malariaProfilePresenter() { + return malariaProfilePresenter(); } @Override diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/presenter/MalariaProfilePresenter.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/presenter/MalariaProfilePresenter.java new file mode 100644 index 0000000..31bb02f --- /dev/null +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/presenter/MalariaProfilePresenter.java @@ -0,0 +1,21 @@ +package org.smartregister.chw.malaria.presenter; + +import android.content.Intent; +import org.smartregister.chw.malaria.contract.MalariaProfileContract; + +public class MalariaProfilePresenter implements MalariaProfileContract.Presenter { + @Override + public MalariaProfileContract.Presenter presenter() { + return presenter(); + } + + @Override + public void startProfileActivity(Intent intent) { + // get the activity and initiate the profile activity + } + + @Override + public void fetchProfileData(Intent intent) { + //fetch profile data from the intent + } +} diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/provider/MalariaRegisterProvider.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/provider/MalariaRegisterProvider.java index 6ba163c..e77d6f4 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/provider/MalariaRegisterProvider.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/provider/MalariaRegisterProvider.java @@ -35,15 +35,17 @@ public class MalariaRegisterProvider implements RecyclerViewProvider visibleColumns; - public MalariaRegisterProvider(Context context, View.OnClickListener paginationClickListener, Set visibleColumns, CommonRepository commonRepository) { + public MalariaRegisterProvider(Context context, View.OnClickListener paginationClickListener, View.OnClickListener onClickListener, Set visibleColumns, CommonRepository commonRepository) { inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.paginationClickListener = paginationClickListener; + this.onClickListener = onClickListener; this.visibleColumns = visibleColumns; this.context = context; this.commonRepository = commonRepository; @@ -75,7 +77,7 @@ private void populatePatientColumn(CommonPersonObjectClient pc, final RegisterVi viewHolder.patientName.setText(patientName + ", " + age); viewHolder.textViewGender.setText(Utils.getValue(pc.getColumnmaps(), DBConstants.KEY.GENDER, true)); viewHolder.textViewVillage.setText(Utils.getValue(pc.getColumnmaps(), DBConstants.KEY.VILLAGE_TOWN, true)); - + viewHolder.dueButton.setOnClickListener(onClickListener); } diff --git a/opensrp-chw-malaria/src/main/res/drawable/record_btn_selector.xml b/opensrp-chw-malaria/src/main/res/drawable/record_btn_selector.xml new file mode 100644 index 0000000..6f05a11 --- /dev/null +++ b/opensrp-chw-malaria/src/main/res/drawable/record_btn_selector.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml b/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml new file mode 100644 index 0000000..c06d63b --- /dev/null +++ b/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/opensrp-chw-malaria/src/main/res/layout/view_record_visit.xml b/opensrp-chw-malaria/src/main/res/layout/view_record_visit.xml new file mode 100644 index 0000000..4c48322 --- /dev/null +++ b/opensrp-chw-malaria/src/main/res/layout/view_record_visit.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml b/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml new file mode 100644 index 0000000..564e4f0 --- /dev/null +++ b/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/opensrp-chw-malaria/src/main/res/values/colors.xml b/opensrp-chw-malaria/src/main/res/values/colors.xml index 079570a..6dd30b3 100644 --- a/opensrp-chw-malaria/src/main/res/values/colors.xml +++ b/opensrp-chw-malaria/src/main/res/values/colors.xml @@ -18,4 +18,9 @@ #FAFAFA #218CC5 + + #218CC5 + #000000 + #FAFAFA + @android:color/holo_blue_light diff --git a/opensrp-chw-malaria/src/main/res/values/strings.xml b/opensrp-chw-malaria/src/main/res/values/strings.xml index 604796a..e1039c0 100644 --- a/opensrp-chw-malaria/src/main/res/values/strings.xml +++ b/opensrp-chw-malaria/src/main/res/values/strings.xml @@ -13,8 +13,7 @@ Saving \u00b7 FOLLOWUP\nVisit - - + Return to profile diff --git a/opensrp-chw-malaria/src/main/res/values/styles.xml b/opensrp-chw-malaria/src/main/res/values/styles.xml new file mode 100644 index 0000000..9dbf099 --- /dev/null +++ b/opensrp-chw-malaria/src/main/res/values/styles.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file From 9dc2519ac83f00a7e807c476c0111cf1967a7c18 Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 13:36:30 +0300 Subject: [PATCH 02/23] loose the link to profile --- .../activity/BaseMalariaRegisterActivity.java | 9 --------- .../src/main/res/menu/profile_menu.xml | 12 ------------ 2 files changed, 21 deletions(-) delete mode 100644 opensrp-chw-malaria/src/main/res/menu/profile_menu.xml diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java index 88f7283..ea6ed4e 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java @@ -164,15 +164,6 @@ protected void registerBottomNavigation() { } } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - menu.findItem(R.id.action_profile); - inflater.inflate(R.menu.profile_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @MenuRes public int getMenuResource() { diff --git a/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml b/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml deleted file mode 100644 index 564e4f0..0000000 --- a/opensrp-chw-malaria/src/main/res/menu/profile_menu.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - From 3a2312d44092e14323a7402ff75f1a4add7159cf Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 14:29:16 +0300 Subject: [PATCH 03/23] fix coveralls --- .../chw/malaria/fragment/BaseMalariaRegisterFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java index 768ec4e..f909c85 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/fragment/BaseMalariaRegisterFragment.java @@ -113,7 +113,7 @@ protected void startRegistration() { protected void onViewClicked(android.view.View view) { // implement onclick actions if(view.getTag() instanceof CommonPersonObjectClient && view.getId() == R.id.due_button) { - goToClient((CommonPersonObjectClient) client); + goToClient((CommonPersonObjectClient) view.getTag()); } } From 2a8535d49d0a955f9a4f84a3c6629fae394a1079 Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 14:37:42 +0300 Subject: [PATCH 04/23] standards --- .../chw/malaria/activity/BaseMalariaProfileActivity.java | 5 ++++- .../chw/malaria/activity/BaseMalariaRegisterActivity.java | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java index d57dd1d..3ee1756 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java @@ -5,6 +5,7 @@ import android.support.v4.view.ViewPager; import org.smartregister.chw.malaria.contract.MalariaProfileContract; import org.smartregister.commonregistry.CommonPersonObject; +import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.malaria.R; import org.smartregister.view.activity.BaseProfileActivity; @@ -12,6 +13,7 @@ public class BaseMalariaProfileActivity extends BaseProfileActivity implements MalariaProfileContract.View, MalariaProfileContract.Presenter { private Context context; + private CommonPersonObjectClient client; private WeakReference view; @Override @@ -52,12 +54,13 @@ public void startProfileActivity(Intent intent) { @Override public void fetchProfileData(Intent intent) { //process profile data from the intent + this.client = (CommonPersonObjectClient) intent.getSerializableExtra("client"); } @Override protected void initializePresenter() { - + //initialize presenter } @Override diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java index ea6ed4e..3572e9a 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java @@ -7,8 +7,6 @@ import android.support.design.bottomnavigation.LabelVisibilityMode; import android.support.v4.app.Fragment; import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; import android.widget.Toast; import com.vijay.jsonwizard.constants.JsonFormConstants; From 623458df4bd05fc533e73454bcd02633f9d560cb Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 14:37:42 +0300 Subject: [PATCH 05/23] standards --- .../chw/malaria/activity/BaseMalariaProfileActivity.java | 8 ++++++-- .../chw/malaria/activity/BaseMalariaRegisterActivity.java | 2 -- .../chw/malaria/contract/MalariaProfileContract.java | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java index d57dd1d..8644bbb 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java @@ -5,6 +5,7 @@ import android.support.v4.view.ViewPager; import org.smartregister.chw.malaria.contract.MalariaProfileContract; import org.smartregister.commonregistry.CommonPersonObject; +import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.malaria.R; import org.smartregister.view.activity.BaseProfileActivity; @@ -12,6 +13,7 @@ public class BaseMalariaProfileActivity extends BaseProfileActivity implements MalariaProfileContract.View, MalariaProfileContract.Presenter { private Context context; + private CommonPersonObjectClient client; private WeakReference view; @Override @@ -35,7 +37,7 @@ public MalariaProfileContract.View getView() { } @Override - public void getProfileData(CommonPersonObject client) { + public void getProfileData(CommonPersonObjectClient client) { //feed the view with the processed data } @@ -52,12 +54,14 @@ public void startProfileActivity(Intent intent) { @Override public void fetchProfileData(Intent intent) { //process profile data from the intent + this.client = (CommonPersonObjectClient) intent.getSerializableExtra("client"); + getProfileData(this.client); } @Override protected void initializePresenter() { - + //initialize presenter } @Override diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java index ea6ed4e..3572e9a 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaRegisterActivity.java @@ -7,8 +7,6 @@ import android.support.design.bottomnavigation.LabelVisibilityMode; import android.support.v4.app.Fragment; import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; import android.widget.Toast; import com.vijay.jsonwizard.constants.JsonFormConstants; diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java index d77123e..bfe209c 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/contract/MalariaProfileContract.java @@ -2,13 +2,13 @@ import android.content.Context; import android.content.Intent; -import org.smartregister.commonregistry.CommonPersonObject; +import org.smartregister.commonregistry.CommonPersonObjectClient; public interface MalariaProfileContract { interface View { Context getContext(); MalariaProfileContract.View getView(); - void getProfileData(CommonPersonObject client); + void getProfileData(CommonPersonObjectClient client); } From 0aa3dc9bc33cc246a0fb7a798d73e8e991af4b6a Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 14:46:24 +0300 Subject: [PATCH 06/23] standards --- .../chw/malaria/activity/BaseMalariaProfileActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java index 8644bbb..e9f090d 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.Intent; import android.support.v4.view.ViewPager; +import android.util.Log; import org.smartregister.chw.malaria.contract.MalariaProfileContract; import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; @@ -12,6 +13,7 @@ import java.lang.ref.WeakReference; public class BaseMalariaProfileActivity extends BaseProfileActivity implements MalariaProfileContract.View, MalariaProfileContract.Presenter { + private final String TAG = getClass().getCanonicalName(); private Context context; private CommonPersonObjectClient client; private WeakReference view; @@ -39,6 +41,7 @@ public MalariaProfileContract.View getView() { @Override public void getProfileData(CommonPersonObjectClient client) { //feed the view with the processed data + Log.v(TAG, client + ""); } @Override From f48df006899d7450e76f85d8020aff31bb38cab2 Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 14:46:24 +0300 Subject: [PATCH 07/23] standards --- .../chw/malaria/activity/BaseMalariaProfileActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java index 8644bbb..30eb210 100644 --- a/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java +++ b/opensrp-chw-malaria/src/main/java/org/smartregister/chw/malaria/activity/BaseMalariaProfileActivity.java @@ -3,8 +3,8 @@ import android.content.Context; import android.content.Intent; import android.support.v4.view.ViewPager; +import android.util.Log; import org.smartregister.chw.malaria.contract.MalariaProfileContract; -import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.malaria.R; import org.smartregister.view.activity.BaseProfileActivity; @@ -12,6 +12,7 @@ import java.lang.ref.WeakReference; public class BaseMalariaProfileActivity extends BaseProfileActivity implements MalariaProfileContract.View, MalariaProfileContract.Presenter { + private final String TAG = getClass().getCanonicalName(); private Context context; private CommonPersonObjectClient client; private WeakReference view; @@ -39,6 +40,7 @@ public MalariaProfileContract.View getView() { @Override public void getProfileData(CommonPersonObjectClient client) { //feed the view with the processed data + Log.v(TAG, client + ""); } @Override From d1ba3e4787e3f43754b2a4486cddbb79035a9c39 Mon Sep 17 00:00:00 2001 From: Denis Rwelamila Date: Mon, 17 Jun 2019 15:37:39 +0300 Subject: [PATCH 08/23] rename familytheme to malariatheme --- .../src/main/res/layout/activity_malaria_profile.xml | 2 +- opensrp-chw-malaria/src/main/res/values/styles.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml b/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml index c06d63b..621a078 100644 --- a/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml +++ b/opensrp-chw-malaria/src/main/res/layout/activity_malaria_profile.xml @@ -24,7 +24,7 @@ android:contentInsetLeft="0dp" android:contentInsetEnd="0dp" android:contentInsetRight="0dp" - android:theme="@style/FamilyTheme.AppBarOverlay.Light" + android:theme="@style/MalariaTheme.AppBarOverlay.Light" app:contentInsetEnd="0dp" app:contentInsetLeft="0dp" app:contentInsetRight="0dp" diff --git a/opensrp-chw-malaria/src/main/res/values/styles.xml b/opensrp-chw-malaria/src/main/res/values/styles.xml index 9dbf099..d51be59 100644 --- a/opensrp-chw-malaria/src/main/res/values/styles.xml +++ b/opensrp-chw-malaria/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ - +