pull/1990/head
kunfei 2 years ago
parent 8b8faaa30f
commit 0383af9997
  1. 17
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt
  2. 11
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookAdapter.kt
  3. 2
      app/src/main/res/layout/activity_remote_book.xml
  4. 1
      app/src/main/res/values-es-rES/strings.xml
  5. 1
      app/src/main/res/values-ja-rJP/strings.xml
  6. 1
      app/src/main/res/values-pt-rBR/strings.xml
  7. 1
      app/src/main/res/values-zh-rHK/strings.xml
  8. 1
      app/src/main/res/values-zh-rTW/strings.xml
  9. 1
      app/src/main/res/values-zh/strings.xml
  10. 1
      app/src/main/res/values/strings.xml

@ -70,6 +70,23 @@ class RemoteBookActivity : VMBaseActivity<ActivityRemoteBookBinding, RemoteBookV
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }
override fun finish() {
if (viewModel.dirList.isEmpty()) {
super.finish()
} else {
viewModel.dirList.removeLastOrNull()
val remoteBook = viewModel.dirList.lastOrNull()
viewModel.dataCallback?.clear()
if (remoteBook != null) {
binding.titleBar.title = remoteBook.filename
viewModel.loadRemoteBookList(remoteBook.path)
} else {
binding.titleBar.setTitle(R.string.remote_book)
viewModel.loadRemoteBookList(RemoteBookWebDav.rootBookUrl)
}
}
}
override fun openDir(remoteBook: RemoteBook) { override fun openDir(remoteBook: RemoteBook) {
viewModel.dirList.add(remoteBook) viewModel.dirList.add(remoteBook)
binding.titleBar.title = remoteBook.filename binding.titleBar.title = remoteBook.filename

@ -47,17 +47,18 @@ class RemoteBookAdapter (context: Context, val callBack: CallBack) :
} }
override fun registerListener(holder: ItemViewHolder, binding: ItemRemoteBookBinding) { override fun registerListener(holder: ItemViewHolder, binding: ItemRemoteBookBinding) {
binding.root.setOnClickListener {
binding.btnDownload.setOnClickListener {
getItem(holder.layoutPosition)?.let { getItem(holder.layoutPosition)?.let {
if (it.isDir) { if (it.isDir) {
callBack.openDir(it) callBack.openDir(it)
} else {
callBack.addToBookshelf(it)
} }
} }
} }
binding.btnDownload.setOnClickListener {
getItem(holder.layoutPosition)?.let {
callBack.addToBookshelf(it)
}
}
} }
interface CallBack { interface CallBack {

@ -10,7 +10,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:title="远程书籍" /> app:title="@string/remote_book" />
<io.legado.app.ui.widget.anima.RefreshProgressBar <io.legado.app.ui.widget.anima.RefreshProgressBar
android:id="@+id/refresh_progress_bar" android:id="@+id/refresh_progress_bar"

@ -996,4 +996,5 @@
<string name="error_decode_bitmap">Fail to decode bitmap</string> <string name="error_decode_bitmap">Fail to decode bitmap</string>
<string name="error_image_url_empty">Image url is empty, check replacement rules</string> <string name="error_image_url_empty">Image url is empty, check replacement rules</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -999,4 +999,5 @@
<string name="error_decode_bitmap">Fail to decode bitmap</string> <string name="error_decode_bitmap">Fail to decode bitmap</string>
<string name="error_image_url_empty">Image url is empty, check replacement rules</string> <string name="error_image_url_empty">Image url is empty, check replacement rules</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -999,4 +999,5 @@
<string name="error_decode_bitmap">Fail to decode bitmap</string> <string name="error_decode_bitmap">Fail to decode bitmap</string>
<string name="error_image_url_empty">Image url is empty, check replacement rules</string> <string name="error_image_url_empty">Image url is empty, check replacement rules</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -996,4 +996,5 @@
<string name="error_decode_bitmap">图片解码失败</string> <string name="error_decode_bitmap">图片解码失败</string>
<string name="error_image_url_empty">图片链接为空,检查替换净化规则</string> <string name="error_image_url_empty">图片链接为空,检查替换净化规则</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -998,4 +998,5 @@
<string name="error_decode_bitmap">图片解码失败</string> <string name="error_decode_bitmap">图片解码失败</string>
<string name="error_image_url_empty">图片链接为空,检查替换净化规则</string> <string name="error_image_url_empty">图片链接为空,检查替换净化规则</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -998,4 +998,5 @@
<string name="error_decode_bitmap">图片解码失败</string> <string name="error_decode_bitmap">图片解码失败</string>
<string name="error_image_url_empty">图片链接为空,检查替换净化规则</string> <string name="error_image_url_empty">图片链接为空,检查替换净化规则</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

@ -999,4 +999,5 @@
<string name="error_decode_bitmap">Fail to decode bitmap</string> <string name="error_decode_bitmap">Fail to decode bitmap</string>
<string name="error_image_url_empty">Image url is empty, check replacement rules</string> <string name="error_image_url_empty">Image url is empty, check replacement rules</string>
<string name="variable_comment">变量说明(variableComment)</string> <string name="variable_comment">变量说明(variableComment)</string>
<string name="remote_book">远程书籍</string>
</resources> </resources>

Loading…
Cancel
Save