pull/32/head
kunfei 5 years ago
parent 91eff38e8b
commit 5b8d4f9f6a
  1. 11
      app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt
  2. 10
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt

@ -2,6 +2,7 @@ package io.legado.app.ui.widget.page
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.FrameLayout import android.widget.FrameLayout
import io.legado.app.R import io.legado.app.R
@ -26,7 +27,15 @@ class ContentView : FrameLayout {
fun upStyle() { fun upStyle() {
page_panel.horizontalPadding = 16.dp page_panel.horizontalPadding = 16.dp
page_panel.setBackgroundResource(R.drawable.bg1)
}
fun setBg(bg: Drawable?) {
page_panel.background = bg
}
fun setBgColor(color: Int) {
page_panel.setBackgroundColor(color)
} }
fun upTime() { fun upTime() {

@ -7,6 +7,7 @@ import android.graphics.Color
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
import android.widget.FrameLayout import android.widget.FrameLayout
import io.legado.app.R
import io.legado.app.ui.widget.page.delegate.CoverPageDelegate import io.legado.app.ui.widget.page.delegate.CoverPageDelegate
import io.legado.app.ui.widget.page.delegate.PageDelegate import io.legado.app.ui.widget.page.delegate.PageDelegate
import kotlinx.android.synthetic.main.view_book_page.view.* import kotlinx.android.synthetic.main.view_book_page.view.*
@ -28,7 +29,7 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att
addView(nextPage) addView(nextPage)
curPage = ContentView(context) curPage = ContentView(context)
addView(curPage) addView(curPage)
upBg()
setWillNotDraw(false) setWillNotDraw(false)
page_panel.backgroundColor = Color.WHITE page_panel.backgroundColor = Color.WHITE
@ -111,6 +112,13 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att
nextPage?.upStyle() nextPage?.upStyle()
} }
fun upBg() {
val bg = context.getDrawable(R.drawable.bg1)
curPage?.setBg(bg)
prevPage?.setBg(bg)
nextPage?.setBg(bg)
}
fun upTime() { fun upTime() {
curPage?.upTime() curPage?.upTime()
prevPage?.upTime() prevPage?.upTime()

Loading…
Cancel
Save