Improved date header accessibility

pull/171/head
M66B 5 years ago
parent 149dee4081
commit 4153312502

@ -42,6 +42,7 @@ import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Parcel; import android.os.Parcel;
@ -622,6 +623,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
new Date().getTime(), new Date().getTime(),
DAY_IN_MILLIS, 0)); DAY_IN_MILLIS, 0));
header.setContentDescription(tvDate.getText().toString());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
header.setAccessibilityHeading(true);
header.measure(View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View.MeasureSpec.EXACTLY), header.measure(View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight()); header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight());

Loading…
Cancel
Save