Merge "Center drop target icons in landscape mode." into sc-dev

This commit is contained in:
Yogisha Dixit
2021-06-17 09:34:42 +00:00
committed by Android (Google) Code Review
3 changed files with 7 additions and 16 deletions

View File

@@ -48,7 +48,7 @@
<dimen name="workspace_page_indicator_overlap_workspace">0dp</dimen>
<!-- Drop target bar -->
<dimen name="dynamic_grid_drop_target_size">48dp</dimen>
<dimen name="dynamic_grid_drop_target_size">52dp</dimen>
<dimen name="drop_target_vertical_gap">20dp</dimen>
<!-- App Widget resize frame -->

View File

@@ -266,9 +266,8 @@
<!-- Drop targets -->
<style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:drawablePadding">7.5dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:drawablePadding">8dp</item>
<item name="android:padding">16dp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">@dimen/drop_target_text_size</item>
<item name="android:singleLine">true</item>

View File

@@ -121,19 +121,11 @@ public abstract class ButtonDropTarget extends TextView
}
protected void setDrawable(int resId) {
mDrawable = getContext().getDrawable(resId).mutate();
mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
setDrawable(mDrawable);
}
private void setDrawable(Drawable drawable) {
// We do not set the drawable in the xml as that inflates two drawables corresponding to
// drawableLeft and drawableStart.
if (mTextVisible) {
setCompoundDrawablesRelative(drawable, null, null, null);
} else {
setCompoundDrawablesRelative(null, drawable, null, null);
}
mDrawable = getContext().getDrawable(resId).mutate();
mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
setCompoundDrawablesRelative(mDrawable, null, null, null);
}
public void setDropTargetBar(DropTargetBar dropTargetBar) {
@@ -334,7 +326,7 @@ public abstract class ButtonDropTarget extends TextView
if (mTextVisible != isVisible || !TextUtils.equals(newText, getText())) {
mTextVisible = isVisible;
setText(newText);
setDrawable(mDrawable);
setCompoundDrawablesRelative(mDrawable, null, null, null);
}
}