Improved date header accessibility

This commit is contained in:
M66B 2019-12-29 12:51:19 +01:00
parent 149dee4081
commit 4153312502
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
@ -622,6 +623,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
new Date().getTime(),
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),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight());