summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2017-06-23 14:57:38 -0700
committerHyunyoung Song <hyunyoungs@google.com>2017-06-26 11:25:01 -0700
commit1322f9cb9a8715d463094e13079af7e6e689429a (patch)
tree2e9a1809d3f3be291de492e46c98387c2b331b19
parent48f1135a6dbdee99ff1e981682e99d8755944062 (diff)
downloadandroid_packages_apps_Trebuchet-1322f9cb9a8715d463094e13079af7e6e689429a.tar.gz
android_packages_apps_Trebuchet-1322f9cb9a8715d463094e13079af7e6e689429a.tar.bz2
android_packages_apps_Trebuchet-1322f9cb9a8715d463094e13079af7e6e689429a.zip
Fixing drag outline not getting drawn when the shortcuts popup is shown.
Shortucts popup uses predrag listener to manage the transient state of the icon. Fixing the order of PredragListener, such that predragEnd gets called before dragStart. This allows the transient state to be cleared before any other state changes are done by onDragStart. Bug: 62544416 Change-Id: I77c9a1aa17a15fe6f9f342af7a7fe3092a9d026b
-rw-r--r--src/com/android/launcher3/Launcher.java5
-rw-r--r--src/com/android/launcher3/Workspace.java16
-rw-r--r--src/com/android/launcher3/dragndrop/DragController.java6
-rw-r--r--src/com/android/launcher3/graphics/DragPreviewProvider.java15
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();