Merge "Improve Talkback for user select dialog" into tm-dev
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/widget_frame"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="112dp">
|
||||
android:layout_height="112dp"
|
||||
android:importantForAccessibility="no">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/button"
|
||||
@@ -41,7 +41,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:labelFor="@android:id/icon"
|
||||
android:textSize="14sp"
|
||||
android:importantForAccessibility="no"
|
||||
style="@style/TextAppearance.PreferenceTitle.SettingsLib"/>
|
||||
</RelativeLayout>
|
||||
|
@@ -120,7 +120,7 @@ public class UserAdapter extends BaseAdapter {
|
||||
private void bindViewHolder(ViewHolder holder, int position) {
|
||||
UserDetails userDetails = getItem(position);
|
||||
holder.getIconView().setImageDrawable(userDetails.mIcon);
|
||||
holder.getTitleView().setText(userDetails.mTitle);
|
||||
holder.setTitle(userDetails.mTitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,18 +206,19 @@ public class UserAdapter extends BaseAdapter {
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView mIconView;
|
||||
private final TextView mTitleView;
|
||||
private final View mButtonView;
|
||||
|
||||
private ViewHolder(View view) {
|
||||
super(view);
|
||||
mIconView = view.findViewById(android.R.id.icon);
|
||||
mTitleView = view.findViewById(android.R.id.title);
|
||||
mButtonView = view.findViewById(R.id.button);
|
||||
}
|
||||
|
||||
private ViewHolder(View view, OnClickListener onClickListener) {
|
||||
this(view);
|
||||
View button = view.findViewById(R.id.button);
|
||||
if (button != null) {
|
||||
button.setOnClickListener(v -> onClickListener.onClick(getAdapterPosition()));
|
||||
if (mButtonView != null) {
|
||||
mButtonView.setOnClickListener(v -> onClickListener.onClick(getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,8 +226,11 @@ public class UserAdapter extends BaseAdapter {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
private TextView getTitleView() {
|
||||
return mTitleView;
|
||||
private void setTitle(CharSequence title) {
|
||||
mTitleView.setText(title);
|
||||
if (mButtonView != null) {
|
||||
mButtonView.setContentDescription(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user