style: improve layout heirarchy
Further improve the layout heirarchy, shrinking some items so that the layout is more compact and scrollable.
This commit is contained in:
@@ -33,7 +33,7 @@ import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
import org.oxycblt.auxio.MainActivity
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.DialogBlacklistBinding
|
||||
import org.oxycblt.auxio.databinding.DialogExcludedBinding
|
||||
import org.oxycblt.auxio.logD
|
||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||
import org.oxycblt.auxio.settings.ui.LifecycleDialog
|
||||
@@ -56,7 +56,7 @@ class ExcludedDialog : LifecycleDialog() {
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val binding = DialogBlacklistBinding.inflate(inflater)
|
||||
val binding = DialogExcludedBinding.inflate(inflater)
|
||||
|
||||
val adapter = ExcludedEntryAdapter { path ->
|
||||
blacklistModel.removePath(path)
|
||||
@@ -68,7 +68,7 @@ class ExcludedDialog : LifecycleDialog() {
|
||||
|
||||
// --- UI SETUP ---
|
||||
|
||||
binding.blacklistRecycler.adapter = adapter
|
||||
binding.excludedRecycler.adapter = adapter
|
||||
|
||||
// Now that the dialog exists, we get the view manually when the dialog is shown
|
||||
// and override its click-listener so that the dialog does not auto-dismiss when we
|
||||
@@ -95,7 +95,7 @@ class ExcludedDialog : LifecycleDialog() {
|
||||
blacklistModel.paths.observe(viewLifecycleOwner) { paths ->
|
||||
adapter.submitList(paths)
|
||||
|
||||
binding.blacklistEmptyText.isVisible = paths.isEmpty()
|
||||
binding.excludedEmpty.isVisible = paths.isEmpty()
|
||||
}
|
||||
|
||||
logD("Dialog created.")
|
||||
@@ -104,7 +104,7 @@ class ExcludedDialog : LifecycleDialog() {
|
||||
}
|
||||
|
||||
override fun onConfigDialog(builder: AlertDialog.Builder) {
|
||||
builder.setTitle(R.string.set_blacklist)
|
||||
builder.setTitle(R.string.set_excluded)
|
||||
|
||||
// Dont set the click listener here, we do some custom black magic in onCreateView instead.
|
||||
builder.setNeutralButton(R.string.lbl_add, null)
|
||||
|
||||
@@ -21,7 +21,7 @@ package org.oxycblt.auxio.excluded
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.oxycblt.auxio.databinding.ItemBlacklistEntryBinding
|
||||
import org.oxycblt.auxio.databinding.ItemExcludedDirBinding
|
||||
import org.oxycblt.auxio.inflater
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ class ExcludedEntryAdapter(
|
||||
override fun getItemCount() = paths.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return ViewHolder(ItemBlacklistEntryBinding.inflate(parent.context.inflater))
|
||||
return ViewHolder(ItemExcludedDirBinding.inflate(parent.context.inflater))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
@@ -50,7 +50,7 @@ class ExcludedEntryAdapter(
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemBlacklistEntryBinding
|
||||
private val binding: ItemExcludedDirBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
init {
|
||||
binding.root.layoutParams = RecyclerView.LayoutParams(
|
||||
@@ -59,9 +59,9 @@ class ExcludedEntryAdapter(
|
||||
}
|
||||
|
||||
fun bind(path: String) {
|
||||
binding.blacklistTitle.text = path
|
||||
binding.blacklistTitle.requestLayout()
|
||||
binding.blacklistClear.setOnClickListener {
|
||||
binding.excludedPath.text = path
|
||||
binding.excludedPath.requestLayout()
|
||||
binding.excludedClear.setOnClickListener {
|
||||
onClear(path)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user