Skip to content

Commit

Permalink
[Fix]: 部分设备帖子详情页面手势返回崩溃问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
why committed Apr 10, 2024
1 parent 00be7dc commit c1fadba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class OverviewCharacterBinder(private val clickItemListener: (MediaDetailEntity.
binding.ivAvatar.loadImageAnimate(item.avatar, cropType = ImageView.ScaleType.FIT_START)
binding.tvName.text = item.characterNameCn.ifBlank { item.characterName }
binding.tvJobs.text = item.jobs.joinToString(";")
binding.tvCommentCount.text = String.format("讨论:%d", item.saveCount)
binding.tvCommentCount.text = String.format("+%d", item.saveCount)
binding.tvCommentCount.isVisible = item.saveCount != 0
binding.tvPerson.isVisible = item.persons.isNotEmpty()
binding.tvPerson.text = buildString {
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/layout/fragment_overview_character_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@
android:id="@+id/tv_name"
android:layout_width="@dimen/ui_size_0"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/ui_size_12"
android:ellipsize="end"
android:maxLines="1"
android:lineSpacingMultiplier="1.25"
android:maxLines="2"
android:paddingVertical="@dimen/ui_size_6"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:textColor="?attr/colorOnSurface"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/tv_comment_count"
app:layout_constraintEnd_toEndOf="@id/iv_avatar"
app:layout_constraintStart_toStartOf="@+id/iv_avatar"
app:layout_constraintTop_toBottomOf="@+id/iv_avatar"
tools:text="@tools:sample/full_names" />
tools:text="@tools:sample/lorem/random" />

<com.xiaoyv.common.widget.text.AnimeTextView
android:id="@+id/tv_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingVertical="@dimen/ui_size_6"
android:paddingHorizontal="@dimen/ui_size_6"
android:paddingBottom="@dimen/ui_size_6"
android:textAppearance="?attr/textAppearanceLabelSmall"
android:textColor="?attr/colorPrimary"
app:layout_constraintBottom_toBottomOf="@+id/tv_name"
android:textColor="?attr/colorOnPrimarySurface"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
app:layout_constraintEnd_toEndOf="@id/iv_avatar"
app:layout_constraintStart_toEndOf="@+id/tv_name"
app:layout_constraintTop_toTopOf="@+id/tv_name"
tools:text="+12" />

<com.xiaoyv.common.widget.text.AnimeTextView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ object MiKanHelper {
runCatching {
idMap.putAll(BgmApiManager.bgmWebApi.queryMikanIdMapByJsdelivr())
}.onFailure {
debugLog { "Mikan, js-cdn sync error: " + it.printStackTrace() }
debugLog { "Mikan, js-cdn sync error: $it" }

// cdn 失败用 github
runCatching {
idMap.putAll(BgmApiManager.bgmWebApi.queryMikanIdMapByGithub())
}.onFailure {
debugLog { "Mikan, github sync error: " + it.printStackTrace() }
debugLog { "Mikan, github sync error: $it" }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.xiaoyv.widget.callback.setOnFastLimitClickListener
import com.xiaoyv.widget.kts.dpf
import com.xiaoyv.widget.kts.dpi
import com.xiaoyv.widget.kts.errorMsg
import com.xiaoyv.widget.kts.fetchActivity
import com.xiaoyv.widget.kts.getAttrColor
import com.xiaoyv.widget.kts.showToastCompat
import com.xiaoyv.widget.kts.useNotNull
Expand Down Expand Up @@ -189,6 +190,8 @@ abstract class WebBase(open val webView: UiWebView) {
@Keep
@JavascriptInterface
fun onLongClickText(content: String, x: Int, y: Int) {
if (webView.context.fetchActivity?.isDestroyed == true || webView.context.fetchActivity?.isFinishing == true) return

val textView = AnimeTextView(webView.context).apply {
text = "复制内容"
textSize = 16f
Expand Down

0 comments on commit c1fadba

Please sign in to comment.