Merge pull request #108 from ClaytonWWilson/dynamic-chain-names

Dynamic chain names
This commit is contained in:
Clayton Wilson 2020-11-05 01:03:19 -05:00 committed by GitHub
commit cfc8b65d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 6 deletions

View File

@ -352,6 +352,7 @@ public class SearchResults extends AppCompatActivity implements FilterDialogFrag
}
// Create a list of all stores in the results so the user can filter by store name
stores.clear();
for (int i = 0; i < resultsProductList.size(); i++) {
if (!stores.contains(resultsProductList.get(i).getChainName())) {
stores.add(resultsProductList.get(i).getChainName());
@ -377,6 +378,17 @@ public class SearchResults extends AppCompatActivity implements FilterDialogFrag
}
});
// Reset price filter
double max = 0;
for (int i = 0; i < resultsProductListSorted.size(); i++){
if (resultsProductListSorted.get(i).getPrice().doubleValue() > max) {
max = resultsProductListSorted.get(i).getPrice().doubleValue();
}
}
this.minPrice = 0;
this.maxPrice = max;
// Apply selected sorting to the list
sortResults();

View File

@ -55,19 +55,30 @@ public class CheckBoxListViewAdapter extends BaseAdapter {
holder = new ViewHolder();
holder.label = (TextView) convertView.findViewById(R.id.store_name);
holder.checkBox = (CheckBox)convertView.findViewById(R.id.store_check_box);
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int getPosition = (Integer) buttonView.getTag();
public void onClick(View v) {
int getPosition = (Integer) ((CompoundButton)(v)).getTag();
if (isChecked) {
if (((CompoundButton) v).isChecked()) {
checkedList.add(list.get(getPosition));
} else {
checkedList.remove(list.get(getPosition));
}
}
});
// holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// int getPosition = (Integer) buttonView.getTag();
//
// if (isChecked) {
// checkedList.add(list.get(getPosition));
// } else {
// checkedList.remove(list.get(getPosition));
// }
// }
// });
convertView.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -90,7 +90,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Descending"
android:text="Ascending"
android:textSize="16sp"
android:textColor="@android:color/black"
android:paddingStart="16dp"/>