pull/32/head
kunfei 5 years ago
parent ed7e94aee7
commit 5891a8c40b
  1. 19
      app/src/main/java/io/legado/app/constant/AppConst.kt
  2. 14
      app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt
  3. 2
      app/src/main/res/layout/view_book_page.xml
  4. 2
      app/src/main/res/values/strings.xml

@ -1,12 +1,15 @@
package io.legado.app.constant
import android.annotation.SuppressLint
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import io.legado.app.App
import io.legado.app.R
import java.text.SimpleDateFormat
import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
@SuppressLint("SimpleDateFormat")
object AppConst {
const val channelIdDownload = "channel_download"
const val channelIdReadAloud = "channel_read_aloud"
@ -21,9 +24,15 @@ object AppConst {
val NOT_AVAILABLE = App.INSTANCE.getString(R.string.not_available)
val GSON_CONVERTER: Gson = GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.setDateFormat("yyyy-MM-dd HH:mm:ssZ")
.create()
val TIME_FORMAT: SimpleDateFormat by lazy {
SimpleDateFormat("HH:mm")
}
val GSON_CONVERTER: Gson by lazy {
GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.setDateFormat("yyyy-MM-dd HH:mm:ssZ")
.create()
}
}

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

@ -9,6 +9,7 @@
app:showDividers="middle">
<LinearLayout
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
@ -33,6 +34,7 @@
android:layout_weight="1" />
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

@ -481,6 +481,6 @@
<string name="dsm_start"><![CDATA[<]]></string>
<string name="dsm_end"><![CDATA[>]]></string>
<string name="reading">阅读</string>
<string name="battery_show">%d%%</string>
</resources>

Loading…
Cancel
Save