Skip to content

Commit

Permalink
[FEATURE] #39 마이페이지 화면 UI 구성하기 (#46)
Browse files Browse the repository at this point in the history
* [FEAT] #39 - 마이 페이지 를 위한 user 모듈 및 Activity 추가
* [FEAT] #39 - UserActivity를 UserFragment로 변경
* [FEAT] #39 - Title과 Divider ViewHolder/UiModel를 재사용할 수 있도록 각각 ui/model 모듈로 이동
* [FEAT] #34 - 마이페이지 화면 상단 UI 구현
* [FEAT] #39 - SmallChip의 Background 색상을 변경할 수 있도록 수정
  • Loading branch information
aurora32s authored Jul 10, 2023
1 parent 1ef4561 commit c274772
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.peonlee.core.ui.designsystem.chip

import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import android.view.LayoutInflater
import com.peonlee.core.ui.R
Expand Down Expand Up @@ -30,6 +31,21 @@ class SmallChip(
context.theme
)
)
val chipBackgroundTint = getColor(
R.styleable.SmallChip_android_backgroundTint,
resources.getColor(
R.color.system_r50,
context.theme
)
)
/**
* TODO applyBackgroundAttributes Method 수정 필요
* background, backgroundTint 둘 중에 하나만 설정할 수 있는 코드
*/
binding.layoutSmallChipBackground.apply {
backgroundTintList = ColorStateList.valueOf(chipBackgroundTint)
}

