feat(accessibility): add contentDesc and toolTip to audioItem

This commit is contained in:
FineFindus 2023-01-09 17:19:20 +01:00
parent bed3e987b7
commit 35299a7b3f
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package org.joinmastodon.android.ui.displayitems;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewGroup;
@ -9,6 +10,7 @@ import android.widget.SeekBar;
import android.widget.TextView;
import org.joinmastodon.android.AudioPlayerService;
import org.joinmastodon.android.MastodonApp;
import org.joinmastodon.android.R;
import org.joinmastodon.android.fragments.BaseStatusListFragment;
import org.joinmastodon.android.model.Attachment;
@ -126,6 +128,10 @@ public class AudioStatusDisplayItem extends StatusDisplayItem{
lastKnownPositionTime=SystemClock.uptimeMillis();
this.playing=playing;
playPauseBtn.setImageResource(playing ? R.drawable.ic_fluent_pause_circle_24_filled : R.drawable.ic_fluent_play_circle_24_filled);
playPauseBtn.setContentDescription(MastodonApp.context.getResources().getString(playing ? R.string.pause : R.string.play));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
playPauseBtn.setTooltipText(MastodonApp.context.getResources().getString(playing ? R.string.pause : R.string.play));
}
if(!playing){
lastRemainingSeconds=-1;
time.setText(formatDuration((int) item.attachment.getDuration()));