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:
OxygenCobalt 2021-08-19 17:35:28 -06:00
parent 1f9d23863f
commit 21a24f2496
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
13 changed files with 40 additions and 43 deletions

View file

@ -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)

View file

@ -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)
}
}

View file

@ -10,7 +10,7 @@
android:paddingTop="@dimen/spacing_small">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/blacklist_recycler"
android:id="@+id/excluded_recycler"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
@ -18,10 +18,10 @@
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="1"
tools:listitem="@layout/item_blacklist_entry" />
tools:listitem="@layout/item_excluded_dir" />
<TextView
android:id="@+id/blacklist_empty_text"
android:id="@+id/excluded_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inter_semibold"

View file

@ -15,7 +15,7 @@
<ImageView
android:id="@+id/album_cover"
style="@style/Widget.ImageView.Large"
style="@style/Widget.ImageView.Normal"
android:contentDescription="@{@string/desc_album_cover(album.name)}"
app:albumArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -9,19 +9,19 @@
android:focusable="false">
<TextView
android:id="@+id/blacklist_title"
android:id="@+id/excluded_path"
style="@style/ItemText.Primary"
android:layout_marginStart="0dp"
android:layout_marginEnd="@dimen/spacing_medium"
android:maxLines="@null"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/blacklist_clear"
app:layout_constraintEnd_toStartOf="@+id/excluded_clear"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="/storage/emulated/0/directory" />
<ImageButton
android:id="@+id/blacklist_clear"
android:id="@+id/excluded_clear"
style="@style/Widget.Button.Unbounded"
android:layout_width="@dimen/size_clear"
android:layout_height="@dimen/size_clear"

View file

@ -89,8 +89,8 @@
<string name="set_content">Content</string>
<string name="set_save">Wiedergabezustand abspeichern</string>
<string name="set_save_desc">Der aktuell Wiedergabezustand jetzt abspeichern</string>
<string name="set_blacklist">Ausgeschlossene Ordner</string>
<string name="set_blacklist_desc">Die Inhalte der ausgeschlossene Ordner sind versteckt von deiner Musikbibliothek</string>
<string name="set_excluded">Ausgeschlossene Ordner</string>
<string name="set_excluded_desc">Die Inhalte der ausgeschlossene Ordner sind versteckt von deiner Musikbibliothek</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">Keine Musik gefunden</string>

View file

@ -92,8 +92,8 @@
<string name="set_content">Contenido</string>
<string name="set_save">Guardar estado de reproducción</string>
<string name="set_save_desc">Guardar el estado actual de la reproducción ahora</string>
<string name="set_blacklist">Carpetas excluidas</string>
<string name="set_blacklist_desc">El contenido de las carpetas excluidas se oculta de la biblioteca</string>
<string name="set_excluded">Carpetas excluidas</string>
<string name="set_excluded_desc">El contenido de las carpetas excluidas se oculta de la biblioteca</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">No se encontró música</string>

View file

@ -90,8 +90,8 @@
<string name="set_content">Inhoud</string>
<string name="set_save">Afspeelstatus opslaan</string>
<string name="set_save_desc">Sla de huidige afspeelstatus nu op </string>
<string name="set_blacklist">Uitgesloten mappen </string>
<string name="set_blacklist_desc">De inhoud van uitgesloten mappen wordt verborgen voor uw bibliotheek</string>
<string name="set_excluded">Uitgesloten mappen </string>
<string name="set_excluded_desc">De inhoud van uitgesloten mappen wordt verborgen voor uw bibliotheek</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">Geen muziek aangetroffen</string>

View file

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TODO: Rejig these dimens to line up with the 8dp grid. -->
<!--
TODO: Redo these dimens to line up with the 8dp grid. Tiny spacing can be used for
internal elements, but micro spacing needs to be phased out. Certain dimens need to
be flattened and buttons need to become at least 48x48
-->
<!-- Spacing Namespace | Dimens for padding/margin attributes -->
<dimen name="spacing_micro">2dp</dimen>
@ -13,9 +17,6 @@
<dimen name="spacing_huge">64dp</dimen>
<dimen name="spacing_insane">128dp</dimen>
<!-- Height Namespace | Height for UI elements -->
<dimen name="height_widget_button">32dp</dimen>
<!-- Width Namespace | Width for UI elements -->
<dimen name="width_track_number">32dp</dimen>
<dimen name="width_fast_scroll">20dp</dimen>
@ -26,12 +27,11 @@
<dimen name="size_cover_compact">48dp</dimen>
<dimen name="size_cover_normal">56dp</dimen>
<dimen name="size_cover_large">64dp</dimen>
<dimen name="size_cover_huge_land">128dp</dimen>
<dimen name="size_cover_huge">264dp</dimen>
<dimen name="size_cover_huge_land">136dp</dimen>
<dimen name="size_play_pause">72dp</dimen>
<dimen name="size_play_pause_compact">36dp</dimen>
<dimen name="size_unbounded">36dp</dimen>
<dimen name="size_scroll_thumb">48dp</dimen>
<dimen name="size_clear">32dp</dimen>
@ -48,5 +48,6 @@
<!-- Misc -->
<dimen name="elevation_small">2dp</dimen>
<dimen name="elevation_normal">4dp</dimen>
<dimen name="offset_thumb">4dp</dimen>
</resources>

View file

@ -97,8 +97,8 @@
<string name="set_content">Content</string>
<string name="set_save">Save playback state</string>
<string name="set_save_desc">Save the current playback state now</string>
<string name="set_blacklist">Excluded Folders</string>
<string name="set_blacklist_desc">The content of excluded folders is hidden from your library</string>
<string name="set_excluded">Excluded Folders</string>
<string name="set_excluded_desc">The content of excluded folders is hidden from your library</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">No music found</string>

View file

@ -48,10 +48,11 @@
</style>
<style name="Widget.Component.AppWidget.Button.Base" parent="Widget.AppCompat.Button.Borderless">
<item name="android:layout_height">@dimen/height_widget_button</item>
<item name="android:layout_height">@dimen/size_unbounded</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:padding">@dimen/spacing_tiny</item>
</style>
<style name="Widget.Component.AppWidget.Button" parent="Widget.Component.AppWidget.Button.Base">

View file

@ -54,11 +54,6 @@
<item name="android:layout_height">@dimen/size_cover_normal</item>
</style>
<style name="Widget.ImageView.Large" parent="">
<item name="android:layout_width">@dimen/size_cover_large</item>
<item name="android:layout_height">@dimen/size_cover_large</item>
</style>
<style name="Widget.ImageView.Full" parent="">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">0dp</item>
@ -180,8 +175,8 @@
<!-- BUTTON STYLES -->
<style name="Widget.Button.Unbounded" parent="Widget.AppCompat.Button.Borderless">
<item name="android:layout_width">@dimen/size_play_pause_compact</item>
<item name="android:layout_height">@dimen/size_play_pause_compact</item>
<item name="android:layout_width">@dimen/size_unbounded</item>
<item name="android:layout_height">@dimen/size_unbounded</item>
<item name="android:background">@drawable/ui_unbounded_ripple</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:padding">@dimen/spacing_micro</item>

View file

@ -149,8 +149,8 @@
<Preference
app:iconSpaceReserved="false"
app:key="KEY_BLACKLIST"
app:summary="@string/set_blacklist_desc"
app:title="@string/set_blacklist" />
app:summary="@string/set_excluded_desc"
app:title="@string/set_excluded" />
</PreferenceCategory>
</PreferenceScreen>