更新
This commit is contained in:
@@ -50,11 +50,6 @@ object AppConst {
|
||||
"androidx.appcompat.view.menu.ListMenuItemView"
|
||||
)
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
val sysElevation = appCtx.resources
|
||||
.getDimension(com.google.android.material.R.dimen.design_appbar_elevation)
|
||||
.toInt()
|
||||
|
||||
val androidId: String by lazy {
|
||||
Settings.System.getString(appCtx.contentResolver, Settings.Secure.ANDROID_ID) ?: "null"
|
||||
}
|
||||
|
||||
@@ -179,5 +179,4 @@ object PreferKey {
|
||||
const val showReadTitleAddition = "showReadTitleAddition"
|
||||
const val readBarStyleFollowPage = "readBarStyleFollowPage"
|
||||
const val contentSelectSpeakMod = "contentReadAloudMod"
|
||||
|
||||
}
|
||||
|
||||
@@ -34,11 +34,13 @@ import io.legato.kazusa.ui.book.read.config.ClickActionConfigDialog
|
||||
import io.legato.kazusa.ui.book.read.config.PaddingConfigDialog
|
||||
import io.legato.kazusa.ui.book.read.config.PageKeyDialog
|
||||
import io.legato.kazusa.ui.file.HandleFileContract
|
||||
import io.legato.kazusa.utils.ColorUtils
|
||||
import io.legato.kazusa.utils.FileDoc
|
||||
import io.legato.kazusa.utils.find
|
||||
import io.legato.kazusa.utils.getPrefString
|
||||
import io.legato.kazusa.utils.gone
|
||||
import io.legato.kazusa.utils.isTv
|
||||
import io.legato.kazusa.utils.setLightStatusBar
|
||||
import io.legato.kazusa.utils.setNavigationBarColorAuto
|
||||
import io.legato.kazusa.utils.setOnApplyWindowInsetsListenerCompat
|
||||
import io.legato.kazusa.utils.showDialogFragment
|
||||
@@ -158,7 +160,6 @@ abstract class BaseReadBookActivity :
|
||||
fun upSystemUiVisibility(
|
||||
isInMultiWindow: Boolean,
|
||||
toolBarHide: Boolean = true,
|
||||
useBgMeanColor: Boolean = false
|
||||
) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.run {
|
||||
@@ -175,20 +176,19 @@ abstract class BaseReadBookActivity :
|
||||
}
|
||||
}
|
||||
upSystemUiVisibilityO(isInMultiWindow, toolBarHide)
|
||||
// if (toolBarHide) {
|
||||
// setLightStatusBar(ReadBookConfig.durConfig.curStatusIconDark())
|
||||
// } else {
|
||||
// val statusBarColor =
|
||||
// if (AppConfig.readBarStyleFollowPage
|
||||
// && ReadBookConfig.durConfig.curBgType() == 0
|
||||
// || useBgMeanColor
|
||||
// ) {
|
||||
// ReadBookConfig.bgMeanColor
|
||||
// } else {
|
||||
// ThemeStore.statusBarColor(this, AppConfig.isTransparentStatusBar)
|
||||
// }
|
||||
// setLightStatusBar(ColorUtils.isColorLight(statusBarColor))
|
||||
// }
|
||||
if (toolBarHide) {
|
||||
setLightStatusBar(ReadBookConfig.durConfig.curStatusIconDark())
|
||||
} else {
|
||||
val statusBarColor =
|
||||
if (AppConfig.readBarStyleFollowPage
|
||||
&& ReadBookConfig.durConfig.curBgType() == 0
|
||||
) {
|
||||
ReadBookConfig.bgMeanColor
|
||||
} else {
|
||||
ReadBookConfig.bgMeanColor
|
||||
}
|
||||
setLightStatusBar(ColorUtils.isColorLight(statusBarColor))
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
||||
@@ -262,7 +262,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
//binding.cursorRight.setColorFilter(accentColor)
|
||||
binding.cursorLeft.setOnTouchListener(this)
|
||||
binding.cursorRight.setOnTouchListener(this)
|
||||
window.setBackgroundDrawable(null)
|
||||
//window.setBackgroundDrawable(null)
|
||||
upScreenTimeOut()
|
||||
ReadBook.register(this)
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
@@ -1222,7 +1222,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
* 更新状态栏,导航栏
|
||||
*/
|
||||
override fun upSystemUiVisibility() {
|
||||
upSystemUiVisibility(isInMultiWindow, !menuLayoutIsVisible, bottomDialog > 0)
|
||||
upSystemUiVisibility(isInMultiWindow, !menuLayoutIsVisible)
|
||||
upNavigationBarColor()
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import io.legato.kazusa.utils.sendToClip
|
||||
import io.legato.kazusa.utils.share
|
||||
import io.legato.kazusa.utils.toastOnUi
|
||||
import io.legato.kazusa.utils.visible
|
||||
import androidx.core.net.toUri
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
class TextActionMenu(private val context: Context, private val callBack: CallBack) :
|
||||
@@ -217,7 +218,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac
|
||||
kotlin.runCatching {
|
||||
val intent = if (callBack.selectedText.isAbsUrl()) {
|
||||
Intent(Intent.ACTION_VIEW).apply {
|
||||
data = Uri.parse(callBack.selectedText)
|
||||
data = callBack.selectedText.toUri()
|
||||
}
|
||||
} else {
|
||||
Intent(Intent.ACTION_WEB_SEARCH).apply {
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.documentfile.provider.DocumentFile
|
||||
import com.google.android.material.slider.Slider
|
||||
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
||||
import io.legato.kazusa.base.BaseDialogFragment
|
||||
import io.legato.kazusa.constant.AppLog
|
||||
import io.legato.kazusa.constant.EventBus
|
||||
@@ -61,7 +62,7 @@ import splitties.init.appCtx
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
||||
class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
|
||||
class BgTextConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_bg_text) {
|
||||
|
||||
companion object {
|
||||
const val TEXT_COLOR = 121
|
||||
@@ -97,14 +98,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.run {
|
||||
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
//setBackgroundDrawableResource(R.color.background)
|
||||
decorView.setPadding(0, 0, 0, 0)
|
||||
val attr = attributes
|
||||
attr.dimAmount = 0.0f
|
||||
attr.gravity = Gravity.BOTTOM
|
||||
attributes = attr
|
||||
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.legato.kazusa.ui.book.read.config
|
||||
import android.content.Context
|
||||
import android.text.SpannableString
|
||||
import android.util.AttributeSet
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.lib.dialogs.alert
|
||||
@@ -10,10 +11,9 @@ import io.legato.kazusa.lib.dialogs.alert
|
||||
import io.legato.kazusa.ui.widget.text.StrokeTextView
|
||||
|
||||
|
||||
class ChineseConverter(context: Context, attrs: AttributeSet?) : StrokeTextView(context, attrs) {
|
||||
class ChineseConverter(context: Context, attrs: AttributeSet?) : MaterialButton(context, attrs) {
|
||||
|
||||
private val spannableString = SpannableString("简/繁")
|
||||
// private var enabledSpan: ForegroundColorSpan = ForegroundColorSpan(context.accentColor)
|
||||
private var onChanged: (() -> Unit)? = null
|
||||
|
||||
init {
|
||||
@@ -27,12 +27,8 @@ class ChineseConverter(context: Context, attrs: AttributeSet?) : StrokeTextView(
|
||||
}
|
||||
|
||||
private fun upUi(type: Int) {
|
||||
//spannableString.removeSpan(enabledSpan)
|
||||
// when (type) {
|
||||
// 1 -> spannableString.setSpan(enabledSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
// 2 -> spannableString.setSpan(enabledSpan, 2, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
// }
|
||||
text = spannableString
|
||||
val showOptions = context.resources.getStringArray(R.array.chinese_mode)
|
||||
text = showOptions.getOrNull(type) ?: ""
|
||||
}
|
||||
|
||||
private fun selectType() {
|
||||
|
||||
@@ -234,7 +234,7 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
|
||||
binding.apply {
|
||||
ivStyle.setText(item.name.ifBlank { "文字" })
|
||||
ivStyle.setTextColor(item.curTextColor())
|
||||
//ivStyle.setImageDrawable(item.curBgDrawable(100, 150))
|
||||
ivStyle.setImageDrawable(item.curBgDrawable(100, 150))
|
||||
if (ReadBookConfig.styleSelect == holder.layoutPosition) {
|
||||
//ivStyle.borderColor = accentColor
|
||||
ivStyle.setTextBold(true)
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.legato.kazusa.ui.book.read.config
|
||||
import android.content.Context
|
||||
import android.text.SpannableString
|
||||
import android.util.AttributeSet
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.help.config.ReadBookConfig
|
||||
import io.legato.kazusa.lib.dialogs.alert
|
||||
@@ -11,10 +12,9 @@ import io.legato.kazusa.ui.widget.text.StrokeTextView
|
||||
|
||||
|
||||
class TextFontWeightConverter(context: Context, attrs: AttributeSet?) :
|
||||
StrokeTextView(context, attrs) {
|
||||
MaterialButton(context, attrs) {
|
||||
|
||||
private val spannableString = SpannableString(context.getString(R.string.font_weight_text))
|
||||
//private var enabledSpan: ForegroundColorSpan = ForegroundColorSpan(context.accentColor)
|
||||
private var onChanged: (() -> Unit)? = null
|
||||
|
||||
init {
|
||||
@@ -29,13 +29,8 @@ class TextFontWeightConverter(context: Context, attrs: AttributeSet?) :
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
fun upUi(type: Int) {
|
||||
// spannableString.removeSpan(enabledSpan)
|
||||
// when (type) {
|
||||
// 0 -> spannableString.setSpan(enabledSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
// 1 -> spannableString.setSpan(enabledSpan, 2, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
// 2 -> spannableString.setSpan(enabledSpan, 4, 5, Spannable.SPAN_INCLUSIVE_EXCLUSIVE)
|
||||
// }
|
||||
text = spannableString
|
||||
val weightOptions = context.resources.getStringArray(R.array.text_font_weight)
|
||||
text = weightOptions.getOrNull(type) ?: ""
|
||||
}
|
||||
|
||||
private fun selectType() {
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.legato.kazusa.utils.printOnDebug
|
||||
import io.legato.kazusa.utils.spToPx
|
||||
import kotlin.math.min
|
||||
import kotlin.math.pow
|
||||
import androidx.core.graphics.createBitmap
|
||||
|
||||
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
class CircleImageView @JvmOverloads constructor(
|
||||
@@ -293,17 +294,9 @@ class CircleImageView @JvmOverloads constructor(
|
||||
|
||||
return try {
|
||||
val bitmap: Bitmap = if (drawable is ColorDrawable) {
|
||||
Bitmap.createBitmap(
|
||||
COLOR_DRAWABLE_DIMENSION,
|
||||
COLOR_DRAWABLE_DIMENSION,
|
||||
BITMAP_CONFIG
|
||||
)
|
||||
createBitmap(COLOR_DRAWABLE_DIMENSION, COLOR_DRAWABLE_DIMENSION, BITMAP_CONFIG)
|
||||
} else {
|
||||
Bitmap.createBitmap(
|
||||
drawable.intrinsicWidth,
|
||||
drawable.intrinsicHeight,
|
||||
BITMAP_CONFIG
|
||||
)
|
||||
createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, BITMAP_CONFIG)
|
||||
}
|
||||
|
||||
val canvas = Canvas(bitmap)
|
||||
|
||||
Reference in New Issue
Block a user