Skip to content
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

Merged
merged 26 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
afb0ad5
chore: remove unused behavior.kt
HeewonP825 Jan 25, 2024
7782ba3
feat: add SwipeRefresh in Timeline
HeewonP825 Jan 25, 2024
17d0e2c
feat: try to forbid basicBackbtn in ProfileFragment
HeewonP825 Jan 25, 2024
1d4ccf3
feat: add nestedScrollableHost/icon & edit color theme name
HeewonP825 Jan 26, 2024
042d4f1
chore: add Timber in Dependency & MainActivity
HeewonP825 Jan 26, 2024
014b772
feat: remove scrollView in RV
HeewonP825 Jan 27, 2024
b211fba
feat: remove scrollView in RV
HeewonP825 Jan 27, 2024
1badc08
feat: remove scrollView in RV
HeewonP825 Jan 29, 2024
c9cd1fb
feat: divide ConstraintLayout into 2
HeewonP825 Jan 29, 2024
e0d8340
feat: edit xml for scrollView
HeewonP825 Jan 30, 2024
8fdee10
feat: add action in backbtn for ProfileFragment
HeewonP825 Jan 30, 2024
1522f5c
feat: add SwipeRefresh in xml
HeewonP825 Jan 30, 2024
e8d2945
feat: add swipe action in Tablayout
HeewonP825 Jan 30, 2024
cecabcb
extract Method for RV in ProfileFragment
HeewonP825 Jan 30, 2024
1815f38
feat: try to add Highlight RV for ProfileFragment Tablayout
HeewonP825 Jan 31, 2024
9e7eaeb
feat: make FAB cannot scroll
HeewonP825 Jan 31, 2024
551ee38
chore:add eol
HeewonP825 Jan 31, 2024
29ee044
feat: edit popupMenu constraintLayout
HeewonP825 Jan 31, 2024
c49fd90
chore: add eol
HeewonP825 Jan 31, 2024
ff578c2
chore: reflect review
HeewonP825 Jan 31, 2024
4a43b7b
chore: reflect review
HeewonP825 Jan 31, 2024
8a45fab
chore: reflect review
HeewonP825 Jan 31, 2024
301fbd8
chore: reflect review
HeewonP825 Jan 31, 2024
b8fa666
chore: reflect review
HeewonP825 Jan 31, 2024
843362c
chore: add eol
HeewonP825 Jan 31, 2024
6fb5420
chore: add eol
HeewonP825 Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mobile/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ android {
}

dependencies {
//easy to see JSON
implementation ("com.jakewharton.timber:timber:4.7.1")

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.navigation.NavController
import androidx.navigation.findNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.smilegate.Easel.databinding.ActivityMainBinding
import timber.log.Timber

class MainActivity : AppCompatActivity() {

Expand All @@ -25,6 +26,9 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

Timber.plant(Timber.DebugTree())

setContentView(binding.root)

/* Status Bar & Navigation Bar */
Expand Down
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
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eol :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

551ee38 eol 모두 처리해서 반영했습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 추후라도 사용하게 되는 코드인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swipe action을 통해 데이터를 리프레쉬 시킬 때 사용할 함수인데 메서드 추출로 인해 클래스를 분리한 상태입니다! ProfileFragment의 코드에 이 함수를 사용하는 부분이 있고 추후 binding 부분을 바꾸어 처리할 예정이라 내용만 주석처리해두었습니다:)

Copy link
Collaborator

Choose a reason for hiding this comment

The 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을 사용하였습니다. 실제 프로젝트에 맞게 변경하세요.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 주석은 어떤 내용인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight 탭에서 보여주는 유료구독페이지를 예전처럼 ViewPager2가 아닌 RecyclerView로 보여줘야 하기때문에 Data ClassAdapter를 만들어서 보여주는 방법을 시도해본건데 GPT한테 부탁한 코드를 그대로 복사해서 주석을 안지웠네용..ㅎㅎ 지웠습니다!!ㅎㅎㅎ

Copy link
Collaborator

Choose a reason for hiding this comment

The 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
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eol :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

551ee38 eol 모두 처리해서 반영했습니다!

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class TimelineRecyclerViewAdapter(private val context: Context, private val time
RecyclerView.Adapter<TimelineRecyclerViewAdapter.TimelineViewHolder>() {

private val popupManager = TimelinePopupManager(context)
private val bottomSheetDialog = RetweetBottomSheetDialog()
private var timelineListItem: MutableList<TimelineItem> = mutableListOf()

fun updateData(newList: List<TimelineItem>) {
timelineListItem = newList.toMutableList()
notifyDataSetChanged()
}
@RequiresApi(Build.VERSION_CODES.S)
inner class TimelineViewHolder(private val binding: ItemTimelineBinding) :
RecyclerView.ViewHolder(binding.root) {
Expand Down
Loading
Loading