refactor: use getContentDescription instead of duplicate code

This commit is contained in:
FineFindus 2023-01-09 21:30:52 +01:00
parent 871c17cbe2
commit a782160dd3
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
2 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ public class AudioStatusDisplayItem extends StatusDisplayItem{
playPauseBtn.setImageResource(playing ? R.drawable.ic_fluent_pause_circle_24_filled : R.drawable.ic_fluent_play_circle_24_filled); 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)); playPauseBtn.setContentDescription(MastodonApp.context.getResources().getString(playing ? R.string.pause : R.string.play));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
playPauseBtn.setTooltipText(MastodonApp.context.getResources().getString(playing ? R.string.pause : R.string.play)); playPauseBtn.setTooltipText(playPauseBtn.getContentDescription());
} }
if(!playing){ if(!playing){
lastRemainingSeconds=-1; lastRemainingSeconds=-1;

View File

@ -102,10 +102,10 @@ public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{
case DIRECT -> R.drawable.ic_fluent_mention_24_regular; case DIRECT -> R.drawable.ic_fluent_mention_24_regular;
}); });
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
visibility.setTooltipText(UiUtils.getVisibilityText(s));
}
visibility.setContentDescription(UiUtils.getVisibilityText(s)); visibility.setContentDescription(UiUtils.getVisibilityText(s));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
visibility.setTooltipText(visibility.getContentDescription());
}
} }
@Override @Override