fix(community): 전체 아이템 말줄임과 폰트를 정렬한다
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.Intent
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
|
import android.text.TextUtils
|
||||||
import android.text.method.LinkMovementMethod
|
import android.text.method.LinkMovementMethod
|
||||||
import android.text.style.ClickableSpan
|
import android.text.style.ClickableSpan
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -46,6 +47,10 @@ class CreatorCommunityAllAdapter(
|
|||||||
(Long, Int, onSuccess: (GetCommunityPostListResponse) -> Unit) -> Unit
|
(Long, Int, onSuccess: (GetCommunityPostListResponse) -> Unit) -> Unit
|
||||||
) : RecyclerView.Adapter<CreatorCommunityAllAdapter.ViewHolder>() {
|
) : RecyclerView.Adapter<CreatorCommunityAllAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val CONTENT_PREVIEW_MAX_LENGTH = 120
|
||||||
|
}
|
||||||
|
|
||||||
val items = mutableListOf<GetCommunityPostListResponse>()
|
val items = mutableListOf<GetCommunityPostListResponse>()
|
||||||
|
|
||||||
inner class ViewHolder(
|
inner class ViewHolder(
|
||||||
@@ -257,8 +262,8 @@ class CreatorCommunityAllAdapter(
|
|||||||
index: Int
|
index: Int
|
||||||
) {
|
) {
|
||||||
textView.visibility = View.VISIBLE
|
textView.visibility = View.VISIBLE
|
||||||
textView.text = text
|
|
||||||
|
|
||||||
|
if (isExpand) {
|
||||||
val spannable = SpannableString(text)
|
val spannable = SpannableString(text)
|
||||||
val pattern = Pattern.compile("https?://\\S+")
|
val pattern = Pattern.compile("https?://\\S+")
|
||||||
val matcher = pattern.matcher(spannable)
|
val matcher = pattern.matcher(spannable)
|
||||||
@@ -275,8 +280,24 @@ class CreatorCommunityAllAdapter(
|
|||||||
spannable.setSpan(clickableSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
spannable.setSpan(clickableSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
}
|
}
|
||||||
|
|
||||||
textView.text = spannable
|
textView.maxLines = Int.MAX_VALUE
|
||||||
|
textView.ellipsize = null
|
||||||
|
textView.linksClickable = true
|
||||||
textView.movementMethod = LinkMovementMethod.getInstance()
|
textView.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
textView.text = spannable
|
||||||
|
} else {
|
||||||
|
val collapsedText = if (text.length > CONTENT_PREVIEW_MAX_LENGTH) {
|
||||||
|
"${text.take(CONTENT_PREVIEW_MAX_LENGTH)}..."
|
||||||
|
} else {
|
||||||
|
text
|
||||||
|
}
|
||||||
|
|
||||||
|
textView.maxLines = 3
|
||||||
|
textView.ellipsize = TextUtils.TruncateAt.END
|
||||||
|
textView.linksClickable = false
|
||||||
|
textView.movementMethod = null
|
||||||
|
textView.text = collapsedText
|
||||||
|
}
|
||||||
|
|
||||||
textView.setOnClickListener {
|
textView.setOnClickListener {
|
||||||
items[index] = items[index].copy(
|
items[index] = items[index].copy(
|
||||||
@@ -284,12 +305,6 @@ class CreatorCommunityAllAdapter(
|
|||||||
)
|
)
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
textView.maxLines = if (isExpand) {
|
|
||||||
Int.MAX_VALUE
|
|
||||||
} else {
|
|
||||||
3
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_round_corner_5_3_222222"
|
android:background="@drawable/bg_round_corner_16_263238"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingHorizontal="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:paddingVertical="11dp">
|
android:paddingVertical="11dp">
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
android:id="@+id/tv_nickname"
|
android:id="@+id/tv_nickname"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/medium"
|
android:fontFamily="@font/bold"
|
||||||
android:textColor="@color/color_eeeeee"
|
android:textColor="@color/color_eeeeee"
|
||||||
android:textSize="13.3sp"
|
android:textSize="18sp"
|
||||||
tools:text="민하나" />
|
tools:text="민하나" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -44,9 +44,9 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="3dp"
|
android:layout_marginTop="3dp"
|
||||||
android:fontFamily="@font/light"
|
android:fontFamily="@font/regular"
|
||||||
android:textColor="@color/color_777777"
|
android:textColor="@color/color_777777"
|
||||||
android:textSize="13.3sp"
|
android:textSize="14sp"
|
||||||
tools:text="3시간전" />
|
tools:text="3시간전" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -64,15 +64,15 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_content"
|
android:id="@+id/tv_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="13.3dp"
|
android:layout_marginTop="13.3dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:fontFamily="@font/medium"
|
android:fontFamily="@font/regular"
|
||||||
android:lineSpacingExtra="8dp"
|
android:lineSpacingExtra="8dp"
|
||||||
android:maxLines="3"
|
android:maxLines="3"
|
||||||
android:textColor="@color/color_bbbbbb"
|
android:textColor="@color/color_bbbbbb"
|
||||||
android:textSize="13.3sp"
|
android:textSize="18sp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!" />
|
tools:text="너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!" />
|
||||||
|
|
||||||
|
|||||||
32
docs/20260304_커뮤니티전체아이템텍스트수정.md
Normal file
32
docs/20260304_커뮤니티전체아이템텍스트수정.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# 커뮤니티 전체 아이템 텍스트 수정
|
||||||
|
|
||||||
|
## 구현 체크리스트
|
||||||
|
- [x] `item_creator_community_all.xml`의 닉네임 글자 크기를 `item_creator_community.xml`과 동일하게 조정
|
||||||
|
- [x] `item_creator_community_all.xml`의 date 글자 크기를 `item_creator_community.xml`과 동일하게 조정
|
||||||
|
- [x] `item_creator_community_all.xml`의 content 글자 크기를 `item_creator_community.xml`과 동일하게 조정
|
||||||
|
- [x] content 길이가 길 때 말줄임표가 보이도록 속성 보강
|
||||||
|
- [x] `item_creator_community_all.xml`의 닉네임/date/content fontFamily를 `item_creator_community.xml`과 동일하게 조정
|
||||||
|
- [x] 콘텐츠가 여러 줄일 때도 글자 수 제한 초과 시 말줄임표가 보이도록 어댑터 로직 보강
|
||||||
|
- [x] 여러 줄 접힘 상태에서 불필요한 스크롤 없이 말줄임표(`...`)가 보이도록 텍스트 처리 로직 보강
|
||||||
|
|
||||||
|
## 검증 기록
|
||||||
|
- 무엇/왜/어떻게: `item_creator_community_all.xml`에서 `tv_nickname`, `tv_date`, `tv_content`의 `textSize`를 기준 레이아웃과 동일 값으로 조정하고, `tv_content` 폭을 `match_parent`로 변경해 긴 텍스트에서 말줄임표가 동작하도록 보강했다.
|
||||||
|
- 실행 명령: `./gradlew :app:testDebugUnitTest`
|
||||||
|
- 결과: BUILD SUCCESSFUL
|
||||||
|
- 실행 명령: `./gradlew :app:assembleDebug`
|
||||||
|
- 결과: BUILD SUCCESSFUL
|
||||||
|
- 진단: XML 파일은 현재 환경에서 LSP 진단 서버 미구성으로 `lsp_diagnostics` 수행 불가(확인 메시지 수신).
|
||||||
|
- 무엇/왜/어떻게: `CreatorCommunityAllAdapter`에서 접힘 상태(`isExpand=false`)일 때 콘텐츠를 120자로 잘라 `...`를 붙인 `visibleText`로 표시하도록 수정해, 여러 줄에서도 글자 수 기준 말줄임표가 보이게 했다.
|
||||||
|
- 실행 명령: `./gradlew --stop && ./gradlew :app:testDebugUnitTest && ./gradlew :app:assembleDebug`
|
||||||
|
- 결과: BUILD SUCCESSFUL (`:app:testDebugUnitTest`, `:app:assembleDebug` 순차 통과)
|
||||||
|
- 진단: Kotlin/XML 확장자에 대한 LSP 서버 미구성으로 `lsp_diagnostics`는 수행 불가.
|
||||||
|
- 무엇/왜/어떻게: 접힘 상태에서 `LinkMovementMethod`를 해제하고(`movementMethod=null`, `linksClickable=false`) `maxLines=3`, `ellipsize=END`, 120자 절단 텍스트를 적용했다. 펼침 상태에서만 URL span/링크 이동을 활성화해, 긴 여러 줄 콘텐츠에서 스크롤 대신 말줄임표가 우선 동작하도록 분리했다.
|
||||||
|
- 실행 명령: `./gradlew --stop && ./gradlew :app:testDebugUnitTest && ./gradlew :app:assembleDebug`
|
||||||
|
- 결과: BUILD SUCCESSFUL (`:app:testDebugUnitTest`, `:app:assembleDebug` 순차 통과)
|
||||||
|
- 진단: `.kt` 확장자 LSP 서버 미구성으로 `lsp_diagnostics` 수행 불가(환경 메시지 확인).
|
||||||
|
- 무엇/왜/어떻게: 후속 요청에 따라 `tv_nickname`, `tv_date`, `tv_content`의 `fontFamily`를 각각 `@font/bold`, `@font/regular`, `@font/regular`로 변경해 기준 레이아웃과 동일하게 맞췄다.
|
||||||
|
- 실행 명령: `./gradlew :app:testDebugUnitTest`
|
||||||
|
- 결과: BUILD SUCCESSFUL
|
||||||
|
- 실행 명령: `./gradlew :app:assembleDebug`
|
||||||
|
- 결과: BUILD SUCCESSFUL
|
||||||
|
- 진단: XML 파일은 현재 환경에서 LSP 진단 서버 미구성으로 `lsp_diagnostics` 수행 불가(확인 메시지 수신).
|
||||||
Reference in New Issue
Block a user