From 4d47dcd464afe2f694c90529e5905eff04b27f11 Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Fri, 18 Sep 2020 16:02:54 -0600 Subject: [PATCH] Update Accessibility Update the content descriptions on the ImageViews. --- .../org/oxycblt/auxio/music/processing/MusicLoader.kt | 8 ++------ app/src/main/res/layout/fragment_album_detail.xml | 5 +++-- app/src/main/res/layout/fragment_artist_detail.xml | 3 ++- app/src/main/res/layout/fragment_loading.xml | 4 ++-- app/src/main/res/layout/item_album.xml | 2 +- app/src/main/res/layout/item_album_song.xml | 5 ++--- app/src/main/res/layout/item_artist.xml | 3 +-- app/src/main/res/layout/item_song.xml | 1 + app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 6 ++++++ 10 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/music/processing/MusicLoader.kt b/app/src/main/java/org/oxycblt/auxio/music/processing/MusicLoader.kt index 4d3e0658a..4e6b4f78f 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/processing/MusicLoader.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/processing/MusicLoader.kt @@ -188,16 +188,12 @@ class MusicLoader( while (cursor.moveToNext()) { val id = cursor.getLong(idIndex) - var name = cursor.getString(nameIndex) ?: albumPlaceholder - val artist = cursor.getString(artistIndex) + val name = cursor.getString(nameIndex) ?: albumPlaceholder + val artist = cursor.getString(artistIndex) ?: artistPlaceholder val year = cursor.getInt(yearIndex) val coverUri = id.toAlbumArtURI() - // Sometimes the android system will return 0 for an album name, update - // it properly if that happens. - name = if (name == "0") albumPlaceholder else name - albums.add( Album( id, name, artist, diff --git a/app/src/main/res/layout/fragment_album_detail.xml b/app/src/main/res/layout/fragment_album_detail.xml index d3c31acb0..17671db24 100644 --- a/app/src/main/res/layout/fragment_album_detail.xml +++ b/app/src/main/res/layout/fragment_album_detail.xml @@ -40,6 +40,7 @@ android:layout_width="@dimen/cover_size_huge" android:layout_height="@dimen/cover_size_huge" android:layout_marginTop="@dimen/margin_medium" + android:contentDescription="@{@string/description_album_cover(album.name)}" app:coverArt="@{album}" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -84,7 +85,7 @@ android:textAppearance="?android:attr/textAppearanceListItem" android:textColor="?android:attr/textColorSecondary" android:layout_marginStart="@dimen/margin_medium" - android:text="@{String.valueOf(album.year)}" + android:text="@{album.year != 0 ? String.valueOf(album.year) : @string/placeholder_no_date}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/artist_name" tools:text="2020" /> @@ -111,7 +112,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:nestedScrollingEnabled="true" + android:nestedScrollingEnabled="false" android:overScrollMode="never" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/fragment_artist_detail.xml b/app/src/main/res/layout/fragment_artist_detail.xml index 5e196394e..7d01e2c73 100644 --- a/app/src/main/res/layout/fragment_artist_detail.xml +++ b/app/src/main/res/layout/fragment_artist_detail.xml @@ -40,6 +40,7 @@ android:layout_width="@dimen/cover_size_huge" android:layout_height="@dimen/cover_size_huge" android:layout_marginTop="@dimen/margin_medium" + android:contentDescription="@{@string/description_artist_image(artist.name)}" app:artistImage="@{artist}" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -110,7 +111,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:nestedScrollingEnabled="true" + android:nestedScrollingEnabled="false" android:overScrollMode="never" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/fragment_loading.xml b/app/src/main/res/layout/fragment_loading.xml index 85936ab0e..5575182ef 100644 --- a/app/src/main/res/layout/fragment_loading.xml +++ b/app/src/main/res/layout/fragment_loading.xml @@ -37,12 +37,12 @@ android:indeterminateTintMode="src_in" android:src="@drawable/ic_error" android:visibility="gone" + android:contentDescription="@string/description_error" app:layout_constraintBottom_toTopOf="@+id/error_text" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/loading_bar" - app:srcCompat="@drawable/ic_error" - tools:ignore="ContentDescription" /> + app:srcCompat="@drawable/ic_error" /> 230dp 32dp + 20sp 26sp 10sp' diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea697d36d..c88991f23 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,9 +14,15 @@ Albums Songs + Album Cover for %s + Artist Cover for %s + Track %s + Error + Unknown Genre Unknown Artist Unknown Album + No Date %1$s / %2$s %1$s, %2$s