-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add scroll action in ProfileFragment #158
Changes from 17 commits
afb0ad5
7782ba3
17d0e2c
1d4ccf3
042d4f1
014b772
b211fba
1badc08
c9cd1fb
e0d8340
8fdee10
1522f5c
e8d2945
cecabcb
1815f38
9e7eaeb
551ee38
29ee044
c49fd90
ff578c2
4a43b7b
8a45fab
301fbd8
b8fa666
843362c
6fb5420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
package com.smilegate.Easel.data | ||
|
||
import com.smilegate.Easel.R | ||
import com.smilegate.Easel.domain.model.HighlightItem | ||
import com.smilegate.Easel.domain.model.TimelineItem | ||
|
||
class ProfileTapRvDataHelper { | ||
companion object { | ||
fun getDataForTab(tabPosition: Int): List<TimelineItem> { | ||
return when (tabPosition) { | ||
0 -> generateDummyMyPostData() // 게시물 | ||
1 -> generateDummyReplyData() // 답글 | ||
2 -> generateDummyMyPostData() // 하이라이트 | ||
3 -> generateDummyMediaData() // 미디어 | ||
4 -> generateDummyLikedData() // 마음에 들어요 | ||
else -> emptyList() // 기본적으로 빈 리스트 반환 | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun generateDummyMyPostData(): List<TimelineItem> { | ||
val profileImgId = R.drawable.sample_profile_img5 | ||
val profileImgId1 = R.drawable.sample_profile_img1 | ||
val profileImgId2 = R.drawable.sample_profile_img2 | ||
val profileImgId3 = R.drawable.sample_profile_img3 | ||
val profileImgId4 = R.drawable.sample_profile_img4 | ||
|
||
val contentImgId = R.drawable.sample_content_img1 | ||
val contentImgId1 = R.drawable.sample_content_img2 | ||
val contentImgId2 = R.drawable.sample_content_img3 | ||
val contentImgId3 = R.drawable.sample_content_img4 | ||
|
||
val timelineList = listOf( | ||
TimelineItem(profileImgId, "이원영", "@courtney81819", "1시간", | ||
"아 슈뢰딩거가 아닌가?ㅋ", null, null, | ||
2, 1, null, 24), | ||
|
||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "32분", | ||
"비가 내리는 날이에요.\n추적이는 바닥을 보며 걷다보니 카페가 나와 커피를 사 봤어요.", contentImgId, null, | ||
4, 2, 5, 121), | ||
|
||
TimelineItem(profileImgId1, "박희원", "@_Parking1_", "18분", | ||
"타래 스타트", contentImgId1, null, | ||
1, 1, null, 114), | ||
|
||
TimelineItem(profileImgId4, "김도율", "@doxxx93", "8분", | ||
"테스트", null, null, | ||
1, null, 2, 32), | ||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "1주", | ||
"커피는 아이스 아메리카노에요.\n컵에 스며든 물방울처럼, 제 마음을 촉촉하게 만들어 주네요..^^", contentImgId2, null, | ||
3, 4, 2, 89), | ||
|
||
TimelineItem(profileImgId3, "김도현", "@KittenDiger", "4일", | ||
"테스트 인용의 인용", null, null, | ||
1, null, null, 30), | ||
|
||
TimelineItem(profileImgId, "이원영", "@courtney81819", "3시간", | ||
"청하 로제", contentImgId3, null, | ||
3, null, 2, 334), | ||
|
||
TimelineItem(profileImgId3, "김도현", "@KittenDiger", "4일", | ||
"구글인ㅇㅎㅇ의 인용의 인용", null, null, | ||
1, 2, null, 50), | ||
) | ||
|
||
return timelineList.shuffled() | ||
} | ||
|
||
fun generateDummyReplyData(): List<TimelineItem> { | ||
val profileImgId = R.drawable.sample_profile_img5 | ||
val profileImgId1 = R.drawable.sample_profile_img1 | ||
val profileImgId2 = R.drawable.sample_profile_img2 | ||
val profileImgId4 = R.drawable.sample_profile_img4 | ||
|
||
val contentImgId = R.drawable.sample_content_img1 | ||
val contentImgId1 = R.drawable.sample_content_img2 | ||
val contentImgId2 = R.drawable.sample_content_img3 | ||
|
||
val timelineList = listOf( | ||
|
||
TimelineItem(profileImgId1, "박희원", "@_Parking1_", "18분", | ||
"타래 스타트", contentImgId1, null, | ||
1, 1, null, 114), | ||
|
||
TimelineItem(profileImgId, "이원영", "@courtney81819", "1시간", | ||
"아 슈뢰딩거가 아닌가?ㅋ", null, null, | ||
2, 1, null, 24), | ||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "32분", | ||
"비가 내리는 날이에요.\n추적이는 바닥을 보며 걷다보니 카페가 나와 커피를 사 봤어요.", contentImgId, null, | ||
4, 2, 5, 121), | ||
|
||
TimelineItem(profileImgId4, "김도율", "@doxxx93", "8분", | ||
"테스트", null, null, | ||
1, null, 2, 32), | ||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "1주", | ||
"커피는 아이스 아메리카노에요.\n컵에 스며든 물방울처럼, 제 마음을 촉촉하게 만들어 주네요..^^", contentImgId2, null, | ||
3, 4, 2, 89), | ||
) | ||
|
||
return timelineList.shuffled() | ||
} | ||
|
||
fun generateDummyHighlightData(): List<HighlightItem> { | ||
|
||
val highlightItem = listOf( | ||
HighlightItem("프로필에 하이라이트 추가", "프로필에 게시물을 하이라이트하려면 Premium을 구독해\n야 합니다.", "Premium 구독하기"), | ||
) | ||
|
||
return highlightItem.shuffled() | ||
} | ||
|
||
fun generateDummyMediaData(): List<TimelineItem> { | ||
val profileImgId = R.drawable.sample_profile_img5 | ||
val profileImgId2 = R.drawable.sample_profile_img2 | ||
val profileImgId3 = R.drawable.sample_profile_img3 | ||
|
||
val contentImgId = R.drawable.sample_content_img1 | ||
val contentImgId2 = R.drawable.sample_content_img3 | ||
val contentImgId3 = R.drawable.sample_content_img4 | ||
|
||
val timelineList = listOf( | ||
|
||
TimelineItem(profileImgId, "이원영", "@courtney81819", "3시간", | ||
"청하 로제", contentImgId3, null, | ||
3, null, 2, 334), | ||
|
||
TimelineItem(profileImgId3, "김도현", "@KittenDiger", "4일", | ||
"구글인ㅇㅎㅇ의 인용의 인용", null, null, | ||
1, 2, null, 50), | ||
|
||
TimelineItem(profileImgId, "이원영", "@courtney81819", "1시간", | ||
"아 슈뢰딩거가 아닌가?ㅋ", null, null, | ||
2, 1, null, 24), | ||
|
||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "32분", | ||
"비가 내리는 날이에요.\n추적이는 바닥을 보며 걷다보니 카페가 나와 커피를 사 봤어요.", contentImgId, null, | ||
4, 2, 5, 121), | ||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "1주", | ||
"커피는 아이스 아메리카노에요.\n컵에 스며든 물방울처럼, 제 마음을 촉촉하게 만들어 주네요..^^", contentImgId2, null, | ||
3, 4, 2, 89), | ||
|
||
TimelineItem(profileImgId3, "김도현", "@KittenDiger", "4일", | ||
"테스트 인용의 인용", null, null, | ||
1, null, null, 30), | ||
) | ||
|
||
return timelineList.shuffled() | ||
} | ||
|
||
fun generateDummyLikedData(): List<TimelineItem> { | ||
val profileImgId = R.drawable.sample_profile_img5 | ||
val profileImgId1 = R.drawable.sample_profile_img1 | ||
val profileImgId2 = R.drawable.sample_profile_img2 | ||
val profileImgId3 = R.drawable.sample_profile_img3 | ||
val profileImgId4 = R.drawable.sample_profile_img4 | ||
|
||
val contentImgId1 = R.drawable.sample_content_img2 | ||
val contentImgId2 = R.drawable.sample_content_img3 | ||
val contentImgId3 = R.drawable.sample_content_img4 | ||
|
||
val timelineList = listOf( | ||
TimelineItem(profileImgId, "이원영", "@courtney81819", "1시간", | ||
"아 슈뢰딩거가 아닌가?ㅋ", null, null, | ||
2, 1, null, 24), | ||
|
||
TimelineItem(profileImgId1, "박희원", "@_Parking1_", "18분", | ||
"타래 스타트", contentImgId1, null, | ||
1, 1, null, 114), | ||
|
||
TimelineItem(profileImgId4, "김도율", "@doxxx93", "8분", | ||
"테스트", null, null, | ||
1, null, 2, 32), | ||
|
||
TimelineItem(profileImgId2, "이상민", "@isangmi92157279", "1주", | ||
"커피는 아이스 아메리카노에요.\n컵에 스며든 물방울처럼, 제 마음을 촉촉하게 만들어 주네요..^^", contentImgId2, null, | ||
3, 4, 2, 89), | ||
|
||
TimelineItem(profileImgId, "이원영", "@courtney81819", "3시간", | ||
"청하 로제", contentImgId3, null, | ||
3, null, 2, 334), | ||
|
||
TimelineItem(profileImgId3, "김도현", "@KittenDiger", "4일", | ||
"구글인ㅇㅎㅇ의 인용의 인용", null, null, | ||
1, 2, null, 50), | ||
) | ||
|
||
return timelineList.shuffled() | ||
} | ||
fun refreshTimelineData() { | ||
//val shuffledTimelineList = ProfileTapRvDataHelper.getDataForTab().shuffled() | ||
// (binding.rvProfile.adapter as? TimelineRecyclerViewAdapter)?.updateData(shuffledTimelineList) | ||
// | ||
// binding.swipeRefreshLayout.isRefreshing = false | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기는 추후라도 사용하게 되는 코드인가요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 죠습니다 👍 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.smilegate.Easel.domain.model | ||
|
||
data class HighlightItem( | ||
val title: String, | ||
val description: String, | ||
val btnText: String // 예시로 이미지 URL을 사용하였습니다. 실제 프로젝트에 맞게 변경하세요. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 주석은 어떤 내용인가요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 죠습니다~!! |
||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.smilegate.Easel.presentation.adapter | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.smilegate.Easel.databinding.ItemHighlightBinding | ||
import com.smilegate.Easel.domain.model.HighlightItem | ||
|
||
class HighlightAdapter(private val context: Context, private val highlightList: List<HighlightItem>) : | ||
RecyclerView.Adapter<HighlightAdapter.HighlightViewHolder>() { | ||
|
||
inner class HighlightViewHolder(private val binding: ItemHighlightBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(item: HighlightItem) { | ||
|
||
binding.textView8.text = item.title.toString() | ||
binding.textView9.text = item.description.toString() | ||
binding.btnText.text = item.btnText.toString() | ||
|
||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HighlightViewHolder { | ||
val inflater = LayoutInflater.from(parent.context) | ||
val binding = ItemHighlightBinding.inflate(inflater, parent, false) | ||
return HighlightViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: HighlightViewHolder, position: Int) { | ||
val highlightItem = highlightList[position] | ||
holder.bind(highlightItem) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return highlightList.size | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eol :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 551ee38 eol 모두 처리해서 반영했습니다! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eol :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
551ee38 eol 모두 처리해서 반영했습니다!