Initial Changes for Dynamic Grid

Change-Id: I9e6f1e5167791cf8dc140778dfa447f86424e9bf
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 868e3ac..bb6903d 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -25,6 +25,7 @@
 import android.graphics.Region.Op;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
+import android.util.TypedValue;
 import android.view.MotionEvent;
 import android.widget.TextView;
 
@@ -34,7 +35,6 @@
  * too aggressive.
  */
 public class BubbleTextView extends TextView {
-    static final float CORNER_RADIUS = 4.0f;
     static final float SHADOW_LARGE_RADIUS = 4.0f;
     static final float SHADOW_SMALL_RADIUS = 1.75f;
     static final float SHADOW_Y_OFFSET = 2.0f;
@@ -55,6 +55,8 @@
     private int mPressedOutlineColor;
     private int mPressedGlowColor;
 
+    private boolean mIsTextVisible;
+
     private boolean mBackgroundSizeChanged;
     private Drawable mBackground;
 
@@ -76,6 +78,15 @@
         init();
     }
 
+    public void onFinishInflate() {
+        super.onFinishInflate();
+
+        // Ensure we are using the right text size
+        LauncherAppState app = LauncherAppState.getInstance();
+        DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+        setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
+    }
+
     private void init() {
         mLongPressHelper = new CheckLongPressHelper(this);
         mBackground = getBackground();
@@ -326,6 +337,20 @@
         if (mBackground != null) mBackground.setCallback(null);
     }
 
+    public void setTextVisibility(boolean visible) {
+        Resources res = getResources();
+        if (visible) {
+            setTextColor(res.getColor(R.color.workspace_icon_text_color));
+        } else {
+            setTextColor(res.getColor(android.R.color.transparent));
+        }
+        mIsTextVisible = visible;
+    }
+
+    public boolean isTextVisible() {
+        return mIsTextVisible;
+    }
+
     @Override
     protected boolean onSetAlpha(int alpha) {
         if (mPrevAlpha != alpha) {