Skip to content

Commit

Permalink
Remove RelativeLayout from Firestore quickstart (firebase#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Jan 12, 2021
1 parent 46ffd96 commit 368ff73
Show file tree
Hide file tree
Showing 6 changed files with 379 additions and 284 deletions.
125 changes: 71 additions & 54 deletions firestore/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -12,6 +13,9 @@
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:theme="@style/AppTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:logo="@drawable/ic_restaurant_white_24px"
app:popupTheme="@style/Theme.AppCompat.Light.DarkActionBar"
app:title="@string/app_name"
Expand All @@ -22,11 +26,13 @@
android:id="@+id/filterBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:background="@color/colorPrimary"
android:paddingBottom="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp">
android:paddingRight="12dp"
android:paddingBottom="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">

<androidx.cardview.widget.CardView
android:id="@+id/filterBar"
Expand All @@ -36,61 +42,64 @@
android:elevation="12dp"
android:foreground="?attr/selectableItemBackground">

<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
android:paddingTop="8dp"
android:paddingBottom="8dp">

<ImageView
android:id="@+id/buttonFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="8dp"
app:tint="@color/greySecondary"
app:srcCompat="@drawable/ic_filter_list_white_24px" />

<LinearLayout
android:id="@+id/textCurrentSearchContainer"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_filter_list_white_24px"
app:tint="@color/greySecondary" />

<TextView
android:id="@+id/textCurrentSearch"
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@+id/buttonFilter"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp">

<TextView
android:id="@+id/textCurrentSearch"
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/all_restaurants"
android:textColor="@color/greySecondary"
tools:text="Filter" />

<TextView
android:id="@+id/textCurrentSortBy"
style="@style/AppTheme.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sorted_by_rating"
android:textColor="@color/greyDisabled" />

</LinearLayout>
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:text="@string/all_restaurants"
android:textColor="@color/greySecondary"
app:layout_constraintStart_toEndOf="@+id/buttonFilter"
app:layout_constraintTop_toTopOf="parent"
tools:text="Filter" />

<TextView
android:id="@+id/textCurrentSortBy"
style="@style/AppTheme.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sorted_by_rating"
android:textColor="@color/greyDisabled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/textCurrentSearch"
app:layout_constraintTop_toBottomOf="@+id/textCurrentSearch" />

<ImageView
android:id="@+id/buttonClearFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:padding="8dp"
app:tint="@color/greySecondary"
app:srcCompat="@drawable/ic_close_white_24px" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_close_white_24px"
app:tint="@color/greySecondary" />

</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.cardview.widget.CardView>

Expand All @@ -100,29 +109,35 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerRestaurants"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/filterBarContainer"
android:layout_height="0dp"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filterBarContainer"
tools:listitem="@layout/item_restaurant" />

<!-- Shadow below toolbar -->
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_below="@+id/filterBarContainer"
android:background="@drawable/bg_shadow" />
android:background="@drawable/bg_shadow"
app:layout_constraintTop_toBottomOf="@+id/filterBarContainer"
/>

<!-- Empty list (pizza guy) view -->
<LinearLayout
android:id="@+id/viewEmpty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/toolbar"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
tools:ignore="UseCompoundDrawables"
tools:visibility="gone">

<ImageView
Expand All @@ -133,7 +148,6 @@
style="@style/AppTheme.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/message_no_results"
android:textColor="@color/greyDisabled" />

Expand All @@ -143,9 +157,12 @@
android:id="@+id/progressLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/recyclerRestaurants"
android:layout_alignTop="@+id/recyclerRestaurants"
android:layout_centerHorizontal="true"
android:visibility="gone" />
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/recyclerRestaurants"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/recyclerRestaurants"
/>

</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 368ff73

Please sign in to comment.