diff options
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher3/dragndrop/DragController.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/graphics/DragPreviewProvider.java | 15 |
4 files changed, 13 insertions, 29 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 66aab4328..12870a1fb 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -79,7 +79,6 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.animation.OvershootInterpolator; import android.view.inputmethod.InputMethodManager; -import android.widget.TextView; import android.widget.Toast; import com.android.launcher3.DropTarget.DragObject; @@ -2626,9 +2625,9 @@ public class Launcher extends BaseActivity if (Utilities.ATLEAST_MARSHMALLOW) { int left = 0, top = 0; int width = v.getMeasuredWidth(), height = v.getMeasuredHeight(); - if (v instanceof TextView) { + if (v instanceof BubbleTextView) { // Launch from center of icon, not entire view - Drawable icon = Workspace.getTextViewIcon((TextView) v); + Drawable icon = ((BubbleTextView) v).getIcon(); if (icon != null) { Rect bounds = icon.getBounds(); left = (width - bounds.width()) / 2; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 0fabeebbf..767e33278 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -51,7 +51,6 @@ import android.view.ViewGroup; import android.view.accessibility.AccessibilityManager; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; -import android.widget.TextView; import android.widget.Toast; import com.android.launcher3.Launcher.CustomContentCallbacks; import com.android.launcher3.Launcher.LauncherOverlay; @@ -2083,19 +2082,6 @@ public class Workspace extends PagedView } } - /** - * Returns the drawable for the given text view. - */ - public static Drawable getTextViewIcon(TextView tv) { - final Drawable[] drawables = tv.getCompoundDrawables(); - for (int i = 0; i < drawables.length; i++) { - if (drawables[i] != null) { - return drawables[i]; - } - } - return null; - } - public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) { View child = cellInfo.cell; @@ -3865,7 +3851,7 @@ public class Workspace extends PagedView updates.contains(info)) { ShortcutInfo si = (ShortcutInfo) info; BubbleTextView shortcut = (BubbleTextView) v; - Drawable oldIcon = getTextViewIcon(shortcut); + Drawable oldIcon = shortcut.getIcon(); boolean oldPromiseState = (oldIcon instanceof PreloadIconDrawable) && ((PreloadIconDrawable) oldIcon).hasNotCompleted(); shortcut.applyFromShortcutInfo(si, si.isPromise() != oldPromiseState); diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index 50ad0ff8a..b8527148b 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -210,13 +210,13 @@ public class DragController implements DragDriver.EventListener, TouchController } private void callOnDragStart() { - for (DragListener listener : new ArrayList<>(mListeners)) { - listener.onDragStart(mDragObject, mOptions); - } if (mOptions.preDragCondition != null) { mOptions.preDragCondition.onPreDragEnd(mDragObject, true /* dragStarted*/); } mIsInPreDrag = false; + for (DragListener listener : new ArrayList<>(mListeners)) { + listener.onDragStart(mDragObject, mOptions); + } } /** diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java index 492d85373..10e91c0a8 100644 --- a/src/com/android/launcher3/graphics/DragPreviewProvider.java +++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java @@ -23,12 +23,11 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.view.View; -import android.widget.TextView; +import com.android.launcher3.BubbleTextView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppWidgetHostView; import com.android.launcher3.R; -import com.android.launcher3.Workspace; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; @@ -57,8 +56,8 @@ public class DragPreviewProvider { blurSizeOutline = context.getResources().getDimensionPixelSize(R.dimen.blur_size_medium_outline); - if (mView instanceof TextView) { - Drawable d = Workspace.getTextViewIcon((TextView) mView); + if (mView instanceof BubbleTextView) { + Drawable d = ((BubbleTextView) mView).getIcon(); Rect bounds = getDrawableBounds(d); previewPadding = blurSizeOutline - bounds.left - bounds.top; } else { @@ -71,8 +70,8 @@ public class DragPreviewProvider { */ private void drawDragView(Canvas destCanvas) { destCanvas.save(); - if (mView instanceof TextView) { - Drawable d = Workspace.getTextViewIcon((TextView) mView); + if (mView instanceof BubbleTextView) { + Drawable d = ((BubbleTextView) mView).getIcon(); Rect bounds = getDrawableBounds(d); destCanvas.translate(blurSizeOutline / 2 - bounds.left, blurSizeOutline / 2 - bounds.top); @@ -112,8 +111,8 @@ public class DragPreviewProvider { int width = mView.getWidth(); int height = mView.getHeight(); - if (mView instanceof TextView) { - Drawable d = Workspace.getTextViewIcon((TextView) mView); + if (mView instanceof BubbleTextView) { + Drawable d = ((BubbleTextView) mView).getIcon(); Rect bounds = getDrawableBounds(d); width = bounds.width(); height = bounds.height(); |