Merge "Fix widget reorder animations in multi-window mode." into ub-launcher3-master

This commit is contained in:
Jonathan Miranda
2016-12-30 00:42:11 +00:00
committed by Android (Google) Code Review
5 changed files with 81 additions and 37 deletions

View File

@@ -25,7 +25,6 @@ import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppWidgetHostView;
import com.android.launcher3.PreloadIconDrawable;
@@ -120,8 +119,7 @@ public class DragPreviewProvider {
width = bounds.width();
height = bounds.height();
} else if (mView instanceof LauncherAppWidgetHostView) {
DeviceProfile profile = Launcher.getLauncher(mView.getContext()).getDeviceProfile();
scale = Math.min(profile.appWidgetScale.x, profile.appWidgetScale.y);
scale = ((LauncherAppWidgetHostView) mView).getScaleToFit();
width = (int) (mView.getWidth() * scale);
height = (int) (mView.getHeight() * scale);
}
@@ -158,8 +156,7 @@ public class DragPreviewProvider {
int height = mView.getHeight();
if (mView instanceof LauncherAppWidgetHostView) {
DeviceProfile profile = Launcher.getLauncher(mView.getContext()).getDeviceProfile();
scale = Math.min(profile.appWidgetScale.x, profile.appWidgetScale.y);
scale = ((LauncherAppWidgetHostView) mView).getScaleToFit();
width = (int) Math.floor(mView.getWidth() * scale);
height = (int) Math.floor(mView.getHeight() * scale);
}
@@ -198,11 +195,10 @@ public class DragPreviewProvider {
public float getScaleAndPosition(Bitmap preview, int[] outPos) {
float scale = Launcher.getLauncher(mView.getContext())
.getDragLayer().getLocationInDragLayer(mView, outPos);
DeviceProfile profile = Launcher.getLauncher(mView.getContext()).getDeviceProfile();
if (mView instanceof LauncherAppWidgetHostView) {
// App widgets are technically scaled, but are drawn at their expected size -- so the
// app widget scale should not affect the scale of the preview.
scale /= Math.min(profile.appWidgetScale.x, profile.appWidgetScale.y);
scale /= ((LauncherAppWidgetHostView) mView).getScaleToFit();
}
outPos[0] = Math.round(outPos[0] -