Merge "Fixing drag outline not getting drawn when the shortcuts popup is shown." into ub-launcher3-dorval-polish
This commit is contained in:
commit
3ed3076550
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue