mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Remove drop target button drawable padding if text isn't hidden
Test: manual Fix: 194320733 Change-Id: I12adeaf37cee5a0fcf383641f24b7750f14daf27
This commit is contained in:
@@ -66,6 +66,8 @@ public abstract class ButtonDropTarget extends TextView
|
||||
private final int mDragDistanceThreshold;
|
||||
/** The size of the drawable shown in the drop target. */
|
||||
private final int mDrawableSize;
|
||||
/** The padding, in pixels, between the text and drawable. */
|
||||
private final int mDrawablePadding;
|
||||
|
||||
protected CharSequence mText;
|
||||
protected Drawable mDrawable;
|
||||
@@ -85,6 +87,8 @@ public abstract class ButtonDropTarget extends TextView
|
||||
Resources resources = getResources();
|
||||
mDragDistanceThreshold = resources.getDimensionPixelSize(R.dimen.drag_distanceThreshold);
|
||||
mDrawableSize = resources.getDimensionPixelSize(R.dimen.drop_target_text_size);
|
||||
mDrawablePadding = resources.getDimensionPixelSize(
|
||||
R.dimen.drop_target_button_drawable_padding);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,6 +304,8 @@ public abstract class ButtonDropTarget extends TextView
|
||||
mTextVisible = isVisible;
|
||||
setText(newText);
|
||||
setCompoundDrawablesRelative(mDrawable, null, null, null);
|
||||
int drawablePadding = mTextVisible ? mDrawablePadding : 0;
|
||||
setCompoundDrawablePadding(drawablePadding);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user