-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] : #15 FriendRecord Emoji Bottom Sheet EmojiList Implement
- Loading branch information
Showing
5 changed files
with
128 additions
and
24 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...src/main/java/com/teampome/pome/presentation/friend/BottomEmojiGridSpaceItemDecoration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.teampome.pome.presentation.friend | ||
|
||
import android.graphics.Rect | ||
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.teampome.pome.util.common.CommonUtil | ||
|
||
class BottomEmojiGridSpaceItemDecoration(private val spanCount: Int): RecyclerView.ItemDecoration() { | ||
// 3, 20 | ||
override fun getItemOffsets( | ||
outRect: Rect, | ||
view: View, | ||
parent: RecyclerView, | ||
state: RecyclerView.State | ||
) { | ||
val position = parent.getChildAdapterPosition(view) | ||
|
||
val column = position % spanCount | ||
|
||
val spaceInPx = CommonUtil.dpToPx(parent.context, 10) | ||
|
||
outRect.top = spaceInPx | ||
|
||
if (column == 0) { | ||
outRect.left = spaceInPx | ||
} else if (column == 1) { | ||
outRect.left = spaceInPx | ||
} else if (column == 2) { | ||
outRect.left = spaceInPx | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/teampome/pome/presentation/friend/FriendEmotionAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.teampome.pome.presentation.friend | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.teampome.pome.databinding.ItemBottomEmojiBinding | ||
import com.teampome.pome.model.response.FriendEmotionResponse | ||
|
||
class FriendEmotionAdapter( | ||
private var friendEmotionList: List<FriendEmotionResponse> | ||
) : RecyclerView.Adapter<FriendEmotionAdapter.FriendEmotionViewHolder>() { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FriendEmotionViewHolder { | ||
val binding = ItemBottomEmojiBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return FriendEmotionViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: FriendEmotionViewHolder, position: Int) { | ||
holder.bind(friendEmotionList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int = friendEmotionList.size | ||
|
||
fun updateData(newData: List<FriendEmotionResponse>) { | ||
this.friendEmotionList = newData | ||
notifyDataSetChanged() | ||
} | ||
|
||
inner class FriendEmotionViewHolder( | ||
private val binding: ItemBottomEmojiBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
fun bind(friendEmotion: FriendEmotionResponse) { | ||
binding.friendEmotionHappyTv.text = friendEmotion.nickname | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
<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"> | ||
|
||
<androidx.appcompat.widget.AppCompatImageView | ||
android:id="@+id/friend_emotion_happy_aiv" | ||
android:layout_width="54dp" | ||
android:layout_height="54dp" | ||
android:layout_marginBottom="16dp" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
tools:src="@drawable/emoji_mint_fiter_happy" /> | ||
<data> | ||
|
||
<TextView | ||
android:id="@+id/friend_emotion_happy_tv" | ||
style="@style/Pome.Medium.14" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/remind_dialog_happy_text" | ||
android:textColor="@color/grey_8" | ||
app:layout_constraintTop_toBottomOf="@+id/friend_emotion_happy_aiv" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
</data> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<androidx.appcompat.widget.AppCompatImageView | ||
android:id="@+id/friend_emotion_happy_aiv" | ||
android:layout_width="54dp" | ||
android:layout_height="54dp" | ||
android:layout_marginBottom="16dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
tools:src="@drawable/emoji_mint_fiter_happy" /> | ||
|
||
<TextView | ||
android:id="@+id/friend_emotion_happy_tv" | ||
style="@style/Pome.Medium.14" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/remind_dialog_happy_text" | ||
android:textColor="@color/grey_8" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/friend_emotion_happy_aiv" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters