Skip to content

Commit

Permalink
Merge pull request #21 from SOPT-32ND-APP4-Karrot/feature/#6-home-view
Browse files Browse the repository at this point in the history
[ui] home 뷰 구현
  • Loading branch information
wateralsie authored May 26, 2023
2 parents 69b1627 + 28d2de5 commit ec4acf8
Show file tree
Hide file tree
Showing 7 changed files with 358 additions and 9 deletions.
Binary file added app/src/main/res/drawable/img_home_ad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/shape_gray_1_fill_8_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/gray_1" />
<corners android:radius="8dp" />
</shape>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/shape_gray_2_line_4_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/gray_2" android:width="1dp" />
<corners android:radius="4dp" />
</shape>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/shape_orange_fill_4_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?colorPrimary" />
<corners android:radius="4dp" />
</shape>
204 changes: 195 additions & 9 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,207 @@
<?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>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.home.HomeFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_home_top_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingBottom="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/tv_home_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="6dp"
android:textAppearance="@style/TextAppearance.Carrot.Title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="동교동" />

<ImageView
android:id="@+id/iv_home_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_home_list"
app:layout_constraintBottom_toBottomOf="@id/tv_home_title"
app:layout_constraintStart_toEndOf="@id/tv_home_title"
app:layout_constraintTop_toTopOf="@id/tv_home_title" />

<ImageView
android:id="@+id/iv_home_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_home_search" />

<ImageView
android:id="@+id/iv_home_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_home_menu" />

<ImageView
android:id="@+id/iv_home_noti"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_home_bell" />

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow_home_top_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginEnd="10dp"
app:constraint_referenced_ids="iv_home_search,iv_home_menu,iv_home_noti"
app:flow_horizontalGap="19dp"
app:layout_constraintBottom_toBottomOf="@id/tv_home_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_home_title" />

</androidx.constraintlayout.widget.ConstraintLayout>

<View
android:id="@+id/view_home_top_bar_line"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray_3"
app:layout_constraintBottom_toBottomOf="@id/layout_home_top_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_home_question"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="12dp"
android:background="@drawable/shape_gray_1_fill_8_rect"
android:paddingHorizontal="19dp"
android:paddingTop="21dp"
android:paddingBottom="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_home_top_bar_line">

<TextView
android:id="@+id/tv_home_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="만족하며 거래하고 있나요?"
android:textAppearance="@style/TextAppearance.Carrot.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_home_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_gray_2_line_4_rect"
android:paddingVertical="10dp"
android:text="아니요"
android:textAppearance="@style/TextAppearance.Carrot.Body3" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_home_yes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_orange_fill_4_rect"
android:paddingVertical="10dp"
android:text="그럼요!"
android:textAppearance="@style/TextAppearance.Carrot.Body3"
android:textColor="?colorOnPrimary" />

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow_home_question_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:constraint_referenced_ids="btn_home_no,btn_home_yes"
app:flow_horizontalGap="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_home_question" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_home_ad"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="14dp"
android:paddingTop="18dp"
android:paddingEnd="19dp"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/layout_home_question">

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

<TextView
android:id="@+id/tv_home_ad_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="13dp"
android:layout_marginTop="4dp"
android:text="동교동 이웃 dd님에게만 보이는 순간이동 포털이 열렸어요"
android:textAppearance="@style/TextAppearance.Carrot.Body2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_home_ad"
app:layout_constraintTop_toTopOf="@id/iv_home_ad" />

<TextView
android:id="@+id/tv_home_ad_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="당근마켓 x 맹그로브 · 순간이동"
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="@color/gray_4"
app:layout_constraintStart_toStartOf="@id/tv_home_ad_content"
app:layout_constraintTop_toBottomOf="@id/tv_home_ad_content" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_home"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/layout_home_ad"
tools:listitem="@layout/item_home" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="12dp"
android:backgroundTint="?colorPrimary"
android:src="@drawable/ic_home_write"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:shapeAppearance="@style/ShapeAppearance.Circle" />

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
142 changes: 142 additions & 0 deletions app/src/main/res/layout/item_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_height="wrap_content"
android:paddingHorizontal="14dp"
android:paddingBottom="16dp">

<View
android:id="@+id/view_home_item_line"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray_1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_home_item"
android:layout_width="95dp"
android:layout_height="0dp"
android:layout_marginTop="14dp"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/img_home_ad" />

<TextView
android:id="@+id/tv_home_item_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="13dp"
android:layout_marginTop="4dp"
android:textAppearance="@style/TextAppearance.Carrot.Body2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_home_item"
app:layout_constraintTop_toTopOf="@id/iv_home_item"
tools:text="스타벅스 다이어리 그린 9,000원 (쿠폰 없음)" />

<TextView
android:id="@+id/tv_home_item_where"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="@color/gray_4"
app:layout_constraintStart_toStartOf="@+id/tv_home_item_content"
app:layout_constraintTop_toBottomOf="@+id/tv_home_item_content"
tools:text="서강동" />

<TextView
android:id="@+id/tv_home_item_separate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text=" · "
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="@color/gray_4"
app:layout_constraintStart_toEndOf="@id/tv_home_item_where"
app:layout_constraintTop_toBottomOf="@+id/tv_home_item_content" />

<TextView
android:id="@+id/tv_home_item_reupload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="끌올 "
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="@color/gray_4"
android:visibility="visible"
app:layout_constraintStart_toEndOf="@id/tv_home_item_separate"
app:layout_constraintTop_toBottomOf="@+id/tv_home_item_content" />

<TextView
android:id="@+id/tv_home_item_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="@color/gray_4"
app:layout_constraintStart_toEndOf="@id/tv_home_item_reupload"
app:layout_constraintTop_toTopOf="@+id/tv_home_item_where"
tools:text="13초 전" />

<TextView
android:id="@+id/tv_home_item_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textAppearance="@style/TextAppearance.Carrot.Number1"
app:layout_constraintStart_toStartOf="@+id/tv_home_item_where"
app:layout_constraintTop_toBottomOf="@+id/tv_home_item_where"
tools:text="8,800원" />

<ImageView
android:id="@+id/iv_home_item_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:src="@drawable/ic_home_down"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@id/tv_home_item_price"
app:layout_constraintStart_toEndOf="@id/tv_home_item_price"
app:layout_constraintTop_toTopOf="@id/tv_home_item_price" />

<TextView
android:id="@+id/tv_home_item_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:text="down"
android:textAppearance="@style/TextAppearance.Carrot.Body4"
android:textColor="?colorPrimary"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/iv_home_item_down"
app:layout_constraintStart_toEndOf="@+id/iv_home_item_down"
app:layout_constraintTop_toTopOf="@+id/iv_home_item_down" />

<ImageView
android:id="@+id/iv_home_item_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_sale_heart_default" />

<TextView
android:id="@+id/tv_home_item_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Carrot.Body4"
tools:text="7" />

<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow_home_item_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="iv_home_item_like,tv_home_item_like"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 6 additions & 0 deletions app/src/main/res/values/shapes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ShapeAppearance.Circle" parent="">
<item name="cornerSize">50%</item>
</style>
</resources>

0 comments on commit ec4acf8

Please sign in to comment.