pull/1155/head
parent
1f761a5713
commit
55efc2e67a
@ -0,0 +1,71 @@ |
||||
package io.legado.app.ui.association |
||||
|
||||
import android.content.Context |
||||
import android.os.Bundle |
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import androidx.fragment.app.viewModels |
||||
import androidx.recyclerview.widget.LinearLayoutManager |
||||
import io.legado.app.R |
||||
import io.legado.app.base.BaseDialogFragment |
||||
import io.legado.app.base.adapter.ItemViewHolder |
||||
import io.legado.app.base.adapter.RecyclerAdapter |
||||
import io.legado.app.data.entities.ReplaceRule |
||||
import io.legado.app.databinding.DialogRecyclerViewBinding |
||||
import io.legado.app.databinding.ItemSourceImportBinding |
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding |
||||
|
||||
class ImportReplaceRuleDialog : BaseDialogFragment() { |
||||
|
||||
private val binding by viewBinding(DialogRecyclerViewBinding::bind) |
||||
private val viewModel by viewModels<ImportReplaceRuleViewModel>() |
||||
lateinit var adapter: SourcesAdapter |
||||
|
||||
override fun onStart() { |
||||
super.onStart() |
||||
dialog?.window?.setLayout( |
||||
ViewGroup.LayoutParams.MATCH_PARENT, |
||||
ViewGroup.LayoutParams.WRAP_CONTENT |
||||
) |
||||
} |
||||
|
||||
override fun onCreateView( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup?, |
||||
savedInstanceState: Bundle? |
||||
): View? { |
||||
return inflater.inflate(R.layout.dialog_recycler_view, container) |
||||
} |
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { |
||||
binding.toolBar.setTitle(R.string.import_replace_rule) |
||||
adapter = SourcesAdapter(requireContext()) |
||||
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext()) |
||||
binding.recyclerView.adapter = adapter |
||||
adapter.setItems(viewModel.allRules) |
||||
} |
||||
|
||||
inner class SourcesAdapter(context: Context) : |
||||
RecyclerAdapter<ReplaceRule, ItemSourceImportBinding>(context) { |
||||
|
||||
override fun getViewBinding(parent: ViewGroup): ItemSourceImportBinding { |
||||
return ItemSourceImportBinding.inflate(inflater, parent, false) |
||||
} |
||||
|
||||
override fun convert( |
||||
holder: ItemViewHolder, |
||||
binding: ItemSourceImportBinding, |
||||
item: ReplaceRule, |
||||
payloads: MutableList<Any> |
||||
) { |
||||
TODO("Not yet implemented") |
||||
} |
||||
|
||||
override fun registerListener(holder: ItemViewHolder, binding: ItemSourceImportBinding) { |
||||
TODO("Not yet implemented") |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue