Fix size of RemoteInputView to for a11y

Fixes: 164065068
Fixes: 186590902
Test: talkback inspection of targets, etc.
Change-Id: I594c9bd0ddccfa436fd8346361afe0449c001710
This commit is contained in:
Jeff DeCew
2021-05-18 16:53:02 -04:00
parent 551a988b60
commit cb667da70b
3 changed files with 21 additions and 30 deletions

View File

@@ -21,10 +21,10 @@
android:width="@dimen/remote_input_view_text_stroke"
android:color="?android:attr/colorAccent"/>
<padding
android:bottom="12dp"
android:bottom="0dp"
android:left="12dp"
android:right="12dp"
android:top="12dp"/>
android:top="0dp"/>
<corners android:radius="24dp" />

View File

@@ -28,18 +28,18 @@
android:id="@+id/remote_input_content"
android:orientation="vertical"
android:clipToPadding="false"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="16dp"
android:layout_weight="1">
<FrameLayout
android:id="@+id/remote_input_content_container"
android:layout_marginTop="-6dp"
android:layout_height="60dp"
android:layout_width="60dp"
android:layout_height="66dp"
android:layout_width="66dp"
android:layout_marginTop="0dp"
android:layout_marginStart="4dp"
android:layout_marginBottom="12dp"
android:layout_marginBottom="0dp"
android:visibility="gone"
android:layout_gravity="center_vertical">
<ImageView
@@ -52,18 +52,20 @@
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/remote_input_delete_bg"
android:paddingStart="24dp"
android:paddingBottom="24dp"
android:paddingTop="6dp"
android:paddingEnd="6dp"
android:paddingStart="18dp"
android:paddingBottom="18dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="end|top"
android:src="@drawable/thumbnail_delete_btn_bg"/>
<ImageView
android:id="@+id/remote_input_delete"
android:paddingTop="3dp"
android:paddingEnd="3dp"
android:paddingStart="27dp"
android:paddingBottom="27dp"
android:paddingTop="9dp"
android:paddingEnd="9dp"
android:paddingStart="21dp"
android:paddingBottom="21dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="end|top"
@@ -76,9 +78,9 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1"
android:paddingTop="2dp"
android:paddingTop="14dp"
android:paddingStart="4dp"
android:paddingBottom="4dp"
android:paddingBottom="16dp"
android:paddingEnd="12dp"
android:layout_gravity="start|center_vertical"
android:textAppearance="?android:attr/textAppearance"
@@ -93,7 +95,7 @@
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">

View File

@@ -35,7 +35,6 @@ import android.graphics.BlendMode;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
@@ -228,8 +227,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
alternateTextColor = ta.getColor(3, backgroundColor);
}
}
mEditText.setAllColors(backgroundColor, editBgColor,
accentColor, textColor, hintTextColor);
final ColorStateList accentTint = new ColorStateList(new int[][]{
new int[]{com.android.internal.R.attr.state_enabled},
new int[]{},
@@ -237,6 +234,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
accentColor,
accentColor & 0x4DFFFFFF // %30 opacity
});
mEditText.setAllColors(accentColor, textColor, hintTextColor);
mContentBackground.setColor(editBgColor);
mContentBackground.setStroke(stroke, accentTint);
mDelete.setImageTintList(ColorStateList.valueOf(alternateTextColor));
@@ -875,7 +873,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
private final OnReceiveContentListener mOnReceiveContentListener = this::onReceiveContent;
private RemoteInputView mRemoteInputView;
private ColorDrawable mBackground;
boolean mShowImeOnInputConnection;
private LightBarController mLightBarController;
private InputMethodManager mInputMethodManager;
@@ -885,8 +882,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
public RemoteEditText(Context context, AttributeSet attrs) {
super(context, attrs);
mLightBarController = Dependency.get(LightBarController.class);
mBackground = new ColorDrawable();
}
void setSupportedMimeTypes(@Nullable Collection<String> mimeTypes) {
@@ -1045,9 +1040,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
if (focusable) {
requestFocus();
setBackground(mBackground);
} else {
setBackground(null);
}
}
@@ -1062,10 +1054,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
return remainingItems;
}
protected void setAllColors(int backgroundColor, int editBackgroundColor,
int accentColor, int textColor, int hintTextColor) {
setBackgroundColor(editBackgroundColor);
mBackground.setColor(editBackgroundColor);
protected void setAllColors(int accentColor, int textColor, int hintTextColor) {
setTextColor(textColor);
setHintTextColor(hintTextColor);
getTextCursorDrawable().setColorFilter(accentColor, PorterDuff.Mode.SRC_IN);