Decouple the scaling / translation of widget views necessary in split-screen
=> We pull apart the scale and translation that are set in a fairly
static way due to split-screen vs. the general translation and scale
properties that might be used more dynamically, in this case
for re-order animations
=> This allows removal of some code that breaks reorder animations
due to the accrual of translations / scales in certain edge cases.
=> TODO in future CL: address other translation cases and make the throw
case for calling base setTranslationX/Y for Workspace Items unconditional
issue 149438360
test: manual
Change-Id: Ic3fde172f669e215cd25db0fcd4e1c3c873d314f
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 93247ab..e8e88c4 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -29,6 +29,7 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -70,7 +71,7 @@
* too aggressive.
*/
public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, OnResumeCallback,
- IconLabelDotView, DraggableView {
+ IconLabelDotView, DraggableView, Reorderable {
private static final int DISPLAY_WORKSPACE = 0;
private static final int DISPLAY_ALL_APPS = 1;
@@ -78,6 +79,8 @@
private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed};
+ private final PointF mTranslationForReorder = new PointF(0, 0);
+ private float mScaleForReorder = 1f;
private static final Property<BubbleTextView, Float> DOT_SCALE_PROPERTY
= new Property<BubbleTextView, Float>(Float.TYPE, "dotScale") {
@@ -672,6 +675,30 @@
return mIconSize;
}
+ public void setReorderOffset(float x, float y) {
+ mTranslationForReorder.set(x, y);
+ super.setTranslationX(x);
+ super.setTranslationY(y);
+ }
+
+ public void getReorderOffset(PointF offset) {
+ offset.set(mTranslationForReorder);
+ }
+
+ public void setReorderScale(float scale) {
+ mScaleForReorder = scale;
+ super.setScaleX(scale);
+ super.setScaleY(scale);
+ }
+
+ public float getReorderScale() {
+ return mScaleForReorder;
+ }
+
+ public View getView() {
+ return this;
+ }
+
@Override
public int getViewType() {
return DRAGGABLE_ICON;