|
|
@ -6,13 +6,13 @@ import android.util.AttributeSet |
|
|
|
import android.widget.FrameLayout |
|
|
|
import android.widget.FrameLayout |
|
|
|
import androidx.appcompat.widget.AppCompatImageView |
|
|
|
import androidx.appcompat.widget.AppCompatImageView |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
|
|
|
|
import io.legado.app.constant.AppConst.TIME_FORMAT |
|
|
|
import io.legado.app.help.ImageLoader |
|
|
|
import io.legado.app.help.ImageLoader |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.utils.dp |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
|
|
|
|
import io.legado.app.utils.getStatusBarHeight |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.view_book_page.view.* |
|
|
|
import kotlinx.android.synthetic.main.view_book_page.view.* |
|
|
|
import org.jetbrains.anko.matchParent |
|
|
|
import org.jetbrains.anko.matchParent |
|
|
|
|
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContentView : FrameLayout { |
|
|
|
class ContentView : FrameLayout { |
|
|
@ -34,8 +34,10 @@ class ContentView : FrameLayout { |
|
|
|
fun upStyle() { |
|
|
|
fun upStyle() { |
|
|
|
ReadBookConfig.getConfig().apply { |
|
|
|
ReadBookConfig.getConfig().apply { |
|
|
|
val pt = if (context.getPrefBoolean("hideStatusBar", false)) { |
|
|
|
val pt = if (context.getPrefBoolean("hideStatusBar", false)) { |
|
|
|
|
|
|
|
top_bar.visible() |
|
|
|
paddingTop.dp |
|
|
|
paddingTop.dp |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
top_bar.gone() |
|
|
|
paddingTop.dp + context.getStatusBarHeight() |
|
|
|
paddingTop.dp + context.getStatusBarHeight() |
|
|
|
} |
|
|
|
} |
|
|
|
page_panel.setPadding(paddingLeft.dp, pt, paddingRight.dp, paddingBottom.dp) |
|
|
|
page_panel.setPadding(paddingLeft.dp, pt, paddingRight.dp, paddingBottom.dp) |
|
|
@ -54,11 +56,15 @@ class ContentView : FrameLayout { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun upTime() { |
|
|
|
fun upTime() { |
|
|
|
|
|
|
|
tv_top_left.text = TIME_FORMAT.format(Date(System.currentTimeMillis())) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun upBattery(battery: Int) { |
|
|
|
fun upBattery(battery: Int) { |
|
|
|
|
|
|
|
tv_top_right.text = context.getString(R.string.battery_show, battery) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setChapterTile(tile: String) { |
|
|
|
|
|
|
|
tv_bottom_left.text = tile |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setContent(page: TextPage?) { |
|
|
|
fun setContent(page: TextPage?) { |
|
|
|