Update Accessibility

Update the content descriptions on the ImageViews.
This commit is contained in:
OxygenCobalt 2020-09-18 16:02:54 -06:00
parent 602cc2153f
commit 4d47dcd464
10 changed files with 21 additions and 17 deletions

View file

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

View file

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

View file

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

View file

@ -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" />
<TextView
android:id="@+id/error_text"

View file

@ -22,11 +22,11 @@
android:id="@+id/cover"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_album" />
<TextView

View file

@ -26,13 +26,12 @@
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorTertiary"
android:textSize="20sp"
android:textSize="@dimen/track_number_text_size"
android:maxLines="1"
android:contentDescription="@{@string/description_track_number(song.track)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_song"
tools:text="1" />
<TextView

View file

@ -22,12 +22,11 @@
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:src="@drawable/ic_exit"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:artistImage="@{artist}"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_artist" />
<TextView

View file

@ -22,6 +22,7 @@
android:id="@+id/cover"
android:layout_width="@dimen/cover_size_compact"
android:layout_height="@dimen/cover_size_compact"
android:contentDescription="@{@string/description_album_cover(song.name)}"
app:coverArt="@{song}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -17,6 +17,7 @@
<dimen name="cover_size_huge">230dp</dimen>
<dimen name="track_number_size">32dp</dimen>
<dimen name="track_number_text_size">20sp</dimen>
<dimen name="detail_header_size_max">26sp</dimen>
<dimen name="detail_header_size_min">10sp</dimen>'

View file

@ -14,9 +14,15 @@
<string name="label_albums">Albums</string>
<string name="label_songs">Songs</string>
<string name="description_album_cover">Album Cover for %s</string>
<string name="description_artist_image">Artist Cover for %s</string>
<string name="description_track_number">Track %s</string>
<string name="description_error">Error</string>
<string name="placeholder_genre">Unknown Genre</string>
<string name="placeholder_artist">Unknown Artist</string>
<string name="placeholder_album">Unknown Album</string>
<string name="placeholder_no_date">No Date</string>
<string name="format_info">%1$s / %2$s</string>
<string name="format_double_counts">%1$s, %2$s</string>