Merge "Adding progress information for preload icons in content description" into ub-launcher3-burnaby-polish
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index a6a1f4e..70bf859 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -25,6 +25,8 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Region;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
@@ -190,6 +192,15 @@
}
/**
+ * Used for measurement only, sets some dummy values on this view.
+ */
+ public void applyDummyInfo() {
+ ColorDrawable d = new ColorDrawable();
+ setIcon(mLauncher.resizeIconDrawable(d), mIconSize);
+ setText("");
+ }
+
+ /**
* Overrides the default long press timeout.
*/
public void setLongPressTimeout(int longPressTimeout) {
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index e5bfe19..40a4678 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -306,14 +306,10 @@
setOnClickListener(enable ? this : null);
}
- protected String getAccessibilityDropConfirmation() {
- return null;
- }
-
@Override
public void onClick(View v) {
LauncherAppState.getInstance().getAccessibilityDelegate()
- .handleAccessibleDrop(this, null, getAccessibilityDropConfirmation());
+ .handleAccessibleDrop(this, null, null);
}
public int getTextColor() {
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index 2a0e203..edaf525 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -125,9 +125,4 @@
dragLayer.animateView(d.dragView, fling, duration, tInterpolator, onAnimationEndRunnable,
DragLayer.ANIMATION_END_DISAPPEAR, null);
}
-
- @Override
- protected String getAccessibilityDropConfirmation() {
- return getResources().getString(R.string.item_removed);
- }
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 370f695..56c8d76 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4678,18 +4678,6 @@
UserHandleCompat.myUserHandle());
}
- /**
- * Generates a dummy AppInfo for us to use to calculate BubbleTextView sizes.
- */
- public AppInfo createDummyAppInfo() {
- Intent intent = new Intent();
- intent.setComponent(new ComponentName(this, Launcher.class));
- PackageManager pm = getPackageManager();
- ResolveInfo info = pm.resolveActivity(intent, 0);
- return new AppInfo(this, LauncherActivityInfoCompat.fromResolveInfo(info, this),
- UserHandleCompat.myUserHandle(), mIconCache);
- }
-
// TODO: This method should be a part of LauncherSearchCallback
public void startDrag(View dragView, ItemInfo dragInfo, DragSource source) {
dragView.setTag(dragInfo);
@@ -4721,8 +4709,9 @@
/**
* Resizes an icon drawable to the correct icon size.
*/
- public void resizeIconDrawable(Drawable icon) {
+ public Drawable resizeIconDrawable(Drawable icon) {
icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx);
+ return icon;
}
/**
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 90f1322..f9bb134 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -336,15 +336,18 @@
// Precalculate the prediction icon and normal icon sizes
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
- BubbleTextView icon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_icon, this, false);
- icon.applyFromApplicationInfo(mLauncher.createDummyAppInfo());
+ BubbleTextView icon = (BubbleTextView) layoutInflater.inflate(
+ R.layout.all_apps_icon, this, false);
+ icon.applyDummyInfo();
icon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST));
- BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_prediction_bar_icon, this, false);
- predIcon.applyFromApplicationInfo(mLauncher.createDummyAppInfo());
+ BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate(
+ R.layout.all_apps_prediction_bar_icon, this, false);
+ predIcon.applyDummyInfo();
predIcon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST));
- mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(), icon.getMeasuredHeight());
+ mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(),
+ icon.getMeasuredHeight());
updateBackgroundAndPaddings();
}