Use core-ktx for bolding chapter transition text
This commit is contained in:
parent
3aafc671f8
commit
4ef25c75b7
@ -1,9 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.viewer.pager
|
package eu.kanade.tachiyomi.ui.reader.viewer.pager
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.Typeface
|
|
||||||
import android.text.Spanned
|
|
||||||
import android.text.style.StyleSpan
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -13,6 +10,7 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.widget.AppCompatTextView
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
|
import androidx.core.text.bold
|
||||||
import androidx.core.text.buildSpannedString
|
import androidx.core.text.buildSpannedString
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
||||||
@ -91,12 +89,9 @@ class PagerTransitionHolder(
|
|||||||
|
|
||||||
textView.text = if (nextChapter != null) {
|
textView.text = if (nextChapter != null) {
|
||||||
buildSpannedString {
|
buildSpannedString {
|
||||||
append(context.getString(R.string.transition_finished))
|
bold { append(context.getString(R.string.transition_finished)) }
|
||||||
setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${transition.from.chapter.name}\n\n")
|
append("\n${transition.from.chapter.name}\n\n")
|
||||||
val currSize = length
|
bold { append(context.getString(R.string.transition_next)) }
|
||||||
append(context.getString(R.string.transition_next))
|
|
||||||
setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${nextChapter.chapter.name}\n\n")
|
append("\n${nextChapter.chapter.name}\n\n")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -116,12 +111,9 @@ class PagerTransitionHolder(
|
|||||||
|
|
||||||
textView.text = if (prevChapter != null) {
|
textView.text = if (prevChapter != null) {
|
||||||
buildSpannedString {
|
buildSpannedString {
|
||||||
append(context.getString(R.string.transition_current))
|
bold { append(context.getString(R.string.transition_current)) }
|
||||||
setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${transition.from.chapter.name}\n\n")
|
append("\n${transition.from.chapter.name}\n\n")
|
||||||
val currSize = length
|
bold { append(context.getString(R.string.transition_previous)) }
|
||||||
append(context.getString(R.string.transition_previous))
|
|
||||||
setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${prevChapter.chapter.name}\n\n")
|
append("\n${prevChapter.chapter.name}\n\n")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
|
package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
|
||||||
|
|
||||||
import android.graphics.Typeface
|
|
||||||
import android.text.Spanned
|
|
||||||
import android.text.style.StyleSpan
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
@ -11,6 +8,7 @@ import android.widget.ProgressBar
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.widget.AppCompatButton
|
import androidx.appcompat.widget.AppCompatButton
|
||||||
import androidx.appcompat.widget.AppCompatTextView
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
|
import androidx.core.text.bold
|
||||||
import androidx.core.text.buildSpannedString
|
import androidx.core.text.buildSpannedString
|
||||||
import androidx.core.view.isNotEmpty
|
import androidx.core.view.isNotEmpty
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@ -94,12 +92,9 @@ class WebtoonTransitionHolder(
|
|||||||
|
|
||||||
textView.text = if (nextChapter != null) {
|
textView.text = if (nextChapter != null) {
|
||||||
buildSpannedString {
|
buildSpannedString {
|
||||||
append(context.getString(R.string.transition_finished))
|
bold { append(context.getString(R.string.transition_finished)) }
|
||||||
setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${transition.from.chapter.name}\n\n")
|
append("\n${transition.from.chapter.name}\n\n")
|
||||||
val currSize = length
|
bold { append(context.getString(R.string.transition_next)) }
|
||||||
append(context.getString(R.string.transition_next))
|
|
||||||
setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${nextChapter.chapter.name}\n\n")
|
append("\n${nextChapter.chapter.name}\n\n")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -119,12 +114,9 @@ class WebtoonTransitionHolder(
|
|||||||
|
|
||||||
textView.text = if (prevChapter != null) {
|
textView.text = if (prevChapter != null) {
|
||||||
buildSpannedString {
|
buildSpannedString {
|
||||||
append(context.getString(R.string.transition_current))
|
bold { append(context.getString(R.string.transition_current)) }
|
||||||
setSpan(StyleSpan(Typeface.BOLD), 0, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${transition.from.chapter.name}\n\n")
|
append("\n${transition.from.chapter.name}\n\n")
|
||||||
val currSize = length
|
bold { append(context.getString(R.string.transition_previous)) }
|
||||||
append(context.getString(R.string.transition_previous))
|
|
||||||
setSpan(StyleSpan(Typeface.BOLD), currSize, length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
|
|
||||||
append("\n${prevChapter.chapter.name}\n\n")
|
append("\n${prevChapter.chapter.name}\n\n")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user