feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 3a3b1872f4
commit f1f9bb787b
  1. 4
      app/src/main/java/io/legado/app/ui/download/DownloadAdapter.kt
  2. 41
      app/src/main/res/layout/item_download.xml
  3. 1
      app/src/main/res/values/strings.xml

@ -6,6 +6,7 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import kotlinx.android.synthetic.main.item_download.view.* import kotlinx.android.synthetic.main.item_download.view.*
import org.jetbrains.anko.sdk27.listeners.onClick
class DownloadAdapter(context: Context) : class DownloadAdapter(context: Context) :
@ -25,6 +26,9 @@ class DownloadAdapter(context: Context) :
tv_download.text = tv_download.text =
context.getString(R.string.download_count, cs.size, item.totalChapterNum) context.getString(R.string.download_count, cs.size, item.totalChapterNum)
} }
tv_export.onClick {
}
} else { } else {
val cacheSize = cacheChapters[item.bookUrl]?.size ?: 0 val cacheSize = cacheChapters[item.bookUrl]?.size ?: 0
tv_download.text = tv_download.text =

@ -1,23 +1,46 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:singleLine="true"
app:layout_constraintRight_toLeftOf="@+id/tv_export"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView <TextView
android:id="@+id/tv_author" android:id="@+id/tv_author"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:singleLine="true"
app:layout_constraintRight_toLeftOf="@+id/tv_export"
app:layout_constraintTop_toBottomOf="@+id/tv_name"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView <TextView
android:id="@+id/tv_download" android:id="@+id/tv_download"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:singleLine="true"
app:layout_constraintRight_toLeftOf="@+id/tv_export"
app:layout_constraintTop_toBottomOf="@id/tv_author"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/tv_export"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="10dp"
android:text="@string/export"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -554,6 +554,7 @@
<string name="enable_selection">启用所选</string> <string name="enable_selection">启用所选</string>
<string name="disable_selection">禁用所选</string> <string name="disable_selection">禁用所选</string>
<string name="export_selection">导出所选</string> <string name="export_selection">导出所选</string>
<string name="export">导出</string>
<string name="load_toc">加载目录</string> <string name="load_toc">加载目录</string>
<string name="tts">TTS</string> <string name="tts">TTS</string>
<string name="web_dav_pw_s">输入你的WebDav授权密码</string> <string name="web_dav_pw_s">输入你的WebDav授权密码</string>

Loading…
Cancel
Save