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: 마이페이지 프로필 및 내 서재 api 연결 #262

Merged
merged 21 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
refactor: 매력포인트 텍스트 결합 수정
  • Loading branch information
yeonjeen committed Aug 29, 2024
commit a9d1bb6a95cebb4182e51f165cdce9f3a4584a48
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ class MyLibraryFragment : BaseFragment<FragmentMyLibraryBinding>(R.layout.fragme
}

private fun setUpObserve() {
myLibraryViewModel.genres.observe(viewLifecycleOwner) { genres ->
myLibraryViewModel.restGenres.observe(viewLifecycleOwner) { genres ->
restGenrePreferenceAdapter.updateRestGenrePreferenceData(genres)
}

myLibraryViewModel.isGenreListVisible.observe(viewLifecycleOwner) { isVisible ->
updateRestGenrePreferenceVisibility(isVisible)
}

myLibraryViewModel.attractivePointsText.observe(viewLifecycleOwner) { combinedText ->
myLibraryViewModel.translatedAttractivePoints.observe(viewLifecycleOwner) { translatedPoints ->
val combinedText =
translatedPoints.joinToString(", ") + getString(R.string.my_library_attractive_point_fixed_text)
applyTextColors(combinedText)
}

Expand All @@ -70,12 +72,13 @@ class MyLibraryFragment : BaseFragment<FragmentMyLibraryBinding>(R.layout.fragme

val spannableStringBuilder = SpannableStringBuilder()

val fixedText = getString(R.string.my_library_attractive_point_fixed_text).trim()
val attractivePointTextLength = combinedText.indexOf(fixedText)
val fixedText = getString(R.string.my_library_attractive_point_fixed_text)

if (attractivePointTextLength != -1) {
val splitText = combinedText.split(fixedText)

if (splitText.isNotEmpty()) {
val attractivePoints =
SpannableString(combinedText.substring(0, attractivePointTextLength)).apply {
SpannableString(splitText[0]).apply {
setSpan(
ForegroundColorSpan(primary100),
0,
Expand All @@ -86,7 +89,7 @@ class MyLibraryFragment : BaseFragment<FragmentMyLibraryBinding>(R.layout.fragme
spannableStringBuilder.append(attractivePoints)

val fixedSpannable =
SpannableString(combinedText.substring(attractivePointTextLength)).apply {
SpannableString(fixedText).apply {
setSpan(
ForegroundColorSpan(gray300),
0,
Expand All @@ -110,7 +113,6 @@ class MyLibraryFragment : BaseFragment<FragmentMyLibraryBinding>(R.layout.fragme
binding.tvMyLibraryAttractivePoints.text = spannableStringBuilder
}


private fun updateNovelPreferencesKeywords(novelPreferences: NovelPreferenceEntity) {
novelPreferences.keywords.forEach { keyword ->
val chip = createKeywordChip(keyword)
Expand Down