diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2023-10-06 18:24:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-06 18:24:13 +0200 |
commit | c38b2634582d74fe3a7c7a4273cac8750dbc7e7d (patch) | |
tree | ccf4c93e1a92b8aa6f58716e5eba009d3642e9cf /app/src/main/java/de/danoeh | |
parent | 3fae29b375380ca785e57ed74e5942c496b2370b (diff) | |
download | AntennaPod-c38b2634582d74fe3a7c7a4273cac8750dbc7e7d.zip |
Better content descriptions for TalkBack (#6684)
Diffstat (limited to 'app/src/main/java/de/danoeh')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java | 8 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java index acb1f1694..987206743 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/VariableSpeedDialog.java @@ -23,7 +23,6 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Collections; @@ -32,7 +31,6 @@ import java.util.Locale; public class VariableSpeedDialog extends BottomSheetDialogFragment { private SpeedSelectionAdapter adapter; - private final DecimalFormat speedFormat; private PlaybackController controller; private final List<Float> selectedSpeeds; private PlaybackSpeedSeekBar speedSeekBar; @@ -41,7 +39,6 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { public VariableSpeedDialog() { DecimalFormatSymbols format = new DecimalFormatSymbols(Locale.US); format.setDecimalSeparator('.'); - speedFormat = new DecimalFormat("0.00", format); selectedSpeeds = new ArrayList<>(UserPreferences.getPlaybackSpeedArray()); } @@ -70,7 +67,7 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { @Subscribe(threadMode = ThreadMode.MAIN) public void updateSpeed(SpeedChangedEvent event) { speedSeekBar.updateSpeed(event.getNewSpeed()); - addCurrentSpeedChip.setText(speedFormat.format(event.getNewSpeed())); + addCurrentSpeedChip.setText(String.format(Locale.getDefault(), "%1$.2f", event.getNewSpeed())); } @Nullable @@ -95,6 +92,7 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { addCurrentSpeedChip.setCloseIconVisible(true); addCurrentSpeedChip.setCloseIconResource(R.drawable.ic_add); addCurrentSpeedChip.setOnCloseIconClickListener(v -> addCurrentSpeed()); + addCurrentSpeedChip.setCloseIconContentDescription(getString(R.string.add_preset)); addCurrentSpeedChip.setOnClickListener(v -> addCurrentSpeed()); return root; } @@ -126,7 +124,7 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { public void onBindViewHolder(@NonNull ViewHolder holder, int position) { float speed = selectedSpeeds.get(position); - holder.chip.setText(speedFormat.format(speed)); + holder.chip.setText(String.format(Locale.getDefault(), "%1$.2f", speed)); holder.chip.setOnLongClickListener(v -> { selectedSpeeds.remove(speed); UserPreferences.setPlaybackSpeedArray(selectedSpeeds); diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java index f809de175..21a29a920 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java @@ -65,6 +65,7 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { .load(); title.setText(item.getTitle()); date.setText(DateFormatter.formatAbbrev(activity, item.getPubDate())); + date.setContentDescription(DateFormatter.formatForAccessibility(item.getPubDate())); ItemActionButton actionButton = ItemActionButton.forItem(item); actionButton.configure(secondaryActionIcon, secondaryActionIcon, activity); secondaryActionIcon.setFocusable(false); |