pull/32/head
kunfei 5 years ago
parent cd11ae9580
commit 57f488b353
  1. 9
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/readbook/config/BgTextConfigDiolog.kt
  3. 28
      app/src/main/java/io/legado/app/ui/readbook/config/ReadStyleDialog.kt
  4. 76
      app/src/main/res/layout/dialog_read_bg_text.xml

@ -27,10 +27,7 @@ import io.legado.app.receiver.TimeElectricityReceiver
import io.legado.app.service.ReadAloudService
import io.legado.app.ui.changesource.ChangeSourceDialog
import io.legado.app.ui.chapterlist.ChapterListActivity
import io.legado.app.ui.readbook.config.MoreConfigDialog
import io.legado.app.ui.readbook.config.PaddingConfigDialog
import io.legado.app.ui.readbook.config.ReadAloudDialog
import io.legado.app.ui.readbook.config.ReadStyleDialog
import io.legado.app.ui.readbook.config.*
import io.legado.app.ui.replacerule.ReplaceRuleActivity
import io.legado.app.ui.sourceedit.SourceEditActivity
import io.legado.app.ui.widget.page.ChapterProvider
@ -179,6 +176,10 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
PaddingConfigDialog().show(supportFragmentManager, "paddingConfig")
}
fun showBgTextConfig() {
BgTextConfigDiolog().show(supportFragmentManager, "bgTextConfig")
}
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.read_book, menu)
return super.onCompatCreateOptionsMenu(menu)

@ -17,7 +17,7 @@ class BgTextConfigDiolog : DialogFragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return super.onCreateView(inflater, container, savedInstanceState)
return inflater.inflate(R.layout.dialog_read_bg_text, container)
}
override fun onStart() {
@ -38,6 +38,10 @@ class BgTextConfigDiolog : DialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initData()
}
private fun initData() {
}
}

@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.activity_read_book.*
import kotlinx.android.synthetic.main.dialog_read_book_style.*
import org.jetbrains.anko.sdk27.listeners.onCheckedChange
import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick
class ReadStyleDialog : DialogFragment() {
@ -205,30 +206,57 @@ class ReadStyleDialog : DialogFragment() {
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg0.onLongClick {
showBgTextConfig()
false
}
tv_bg1.onClick {
ReadBookConfig.styleSelect = 1
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg1.onLongClick {
showBgTextConfig()
false
}
tv_bg2.onClick {
ReadBookConfig.styleSelect = 2
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg2.onLongClick {
showBgTextConfig()
false
}
tv_bg3.onClick {
ReadBookConfig.styleSelect = 3
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg3.onLongClick {
showBgTextConfig()
false
}
tv_bg4.onClick {
ReadBookConfig.styleSelect = 4
ReadBookConfig.upBg()
upBg()
postEvent(Bus.UP_CONFIG, true)
}
tv_bg4.onLongClick {
showBgTextConfig()
false
}
}
private fun showBgTextConfig() {
val activity = activity
if (activity is ReadBookActivity) {
activity.showBgTextConfig()
}
}
private fun setBg() {

@ -1,12 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:padding="10dp">
<io.legado.app.lib.theme.view.ATESwitch
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dark_status_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="6dp">
<io.legado.app.lib.theme.view.ATEStrokeTextView
android:id="@+id/tvSelectTextColor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="6dp"
android:layout_weight="1"
android:singleLine="true"
android:gravity="center"
android:padding="6dp"
android:text="文字颜色"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<io.legado.app.lib.theme.view.ATEStrokeTextView
android:id="@+id/tvSelectBgColor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="6dp"
android:layout_weight="1"
android:singleLine="true"
android:gravity="center"
android:padding="6dp"
android:text="背景颜色"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<io.legado.app.lib.theme.view.ATEStrokeTextView
android:id="@+id/tvDefault"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="6dp"
android:layout_weight="1"
android:singleLine="true"
android:gravity="center"
android:padding="6dp"
android:text="恢复默认"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:clickable="true"
android:padding="6dp"
android:focusable="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:text="背景图片" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bgImgList"
android:layout_width="match_parent"
android:layout_height="100dp" />
</LinearLayout>
</LinearLayout>
Loading…
Cancel
Save