mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:01:52 +01:00
Using withsubtitle helper method in more places
2 commits back also added a helper method for combining text with a subtitle
This commit is contained in:
parent
71548573ec
commit
27d49401ae
@ -13,6 +13,7 @@ import androidx.core.view.isVisible
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.LibraryDisplayLayoutBinding
|
||||
import eu.kanade.tachiyomi.util.bindToPreference
|
||||
import eu.kanade.tachiyomi.util.lang.withSubtitle
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.rowsForValue
|
||||
@ -96,14 +97,7 @@ class LibraryDisplayView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
val rows = this@LibraryDisplayView.rowsForValue(progress)
|
||||
val titleText = context.getString(R.string.grid_size)
|
||||
val subtitleText = context.getString(R.string._per_row, rows)
|
||||
val spannable = SpannableStringBuilder(titleText + "\n" + subtitleText)
|
||||
spannable.setSpan(
|
||||
ForegroundColorSpan(context.getResourceColor(android.R.attr.textColorSecondary)),
|
||||
titleText.length + 1,
|
||||
spannable.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
text = spannable
|
||||
text = titleText.withSubtitle(context, subtitleText)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.RecentsOptionsSheetBinding
|
||||
import eu.kanade.tachiyomi.util.bindToPreference
|
||||
import eu.kanade.tachiyomi.util.lang.withSubtitle
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
|
||||
import eu.kanade.tachiyomi.util.view.setEdgeToEdge
|
||||
@ -36,14 +37,7 @@ class RecentsOptionsSheet(activity: Activity) :
|
||||
|
||||
val titleText = context.getString(R.string.show_reset_history_button)
|
||||
val subtitleText = context.getString(R.string.press_and_hold_to_also_reset)
|
||||
val spannable = SpannableStringBuilder(titleText + "\n" + subtitleText)
|
||||
spannable.setSpan(
|
||||
ForegroundColorSpan(binding.showRemoveHistory.context.getResourceColor(android.R.attr.textColorSecondary)),
|
||||
titleText.length + 1,
|
||||
spannable.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
binding.showRemoveHistory.text = spannable
|
||||
binding.showRemoveHistory.text = titleText.withSubtitle(context, subtitleText)
|
||||
}
|
||||
|
||||
private fun initGeneralPreferences() {
|
||||
|
Loading…
Reference in New Issue
Block a user