mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 18:48:48 +00:00
Fixed search results not being cleared after new search
This commit is contained in:
parent
dff6c9deb3
commit
b498220d9f
@ -1,4 +1,5 @@
|
||||
package com.example.listify;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@ -77,7 +78,9 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Toast.makeText(SearchResults.this, resultsProductListSorted.get(position).getItemName(), Toast.LENGTH_SHORT).show();
|
||||
// Toast.makeText(SearchResults.this, resultsProductListSorted.get(position).getItemName(), Toast.LENGTH_SHORT).show();
|
||||
Intent itemDetails = new Intent(SearchResults.this, ItemDetails.class);
|
||||
startActivity(itemDetails);
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,6 +132,9 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
|
||||
// TODO: Create a new Product Object for each result
|
||||
// TODO: Add each result to productList
|
||||
|
||||
// Clear the old search results
|
||||
resultsProductList = new ArrayList<>();
|
||||
|
||||
// Hardcode some search results...
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Product a = new Product("Bottled Water", "0000", "Walmart", "0001", "0123456780", "Bro, it's water...", "Grocery", 13.37, "9/24/2020", "1", "http://3.bp.blogspot.com/-MfroPPQVDKo/UyhUZWqGvkI/AAAAAAAAB-I/DGk622onsvc/s1600/lettuce-b-kool-cat-meme.jpg");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user