From 2e8d11ef345b108aa514a96345c382ebd429e90c Mon Sep 17 00:00:00 2001 From: saumeel Date: Mon, 1 May 2017 04:07:29 -0400 Subject: [PATCH] Fixed Search by Food --- .../cis350/foodtruckapp/SearchFoodActivity.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/edu/upenn/cis350/foodtruckapp/SearchFoodActivity.java b/app/src/main/java/edu/upenn/cis350/foodtruckapp/SearchFoodActivity.java index ea838d9..e9d8dfa 100644 --- a/app/src/main/java/edu/upenn/cis350/foodtruckapp/SearchFoodActivity.java +++ b/app/src/main/java/edu/upenn/cis350/foodtruckapp/SearchFoodActivity.java @@ -99,7 +99,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { foodList.clear(); Iterable users = dataSnapshot.getChildren(); for (DataSnapshot user : users) { - DataSnapshot name = user.child("Name of Food Truck"); + DataSnapshot name = user.child("Name Of Food Truck"); DataSnapshot type = user.child("Type"); @@ -112,10 +112,9 @@ public void onDataChange(DataSnapshot dataSnapshot) { if (uniqueID.getValue() == null){ continue; } - if (((String)TOF.getValue()).equalsIgnoreCase(queryUsable)){ - foodList.put(name.getValue(String.class),uniqueID.getValue(String.class)); - } - else { + if (((String)TOF.getValue()).equalsIgnoreCase(queryUsable)) { + foodList.put(name.getValue(String.class), uniqueID.getValue(String.class)); + } else { DataSnapshot menuItems = user.child("Menu"); if (menuItems.getValue() == null){ continue; @@ -124,7 +123,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { if (values != null) { for (String item : values.keySet()) { if (item.equalsIgnoreCase(queryUsable)) { - foodList.put(name.getValue(String.class),uniqueID.getValue(String.class)); + foodList.put(name.getValue(String.class), uniqueID.getValue(String.class)); } } } @@ -134,7 +133,6 @@ public void onDataChange(DataSnapshot dataSnapshot) { setListView(); } - @Override public void onCancelled(DatabaseError databaseError) {