applyTextAttributes(
chipTitleText,
chipTitleTextColor
Expand Down
1 change: 1 addition & 0 deletions core/ui/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<declare-styleable name="SmallChip">
<attr name="android:text" format="reference|string" />
<attr name="android:textColor" format="color" />
<attr name="android:backgroundTint" format="color" />
</declare-styleable>

<declare-styleable name="MediumChip">
Expand Down
2 changes: 2 additions & 0 deletions feature/login/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
<style name="Base.Theme.PeonLee" parent="Theme.Material3.DayNight.NoActionBar">
<!-- 기본 배경 색 -->
<item name="android:colorBackground">@color/bg0</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor">@color/bg0</item>
</style>
</resources>
1 change: 1 addition & 0 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ android {
dependencies {
implementation(project(":feature:home"))
implementation(project(":feature:explore"))
implementation(project(":feature:user"))
implementation(libs.bundles.fragment)
}
1 change: 1 addition & 0 deletions feature/user/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
8 changes: 8 additions & 0 deletions feature/user/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("peonlee.android.feature")
}

android {
namespace = "com.peonlee.user"
viewBinding { enable = true }
}
2 changes: 2 additions & 0 deletions feature/user/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
32 changes: 32 additions & 0 deletions feature/user/src/main/java/com/peonlee/user/UserFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.peonlee.user

import android.view.LayoutInflater
import android.view.ViewGroup
import com.peonlee.core.ui.base.BaseFragment
import com.peonlee.user.databinding.FragmentUserBinding

/**
* 사용자 마이 페이지 Fragment
*/
class UserFragment : BaseFragment<FragmentUserBinding>() {
override fun bindingFactory(parent: ViewGroup): FragmentUserBinding {
return FragmentUserBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
}

override fun initViews() = with(binding) {
// TODO 실제 사용자 정보로 대체 필요
tvNickname.text = "꿈꾸는날다람쥐"
// 작성한 리뷰 개수
tvCommentCount.text = getString(R.string.count, 24)
// 평가한 상품 개수
tvEvaluateCount.text = getString(R.string.count, 102)
}

companion object {
fun getInstance() = UserFragment()
}
}
176 changes: 176 additions & 0 deletions feature/user/src/main/res/layout/fragment_user.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?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="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/tvNickname"
style="@style/Text.Subtitle01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="꿈꾸는날다람쥐" />

<TextView
android:id="@+id/tvEvaluateCount"
style="@style/Text.Subtitle01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="8dp"
android:gravity="center"
android:textColor="@color/brand100"
app:layout_constraintEnd_toStartOf="@id/tvCommentCount"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNickname"
tools:text="0개" />

<TextView
android:id="@+id/tvEvaluateName"
style="@style/Text.Body06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="평가한 상품"
android:textColor="@color/bg40"
app:layout_constraintEnd_toEndOf="@id/tvEvaluateCount"
app:layout_constraintStart_toStartOf="@id/tvEvaluateCount"
app:layout_constraintTop_toBottomOf="@id/tvEvaluateCount" />

<TextView
android:id="@+id/tvCommentCount"
style="@style/Text.Subtitle01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="18dp"
android:gravity="center"
android:textColor="@color/brand100"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvEvaluateCount"
app:layout_constraintTop_toTopOf="@id/tvEvaluateCount"
tools:text="0개" />

<TextView
android:id="@+id/tvCommentName"
style="@style/Text.Body06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="남긴 리뷰"
android:textColor="@color/bg40"
app:layout_constraintEnd_toEndOf="@id/tvCommentCount"
app:layout_constraintStart_toStartOf="@id/tvCommentCount"
app:layout_constraintTop_toBottomOf="@id/tvCommentCount" />

<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_marginTop="34dp"
android:background="@color/bg10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvEvaluateName" />

<TextView
android:id="@+id/tvSaveBoxName"
style="@style/Text.Body02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:layout_marginTop="16dp"
android:gravity="center"
android:paddingVertical="19dp"
android:text="보관함"
android:textColor="@color/bg80"
app:layout_constraintEnd_toStartOf="@id/btnSaveBox"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider" />

<com.peonlee.core.ui.designsystem.chip.SmallChip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:backgroundTint="@color/bg20"
android:text="준비중"
android:textColor="@color/bg40"
app:layout_constraintBottom_toBottomOf="@id/tvSaveBoxName"
app:layout_constraintStart_toEndOf="@id/tvSaveBoxName"
app:layout_constraintTop_toTopOf="@id/tvSaveBoxName" />

<ImageView
android:id="@+id/btnSaveBox"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="18dp"
android:src="@drawable/ic_chevron_right"
app:layout_constraintBottom_toBottomOf="@id/tvSaveBoxName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSaveBoxName"
app:layout_constraintTop_toTopOf="@id/tvSaveBoxName" />

<View
android:id="@+id/dividerSaveBox"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginHorizontal="18dp"
android:background="@color/bg20"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSaveBoxName" />


<TextView
android:id="@+id/tvSettingName"
style="@style/Text.Body02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:gravity="center"
android:paddingVertical="19dp"
android:text="설정"
android:textColor="@color/bg80"
app:layout_constraintEnd_toStartOf="@id/btnSetting"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/dividerSaveBox" />

<com.peonlee.core.ui.designsystem.chip.SmallChip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:backgroundTint="@color/bg20"
android:text="준비중"
android:textColor="@color/bg40"
app:layout_constraintBottom_toBottomOf="@id/tvSettingName"
app:layout_constraintStart_toEndOf="@id/tvSettingName"
app:layout_constraintTop_toTopOf="@id/tvSettingName" />

<ImageView
android:id="@+id/btnSetting"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="18dp"
android:src="@drawable/ic_chevron_right"
app:layout_constraintBottom_toBottomOf="@id/tvSettingName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSettingName"
app:layout_constraintTop_toTopOf="@id/tvSettingName" />

<View
android:id="@+id/dividerSetting"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginHorizontal="18dp"
android:background="@color/bg20"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSettingName" />
</androidx.constraintlayout.widget.ConstraintLayout>
5 changes: 5 additions & 0 deletions feature/user/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 마이페이지 화면 -->
<string name="count">%d개</string>
</resources>
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ include(":core:domain")
include(":feature:detail")
include(":core:model")
include(":core:common")
include(":feature:user")

0 comments on commit c274772

Please sign in to comment.