pull/2514/head
kunfei 2 years ago
parent 9fd0567122
commit 102e7bd689
  1. 36
      app/src/main/java/io/legado/app/ui/association/AddToBookshelfDialog.kt
  2. 3
      app/src/main/java/io/legado/app/ui/association/OnLineImportActivity.kt
  3. 6
      app/src/main/res/layout/dialog_add_to_bookshelf.xml

@ -0,0 +1,36 @@
package io.legado.app.ui.association
import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.utils.setLayout
class AddToBookshelfDialog() : BaseDialogFragment(R.layout.dialog_add_to_bookshelf) {
constructor(bookUrl: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
putString("bookUrl", bookUrl)
putBoolean("finishOnDismiss", finishOnDismiss)
}
}
override fun onStart() {
super.onStart()
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
if (arguments?.getBoolean("finishOnDismiss") == true) {
activity?.finish()
}
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
}
}

@ -73,6 +73,9 @@ class OnLineImportActivity :
"/readConfig" -> viewModel.getBytes(url) { bytes ->
viewModel.importReadConfig(bytes, this::finallyDialog)
}
"addToBookshelf" -> showDialogFragment(
AddToBookshelfDialog(url)
)
"/importonline" -> when (it.host) {
"booksource" -> showDialogFragment(
ImportBookSourceDialog(url, true)

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save