|
|
@ -9,7 +9,6 @@ import android.view.MenuItem |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup |
|
|
|
import androidx.appcompat.widget.Toolbar |
|
|
|
import androidx.appcompat.widget.Toolbar |
|
|
|
import androidx.fragment.app.FragmentManager |
|
|
|
|
|
|
|
import androidx.fragment.app.viewModels |
|
|
|
import androidx.fragment.app.viewModels |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
@ -26,26 +25,21 @@ import io.legado.app.databinding.ItemSourceImportBinding |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
import io.legado.app.ui.widget.dialog.WaitDialog |
|
|
|
import io.legado.app.ui.widget.dialog.WaitDialog |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.dp |
|
|
|
|
|
|
|
import io.legado.app.utils.putPrefBoolean |
|
|
|
|
|
|
|
import io.legado.app.utils.splitNotBlank |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
|
|
|
|
import io.legado.app.utils.visible |
|
|
|
|
|
|
|
|
|
|
|
class ImportReplaceRuleDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener { |
|
|
|
class ImportReplaceRuleDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener { |
|
|
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
constructor(source: String, finishOnDismiss: Boolean = false) : this() { |
|
|
|
|
|
|
|
arguments = Bundle().apply { |
|
|
|
fun start( |
|
|
|
|
|
|
|
fragmentManager: FragmentManager, |
|
|
|
|
|
|
|
source: String, |
|
|
|
|
|
|
|
finishOnDismiss: Boolean = false |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
fragmentManager.showDialog<ImportReplaceRuleDialog> { |
|
|
|
|
|
|
|
putString("source", source) |
|
|
|
putString("source", source) |
|
|
|
putBoolean("finishOnDismiss", finishOnDismiss) |
|
|
|
putBoolean("finishOnDismiss", finishOnDismiss) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val binding by viewBinding(DialogRecyclerViewBinding::bind) |
|
|
|
private val binding by viewBinding(DialogRecyclerViewBinding::bind) |
|
|
|
private val viewModel by viewModels<ImportReplaceRuleViewModel>() |
|
|
|
private val viewModel by viewModels<ImportReplaceRuleViewModel>() |
|
|
|
private val adapter by lazy { SourcesAdapter(requireContext()) } |
|
|
|
private val adapter by lazy { SourcesAdapter(requireContext()) } |
|
|
|