背景配置自由添加

pull/371/head
gedoor 4 years ago
parent 32218d7e27
commit dd83e98d08
  1. 10
      app/src/main/assets/readConfig.json
  2. 107
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  3. 4
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  4. 13
      app/src/main/java/io/legado/app/help/storage/Restore.kt
  5. 4
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  6. 112
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  7. 6
      app/src/main/res/layout/dialog_read_bg_text.xml
  8. 84
      app/src/main/res/layout/dialog_read_book_style.xml
  9. 6
      app/src/main/res/layout/item_bg_image.xml
  10. 12
      app/src/main/res/layout/item_read_style.xml

@ -1,14 +1,4 @@
[ [
{
"bgStr": "#FFFFFF",
"bgStrNight": "#000000",
"textColor": "#000000",
"textColorNight": "#FFFFFF",
"bgType": 0,
"bgTypeNight": 0,
"darkStatusIcon": true,
"darkStatusIconNight": false
},
{ {
"bgStr": "#FFFFFF", "bgStr": "#FFFFFF",
"bgStrNight": "#000000", "bgStrNight": "#000000",

@ -21,18 +21,21 @@ import java.io.File
@Keep @Keep
object ReadBookConfig { object ReadBookConfig {
const val configFileName = "readConfig.json" const val configFileName = "readConfig.json"
const val shareConfigFileName = "shareReadConfig.json"
val configFilePath = FileUtils.getPath(App.INSTANCE.filesDir, configFileName) val configFilePath = FileUtils.getPath(App.INSTANCE.filesDir, configFileName)
val shareConfigFilePath = FileUtils.getPath(App.INSTANCE.filesDir, shareConfigFileName)
val configList: ArrayList<Config> = arrayListOf() val configList: ArrayList<Config> = arrayListOf()
lateinit var shareConfig: Config
private val defaultConfigs by lazy { private val defaultConfigs by lazy {
val json = String(App.INSTANCE.assets.open(configFileName).readBytes()) val json = String(App.INSTANCE.assets.open(configFileName).readBytes())
GSON.fromJsonArray<Config>(json)!! GSON.fromJsonArray<Config>(json)!!
} }
var durConfig var durConfig
get() = getConfig(styleSelect + 1) get() = getConfig(styleSelect)
set(value) { set(value) {
configList[styleSelect + 1] = value configList[styleSelect] = value
if (shareLayout) { if (shareLayout) {
configList[5] = value shareConfig = value
} }
upBg() upBg()
} }
@ -42,7 +45,8 @@ object ReadBookConfig {
val textColor: Int get() = durConfig.textColor() val textColor: Int get() = durConfig.textColor()
init { init {
upConfig() initConfigs()
initShareConfig()
} }
@Synchronized @Synchronized
@ -50,30 +54,38 @@ object ReadBookConfig {
if (configList.size < 5) { if (configList.size < 5) {
resetAll() resetAll()
} }
if (configList.size < 6) { return configList.getOrNull(index) ?: configList[0]
configList.add(0, Config())
}
return configList[index]
} }
fun upConfig() { fun initConfigs() {
(getConfigs() ?: defaultConfigs).let { val configFile = File(configFilePath)
var configs: List<Config>? = null
if (configFile.exists()) {
try {
val json = configFile.readText()
configs = GSON.fromJsonArray(json)
} catch (e: Exception) {
e.printStackTrace()
}
}
(configs ?: defaultConfigs).let {
configList.clear() configList.clear()
configList.addAll(it) configList.addAll(it)
} }
} }
private fun getConfigs(): List<Config>? { fun initShareConfig() {
val configFile = File(configFilePath) val configFile = File(configFilePath)
var c: Config? = null
if (configFile.exists()) { if (configFile.exists()) {
try { try {
val json = configFile.readText() val json = configFile.readText()
return GSON.fromJsonArray(json) c = GSON.fromJsonObject(json)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
} }
return null shareConfig = c ?: configList.getOrNull(5) ?: Config()
} }
fun upBg() { fun upBg() {
@ -160,7 +172,7 @@ object ReadBookConfig {
var hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) var hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar)
var hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) var hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar)
val config get() = if (shareLayout) getConfig(0) else durConfig val config get() = if (shareLayout) shareConfig else durConfig
var textFont: String var textFont: String
get() = config.textFont get() = config.textFont
@ -308,39 +320,38 @@ object ReadBookConfig {
fun getExportConfig(): Config { fun getExportConfig(): Config {
val exportConfig = GSON.fromJsonObject<Config>(GSON.toJson(durConfig))!! val exportConfig = GSON.fromJsonObject<Config>(GSON.toJson(durConfig))!!
if (shareLayout) { if (shareLayout) {
val shearConfig = getConfig(0) exportConfig.textFont = shareConfig.textFont
exportConfig.textFont = shearConfig.textFont exportConfig.textBold = shareConfig.textBold
exportConfig.textBold = shearConfig.textBold exportConfig.textSize = shareConfig.textSize
exportConfig.textSize = shearConfig.textSize exportConfig.letterSpacing = shareConfig.letterSpacing
exportConfig.letterSpacing = shearConfig.letterSpacing exportConfig.lineSpacingExtra = shareConfig.lineSpacingExtra
exportConfig.lineSpacingExtra = shearConfig.lineSpacingExtra exportConfig.paragraphSpacing = shareConfig.paragraphSpacing
exportConfig.paragraphSpacing = shearConfig.paragraphSpacing exportConfig.titleMode = shareConfig.titleMode
exportConfig.titleMode = shearConfig.titleMode exportConfig.titleSize = shareConfig.titleSize
exportConfig.titleSize = shearConfig.titleSize exportConfig.titleTopSpacing = shareConfig.titleTopSpacing
exportConfig.titleTopSpacing = shearConfig.titleTopSpacing exportConfig.titleBottomSpacing = shareConfig.titleBottomSpacing
exportConfig.titleBottomSpacing = shearConfig.titleBottomSpacing exportConfig.paddingBottom = shareConfig.paddingBottom
exportConfig.paddingBottom = shearConfig.paddingBottom exportConfig.paddingLeft = shareConfig.paddingLeft
exportConfig.paddingLeft = shearConfig.paddingLeft exportConfig.paddingRight = shareConfig.paddingRight
exportConfig.paddingRight = shearConfig.paddingRight exportConfig.paddingTop = shareConfig.paddingTop
exportConfig.paddingTop = shearConfig.paddingTop exportConfig.headerPaddingBottom = shareConfig.headerPaddingBottom
exportConfig.headerPaddingBottom = shearConfig.headerPaddingBottom exportConfig.headerPaddingLeft = shareConfig.headerPaddingLeft
exportConfig.headerPaddingLeft = shearConfig.headerPaddingLeft exportConfig.headerPaddingRight = shareConfig.headerPaddingRight
exportConfig.headerPaddingRight = shearConfig.headerPaddingRight exportConfig.headerPaddingTop = shareConfig.headerPaddingTop
exportConfig.headerPaddingTop = shearConfig.headerPaddingTop exportConfig.footerPaddingBottom = shareConfig.footerPaddingBottom
exportConfig.footerPaddingBottom = shearConfig.footerPaddingBottom exportConfig.footerPaddingLeft = shareConfig.footerPaddingLeft
exportConfig.footerPaddingLeft = shearConfig.footerPaddingLeft exportConfig.footerPaddingRight = shareConfig.footerPaddingRight
exportConfig.footerPaddingRight = shearConfig.footerPaddingRight exportConfig.footerPaddingTop = shareConfig.footerPaddingTop
exportConfig.footerPaddingTop = shearConfig.footerPaddingTop exportConfig.showHeaderLine = shareConfig.showHeaderLine
exportConfig.showHeaderLine = shearConfig.showHeaderLine exportConfig.showFooterLine = shareConfig.showFooterLine
exportConfig.showFooterLine = shearConfig.showFooterLine exportConfig.tipHeaderLeft = shareConfig.tipHeaderLeft
exportConfig.tipHeaderLeft = shearConfig.tipHeaderLeft exportConfig.tipHeaderMiddle = shareConfig.tipHeaderMiddle
exportConfig.tipHeaderMiddle = shearConfig.tipHeaderMiddle exportConfig.tipHeaderRight = shareConfig.tipHeaderRight
exportConfig.tipHeaderRight = shearConfig.tipHeaderRight exportConfig.tipFooterLeft = shareConfig.tipFooterLeft
exportConfig.tipFooterLeft = shearConfig.tipFooterLeft exportConfig.tipFooterMiddle = shareConfig.tipFooterMiddle
exportConfig.tipFooterMiddle = shearConfig.tipFooterMiddle exportConfig.tipFooterRight = shareConfig.tipFooterRight
exportConfig.tipFooterRight = shearConfig.tipFooterRight exportConfig.hideHeader = shareConfig.hideHeader
exportConfig.hideHeader = shearConfig.hideHeader exportConfig.hideFooter = shareConfig.hideFooter
exportConfig.hideFooter = shearConfig.hideFooter
} }
return exportConfig return exportConfig
} }
@ -365,7 +376,7 @@ object ReadBookConfig {
var textSize: Int = 20,//文字大小 var textSize: Int = 20,//文字大小
var letterSpacing: Float = 0.1f,//字间距 var letterSpacing: Float = 0.1f,//字间距
var lineSpacingExtra: Int = 12,//行间距 var lineSpacingExtra: Int = 12,//行间距
var paragraphSpacing: Int = 4,//段距 var paragraphSpacing: Int = 2,//段距
var titleMode: Int = 0,//标题居中 var titleMode: Int = 0,//标题居中
var titleSize: Int = 0, var titleSize: Int = 0,
var titleTopSpacing: Int = 0, var titleTopSpacing: Int = 0,

@ -35,6 +35,7 @@ object Backup {
"readRecord.json", "readRecord.json",
"httpTTS.json", "httpTTS.json",
ReadBookConfig.configFileName, ReadBookConfig.configFileName,
ReadBookConfig.shareConfigFileName,
ThemeConfig.configFileName, ThemeConfig.configFileName,
"config.xml" "config.xml"
) )
@ -67,6 +68,9 @@ object Backup {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName) FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName)
.writeText(it) .writeText(it)
} }
GSON.toJson(ReadBookConfig.shareConfig).let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.shareConfigFileName)
}
GSON.toJson(ThemeConfig.configList).let { GSON.toJson(ThemeConfig.configList).let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ThemeConfig.configFileName) FileUtils.createFileIfNotExist(backupPath + File.separator + ThemeConfig.configFileName)
.writeText(it) .writeText(it)

@ -177,7 +177,18 @@ object Restore {
if (file.exists()) { if (file.exists()) {
FileUtils.deleteFile(ReadBookConfig.configFilePath) FileUtils.deleteFile(ReadBookConfig.configFilePath)
file.copyTo(File(ReadBookConfig.configFilePath)) file.copyTo(File(ReadBookConfig.configFilePath))
ReadBookConfig.upConfig() ReadBookConfig.initConfigs()
}
} catch (e: Exception) {
e.printStackTrace()
}
try {
val file =
FileUtils.createFileIfNotExist(path + File.separator + ReadBookConfig.shareConfigFileName)
if (file.exists()) {
FileUtils.deleteFile(ReadBookConfig.shareConfigFilePath)
file.copyTo(File(ReadBookConfig.shareConfigFilePath))
ReadBookConfig.initShareConfig()
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()

@ -11,8 +11,6 @@ import android.os.Bundle
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.* import android.view.*
import androidx.documentfile.provider.DocumentFile import androidx.documentfile.provider.DocumentFile
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.jaredrummler.android.colorpicker.ColorPickerDialog import com.jaredrummler.android.colorpicker.ColorPickerDialog
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
@ -111,8 +109,6 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
private fun initData() = with(ReadBookConfig.durConfig) { private fun initData() = with(ReadBookConfig.durConfig) {
sw_dark_status_icon.isChecked = statusIconDark() sw_dark_status_icon.isChecked = statusIconDark()
adapter = BgAdapter(requireContext()) adapter = BgAdapter(requireContext())
recycler_view.layoutManager =
LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
recycler_view.adapter = adapter recycler_view.adapter = adapter
val headerView = LayoutInflater.from(requireContext()) val headerView = LayoutInflater.from(requireContext())
.inflate(R.layout.item_bg_image, recycler_view, false) .inflate(R.layout.item_bg_image, recycler_view, false)

@ -8,6 +8,8 @@ import android.view.*
import androidx.core.view.get import androidx.core.view.get
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseDialogFragment import io.legado.app.base.BaseDialogFragment
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
@ -21,6 +23,7 @@ import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_read.* import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.dialog_read_book_style.* import kotlinx.android.synthetic.main.dialog_read_book_style.*
import kotlinx.android.synthetic.main.dialog_title_config.view.* import kotlinx.android.synthetic.main.dialog_title_config.view.*
import kotlinx.android.synthetic.main.item_read_style.view.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick import org.jetbrains.anko.sdk27.listeners.onLongClick
@ -28,6 +31,7 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick
class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
val callBack get() = activity as? ReadBookActivity val callBack get() = activity as? ReadBookActivity
lateinit var styleAdapter: StyleAdapter
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
@ -82,6 +86,8 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
dsb_line_size.valueFormat = { ((it - 10) / 10f).toString() } dsb_line_size.valueFormat = { ((it - 10) / 10f).toString() }
dsb_paragraph_spacing.valueFormat = { (it / 10f).toString() } dsb_paragraph_spacing.valueFormat = { (it / 10f).toString() }
styleAdapter = StyleAdapter()
rv_style.adapter = styleAdapter
} }
private fun initData() { private fun initData() {
@ -92,8 +98,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
} }
upStyle() upStyle()
setBg() styleAdapter.setItems(ReadBookConfig.configList)
upBg()
} }
private fun initViewEvent() { private fun initViewEvent() {
@ -152,16 +157,6 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
ReadBookConfig.paragraphSpacing = it ReadBookConfig.paragraphSpacing = it
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
bg0.onClick { changeBg(0) }
bg0.onLongClick { showBgTextConfig(0) }
bg1.onClick { changeBg(1) }
bg1.onLongClick { showBgTextConfig(1) }
bg2.onClick { changeBg(2) }
bg2.onLongClick { showBgTextConfig(2) }
bg3.onClick { changeBg(3) }
bg3.onLongClick { showBgTextConfig(3) }
bg4.onClick { changeBg(4) }
bg4.onLongClick { showBgTextConfig(4) }
} }
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
@ -195,11 +190,13 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
private fun changeBg(index: Int) { private fun changeBg(index: Int) {
if (ReadBookConfig.styleSelect != index) { val oldIndex = ReadBookConfig.styleSelect
if (index != oldIndex) {
ReadBookConfig.styleSelect = index ReadBookConfig.styleSelect = index
ReadBookConfig.upBg() ReadBookConfig.upBg()
upStyle() upStyle()
upBg() styleAdapter.notifyItemChanged(oldIndex)
styleAdapter.notifyItemChanged(index)
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
@ -220,59 +217,6 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
} }
} }
private fun setBg() = ReadBookConfig.apply {
bg0.setTextColor(getConfig(0).textColor())
bg1.setTextColor(getConfig(1).textColor())
bg2.setTextColor(getConfig(2).textColor())
bg3.setTextColor(getConfig(3).textColor())
bg4.setTextColor(getConfig(4).textColor())
for (i in 0..4) {
val iv = when (i) {
1 -> bg1
2 -> bg2
3 -> bg3
4 -> bg4
else -> bg0
}
iv.setImageDrawable(getConfig(i).bgDrawable(100, 150))
}
}
private fun upBg() = ReadBookConfig.apply {
bg0.borderColor = getConfig(0).textColor()
bg0.setTextBold(false)
bg1.borderColor = getConfig(1).textColor()
bg1.setTextBold(false)
bg2.borderColor = getConfig(2).textColor()
bg2.setTextBold(false)
bg3.borderColor = getConfig(3).textColor()
bg3.setTextBold(false)
bg4.borderColor = getConfig(4).textColor()
bg4.setTextBold(false)
when (styleSelect) {
1 -> {
bg1.borderColor = accentColor
bg1.setTextBold(true)
}
2 -> {
bg2.borderColor = accentColor
bg2.setTextBold(true)
}
3 -> {
bg3.borderColor = accentColor
bg3.setTextBold(true)
}
4 -> {
bg4.borderColor = accentColor
bg4.setTextBold(true)
}
else -> {
bg0.borderColor = accentColor
bg0.setTextBold(true)
}
}
}
override val curFontPath: String override val curFontPath: String
get() = ReadBookConfig.textFont get() = ReadBookConfig.textFont
@ -282,4 +226,38 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
inner class StyleAdapter :
SimpleRecyclerAdapter<ReadBookConfig.Config>(requireContext(), R.layout.item_read_style) {
override fun convert(
holder: ItemViewHolder,
item: ReadBookConfig.Config,
payloads: MutableList<Any>
) {
holder.itemView.apply {
iv_style.setTextColor(item.textColor())
iv_style.setImageDrawable(item.bgDrawable(100, 150))
if (ReadBookConfig.styleSelect == holder.layoutPosition) {
iv_style.borderColor = accentColor
iv_style.setTextBold(true)
} else {
iv_style.borderColor = item.textColor()
iv_style.setTextBold(false)
}
}
}
override fun registerListener(holder: ItemViewHolder) {
holder.itemView.apply {
iv_style.onClick {
changeBg(holder.layoutPosition)
}
iv_style.onLongClick {
showBgTextConfig(holder.layoutPosition)
}
}
}
}
} }

@ -112,7 +112,9 @@
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="100dp"
android:padding="6dp" /> android:orientation="horizontal"
android:padding="6dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_bg_image" />
</LinearLayout> </LinearLayout>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools"
android:id="@+id/root_view" android:id="@+id/root_view"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -323,87 +324,12 @@
</LinearLayout> </LinearLayout>
<LinearLayout <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_style"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center_vertical"> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tool:listitem="@layout/item_read_style" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/bg0"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/bg1"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/bg2"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/bg3"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<io.legado.app.ui.widget.image.CircleImageView
android:id="@+id/bg4"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout> </LinearLayout>

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="66dp" android:layout_width="66dp"
android:layout_height="match_parent" android:layout_height="88dp"
xmlns:tool="http://schemas.android.com/tools"
android:padding="2dp" android:padding="2dp"
android:orientation="vertical"> android:orientation="vertical">
@ -11,7 +12,8 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:contentDescription="@string/bg_image" /> android:contentDescription="@string/bg_image"
tool:src="@drawable/ic_image" />
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<io.legado.app.ui.widget.image.CircleImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/iv_style"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:src="@drawable/image_cover_default"
app:civ_border_color="@color/primaryText"
app:civ_border_width="1dp"
app:text="@string/text" />
Loading…
Cancel
Save