Make the text for the drop target buttons fit if it's too long.

The text "Don't suggest app" is too long when the device language
is GE or JA, or if you make the text bigger in settings.

Before truncating the text completely we are going to try to make
the text smaller until it gets to a predefined value
(button_drop_target_min_text_size).

Test: Change the language to German (Deutch) and install a new app and drag it to the workspace to see the button "App nicht vorschlagen"
Test: Also, a nice way to test is to go to SecondaryDropTarget#setupUi and hardcode the option to always show "Don't suggest app"
Fix: 221480721
Change-Id: I99def4e23cd17109a297aecaa620cef7a0d137e7
diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java
index 73289fb..b94cdbf 100644
--- a/src/com/android/launcher3/DropTargetBar.java
+++ b/src/com/android/launcher3/DropTargetBar.java
@@ -140,9 +140,22 @@
         if (visibleCount > 0) {
             int availableWidth = width / visibleCount;
             boolean textVisible = true;
-            for (ButtonDropTarget buttons : mDropTargets) {
-                if (buttons.getVisibility() != GONE) {
-                    textVisible = textVisible && !buttons.isTextTruncated(availableWidth);
+            boolean textResized = false;
+            float textSize = mDropTargets[0].getTextSize();
+            for (ButtonDropTarget button : mDropTargets) {
+                if (button.getVisibility() == GONE) {
+                    continue;
+                }
+                if (button.isTextTruncated(availableWidth)) {
+                    textSize = Math.min(textSize, button.resizeTextToFit(availableWidth));
+                    textResized = true;
+                }
+                textVisible = textVisible && !button.isTextTruncated(availableWidth);
+            }
+
+            if (textResized) {
+                for (ButtonDropTarget button : mDropTargets) {
+                    button.setTextSize(textSize);
                 }
             }