Store-filtering-related bugs fixed

This commit is contained in:
Clayton Wilson 2020-11-05 00:01:20 -05:00
parent ad4e7fd810
commit 9edab80c2f
3 changed files with 18 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());

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"/>