Better content descriptions for TalkBack (#6684)
This commit is contained in:
parent
3fae29b375
commit
c38b263458
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:title="@string/add_feed_label"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
android:minHeight="?attr/actionBarSize"
|
||||
android:layout_alignParentTop="true"
|
||||
app:navigationIcon="?homeAsUpIndicator"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:layout_collapseMode="pin" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
|
|
@ -16,55 +16,6 @@
|
|||
android:orientation="horizontal"
|
||||
android:gravity="bottom">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:background="@color/image_readability_tint"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<View
|
||||
android:layout_width="148dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butShowInfo"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/show_info_label"
|
||||
android:layout_marginLeft="-8dp"
|
||||
android:layout_marginStart="-8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_info_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butFilter"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/filter"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_filter_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butShowSettings"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/show_feed_settings_label"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_settings_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
|
@ -138,6 +89,55 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:background="@color/image_readability_tint"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<View
|
||||
android:layout_width="148dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butShowInfo"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/show_info_label"
|
||||
android:layout_marginLeft="-8dp"
|
||||
android:layout_marginStart="-8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_info_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butFilter"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/filter"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_filter_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butShowSettings"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/show_feed_settings_label"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/ic_settings_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.joanzapata.iconify.widget.IconTextView
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:title="@string/discover"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/subscriptions_label"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
android:layout_marginLeft="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/shuffle_suggestions"
|
||||
app:layout_constraintBottom_toBottomOf="@id/barrier"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/titleLabel"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator"
|
||||
app:title="@string/queue_label" />
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:title="@string/search_label"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
android:gravity="start"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:lines="2"
|
||||
android:importantForAccessibility="no"
|
||||
tools:text="@sample/episodes.json/data/title" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,6 +4,8 @@ plugins {
|
|||
apply from: "../../common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation project(":ui:i18n")
|
||||
|
||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationContentDescription="@string/toolbar_back_button_content_description"
|
||||
app:navigationIcon="?homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -685,6 +685,8 @@
|
|||
<string name="play_chapter">Play chapter</string>
|
||||
<string name="prev_chapter">Previous chapter</string>
|
||||
<string name="next_chapter">Next chapter</string>
|
||||
<string name="shuffle_suggestions">Shuffle suggestions</string>
|
||||
<string name="add_preset">Add preset</string>
|
||||
|
||||
<!-- Feed settings/information screen -->
|
||||
<string name="authentication_label">Authentication</string>
|
||||
|
|
Loading…
Reference in New Issue