mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -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)
|
||||
|
||||
6
app/src/main/res/layout/dialog_add_to_bookshelf.xml
Normal file
6
app/src/main/res/layout/dialog_add_to_bookshelf.xml
Normal file
@@ -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>
|
||||
Reference in New Issue
Block a user