Rotate back button drawable when IME present.
Currently rotation for IME rotates the whole view, including the background.
Fix: 266874111
Test: manual.
Change-Id: Iea310c99d0714d98ce534a0170316a0fb351f57d
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index 4e80d41..c20f323 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -26,6 +26,7 @@
import android.util.IntProperty;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.launcher3.util.MultiScalePropertyFactory;
@@ -200,6 +201,23 @@
}
};
+ public static final FloatProperty<ImageView> ROTATION_DRAWABLE_PERCENT =
+ new FloatProperty<ImageView>("drawableRotationPercent") {
+ // RotateDrawable linearly interpolates the rotation degrees between fromDegrees
+ // and toDegrees using the drawable level as a percent of its MAX_LEVEL.
+ private static final int MAX_LEVEL = 10000;
+
+ @Override
+ public void setValue(ImageView view, float percent) {
+ view.setImageLevel((int) (percent * MAX_LEVEL));
+ }
+
+ @Override
+ public Float get(ImageView view) {
+ return view.getDrawable().getLevel() / (float) MAX_LEVEL;
+ }
+ };
+
/**
* Utility method to create an {@link AnimatorListener} which executes a callback on animation
* cancel.