Skip to content

Commit

Permalink
💄 implement layout components for search screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkim2689 committed Jul 25, 2024
1 parent dc15f94 commit 0c82aac
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 0 deletions.
7 changes: 7 additions & 0 deletions android/app/src/main/res/drawable/ic_search_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="20" android:viewportWidth="20" android:width="24dp">

<path android:fillColor="#00000000" android:pathData="M15.417,9.167C15.417,12.619 12.618,15.417 9.167,15.417C5.715,15.417 2.917,12.619 2.917,9.167C2.917,5.715 5.715,2.917 9.167,2.917C12.618,2.917 15.417,5.715 15.417,9.167Z" android:strokeColor="#111111" android:strokeWidth="1.25"/>

<path android:fillColor="#00000000" android:pathData="M17.083,17.083L13.75,13.75" android:strokeColor="#111111" android:strokeLineCap="round" android:strokeWidth="1.25"/>

</vector>
62 changes: 62 additions & 0 deletions android/app/src/main/res/layout/item_appbar_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<layout 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">

<data>

<variable
name="title"
type="String" />

<variable
name="searchKeyword"
type="String" />
</data>

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/abl_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/tb_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="false"
app:layout_anchor="@+id/abl_default"
app:layout_scrollFlags="scroll|snap">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@color/white"
app:layout_collapseMode="parallax" />

<TextView
android:id="@+id/tv_title"
style="@style/Headline.H2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="4dp"
android:text="@string/search_appbar" />

</com.google.android.material.appbar.CollapsingToolbarLayout>

<include
layout="@layout/item_search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="8dp"
app:hint="@{@string/search_searchbar_hint}"
app:content="@={searchKeyword}"
app:layout_collapseMode="parallax" />

</com.google.android.material.appbar.AppBarLayout>

</layout>
48 changes: 48 additions & 0 deletions android/app/src/main/res/layout/item_search_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

<variable
name="content"
type="String" />

<variable
name="hint"
type="String" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_radius_outlined"
android:padding="12dp">

<ImageView
android:id="@+id/iv_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_search_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/et_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@={content}"
android:hint="@{hint}"
android:imeOptions="actionSearch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_search"
app:layout_constraintTop_toTopOf="parent"
android:background="@android:color/transparent"
android:inputType="text"
style="@style/Body.B1"
android:layout_marginStart="12dp"
android:maxLines="1"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
29 changes: 29 additions & 0 deletions android/app/src/main/res/layout/item_search_image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>
<variable
name="imageUrl"
type="String" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="1dp">

<ImageView
android:id="@+id/iv_search_result"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/gray"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:imageUrl="@{imageUrl}"
android:scaleType="centerCrop"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
3 changes: 3 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@

<string name="category_appbar">Category</string>

<string name="search_appbar">Search</string>
<string name="search_searchbar_hint">Search</string>

</resources>

0 comments on commit 0c82aac

Please sign in to comment.