Removing various reflection based animations, to allow for better proguarding

Change-Id: If9df24ea4170e8a3d336057d1c3dc800934fc1ac
This commit is contained in:
Sunny Goyal committed 2018-09-21 18:21:04 +00:00
1 parent 194f58525a
commit 55bdeed7bb
7 files changed
+80 -147

No files matched your search

-74
View File
@@ -2,80 +2,6 @@
*;
}
-keep class com.android.launcher3.allapps.AllAppsBackgroundDrawable {
public void setAlpha(int);
public int getAlpha();
}
-keep class com.android.launcher3.BaseRecyclerViewFastScrollBar {
public void setThumbWidth(int);
public int getThumbWidth();
public void setTrackWidth(int);
public int getTrackWidth();
}
-keep class com.android.launcher3.BaseRecyclerViewFastScrollPopup {
public void setAlpha(float);
public float getAlpha();
}
-keep class com.android.launcher3.ButtonDropTarget {
public int getTextColor();
}
-keep class com.android.launcher3.CellLayout {
public float getBackgroundAlpha();
public void setBackgroundAlpha(float);
}
-keep class com.android.launcher3.CellLayout$LayoutParams {
public void setWidth(int);
public int getWidth();
public void setHeight(int);
public int getHeight();
public void setX(int);
public int getX();
public void setY(int);
public int getY();
}
-keep class com.android.launcher3.views.BaseDragLayer$LayoutParams {
public void setWidth(int);
public int getWidth();
public void setHeight(int);
public int getHeight();
public void setX(int);
public int getX();
public void setY(int);
public int getY();
}
-keep class com.android.launcher3.FastBitmapDrawable {
public void setDesaturation(float);
public float getDesaturation();
public void setBrightness(float);
public float getBrightness();
}
-keep class com.android.launcher3.MemoryDumpActivity {
*;
}
-keep class com.android.launcher3.PreloadIconDrawable {
public float getAnimationProgress();
public void setAnimationProgress(float);
}
-keep class com.android.launcher3.pageindicators.CaretDrawable {
public float getCaretProgress();
public void setCaretProgress(float);
}
-keep class com.android.launcher3.Workspace {
public float getBackgroundAlpha();
public void setBackgroundAlpha(float);
}
# Proguard will strip new callbacks in LauncherApps.Callback from
# WrappedCallback if compiled against an older SDK. Don't let this happen.
-keep class com.android.launcher3.compat.** {
@@ -1,5 +1,10 @@
package com.android.launcher3;
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_HEIGHT;
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_WIDTH;
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_X;
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_Y;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
@@ -429,10 +434,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
requestLayout();
} else {
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(lp,
PropertyValuesHolder.ofInt("width", lp.width, newWidth),
PropertyValuesHolder.ofInt("height", lp.height, newHeight),
PropertyValuesHolder.ofInt("x", lp.x, newX),
PropertyValuesHolder.ofInt("y", lp.y, newY));
PropertyValuesHolder.ofInt(LAYOUT_WIDTH, lp.width, newWidth),
PropertyValuesHolder.ofInt(LAYOUT_HEIGHT, lp.height, newHeight),
PropertyValuesHolder.ofInt(LAYOUT_X, lp.x, newX),
PropertyValuesHolder.ofInt(LAYOUT_Y, lp.y, newY));
mFirstFrameAnimatorHelper.addTo(oa).addUpdateListener(a -> requestLayout());
AnimatorSet set = new AnimatorSet();
@@ -33,6 +33,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Property;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -55,6 +56,20 @@ import com.android.launcher3.util.Thunk;
public abstract class ButtonDropTarget extends TextView
implements DropTarget, DragController.DragListener, OnClickListener {
private static final Property<ButtonDropTarget, Integer> TEXT_COLOR =
new Property<ButtonDropTarget, Integer>(Integer.TYPE, "textColor") {
@Override
public Integer get(ButtonDropTarget target) {
return target.getTextColor();
}
@Override
public void set(ButtonDropTarget target, Integer value) {
target.setTextColor(value);
}
};
private static final int[] sTempCords = new int[2];
private static final int DRAG_VIEW_DROP_DURATION = 285;
@@ -206,7 +221,7 @@ public abstract class ButtonDropTarget extends TextView
});
mCurrentColorAnim.play(anim1);
mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, "textColor", targetColor));
mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, TEXT_COLOR, targetColor));
mCurrentColorAnim.start();
}
-32
View File
@@ -2678,38 +2678,6 @@ public class CellLayout extends ViewGroup {
public String toString() {
return "(" + this.cellX + ", " + this.cellY + ")";
}
public void setWidth(int width) {
this.width = width;
}
public int getWidth() {
return width;
}
public void setHeight(int height) {
this.height = height;
}
public int getHeight() {
return height;
}
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
}
// This class stores info for two purposes:
@@ -19,6 +19,7 @@ package com.android.launcher3;
import android.graphics.drawable.Drawable;
import android.util.Property;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
public class LauncherAnimUtils {
/**
@@ -64,4 +65,30 @@ public class LauncherAnimUtils {
public static int blockedFlingDurationFactor(float velocity) {
return (int) Utilities.boundToRange(Math.abs(velocity) / 2, 2f, 6f);
}
public static final Property<LayoutParams, Integer> LAYOUT_WIDTH =
new Property<LayoutParams, Integer>(Integer.TYPE, "width") {
@Override
public Integer get(LayoutParams lp) {
return lp.width;
}
@Override
public void set(LayoutParams lp, Integer width) {
lp.width = width;
}
};
public static final Property<LayoutParams, Integer> LAYOUT_HEIGHT =
new Property<LayoutParams, Integer>(Integer.TYPE, "height") {
@Override
public Integer get(LayoutParams lp) {
return lp.height;
}
@Override
public void set(LayoutParams lp, Integer height) {
lp.height = height;
}
};
}
+1 -4
View File
@@ -671,9 +671,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
final boolean stripEmptyScreens) {
// XXX: Do we need to update LM workspace screens below?
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);
final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
mRemoveEmptyScreenRunnable = new Runnable() {
@@ -692,7 +689,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
};
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
ObjectAnimator oa = ObjectAnimator.ofFloat(cl, ALPHA, 0f);
oa.setDuration(duration);
oa.setStartDelay(delay);
oa.addListener(new AnimatorListenerAdapter() {
@@ -21,6 +21,7 @@ import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Property;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -42,6 +43,32 @@ import java.util.ArrayList;
public abstract class BaseDragLayer<T extends Context & ActivityContext>
extends InsettableFrameLayout {
public static final Property<LayoutParams, Integer> LAYOUT_X =
new Property<LayoutParams, Integer>(Integer.TYPE, "x") {
@Override
public Integer get(LayoutParams lp) {
return lp.x;
}
@Override
public void set(LayoutParams lp, Integer x) {
lp.x = x;
}
};
public static final Property<LayoutParams, Integer> LAYOUT_Y =
new Property<LayoutParams, Integer>(Integer.TYPE, "y") {
@Override
public Integer get(LayoutParams lp) {
return lp.y;
}
@Override
public void set(LayoutParams lp, Integer y) {
lp.y = y;
}
};
protected final int[] mTmpXY = new int[2];
protected final Rect mHitRect = new Rect();
@@ -307,38 +334,6 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
public LayoutParams(ViewGroup.LayoutParams lp) {
super(lp);
}
public void setWidth(int width) {
this.width = width;
}
public int getWidth() {
return width;
}
public void setHeight(int height) {
this.height = height;
}
public int getHeight() {
return height;
}
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
}
protected void onLayout(boolean changed, int l, int t, int r, int b) {