summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/screenshot_shelf.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotAnimationController.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt9
3 files changed, 22 insertions, 8 deletions
diff --git a/packages/SystemUI/res/layout/screenshot_shelf.xml b/packages/SystemUI/res/layout/screenshot_shelf.xml
index 7adfa6ca1c29..b4eb0f2dfb3b 100644
--- a/packages/SystemUI/res/layout/screenshot_shelf.xml
+++ b/packages/SystemUI/res/layout/screenshot_shelf.xml
@@ -23,7 +23,9 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/screenshot_static"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:clipToPadding="false">
<FrameLayout
android:id="@+id/actions_container_background"
android:visibility="gone"
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotAnimationController.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotAnimationController.kt
index 4eceb176fcd2..da268300e8c4 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotAnimationController.kt
@@ -43,7 +43,6 @@ class ScreenshotAnimationController(private val view: ScreenshotShelfView) {
private val staticUI =
listOf<View>(
view.requireViewById(R.id.screenshot_preview_border),
- view.requireViewById(R.id.actions_container_background),
view.requireViewById(R.id.screenshot_badge),
view.requireViewById(R.id.screenshot_dismiss_button)
)
@@ -71,6 +70,8 @@ class ScreenshotAnimationController(private val view: ScreenshotShelfView) {
entranceAnimation.doOnStart { screenshotPreview.visibility = View.INVISIBLE }
}
+ entranceAnimation.play(getActionsAnimator()).with(previewAnimator)
+
val fadeInAnimator = ValueAnimator.ofFloat(0f, 1f)
fadeInAnimator.addUpdateListener {
for (child in staticUI) {
@@ -123,6 +124,20 @@ class ScreenshotAnimationController(private val view: ScreenshotShelfView) {
animator?.cancel()
}
+ private fun getActionsAnimator(): Animator {
+ val startingOffset = view.height - actionContainer.top
+ val actionsYAnimator =
+ ValueAnimator.ofFloat(startingOffset.toFloat(), 0f).apply {
+ duration = PREVIEW_Y_ANIMATION_DURATION_MS
+ interpolator = fastOutSlowIn
+ }
+ actionsYAnimator.addUpdateListener {
+ actionContainer.translationY = it.animatedValue as Float
+ }
+ actionContainer.translationY = startingOffset.toFloat()
+ return actionsYAnimator
+ }
+
private fun getPreviewAnimator(bounds: Rect): Animator {
val targetPosition = Rect()
screenshotPreview.getHitRect(targetPosition)
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt
index 4437bf533353..2dd1ca090299 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt
@@ -75,15 +75,14 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
fun updateInsets(insets: WindowInsets) {
val orientation = mContext.resources.configuration.orientation
val inPortrait = orientation == Configuration.ORIENTATION_PORTRAIT
- val p = screenshotStatic.layoutParams as LayoutParams
val cutout = insets.displayCutout
val navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars())
if (cutout == null) {
- p.setMargins(0, 0, 0, navBarInsets.bottom)
+ screenshotStatic.setPadding(0, 0, 0, navBarInsets.bottom)
} else {
val waterfall = cutout.waterfallInsets
if (inPortrait) {
- p.setMargins(
+ screenshotStatic.setPadding(
waterfall.left,
max(cutout.safeInsetTop.toDouble(), waterfall.top.toDouble()).toInt(),
waterfall.right,
@@ -94,7 +93,7 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
.toInt()
)
} else {
- p.setMargins(
+ screenshotStatic.setPadding(
max(cutout.safeInsetLeft.toDouble(), waterfall.left.toDouble()).toInt(),
waterfall.top,
max(cutout.safeInsetRight.toDouble(), waterfall.right.toDouble()).toInt(),
@@ -102,8 +101,6 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
)
}
}
- screenshotStatic.layoutParams = p
- screenshotStatic.requestLayout()
}
private fun getSwipeRegion(): Region {