summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/InsetsAnimationControlImpl.java4
-rw-r--r--core/java/android/view/InsetsController.java15
-rw-r--r--core/java/android/view/InsetsSource.java9
-rw-r--r--core/java/android/view/InsetsState.java17
4 files changed, 33 insertions, 12 deletions
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index dad7696397ee..0653b06e4b9d 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -16,8 +16,6 @@
package android.view;
-import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_HIDDEN;
-import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_SHOWN;
import static android.view.InsetsState.ISIDE_BOTTOM;
import static android.view.InsetsState.ISIDE_FLOATING;
import static android.view.InsetsState.ISIDE_LEFT;
@@ -188,7 +186,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
@Override
public void finish(boolean shown) {
- if (mCancelled) {
+ if (mCancelled || mFinished) {
return;
}
setInsetsAndAlpha(shown ? mShownInsets : mHiddenInsets, 1f /* alpha */, 1f /* fraction */);
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 2785d216d24d..22d6f37dbd95 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -70,7 +70,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
private static final int ANIMATION_DURATION_HIDE_MS = 340;
private static final int PENDING_CONTROL_TIMEOUT_MS = 2000;
- static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
+ public static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
/**
* Layout mode during insets animation: The views should be laid out as if the changing inset
@@ -78,7 +78,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
* be called as if the changing insets types are shown, which will result in the views being
* laid out as if the insets are fully shown.
*/
- static final int LAYOUT_INSETS_DURING_ANIMATION_SHOWN = 0;
+ public static final int LAYOUT_INSETS_DURING_ANIMATION_SHOWN = 0;
/**
* Layout mode during insets animation: The views should be laid out as if the changing inset
@@ -86,7 +86,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
* be called as if the changing insets types are hidden, which will result in the views being
* laid out as if the insets are fully hidden.
*/
- static final int LAYOUT_INSETS_DURING_ANIMATION_HIDDEN = 1;
+ public static final int LAYOUT_INSETS_DURING_ANIMATION_HIDDEN = 1;
/**
* Determines the behavior of how the views should be laid out during an insets animation that
@@ -149,7 +149,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@Override
public void set(WindowInsetsAnimationController controller, Insets value) {
controller.setInsetsAndAlpha(
- value, 1f /* alpha */, (((DefaultAnimationControlListener)
+ value, 1f /* alpha */, (((InternalAnimationControlListener)
((InsetsAnimationControlImpl) controller).getListener())
.getRawFraction()));
}
@@ -166,7 +166,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
private ObjectAnimator mAnimator;
protected boolean mShow;
- InternalAnimationControlListener(boolean show) {
+ public InternalAnimationControlListener(boolean show) {
mShow = show;
}
@@ -214,7 +214,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
return (float) mAnimator.getCurrentPlayTime() / mAnimator.getDuration();
}
- protected long getDurationMs() {
+ /**
+ * To get the animation duration in MS.
+ */
+ public long getDurationMs() {
if (mAnimator != null) {
return mAnimator.getDuration();
}
diff --git a/core/java/android/view/InsetsSource.java b/core/java/android/view/InsetsSource.java
index 77bc25b4c729..d4961eab7473 100644
--- a/core/java/android/view/InsetsSource.java
+++ b/core/java/android/view/InsetsSource.java
@@ -193,6 +193,15 @@ public class InsetsSource implements Parcelable {
dest.writeBoolean(mVisible);
}
+ @Override
+ public String toString() {
+ return "InsetsSource: {"
+ + "mType=" + InsetsState.typeToString(mType)
+ + ", mFrame=" + mFrame.toShortString()
+ + ", mVisible" + mVisible
+ + "}";
+ }
+
public static final @android.annotation.NonNull Creator<InsetsSource> CREATOR = new Creator<InsetsSource>() {
public InsetsSource createFromParcel(Parcel in) {
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index bd19799bb664..8648682aaa2e 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -21,7 +21,6 @@ import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL;
import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME;
import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE;
import static android.view.ViewRootImpl.sNewInsetsMode;
-import static android.view.WindowInsets.Type.IME;
import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES;
import static android.view.WindowInsets.Type.SIZE;
import static android.view.WindowInsets.Type.SYSTEM_GESTURES;
@@ -43,7 +42,6 @@ import android.util.ArraySet;
import android.util.SparseIntArray;
import android.view.WindowInsets.Type;
import android.view.WindowInsets.Type.InsetsType;
-import android.view.WindowManager.LayoutParams;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import java.io.PrintWriter;
@@ -366,7 +364,12 @@ public class InsetsState implements Parcelable {
return result;
}
- static @Type.InsetsType int toPublicType(@InternalInsetsType int type) {
+ /**
+ * Converting a internal type to the public type.
+ * @param type internal insets type, {@code InternalInsetsType}.
+ * @return public insets type, {@code Type.InsetsType}.
+ */
+ public static @Type.InsetsType int toPublicType(@InternalInsetsType int type) {
switch (type) {
case ITYPE_STATUS_BAR:
return Type.STATUS_BARS;
@@ -510,5 +513,13 @@ public class InsetsState implements Parcelable {
mSources.put(source.getType(), source);
}
}
+
+ @Override
+ public String toString() {
+ return "InsetsState: {"
+ + "mDisplayFrame=" + mDisplayFrame
+ + ", mSources=" + mSources
+ + "}";
+ }
}