|
|
@ -9,6 +9,7 @@ import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT |
|
|
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT |
|
|
|
import androidx.appcompat.widget.Toolbar |
|
|
|
import androidx.appcompat.widget.Toolbar |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
|
|
|
|
import androidx.fragment.app.FragmentManager |
|
|
|
import androidx.lifecycle.Observer |
|
|
|
import androidx.lifecycle.Observer |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.Theme |
|
|
|
import io.legado.app.constant.Theme |
|
|
@ -22,14 +23,15 @@ class ReplaceEditDialog : DialogFragment(), |
|
|
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
|
|
|
|
|
|
|
|
fun newInstance(id: Long? = null): ReplaceEditDialog { |
|
|
|
fun show(fragmentManager: FragmentManager, id: Long? = null, pattern: String? = null) { |
|
|
|
val dialog = ReplaceEditDialog() |
|
|
|
val dialog = ReplaceEditDialog() |
|
|
|
id?.let { |
|
|
|
id?.let { |
|
|
|
val bundle = Bundle() |
|
|
|
val bundle = Bundle() |
|
|
|
bundle.putLong("id", id) |
|
|
|
bundle.putLong("id", id) |
|
|
|
|
|
|
|
bundle.putString("pattern", pattern) |
|
|
|
dialog.arguments = bundle |
|
|
|
dialog.arguments = bundle |
|
|
|
} |
|
|
|
} |
|
|
|
return dialog |
|
|
|
dialog.show(fragmentManager, "editReplace") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -56,7 +58,7 @@ class ReplaceEditDialog : DialogFragment(), |
|
|
|
tool_bar.inflateMenu(R.menu.replace_edit) |
|
|
|
tool_bar.inflateMenu(R.menu.replace_edit) |
|
|
|
tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) |
|
|
|
tool_bar.menu.applyTint(requireContext(), Theme.getTheme()) |
|
|
|
tool_bar.setOnMenuItemClickListener(this) |
|
|
|
tool_bar.setOnMenuItemClickListener(this) |
|
|
|
viewModel.replaceRuleData.observe(this, Observer { |
|
|
|
viewModel.replaceRuleData.observe(viewLifecycleOwner, Observer { |
|
|
|
upReplaceView(it) |
|
|
|
upReplaceView(it) |
|
|
|
}) |
|
|
|
}) |
|
|
|
arguments?.let { |
|
|
|
arguments?.let { |
|
|
|