Loading res/values/styles.xml +1 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,7 @@ <style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault.Medium"> <item name="android:drawablePadding">@dimen/drop_target_button_drawable_padding</item> <item name="android:padding">14dp</item> <item name="android:includeFontPadding">false</item> <item name="android:textColor">@color/drop_target_text</item> <item name="android:textSize">@dimen/drop_target_text_size</item> <item name="android:singleLine">true</item> Loading src/com/android/launcher3/ButtonDropTarget.java +5 −10 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import android.content.Context; import android.content.res.Resources; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.InputType; Loading Loading @@ -58,8 +59,6 @@ public abstract class ButtonDropTarget extends TextView public static final int TOOLTIP_LEFT = 1; public static final int TOOLTIP_RIGHT = 2; private final Rect mTempRect = new Rect(); protected final ActivityContext mActivityContext; protected final DropTargetHandler mDropTargetHandler; protected DropTargetBar mDropTargetBar; Loading Loading @@ -417,15 +416,11 @@ public abstract class ButtonDropTarget extends TextView */ @VisibleForTesting protected boolean isTextClippedVertically(int availableHeight) { availableHeight -= getPaddingTop() + getPaddingBottom(); if (availableHeight <= 0) { return true; } Paint.FontMetricsInt fontMetricsInt = getPaint().getFontMetricsInt(); int lineCount = (getLineCount() <= 0) ? 1 : getLineCount(); int textHeight = lineCount * (fontMetricsInt.bottom - fontMetricsInt.top); getPaint().getTextBounds(mText.toString(), 0, mText.length(), mTempRect); // Add bounds bottom to height, as text bounds height measures from the text baseline and // above, which characters can descend below return mTempRect.bottom + mTempRect.height() >= availableHeight; return textHeight + getPaddingTop() + getPaddingBottom() >= availableHeight; } /** Loading src/com/android/launcher3/DropTargetBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public class DropTargetBar extends FrameLayout firstButton.setTextVisible(true); firstButton.setIconVisible(true); firstButton.measure(widthSpec, heightSpec); firstButton.resizeTextToFit(); } else if (visibleCount == 2) { DeviceProfile dp = mLauncher.getDeviceProfile(); int verticalPadding = dp.dropTargetVerticalPaddingPx; Loading Loading
res/values/styles.xml +1 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,7 @@ <style name="DropTargetButtonBase" parent="@android:style/TextAppearance.DeviceDefault.Medium"> <item name="android:drawablePadding">@dimen/drop_target_button_drawable_padding</item> <item name="android:padding">14dp</item> <item name="android:includeFontPadding">false</item> <item name="android:textColor">@color/drop_target_text</item> <item name="android:textSize">@dimen/drop_target_text_size</item> <item name="android:singleLine">true</item> Loading
src/com/android/launcher3/ButtonDropTarget.java +5 −10 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import android.content.Context; import android.content.res.Resources; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.InputType; Loading Loading @@ -58,8 +59,6 @@ public abstract class ButtonDropTarget extends TextView public static final int TOOLTIP_LEFT = 1; public static final int TOOLTIP_RIGHT = 2; private final Rect mTempRect = new Rect(); protected final ActivityContext mActivityContext; protected final DropTargetHandler mDropTargetHandler; protected DropTargetBar mDropTargetBar; Loading Loading @@ -417,15 +416,11 @@ public abstract class ButtonDropTarget extends TextView */ @VisibleForTesting protected boolean isTextClippedVertically(int availableHeight) { availableHeight -= getPaddingTop() + getPaddingBottom(); if (availableHeight <= 0) { return true; } Paint.FontMetricsInt fontMetricsInt = getPaint().getFontMetricsInt(); int lineCount = (getLineCount() <= 0) ? 1 : getLineCount(); int textHeight = lineCount * (fontMetricsInt.bottom - fontMetricsInt.top); getPaint().getTextBounds(mText.toString(), 0, mText.length(), mTempRect); // Add bounds bottom to height, as text bounds height measures from the text baseline and // above, which characters can descend below return mTempRect.bottom + mTempRect.height() >= availableHeight; return textHeight + getPaddingTop() + getPaddingBottom() >= availableHeight; } /** Loading
src/com/android/launcher3/DropTargetBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public class DropTargetBar extends FrameLayout firstButton.setTextVisible(true); firstButton.setIconVisible(true); firstButton.measure(widthSpec, heightSpec); firstButton.resizeTextToFit(); } else if (visibleCount == 2) { DeviceProfile dp = mLauncher.getDeviceProfile(); int verticalPadding = dp.dropTargetVerticalPaddingPx; Loading