This commit is contained in:
HapeLee
2025-06-03 04:05:25 +08:00
parent 63a3dfafbc
commit d529b41548
6 changed files with 61 additions and 73 deletions
@@ -168,7 +168,7 @@ class BookInfoActivity :
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
binding.tvIntro.revealOnFocusHint = false
binding.tvDetail?.let { it.revealOnFocusHint = false }
}
viewModel.bookData.observe(this) { showBook(it) }
@@ -297,16 +297,16 @@ class BookInfoActivity :
}
}
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
if (ev.action == MotionEvent.ACTION_DOWN) {
currentFocus?.let {
if (it === binding.tvIntro && binding.tvIntro.hasSelection()) {
it.clearFocus()
}
}
}
return super.dispatchTouchEvent(ev)
}
// override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
// if (ev.action == MotionEvent.ACTION_DOWN) {
// currentFocus?.let {
// if (it === binding.tvIntro && binding.tvIntro.hasSelection()) {
// it.clearFocus()
// }
// }
// }
// return super.dispatchTouchEvent(ev)
// }
private fun refreshBook() {
upLoading(true)
@@ -343,7 +343,7 @@ class BookInfoActivity :
tvAuthor.text = getString(R.string.author_show, book.getRealAuthor())
tvOrigin.text = getString(R.string.origin_show, book.originName)
tvLasted.text = getString(R.string.lasted_show, book.latestChapterTitle)
tvIntro.text = book.getDisplayIntro()
tvDetail?.let { it.text = book.getDisplayIntro() }
llToc?.visible(!book.isWebFile)
upTvBookshelf()
upKinds(book)
@@ -366,7 +366,9 @@ class BookInfoActivity :
lbKind.gone()
} else {
lbKind.visible()
lbKind.setLabels(kinds)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
lbKind.setLabels(kinds)
}
}
}
}
@@ -12,6 +12,7 @@ import android.view.animation.Interpolator
import android.widget.OverScroller
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.ViewCompat
import com.google.android.material.textview.MaterialTextView
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
@@ -21,7 +22,7 @@ import kotlin.math.min
* 嵌套惯性滚动 TextView
*/
class ScrollTextView(context: Context, attrs: AttributeSet?) :
AppCompatTextView(context, attrs) {
MaterialTextView(context, attrs) {
//是否到顶或者到底的标志
private var disallowIntercept = true