Skip to content

Commit

Permalink
🎨 Design: 친ꡬ μ΄ˆλŒ€ ν™”λ©΄ μˆ˜μ •
Browse files Browse the repository at this point in the history
- μ΄ˆλŒ€ν•  친ꡬ μ•„μ΄ν…œ UI κ΅¬ν˜„
- 전체 선택 μ·¨μ†Œ, μ΄ˆλŒ€ ν˜„ν™© ν‘œμ‹œ, μ΄ˆλŒ€ν•˜κΈ° λ²„νŠΌ

Related to: #347
  • Loading branch information
nahy-512 committed Jan 8, 2025
1 parent 146b48f commit 4caa8fe
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mongmong.namo.presentation.ui.community.moim.schedule

import android.text.Html
import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.mongmong.namo.R
Expand Down Expand Up @@ -29,12 +30,19 @@ class FriendInviteActivity : BaseActivity<ActivityFriendInviteBinding>(R.layout.
}
}

// μ΄ˆλŒ€ν•œ 친ꡬ ν˜„ν™© ν‘œμ‹œμš©
private fun setFriendSelectedNum() {
// {μ΄ˆλŒ€ν•  친ꡬ 수} / {전체 친ꡬ 수}
binding.friendInviteSelectedNumTv.text = Html.fromHtml(String.format(resources.getString(R.string.moim_schedule_friend_invite_selected_num), viewModel.friendToInviteList.value?.size, viewModel.friendList.value?.size))
}

private fun setAdapter() {
friendAdapter = FriendInviteRVAdapter()
binding.friendInviteListRv.apply {
adapter = friendAdapter
layoutManager = LinearLayoutManager(context)
}

friendAdapter.setItemClickListener(object : FriendInviteRVAdapter.MyItemClickListener {
override fun onInviteButtonClick(position: Int) {
//TODO: 친ꡬ μ΄ˆλŒ€ 진행
Expand All @@ -51,6 +59,7 @@ class FriendInviteActivity : BaseActivity<ActivityFriendInviteBinding>(R.layout.
if (it.isNotEmpty()) {
setAdapter()
friendAdapter.addFriend(it)
setFriendSelectedNum()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ import javax.inject.Inject
class FriendInviteViewModel @Inject constructor(
private val getFriendsUseCase: GetFriendsUseCase,
): ViewModel() {
// λͺ¨λ“  친ꡬ λͺ©λ‘
private val _friendList = MutableLiveData<List<Friend>>()
val friendList: LiveData<List<Friend>> = _friendList

// μ΄ˆλŒ€ν•  친ꡬ λͺ©λ‘
private val _friendToInviteList = MutableLiveData<List<Friend>>(emptyList())
val friendToInviteList: LiveData<List<Friend>> = _friendToInviteList

init {
getFriends()
}
Expand Down
112 changes: 103 additions & 9 deletions app/src/main/res/layout/activity_friend_invite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,130 @@
app:layout_constraintTop_toTopOf="@id/friend_invite_search_et"
style="@style/search_btn"/>

<!-- 친ꡬ λ¦¬μŠ€νŠΈκ°€ 없을 λ•Œ ν‘œμ‹œν•  empty view -->
<LinearLayout
android:id="@+id/friend_invite_empty_ll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:visibility="@{viewModel.friendList.empty ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toBottomOf="@id/friend_invite_search_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">

<ImageView
android:layout_width="300dp"
android:layout_height="200dp"
android:src="@drawable/img_group_empty"/>

<TextView
android:id="@+id/friend_invite_empty_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:text="@string/moim_schedule_invite_friend_empty"
style="@style/content_regular"/>

</LinearLayout>

<!-- μ΄ˆλŒ€ν•  친ꡬ -->
<LinearLayout
android:id="@+id/friend_invite_preparatory_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginHorizontal="25dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/friend_invite_search_btn">

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="25dp"
android:text="@string/moim_schedule_invite_friend"
android:drawableEnd="@drawable/ic_arrow_up"
style="@style/content_bold"/>

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal"
tools:listitem="@layout/item_friend_to_invite"/>

</LinearLayout>

<!-- μ΄ˆλŒ€ -->
<LinearLayout
android:id="@+id/friend_invite_reset_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="25dp"
android:orientation="horizontal"
android:visibility="@{viewModel.friendToInviteList.empty ? View.GONE : View.VISIBLE}"
app:layout_constraintTop_toBottomOf="@id/friend_invite_preparatory_ll">

<TextView
android:id="@+id/friend_invite_empty_tv"
android:id="@+id/friend_invite_reset_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:text="@string/moim_schedule_invite_friend_empty"
style="@style/content_regular"/>
android:padding="3dp"
android:text="@string/moim_schedule_invite_friend_reset"
android:textColor="@color/main_text"
style="@style/subtext_14"/>

<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>

<TextView
android:id="@+id/friend_invite_selected_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_placeholder"
tools:text="3 / 7"
style="@style/button_label"/>

<TextView
android:id="@+id/friend_invite_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:paddingHorizontal="12dp"
android:paddingVertical="4dp"
android:background="@drawable/bg_basic_btn"
android:textColor="@color/white"
android:text="@string/moim_schedule_do_invite"
style="@style/button_label"/>

</LinearLayout>

<!-- λͺ¨λ“  친ꡬ -->
<LinearLayout
android:id="@+id/friend_invite_all_friend_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginHorizontal="25dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/friend_invite_reset_ll">

<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/moim_schedule_all_friend"
style="@style/content_bold"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/friend_invite_list_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="20dp"
android:layout_marginTop="24dp"
android:layout_marginTop="12dp"
android:visibility="@{viewModel.friendList.empty ? View.GONE : View.VISIBLE}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_friend_invite"
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/res/layout/item_friend_invite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:backgroundTint="@color/item_background"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="20dp"
android:layout_marginBottom="16dp"
android:paddingVertical="12dp"
android:paddingHorizontal="16dp">

Expand Down Expand Up @@ -67,22 +67,22 @@

</LinearLayout>

<TextView
android:id="@+id/item_friend_introduction_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@{friend.introduction}"
tools:text="μΉœκ΅¬κ°€ 직접 μž‘μ„±ν•œ ν•œ 쀄 μ†Œκ°œ"
style="@style/subtext_12" />
<!-- <TextView-->
<!-- android:id="@+id/item_friend_introduction_tv"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="6dp"-->
<!-- android:text="@{friend.introduction}"-->
<!-- tools:text="μΉœκ΅¬κ°€ 직접 μž‘μ„±ν•œ ν•œ 쀄 μ†Œκ°œ"-->
<!-- style="@style/subtext_12" />-->

</LinearLayout>

<CheckBox
android:id="@+id/item_friend_invite_btn"
android:layout_width="28dp"
android:layout_height="28dp"
android:checked="true"
android:checked="false"
android:button="@null"
android:background="@drawable/selector_invite"/>

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

<data>
<variable
name="friend"
type="com.mongmong.namo.domain.model.Friend" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="12dp">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/image_delete_btn"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_close"
app:civ_circle_background_color="@color/white"
app:civ_border_color="@color/white"
app:civ_border_width="2dp"
android:elevation="3dp"
android:layout_marginTop="-5dp"
android:layout_marginEnd="-5dp"
app:layout_constraintTop_toTopOf="@id/image_cv"
app:layout_constraintEnd_toEndOf="@id/image_cv"/>

<androidx.cardview.widget.CardView
android:id="@+id/image_cv"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_margin="6dp"
app:cardCornerRadius="15dp"
app:cardElevation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_iv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/img_default_profile" />
</androidx.cardview.widget.CardView>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@{friend.nickname}"
android:textColor="@color/main_text"
app:layout_constraintTop_toBottomOf="@id/image_cv"
app:layout_constraintStart_toStartOf="@id/image_cv"
app:layout_constraintEnd_toEndOf="@id/image_cv"
tools:text="μ½”μ½”μ•„"
style="@style/subtext_12"/>

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
15 changes: 13 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<string name="birth">생일</string>
<string name="nickname">λ‹‰λ„€μž„</string>
<string name="input_hint">μž…λ ₯</string>
<string name="continuously">계속</string>

<!-- μ•½κ΄€ λ™μ˜ κ΄€λ ¨ String -->
<string name="for_service">μ„œλΉ„μŠ€ μ΄μš©μ„ μœ„ν•œ</string>
Expand Down Expand Up @@ -208,8 +209,12 @@
<string name="moim_schedule_new_moim_start">μƒˆ λͺ¨μž„ μ‹œμž‘ν•˜κΈ°</string>
<string name="moim_schedule_look_invite_friend_schedule">μ΄ˆλŒ€ν•œ 친ꡬ 일정 보기</string>
<string name="moim_schedule_do_friend_invite">친ꡬ μ΄ˆλŒ€ν•˜κΈ°</string>
<string name="moim_schedule_invite_friend">μ΄ˆλŒ€ν•œ 친ꡬ</string>
<string name="moim_schedule_invite_friend_empty">아직 μ΄ˆλŒ€ν•œ μΉœκ΅¬κ°€ μ—†μŠ΅λ‹ˆλ‹€.</string>
<string name="moim_schedule_invite_friend">μ΄ˆλŒ€ν•  친ꡬ</string>
<string name="moim_schedule_invite_friend_reset">전체 선택 μ·¨μ†Œ</string>
<string name="moim_schedule_friend_invite_selected_num"><![CDATA[<font color=\'#DA6022\'>%d</font> / %d]]></string> <!-- 선택 μΈμ›μˆ˜ / 전체 친ꡬ 수 -->
<string name="moim_schedule_do_invite">μ΄ˆλŒ€ν•˜κΈ°</string>
<string name="moim_schedule_all_friend">λͺ¨λ“  친ꡬ</string>
<string name="moim_schedule_invite_friend_empty">아직 μΆ”κ°€λœ μΉœκ΅¬κ°€ μ—†μ–΄μš”.\n친ꡬλ₯Ό μΆ”κ°€ν•œ ν›„ λͺ¨μž„을 λ§Œλ“€μ–΄λ³΄μ„Έμš”!</string>
<string name="moim_schedule_add_guest">게슀트 μ΄ˆλŒ€ν•˜κΈ°</string>
<string name="moim_schedule_record_activity">ν™œλ™ κΈ°λ‘ν•˜κΈ° </string>
<string name="moim_schedule_participant_info">μ°Έμ„μž 정보</string>
Expand All @@ -236,4 +241,10 @@
<string name="request_accept">수락</string>
<string name="request_deny">거절</string>

<!-- λ‹€μ΄μ–Όλ‘œκ·Έ -->
<string name="dialog_moim_friend_invite_title">\β€˜%s\' λͺ¨μž„ 일정에\n친ꡬλ₯Ό μ΄ˆλŒ€ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?</string>
<string name="dialog_moim_friend_invite_content">μ§€κΈˆ μ·¨μ†Œν•˜μ…”λ„ μΆ”ν›„ 일정 νŽΈμ§‘μ—μ„œ\n친ꡬλ₯Ό μΆ”κ°€ν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€.</string>
<string name="dialog_moim_delete_title">λͺ¨μž„ 일정을 정말 μ‚­μ œν•˜μ‹œκ² μ–΄μš”?</string>
<string name="dialog_moim_delete_content">μ‚­μ œν•œ λͺ¨μž„ 일정은\nλͺ¨λ“  μ°Έμ—¬μžμ˜ μΌμ •μ—μ„œ μ‚­μ œλ©λ‹ˆλ‹€.</string>

</resources>

0 comments on commit 4caa8fe

Please sign in to comment.