Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
added some more accessibility descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Sep 26, 2018
1 parent e324011 commit 9320516
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 0 additions & 2 deletions app/src/main/java/org/y20k/transistor/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;

//import android.arch.lifecycle.ViewModelProviders;


/**
* MainActivity class
Expand Down
25 changes: 19 additions & 6 deletions app/src/main/java/org/y20k/transistor/MainActivityFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ private void setupStationMainViews(Station station) {
mPlayerStationName.setContentDescription(station.getStationName()); // for accessibility apps like TalkBack
mPlayerStationImage.setImageBitmap(stationImage);
mPlayerSheetStreamUrl.setText(station.getStreamUri().toString());
mPlayerSheetStreamUrl.setContentDescription(station.getStreamUri().toString()); // for accessibility apps like TalkBack
}


Expand All @@ -604,6 +605,7 @@ private void setupStationPlaybackButtonState(Station station) {
}


/* Initiates the rotation animation of the playback button */
private void animatePlaybackButtonStateTransition(Station station) {
if (isAdded()) {
// toggle views needed for active playback
Expand Down Expand Up @@ -671,24 +673,35 @@ private void setupStationMetadataViews(Station station) {
private void setupExtendedMetaDataViews(Station station) {

// fill and show mime type
if (!station.getMimeType().equals("")) {
mStationDataSheetMimeType.setText(station.getMimeType());
String mimeType = station.getMimeType();
if (!mimeType.equals("")) {
mStationDataSheetMimeType.setText(mimeType);
mStationDataSheetMimeType.setContentDescription(mimeType); // for accessibility apps like TalkBack
} else {
mStationDataSheetMimeType.setText(R.string.player_sheet_p_no_data);
mStationDataSheetMimeType.setContentDescription(getString(R.string.player_sheet_p_no_data)); // for accessibility apps like TalkBack
}

// fill and show channel count
if (station.getChannelCount() > 0) {
mStationDataSheetChannelCount.setText(String.valueOf(station.getChannelCount()));
int channelCount = station.getChannelCount();
if (channelCount > 0) {
String channelCountString = String.valueOf(channelCount);
mStationDataSheetChannelCount.setText(channelCountString);
mStationDataSheetChannelCount.setContentDescription(channelCountString); // for accessibility apps like TalkBack
} else {
mStationDataSheetChannelCount.setText(R.string.player_sheet_p_no_data);
mStationDataSheetChannelCount.setContentDescription(getString(R.string.player_sheet_p_no_data)); // for accessibility apps like TalkBack
}

// fill and show sample rate
if (station.getSampleRate() > 0) {
mStationDataSheetSampleRate.setText(String.valueOf(station.getSampleRate()));
int sampleRate = station.getSampleRate();
if (sampleRate > 0) {
String sampleRateString = String.valueOf(sampleRate);
mStationDataSheetSampleRate.setText(sampleRateString);
mStationDataSheetSampleRate.setContentDescription(sampleRateString); // for accessibility apps like TalkBack
} else {
mStationDataSheetSampleRate.setText(R.string.player_sheet_p_no_data);
mStationDataSheetSampleRate.setContentDescription(getString(R.string.player_sheet_p_no_data)); // for accessibility apps like TalkBack
}

// // fill and show bit rate
Expand Down

0 comments on commit 9320516

Please sign in to comment.