-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AC-620: Make UI more consistent #607
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,10 @@ | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored name and formatted using AS |
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import rx.android.schedulers.AndroidSchedulers; | ||
|
||
public class SimilarPatientsRecyclerViewAdapter extends RecyclerView.Adapter<SimilarPatientsRecyclerViewAdapter.PatientViewHolder>{ | ||
public class SimilarPatientsRecyclerViewAdapter extends RecyclerView.Adapter<SimilarPatientsRecyclerViewAdapter.PatientViewHolder> { | ||
|
||
private List<Patient> patientList; | ||
private Patient newPatient; | ||
|
@@ -56,7 +57,7 @@ public SimilarPatientsRecyclerViewAdapter(Activity mContext, List<Patient> patie | |
@NonNull | ||
@Override | ||
public PatientViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.similar_patient_row, parent, false); | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_similar_patient, parent, false); | ||
FontsUtil.setFont((ViewGroup) itemView); | ||
return new PatientViewHolder(itemView); | ||
} | ||
|
@@ -90,7 +91,7 @@ public int getItemCount() { | |
return patientList.size(); | ||
} | ||
|
||
public class PatientViewHolder extends RecyclerView.ViewHolder{ | ||
public class PatientViewHolder extends RecyclerView.ViewHolder { | ||
|
||
private LinearLayout mRowLayout; | ||
private TextView mGivenName; | ||
|
@@ -102,6 +103,7 @@ public class PatientViewHolder extends RecyclerView.ViewHolder{ | |
private TextView mPostalCode; | ||
private TextView mCity; | ||
private TextView mCountry; | ||
|
||
public PatientViewHolder(View itemView) { | ||
super(itemView); | ||
mRowLayout = (LinearLayout) itemView; | ||
|
@@ -117,6 +119,7 @@ public PatientViewHolder(View itemView) { | |
} | ||
|
||
} | ||
|
||
private void downloadPatient(Patient patient) { | ||
new PatientDAO().savePatient(patient) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
|
@@ -127,14 +130,12 @@ private void downloadPatient(Patient patient) { | |
} | ||
|
||
private void setBirthdate(PatientViewHolder holder, Patient patient) { | ||
try{ | ||
try { | ||
holder.mBirthDate.setText(DateUtils.convertTime(DateUtils.convertTime(patient.getBirthdate()))); | ||
if (Objects.equal(patient.getBirthdate(), newPatient.getBirthdate())) { | ||
setStyleForMatchedPatientFields(holder.mBirthDate); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
} catch (Exception e) { | ||
holder.mBirthDate.setText(" "); | ||
} | ||
} | ||
|
@@ -143,7 +144,8 @@ private void setGender(PatientViewHolder holder, Patient patient) { | |
if (null != patient.getGender()) { | ||
holder.mGender.setText(patient.getGender()); | ||
if (Objects.equal(patient.getGender(), newPatient.getGender())) { | ||
setStyleForMatchedPatientFields(holder.mGender); } | ||
setStyleForMatchedPatientFields(holder.mGender); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -195,8 +197,8 @@ private void setPatientName(PatientViewHolder holder, Patient patient) { | |
} | ||
} | ||
|
||
private void setStyleForMatchedPatientFields(TextView textView){ | ||
textView.setTypeface(null , Typeface.BOLD); | ||
private void setStyleForMatchedPatientFields(TextView textView) { | ||
textView.setTypeface(null, Typeface.BOLD); | ||
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored name and formatted using AS |
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import rx.android.schedulers.AndroidSchedulers; | ||
|
||
public class FormEntryPatientListAdapter extends RecyclerView.Adapter<FormEntryPatientListAdapter.PatientViewHolder> { | ||
|
@@ -46,7 +47,7 @@ public FormEntryPatientListAdapter(FormEntryPatientListFragment context, List<Pa | |
@NonNull | ||
@Override | ||
public PatientViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.patient_details_row, parent, false); | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_patient_details, parent, false); | ||
FontsUtil.setFont((ViewGroup) itemView); | ||
return new PatientViewHolder(itemView); | ||
} | ||
|
@@ -97,7 +98,7 @@ public int getItemCount() { | |
return mItems.size(); | ||
} | ||
|
||
class PatientViewHolder extends RecyclerView.ViewHolder{ | ||
class PatientViewHolder extends RecyclerView.ViewHolder { | ||
private LinearLayout mRowLayout; | ||
private TextView mIdentifier; | ||
private TextView mDisplayName; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored name and formatted using AS |
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import rx.android.schedulers.AndroidSchedulers; | ||
|
||
class LastViewedPatientRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | ||
|
@@ -78,21 +79,21 @@ public void setSelectedPatientPositions(Set<Integer> selectedPatientPositions) { | |
this.selectedPatientPositions = selectedPatientPositions; | ||
} | ||
|
||
public void addPatients(List<Patient> patients){ | ||
public void addPatients(List<Patient> patients) { | ||
this.patients.addAll(patients); | ||
notifyDataSetChanged(); | ||
} | ||
|
||
public void deleteLastItem(){ | ||
patients.remove(getItemCount()-1); | ||
public void deleteLastItem() { | ||
patients.remove(getItemCount() - 1); | ||
notifyItemRemoved(getItemCount()); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
if( viewType == VIEW_TYPE_ITEM ) { | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.find_last_viewed_patients_row, parent, false); | ||
if (viewType == VIEW_TYPE_ITEM) { | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_find_last_viewed_patients, parent, false); | ||
FontsUtil.setFont((ViewGroup) itemView); | ||
return new PatientViewHolder(itemView); | ||
} else { | ||
|
@@ -130,8 +131,8 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi | |
((PatientViewHolder) holder).mBirthDate.setText(" "); | ||
} | ||
|
||
if (null != ((PatientViewHolder) holder).mAvailableOfflineCheckbox) { | ||
setUpCheckBoxLogic( ((PatientViewHolder) holder), patient); | ||
if (null != ((PatientViewHolder) holder).mAvailableOfflineCheckbox) { | ||
setUpCheckBoxLogic(((PatientViewHolder) holder), patient); | ||
} | ||
} else { | ||
((ProgressBarViewHolder) holder).progressBar.setIndeterminate(true); | ||
|
@@ -140,7 +141,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi | |
|
||
private boolean isPatientSelected(int position) { | ||
for (Integer selectedPatientPosition : selectedPatientPositions) { | ||
if(selectedPatientPosition.equals(position)){ | ||
if (selectedPatientPosition.equals(position)) { | ||
return true; | ||
} | ||
} | ||
|
@@ -160,7 +161,7 @@ public int getItemCount() { | |
return patients == null ? 0 : patients.size(); | ||
} | ||
|
||
class PatientViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener{ | ||
class PatientViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener { | ||
private LinearLayout mRowLayout; | ||
private TextView mIdentifier; | ||
private TextView mDisplayName; | ||
|
@@ -186,13 +187,13 @@ public void clearAnimation() { | |
|
||
@Override | ||
public void onClick(View view) { | ||
if(isLongClicked){ | ||
if (isLongClicked) { | ||
setSelected(!mRowLayout.isSelected()); | ||
} | ||
} | ||
|
||
private void setSelected(boolean select) { | ||
if(select){ | ||
if (select) { | ||
if (!enableDownload) | ||
toggleDownloadButton(); | ||
selectedPatientPositions.add(getAdapterPosition()); | ||
|
@@ -225,20 +226,20 @@ class ProgressBarViewHolder extends RecyclerView.ViewHolder { | |
|
||
public ProgressBarViewHolder(View itemView) { | ||
super(itemView); | ||
progressBar = (ProgressBar)itemView.findViewById(R.id.recycleviewProgressbar); | ||
progressBar = (ProgressBar) itemView.findViewById(R.id.recycleviewProgressbar); | ||
} | ||
} | ||
|
||
private void removeIdFromSelectedIds(Integer position) { | ||
Set<Integer> newSet = new HashSet<>(); | ||
for (Integer selectedPatientsId : selectedPatientPositions) { | ||
if(!selectedPatientsId.equals(position)){ | ||
if (!selectedPatientsId.equals(position)) { | ||
newSet.add(selectedPatientsId); | ||
} | ||
} | ||
selectedPatientPositions = newSet; | ||
if (selectedPatientPositions.size() == 0 && isLongClicked && enableDownload) | ||
toggleDownloadButton(); | ||
toggleDownloadButton(); | ||
} | ||
|
||
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() { | ||
|
@@ -285,7 +286,7 @@ public void onDestroyActionMode(ActionMode mode) { | |
isLongClicked = false; | ||
} | ||
|
||
public void finish(ActionMode mode){ | ||
public void finish(ActionMode mode) { | ||
mode.finish(); | ||
isLongClicked = false; | ||
} | ||
|
@@ -296,15 +297,15 @@ public void startActionMode() { | |
isLongClicked = true; | ||
} | ||
|
||
public void finishActionMode(){ | ||
public void finishActionMode() { | ||
if (actionMode != null) { | ||
actionMode.finish(); | ||
isLongClicked = false; | ||
} | ||
} | ||
|
||
public void selectAll() { | ||
for(int i = 0; i < patients.size(); i++){ | ||
for (int i = 0; i < patients.size(); i++) { | ||
selectedPatientPositions.add(i); | ||
} | ||
isAllSelected = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
import androidx.core.content.ContextCompat; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored name and formatted using AS |
||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
public class MergePatientsRecycleViewAdapter extends RecyclerView.Adapter<MergePatientsRecycleViewAdapter.PatientViewHolder>{ | ||
public class MergePatientsRecycleViewAdapter extends RecyclerView.Adapter<MergePatientsRecycleViewAdapter.PatientViewHolder> { | ||
|
||
private List<Patient> patientList; | ||
private Patient newPatient; | ||
|
@@ -56,7 +56,7 @@ public MergePatientsRecycleViewAdapter(Activity mContext, MatchingPatientsContra | |
@NonNull | ||
@Override | ||
public PatientViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.similar_patient_row, parent, false); | ||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_similar_patient, parent, false); | ||
FontsUtil.setFont((ViewGroup) itemView); | ||
return new PatientViewHolder(itemView); | ||
} | ||
|
@@ -76,7 +76,7 @@ public int getItemCount() { | |
return patientList.size(); | ||
} | ||
|
||
public class PatientViewHolder extends RecyclerView.ViewHolder{ | ||
public class PatientViewHolder extends RecyclerView.ViewHolder { | ||
|
||
private TextView mGivenName; | ||
private TextView mMiddleName; | ||
|
@@ -87,6 +87,7 @@ public class PatientViewHolder extends RecyclerView.ViewHolder{ | |
private TextView mPostalCode; | ||
private TextView mCity; | ||
private TextView mCountry; | ||
|
||
public PatientViewHolder(View itemView) { | ||
super(itemView); | ||
mGivenName = (TextView) itemView.findViewById(R.id.patientGivenName); | ||
|
@@ -99,12 +100,12 @@ public PatientViewHolder(View itemView) { | |
mCity = (TextView) itemView.findViewById(R.id.patientCity); | ||
mCountry = (TextView) itemView.findViewById(R.id.patientCountry); | ||
itemView.setOnClickListener(view -> { | ||
CardView cardView = (CardView)view.findViewById(R.id.cardView); | ||
CardView cardView = (CardView) view.findViewById(R.id.cardView); | ||
if (selectedPosition == -1) { | ||
selectedPosition = getAdapterPosition(); | ||
mPresenter.setSelectedPatient(patientList.get(selectedPosition)); | ||
cardView.setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.patient_selected_highlight)); | ||
} else if(selectedPosition == getAdapterPosition()){ | ||
} else if (selectedPosition == getAdapterPosition()) { | ||
selectedPosition = -1; | ||
mPresenter.removeSelectedPatient(); | ||
cardView.setCardBackgroundColor(Color.WHITE); | ||
|
@@ -117,14 +118,12 @@ public PatientViewHolder(View itemView) { | |
} | ||
|
||
private void setBirthdate(PatientViewHolder holder, Patient patient) { | ||
try{ | ||
try { | ||
holder.mBirthDate.setText(DateUtils.convertTime(DateUtils.convertTime(patient.getBirthdate()))); | ||
if (Objects.equal(patient.getBirthdate(), newPatient.getBirthdate())) { | ||
setStyleForMatchedPatientFields(holder.mBirthDate); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
} catch (Exception e) { | ||
holder.mBirthDate.setText(" "); | ||
} | ||
} | ||
|
@@ -133,7 +132,8 @@ private void setGender(PatientViewHolder holder, Patient patient) { | |
if (null != patient.getGender()) { | ||
holder.mGender.setText(patient.getGender()); | ||
if (Objects.equal(patient.getGender(), newPatient.getGender())) { | ||
setStyleForMatchedPatientFields(holder.mGender); } | ||
setStyleForMatchedPatientFields(holder.mGender); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -185,8 +185,8 @@ private void setPatientName(PatientViewHolder holder, Patient patient) { | |
} | ||
} | ||
|
||
private void setStyleForMatchedPatientFields(TextView textView){ | ||
textView.setTypeface(null , Typeface.BOLD); | ||
private void setStyleForMatchedPatientFields(TextView textView) { | ||
textView.setTypeface(null, Typeface.BOLD); | ||
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored name and Formatted using AS