feat: 优化代码

pull/141/head
kunfei 5 years ago
parent a2bde00a9e
commit 76c2c45e9f
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 12
      app/src/main/java/io/legado/app/utils/ViewExtensions.kt
  3. 2
      app/src/main/res/layout/view_read_menu.xml

@ -479,6 +479,8 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
if (!ReadBook.isLocalBook) {
tv_chapter_url.text = it.url
tv_chapter_url.visible()
} else {
tv_chapter_url.gone()
}
seek_read_page.max = it.pageSize().minus(1)
seek_read_page.progress = ReadBook.durPageIndex

@ -40,15 +40,21 @@ fun View.disableAutoFill() = run {
}
fun View.gone() {
visibility = GONE
if (visibility != GONE) {
visibility = GONE
}
}
fun View.invisible() {
visibility = INVISIBLE
if (visibility != INVISIBLE) {
visibility = INVISIBLE
}
}
fun View.visible() {
visibility = VISIBLE
if (visibility != VISIBLE) {
visibility = VISIBLE
}
}
fun View.visible(visible: Boolean) {

@ -27,7 +27,6 @@
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:text="@string/chapter"
android:textSize="12sp"
android:visibility="gone" />
@ -38,7 +37,6 @@
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:text="@string/chapter"
android:textSize="12sp"
android:visibility="gone" />

Loading…
Cancel
Save