Better content descriptions for the account list items

Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
This commit is contained in:
Peter Vágner 2019-12-28 20:59:04 +01:00 committed by M66B
parent 5050a8f0a8
commit 76ece08d8f
2 changed files with 14 additions and 8 deletions

View File

@ -135,6 +135,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
vwColor.setVisibility(ActivityBilling.isPro(context) ? View.VISIBLE : View.INVISIBLE);
ivSync.setImageResource(account.synchronize ? R.drawable.baseline_sync_24 : R.drawable.baseline_sync_disabled_24);
ivSync.setContentDescription(context.getString(account.synchronize ? R.string.title_legend_synchronize_on : R.string.title_legend_synchronize_off));
ivOAuth.setVisibility(
settings && account.auth_type != MailService.AUTH_TYPE_PASSWORD ? View.VISIBLE : View.GONE);
@ -155,14 +156,19 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvUser.setText(account.user);
if ("connected".equals(account.state))
if ("connected".equals(account.state)) {
ivState.setImageResource(R.drawable.baseline_cloud_24);
else if ("connecting".equals(account.state))
ivState.setContentDescription(context.getString(R.string.title_legend_connected));
} else if ("connecting".equals(account.state)) {
ivState.setImageResource(R.drawable.baseline_cloud_queue_24);
else if ("closing".equals(account.state))
ivState.setContentDescription(context.getString(R.string.title_legend_connecting));
} else if ("closing".equals(account.state)) {
ivState.setImageResource(R.drawable.baseline_close_24);
else
ivState.setContentDescription(context.getString(R.string.title_legend_closing));
} else {
ivState.setImageResource(R.drawable.baseline_cloud_off_24);
ivState.setContentDescription(context.getString(R.string.title_legend_disconnected));
}
ivState.setVisibility(account.synchronize || account.state != null ? View.VISIBLE : View.INVISIBLE);
tvHost.setText(String.format("%s:%d", account.host, account.port));

View File

@ -38,7 +38,7 @@
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:contentDescription="@string/title_legend_connection_state"
android:contentDescription="@string/title_legend_disconnected"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toTopOf="@+id/tvName"
@ -49,7 +49,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/title_legend_primary"
android:contentDescription="@string/title_legend_oauth"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/ivState"
app:layout_constraintTop_toTopOf="@+id/tvName"
@ -98,7 +98,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:contentDescription="@string/title_legend_sync_state"
android:contentDescription="@string/title_legend_synchronize_on"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvName"
@ -231,4 +231,4 @@
app:constraint_referenced_ids="ivSync,tvHost" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ViewCardOptional>
</FrameLayout>
</FrameLayout>