Fix search function bug

This commit is contained in:
Nezumi
2023-03-10 22:31:10 +07:00
parent 1553dbd55e
commit 2e0d3c6c08
2 changed files with 13 additions and 20 deletions
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\phanh\.android\avd\Pixel_5_API_31.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-03-10T08:30:32.300635400Z" />
</component>
</project>
@@ -212,12 +212,22 @@ public class SearchFragment extends Fragment {
statusCategoryChecked.remove(Integer.valueOf(tempCategory.getId()));
}
ACTION_CODE = LIST_FOOD_BY_CATEGORY;
listFoodSearch.clear();
CURRENT_PAGE = 0;
showProgressBarAndHideEndOfListText();
getListFoodByCategory(CURRENT_PAGE);
Toast.makeText(getContext(), "Category check: " + statusCategoryChecked, Toast.LENGTH_SHORT).show();
//Check category list null or not
if(statusCategoryChecked.size() == 0){
//If null, return list food
ACTION_CODE = LIST_FOOD;
getListFood(0);
} else {
//If have category check, return list food by category
ACTION_CODE = LIST_FOOD_BY_CATEGORY;
getListFoodByCategory(CURRENT_PAGE);
}
}
});