mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 18:48:48 +00:00
Simplified a section of code for total price by store (used HashMap to access header section)
This commit is contained in:
parent
8afa81db59
commit
7bc43d8249
@ -100,11 +100,7 @@ public class ListPage extends AppCompatActivity {
|
|||||||
pListItemPair.add(entry);
|
pListItemPair.add(entry);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int index = 0;
|
int index = storeHeaderIndex.get("Kroger");
|
||||||
|
|
||||||
while(index < pNames.size() && !pNames.get(index).equals("Kroger")) {
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
totalPriceByStore.put("Kroger", totalPriceByStore.get("Kroger") + (item.getPrice().doubleValue() * entry.getQuantity()));
|
totalPriceByStore.put("Kroger", totalPriceByStore.get("Kroger") + (item.getPrice().doubleValue() * entry.getQuantity()));
|
||||||
pPrices.set(index, totalPriceByStore.get("Kroger").toString());
|
pPrices.set(index, totalPriceByStore.get("Kroger").toString());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user