Better content descriptions for the folder list item

Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
pull/171/head
Peter Vágner 5 years ago committed by M66B
parent 76ece08d8f
commit 8ae56d0326

@ -188,26 +188,34 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
vwColor.setVisibility(ActivityBilling.isPro(context) ? View.VISIBLE : View.GONE); vwColor.setVisibility(ActivityBilling.isPro(context) ? View.VISIBLE : View.GONE);
if (folder.sync_state == null || "requested".equals(folder.sync_state)) { if (folder.sync_state == null || "requested".equals(folder.sync_state)) {
if (folder.executing > 0) if (folder.executing > 0) {
ivState.setImageResource(R.drawable.baseline_dns_24); ivState.setImageResource(R.drawable.baseline_dns_24);
else if ("waiting".equals(folder.state)) ivState.setContentDescription(context.getString(R.string.title_legend_executing));
} else if ("waiting".equals(folder.state)) {
ivState.setImageResource(R.drawable.baseline_hourglass_empty_24); ivState.setImageResource(R.drawable.baseline_hourglass_empty_24);
else if ("connected".equals(folder.state)) ivState.setContentDescription(context.getString(R.string.title_legend_waiting));
} else if ("connected".equals(folder.state)) {
ivState.setImageResource(R.drawable.baseline_cloud_24); ivState.setImageResource(R.drawable.baseline_cloud_24);
else if ("connecting".equals(folder.state)) ivState.setContentDescription(context.getString(R.string.title_legend_connected));
} else if ("connecting".equals(folder.state)) {
ivState.setImageResource(R.drawable.baseline_cloud_queue_24); ivState.setImageResource(R.drawable.baseline_cloud_queue_24);
else if ("closing".equals(folder.state)) ivState.setContentDescription(context.getString(R.string.title_legend_connecting));
}else if ("closing".equals(folder.state)) {
ivState.setImageResource(R.drawable.baseline_close_24); ivState.setImageResource(R.drawable.baseline_close_24);
else if (folder.state == null) ivState.setContentDescription(context.getString(R.string.title_legend_closing));
} else if (folder.state == null) {
ivState.setImageResource(R.drawable.baseline_cloud_off_24); ivState.setImageResource(R.drawable.baseline_cloud_off_24);
else ivState.setContentDescription(context.getString(R.string.title_legend_disconnected));
} else
ivState.setImageResource(R.drawable.baseline_warning_24); ivState.setImageResource(R.drawable.baseline_warning_24);
} else { } else {
if ("syncing".equals(folder.sync_state)) if ("syncing".equals(folder.sync_state)) {
ivState.setImageResource(R.drawable.baseline_compare_arrows_24); ivState.setImageResource(R.drawable.baseline_compare_arrows_24);
else if ("downloading".equals(folder.sync_state)) ivState.setContentDescription(context.getString(R.string.title_legend_synchronizing));
} else if ("downloading".equals(folder.sync_state)) {
ivState.setImageResource(R.drawable.baseline_cloud_download_24); ivState.setImageResource(R.drawable.baseline_cloud_download_24);
else ivState.setContentDescription(context.getString(R.string.title_legend_downloading));
} else
ivState.setImageResource(R.drawable.baseline_warning_24); ivState.setImageResource(R.drawable.baseline_warning_24);
} }
ivState.setVisibility( ivState.setVisibility(
@ -223,6 +231,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
vwLevel.setLayoutParams(lp); vwLevel.setLayoutParams(lp);
ibExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */); ibExpander.setImageLevel(folder.collapsed ? 1 /* more */ : 0 /* less */);
ibExpander.setContentDescription(context.getString(folder.collapsed ? R.string.title_accessibility_expand : R.string.title_accessibility_collapse));
ibExpander.setVisibility(account < 0 || !folder.expander ibExpander.setVisibility(account < 0 || !folder.expander
? View.GONE ? View.GONE
: folder.child_refs != null && folder.child_refs.size() > 0 : folder.child_refs != null && folder.child_refs.size() > 0
@ -279,6 +288,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (folder.account == null) { if (folder.account == null) {
tvAfter.setText(null); tvAfter.setText(null);
ivSync.setImageResource(R.drawable.baseline_sync_24); ivSync.setImageResource(R.drawable.baseline_sync_24);
ivSync.setContentDescription(context.getString(R.string.title_legend_synchronize_on));
} else { } else {
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
@ -296,6 +306,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
tvAfter.setText(a.toString()); tvAfter.setText(a.toString());
ivSync.setImageResource(folder.synchronize ? R.drawable.baseline_sync_24 : R.drawable.baseline_sync_disabled_24); ivSync.setImageResource(folder.synchronize ? R.drawable.baseline_sync_24 : R.drawable.baseline_sync_disabled_24);
ivSync.setContentDescription(context.getString(folder.synchronize ? R.string.title_legend_synchronize_on : R.string.title_legend_synchronize_off));
} }
ivSync.setImageTintList(ColorStateList.valueOf( ivSync.setImageTintList(ColorStateList.valueOf(
folder.synchronize && folder.initialize != 0 && !EntityFolder.OUTBOX.equals(folder.type) folder.synchronize && folder.initialize != 0 && !EntityFolder.OUTBOX.equals(folder.type)

@ -82,7 +82,7 @@
android:id="@+id/ivSubscribed" android:id="@+id/ivSubscribed"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="24dp" android:layout_height="24dp"
android:contentDescription="@string/title_legend_notify" android:contentDescription="@string/title_legend_subscribed"
android:paddingEnd="6dp" android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="@+id/tvName" app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/ivUnified" app:layout_constraintStart_toEndOf="@id/ivUnified"
@ -143,7 +143,6 @@
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:contentDescription="@string/title_legend_count"
app:layout_constraintBottom_toBottomOf="@+id/tvName" app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvName" app:layout_constraintTop_toTopOf="@+id/tvName"
@ -153,7 +152,6 @@
android:id="@+id/ivType" android:id="@+id/ivType"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="24dp" android:layout_height="24dp"
android:contentDescription="@string/title_legend_folder_type"
android:paddingEnd="6dp" android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="@+id/tvType" app:layout_constraintBottom_toBottomOf="@+id/tvType"
app:layout_constraintStart_toEndOf="@id/ibExpander" app:layout_constraintStart_toEndOf="@id/ibExpander"
@ -207,7 +205,6 @@
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:contentDescription="@string/title_legend_sync_state"
app:layout_constraintBottom_toBottomOf="@id/tvType" app:layout_constraintBottom_toBottomOf="@id/tvType"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvType" app:layout_constraintTop_toTopOf="@+id/tvType"

Loading…
Cancel
Save