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

가사해석 글자수 제한 (RecyclerView) #1

Open
jaemin-Yoo opened this issue May 27, 2022 · 0 comments
Open

가사해석 글자수 제한 (RecyclerView) #1

jaemin-Yoo opened this issue May 27, 2022 · 0 comments
Assignees

Comments

@jaemin-Yoo
Copy link
Member

LyricsListAdapter.kt

inner class LyricsTextWatcher() : TextWatcher {
        private var position = 0

        fun updatePosition(position: Int){
            this.position = position
        }

        override fun afterTextChanged(p0: Editable?) {}
        override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
        override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
            val text = p0.toString()
            interpret[position] = text
            lengthList[position] = text.length
            textLength = lengthList.sum() // EditText 총 글자 수
            changeTextLengthListener.changeLength(textLength)
        }
    }

글자수 제한을 여기서 어떻게 걸어야하는지 고민 필요
RecyclerView 라서 뷰 재사용하는방식 때문에,
글자수 카운팅 하는 부분이 복잡함

현재: 완료 버튼 누를 시 <글자수가 초과되었습니다> 토스트 메시지 띄움
목표: 글자 입력 시 자동으로 1100자가 초과되면 입력이 안되게끔 하기

@jaemin-Yoo jaemin-Yoo self-assigned this May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant