Commit 6e56a9bf authored by Willard's avatar Willard

Fix dishes not appearing properly in StallView

parent fb03238d
<component name="ProjectDictionaryState">
<dictionary name="candy" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -83,6 +83,11 @@ public class DishAdapter extends BaseAdapter { ...@@ -83,6 +83,11 @@ public class DishAdapter extends BaseAdapter {
} }
} }
public void defaultFilter() {
filteredDishes.clear();
filteredDishes.addAll(dishes);
}
static class DishViewHolder { static class DishViewHolder {
TextView name; TextView name;
......
...@@ -159,6 +159,7 @@ public class StallViewActivity extends AppCompatActivity { ...@@ -159,6 +159,7 @@ public class StallViewActivity extends AppCompatActivity {
List<Dish> newDishes = response.body(); List<Dish> newDishes = response.body();
dishes.clear(); dishes.clear();
dishes.addAll(newDishes); dishes.addAll(newDishes);
dAdapter.defaultFilter();
dAdapter.notifyDataSetChanged(); dAdapter.notifyDataSetChanged();
} }
......
...@@ -18,163 +18,165 @@ ...@@ -18,163 +18,165 @@
android:fillViewport="true"> android:fillViewport="true">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="2"> android:weightSum="2">
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:weightSum="5" android:orientation="horizontal"
android:layout_height="wrap_content"> android:weightSum="5">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="3"> android:layout_weight="3"
android:orientation="vertical">
<TextView <TextView
android:text="Name" android:id="@+id/dish_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/dish_name"
android:layout_weight="2" android:layout_weight="2"
android:textSize="18sp" /> android:text="Name"
android:textSize="18sp"/>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView <TextView
android:text="Location: "
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Location: "
android:textSize="18sp" android:textSize="18sp"
/> />
<TextView <TextView
android:text="Location" android:id="@+id/stall_location"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/stall_location" android:layout_weight="1"
android:layout_weight="1" /> android:text="Location"/>
</LinearLayout> </LinearLayout>
<CheckBox <CheckBox
android:text="Favorite" android:id="@+id/favorite_checkbox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/favorite_checkbox"
android:button="@drawable/favorite_checkbox"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:layout_weight="1" /> android:layout_weight="1"
android:button="@drawable/favorite_checkbox"
android:text="Favorite"/>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/dish_pic"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="78dp" android:layout_height="78dp"
app:srcCompat="@mipmap/ic_launcher" android:layout_weight="2"
android:id="@+id/dish_pic" app:srcCompat="@mipmap/ic_launcher"/>
android:layout_weight="2" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:weightSum="10"
android:paddingTop="10dp"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp"> android:paddingRight="10dp"
android:paddingTop="10dp"
android:weightSum="10">
<TextView <TextView
android:text="Description:"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textSize="18sp" /> android:text="Description:"
android:textSize="18sp"/>
<TextView <TextView
android:text="This is a foodz" android:id="@+id/stall_description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/stall_description"
android:layout_weight="9" android:layout_weight="9"
android:paddingTop="5dp" /> android:paddingTop="5dp"
android:text="This is a foodz"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingTop="10dp"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:weightSum="14" android:layout_weight="3"
android:paddingLeft="10dp"> android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:weightSum="14">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<TextView <TextView
android:text="Dishes:"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:textSize="18sp" /> android:text="Dishes:"
android:textSize="18sp"/>
<ListView <ListView
android:layout_width="match_parent"
android:layout_height="125dp"
android:id="@+id/stall_dishes" android:id="@+id/stall_dishes"
android:fadeScrollbars="false" /> android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_weight="6.45"
android:fadeScrollbars="false"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1"
android:orientation="horizontal">
<TextView <TextView
android:text="Reviews:"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="18sp" android:layout_weight="1"
android:layout_weight="1"/> android:text="Reviews:"
android:textSize="18sp"/>
<Button <Button
android:id="@+id/add_review_button"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/add_review_button"
android:drawableLeft="@drawable/ic_add_circle_outline_black_24dp" android:drawableLeft="@drawable/ic_add_circle_outline_black_24dp"
android:text="Add your own review" android:text="Add your own review"/>
style="@style/Widget.AppCompat.Button.Borderless"/>
</LinearLayout> </LinearLayout>
<ListView <ListView
android:layout_width="match_parent"
android:id="@+id/stall_reviews" android:id="@+id/stall_reviews"
android:layout_height="wrap_content" /> android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment