mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Merge "Remove drop target button drawable padding if text is hidden" into sc-qpr1-dev
This commit is contained in:
@@ -197,6 +197,7 @@
|
||||
<dimen name="drop_target_text_size">16sp</dimen>
|
||||
<dimen name="drop_target_shadow_elevation">2dp</dimen>
|
||||
<dimen name="drop_target_bar_margin_horizontal">4dp</dimen>
|
||||
<dimen name="drop_target_button_drawable_padding">8dp</dimen>
|
||||
|
||||
<!-- the distance an icon must be dragged before button drop targets accept it -->
|
||||
<dimen name="drag_distanceThreshold">30dp</dimen>
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
|
||||
<!-- Drop targets -->
|
||||
<style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault">
|
||||
<item name="android:drawablePadding">8dp</item>
|
||||
<item name="android:drawablePadding">@dimen/drop_target_button_drawable_padding</item>
|
||||
<item name="android:padding">14dp</item>
|
||||
<item name="android:textColor">@color/drop_target_text</item>
|
||||
<item name="android:textSize">@dimen/drop_target_text_size</item>
|
||||
|
||||
@@ -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
|
||||
@@ -303,6 +307,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