|
|
@ -42,7 +42,7 @@ object ReadBookConfig { |
|
|
|
|
|
|
|
|
|
|
|
var bg: Drawable? = null |
|
|
|
var bg: Drawable? = null |
|
|
|
var bgMeanColor: Int = 0 |
|
|
|
var bgMeanColor: Int = 0 |
|
|
|
val textColor: Int get() = durConfig.textColor() |
|
|
|
val textColor: Int get() = durConfig.curTextColor() |
|
|
|
|
|
|
|
|
|
|
|
init { |
|
|
|
init { |
|
|
|
initConfigs() |
|
|
|
initConfigs() |
|
|
@ -168,9 +168,9 @@ object ReadBookConfig { |
|
|
|
val config get() = if (shareLayout) shareConfig else durConfig |
|
|
|
val config get() = if (shareLayout) shareConfig else durConfig |
|
|
|
|
|
|
|
|
|
|
|
var pageAnim: Int |
|
|
|
var pageAnim: Int |
|
|
|
get() = config.pageAnim() |
|
|
|
get() = config.curPageAnim() |
|
|
|
set(value) { |
|
|
|
set(value) { |
|
|
|
config.setPageAnim(value) |
|
|
|
config.setCurPageAnim(value) |
|
|
|
isScroll = pageAnim == 3 |
|
|
|
isScroll = pageAnim == 3 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -365,20 +365,20 @@ object ReadBookConfig { |
|
|
|
@Keep |
|
|
|
@Keep |
|
|
|
@Parcelize |
|
|
|
@Parcelize |
|
|
|
class Config( |
|
|
|
class Config( |
|
|
|
private var bgStr: String = "#EEEEEE",//白天背景 |
|
|
|
var bgStr: String = "#EEEEEE",//白天背景 |
|
|
|
private var bgStrNight: String = "#000000",//夜间背景 |
|
|
|
var bgStrNight: String = "#000000",//夜间背景 |
|
|
|
private var bgStrEInk: String = "#FFFFFF", |
|
|
|
var bgStrEInk: String = "#FFFFFF", |
|
|
|
private var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片 |
|
|
|
var bgType: Int = 0,//白天背景类型 0:颜色, 1:assets图片, 2其它图片 |
|
|
|
private var bgTypeNight: Int = 0,//夜间背景类型 |
|
|
|
var bgTypeNight: Int = 0,//夜间背景类型 |
|
|
|
private var bgTypeEInk: Int = 0, |
|
|
|
var bgTypeEInk: Int = 0, |
|
|
|
private var darkStatusIcon: Boolean = true,//白天是否暗色状态栏 |
|
|
|
var darkStatusIcon: Boolean = true,//白天是否暗色状态栏 |
|
|
|
private var darkStatusIconNight: Boolean = false,//晚上是否暗色状态栏 |
|
|
|
var darkStatusIconNight: Boolean = false,//晚上是否暗色状态栏 |
|
|
|
private var darkStatusIconEInk: Boolean = true, |
|
|
|
var darkStatusIconEInk: Boolean = true, |
|
|
|
private var textColor: String = "#3E3D3B",//白天文字颜色 |
|
|
|
var textColor: String = "#3E3D3B",//白天文字颜色 |
|
|
|
private var textColorNight: String = "#ADADAD",//夜间文字颜色 |
|
|
|
var textColorNight: String = "#ADADAD",//夜间文字颜色 |
|
|
|
private var textColorEInk: String = "#000000", |
|
|
|
var textColorEInk: String = "#000000", |
|
|
|
private var pageAnim: Int = 0, |
|
|
|
var pageAnim: Int = 0, |
|
|
|
private var pageAnimEInk: Int = 3, |
|
|
|
var pageAnimEInk: Int = 3, |
|
|
|
var textFont: String = "",//字体 |
|
|
|
var textFont: String = "",//字体 |
|
|
|
var textBold: Int = 0,//是否粗体字 0:正常, 1:粗体, 2:细体 |
|
|
|
var textBold: Int = 0,//是否粗体字 0:正常, 1:粗体, 2:细体 |
|
|
|
var textSize: Int = 20,//文字大小 |
|
|
|
var textSize: Int = 20,//文字大小 |
|
|
@ -413,7 +413,7 @@ object ReadBookConfig { |
|
|
|
var hideHeader: Boolean = true, |
|
|
|
var hideHeader: Boolean = true, |
|
|
|
var hideFooter: Boolean = false |
|
|
|
var hideFooter: Boolean = false |
|
|
|
) : Parcelable { |
|
|
|
) : Parcelable { |
|
|
|
fun setBg(bgType: Int, bg: String) { |
|
|
|
fun setCurBg(bgType: Int, bg: String) { |
|
|
|
when { |
|
|
|
when { |
|
|
|
AppConfig.isEInkMode -> { |
|
|
|
AppConfig.isEInkMode -> { |
|
|
|
bgTypeEInk = bgType |
|
|
|
bgTypeEInk = bgType |
|
|
@ -430,7 +430,7 @@ object ReadBookConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setTextColor(color: Int) { |
|
|
|
fun setCurTextColor(color: Int) { |
|
|
|
when { |
|
|
|
when { |
|
|
|
AppConfig.isEInkMode -> textColorEInk = "#${color.hexString}" |
|
|
|
AppConfig.isEInkMode -> textColorEInk = "#${color.hexString}" |
|
|
|
AppConfig.isNightTheme -> textColorNight = "#${color.hexString}" |
|
|
|
AppConfig.isNightTheme -> textColorNight = "#${color.hexString}" |
|
|
@ -455,21 +455,21 @@ object ReadBookConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setPageAnim(anim: Int) { |
|
|
|
fun setCurPageAnim(anim: Int) { |
|
|
|
when { |
|
|
|
when { |
|
|
|
AppConfig.isEInkMode -> pageAnimEInk = anim |
|
|
|
AppConfig.isEInkMode -> pageAnimEInk = anim |
|
|
|
else -> pageAnim = anim |
|
|
|
else -> pageAnim = anim |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun pageAnim(): Int { |
|
|
|
fun curPageAnim(): Int { |
|
|
|
return when { |
|
|
|
return when { |
|
|
|
AppConfig.isEInkMode -> pageAnimEInk |
|
|
|
AppConfig.isEInkMode -> pageAnimEInk |
|
|
|
else -> pageAnim |
|
|
|
else -> pageAnim |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun textColor(): Int { |
|
|
|
fun curTextColor(): Int { |
|
|
|
return when { |
|
|
|
return when { |
|
|
|
AppConfig.isEInkMode -> Color.parseColor(textColorEInk) |
|
|
|
AppConfig.isEInkMode -> Color.parseColor(textColorEInk) |
|
|
|
AppConfig.isNightTheme -> Color.parseColor(textColorNight) |
|
|
|
AppConfig.isNightTheme -> Color.parseColor(textColorNight) |
|
|
@ -477,7 +477,7 @@ object ReadBookConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun bgStr(): String { |
|
|
|
fun curBgStr(): String { |
|
|
|
return when { |
|
|
|
return when { |
|
|
|
AppConfig.isEInkMode -> bgStrEInk |
|
|
|
AppConfig.isEInkMode -> bgStrEInk |
|
|
|
AppConfig.isNightTheme -> bgStrNight |
|
|
|
AppConfig.isNightTheme -> bgStrNight |
|
|
@ -485,7 +485,7 @@ object ReadBookConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun bgType(): Int { |
|
|
|
fun curBgType(): Int { |
|
|
|
return when { |
|
|
|
return when { |
|
|
|
AppConfig.isEInkMode -> bgTypeEInk |
|
|
|
AppConfig.isEInkMode -> bgTypeEInk |
|
|
|
AppConfig.isNightTheme -> bgTypeNight |
|
|
|
AppConfig.isNightTheme -> bgTypeNight |
|
|
@ -497,14 +497,14 @@ object ReadBookConfig { |
|
|
|
var bgDrawable: Drawable? = null |
|
|
|
var bgDrawable: Drawable? = null |
|
|
|
val resources = App.INSTANCE.resources |
|
|
|
val resources = App.INSTANCE.resources |
|
|
|
try { |
|
|
|
try { |
|
|
|
bgDrawable = when (bgType()) { |
|
|
|
bgDrawable = when (curBgType()) { |
|
|
|
0 -> ColorDrawable(Color.parseColor(bgStr())) |
|
|
|
0 -> ColorDrawable(Color.parseColor(curBgStr())) |
|
|
|
1 -> { |
|
|
|
1 -> { |
|
|
|
BitmapDrawable( |
|
|
|
BitmapDrawable( |
|
|
|
resources, |
|
|
|
resources, |
|
|
|
BitmapUtils.decodeAssetsBitmap( |
|
|
|
BitmapUtils.decodeAssetsBitmap( |
|
|
|
App.INSTANCE, |
|
|
|
App.INSTANCE, |
|
|
|
"bg" + File.separator + bgStr(), |
|
|
|
"bg" + File.separator + curBgStr(), |
|
|
|
width, |
|
|
|
width, |
|
|
|
height |
|
|
|
height |
|
|
|
) |
|
|
|
) |
|
|
@ -512,7 +512,7 @@ object ReadBookConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
else -> BitmapDrawable( |
|
|
|
else -> BitmapDrawable( |
|
|
|
resources, |
|
|
|
resources, |
|
|
|
BitmapUtils.decodeBitmap(bgStr(), width, height) |
|
|
|
BitmapUtils.decodeBitmap(curBgStr(), width, height) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|