Loading packages/SystemUI/res/layout/clipboard_overlay.xml +118 −127 Original line number Diff line number Diff line Loading @@ -14,30 +14,21 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <FrameLayout <com.android.systemui.screenshot.DraggableConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/clipboard_ui" android:theme="@style/FloatingOverlay" android:alpha="0" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/background_protection" android:layout_height="@dimen/overlay_bg_protection_height" android:layout_width="match_parent" android:layout_gravity="bottom" android:src="@drawable/overlay_actions_background_protection"/> <com.android.systemui.screenshot.DraggableConstraintLayout android:id="@+id/clipboard_ui" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/actions_container_background" android:visibility="gone" android:layout_height="0dp" android:layout_width="0dp" android:elevation="1dp" android:elevation="4dp" android:background="@drawable/action_chip_container_background" android:layout_marginStart="@dimen/overlay_action_container_margin_horizontal" app:layout_constraintBottom_toBottomOf="@+id/actions_container" Loading @@ -51,8 +42,9 @@ android:layout_marginEnd="@dimen/overlay_action_container_margin_horizontal" android:paddingEnd="@dimen/overlay_action_container_padding_right" android:paddingVertical="@dimen/overlay_action_container_padding_vertical" android:elevation="1dp" android:elevation="4dp" android:scrollbars="none" android:layout_marginBottom="4dp" app:layout_constraintHorizontal_bias="0" app:layout_constraintWidth_percent="1.0" app:layout_constraintWidth_max="wrap" Loading @@ -78,7 +70,7 @@ android:layout_marginBottom="@dimen/overlay_offset_y" app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="@id/actions_container_background" android:elevation="@dimen/overlay_preview_elevation" android:elevation="7dp" app:layout_constraintEnd_toEndOf="@id/clipboard_preview_end" app:layout_constraintTop_toTopOf="@id/clipboard_preview_top" android:background="@drawable/overlay_border"/> Loading @@ -98,7 +90,7 @@ app:constraint_referenced_ids="clipboard_preview"/> <FrameLayout android:id="@+id/clipboard_preview" android:elevation="@dimen/overlay_preview_elevation" android:elevation="7dp" android:background="@drawable/overlay_preview_background" android:clipChildren="true" android:clipToOutline="true" Loading Loading @@ -134,7 +126,7 @@ android:id="@+id/dismiss_button" android:layout_width="@dimen/overlay_dismiss_button_tappable_size" android:layout_height="@dimen/overlay_dismiss_button_tappable_size" android:elevation="@dimen/overlay_dismiss_button_elevation" android:elevation="10dp" android:visibility="gone" android:alpha="0" app:layout_constraintStart_toEndOf="@id/clipboard_preview" Loading @@ -150,4 +142,3 @@ android:src="@drawable/overlay_cancel"/> </FrameLayout> </com.android.systemui.screenshot.DraggableConstraintLayout> </FrameLayout> No newline at end of file packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java +16 −24 Original line number Diff line number Diff line Loading @@ -122,7 +122,6 @@ public class ClipboardOverlayController { private final AccessibilityManager mAccessibilityManager; private final TextClassifier mTextClassifier; private final FrameLayout mContainer; private final DraggableConstraintLayout mView; private final View mClipboardPreview; private final ImageView mImagePreview; Loading Loading @@ -177,9 +176,8 @@ public class ClipboardOverlayController { setWindowFocusable(false); mContainer = (FrameLayout) mView = (DraggableConstraintLayout) LayoutInflater.from(mContext).inflate(R.layout.clipboard_overlay, null); mView = requireNonNull(mContainer.findViewById(R.id.clipboard_ui)); mActionContainerBackground = requireNonNull(mView.findViewById(R.id.actions_container_background)); mActionContainer = requireNonNull(mView.findViewById(R.id.actions)); Loading @@ -201,13 +199,6 @@ public class ClipboardOverlayController { public void onSwipeDismissInitiated(Animator animator) { mUiEventLogger.log(CLIPBOARD_OVERLAY_SWIPE_DISMISSED); mExitAnimator = animator; animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); mContainer.animate().alpha(0).setDuration(animation.getDuration()).start(); } }); } @Override Loading @@ -231,7 +222,7 @@ public class ClipboardOverlayController { attachWindow(); withWindowAttached(() -> { mWindow.setContentView(mContainer); mWindow.setContentView(mView); updateInsets(mWindowManager.getCurrentWindowMetrics().getWindowInsets()); mView.requestLayout(); }); Loading Loading @@ -308,7 +299,7 @@ public class ClipboardOverlayController { } else { mRemoteCopyChip.setVisibility(View.GONE); } withWindowAttached(() -> mContainer.post(this::animateIn)); withWindowAttached(() -> mView.post(this::animateIn)); mTimeoutHandler.resetTimeout(); } Loading Loading @@ -508,7 +499,7 @@ public class ClipboardOverlayController { rootAnim.setInterpolator(linearInterpolator); rootAnim.setDuration(66); rootAnim.addUpdateListener(animation -> { mContainer.setAlpha(animation.getAnimatedFraction()); mView.setAlpha(animation.getAnimatedFraction()); }); ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1); Loading Loading @@ -553,7 +544,7 @@ public class ClipboardOverlayController { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mContainer.setAlpha(1); mView.setAlpha(1); mTimeoutHandler.resetTimeout(); } }); Loading @@ -568,9 +559,7 @@ public class ClipboardOverlayController { ValueAnimator rootAnim = ValueAnimator.ofFloat(0, 1); rootAnim.setInterpolator(linearInterpolator); rootAnim.setDuration(100); rootAnim.addUpdateListener(animation -> { mContainer.setAlpha(1 - animation.getAnimatedFraction()); }); rootAnim.addUpdateListener(anim -> mView.setAlpha(1 - anim.getAnimatedFraction())); ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1); scaleAnim.setInterpolator(scaleInterpolator); Loading Loading @@ -647,7 +636,7 @@ public class ClipboardOverlayController { private void reset() { mView.setTranslationX(0); mContainer.setAlpha(0); mView.setAlpha(0); mActionContainerBackground.setVisibility(View.GONE); resetActionChips(); mTimeoutHandler.cancelTimeout(); Loading Loading @@ -706,8 +695,9 @@ public class ClipboardOverlayController { } DisplayCutout cutout = insets.getDisplayCutout(); Insets navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars()); Insets imeInsets = insets.getInsets(WindowInsets.Type.ime()); if (cutout == null) { p.setMargins(0, 0, 0, navBarInsets.bottom); p.setMargins(0, 0, 0, Math.max(imeInsets.bottom, navBarInsets.bottom)); } else { Insets waterfall = cutout.getWaterfallInsets(); if (orientation == ORIENTATION_PORTRAIT) { Loading @@ -715,14 +705,16 @@ public class ClipboardOverlayController { waterfall.left, Math.max(cutout.getSafeInsetTop(), waterfall.top), waterfall.right, Math.max(imeInsets.bottom, Math.max(cutout.getSafeInsetBottom(), Math.max(navBarInsets.bottom, waterfall.bottom))); Math.max(navBarInsets.bottom, waterfall.bottom)))); } else { p.setMargins( Math.max(cutout.getSafeInsetLeft(), waterfall.left), waterfall.left, waterfall.top, Math.max(cutout.getSafeInsetRight(), waterfall.right), Math.max(navBarInsets.bottom, waterfall.bottom)); waterfall.right, Math.max(imeInsets.bottom, Math.max(navBarInsets.bottom, waterfall.bottom))); } } mView.setLayoutParams(p); Loading Loading
packages/SystemUI/res/layout/clipboard_overlay.xml +118 −127 Original line number Diff line number Diff line Loading @@ -14,30 +14,21 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <FrameLayout <com.android.systemui.screenshot.DraggableConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/clipboard_ui" android:theme="@style/FloatingOverlay" android:alpha="0" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/background_protection" android:layout_height="@dimen/overlay_bg_protection_height" android:layout_width="match_parent" android:layout_gravity="bottom" android:src="@drawable/overlay_actions_background_protection"/> <com.android.systemui.screenshot.DraggableConstraintLayout android:id="@+id/clipboard_ui" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/actions_container_background" android:visibility="gone" android:layout_height="0dp" android:layout_width="0dp" android:elevation="1dp" android:elevation="4dp" android:background="@drawable/action_chip_container_background" android:layout_marginStart="@dimen/overlay_action_container_margin_horizontal" app:layout_constraintBottom_toBottomOf="@+id/actions_container" Loading @@ -51,8 +42,9 @@ android:layout_marginEnd="@dimen/overlay_action_container_margin_horizontal" android:paddingEnd="@dimen/overlay_action_container_padding_right" android:paddingVertical="@dimen/overlay_action_container_padding_vertical" android:elevation="1dp" android:elevation="4dp" android:scrollbars="none" android:layout_marginBottom="4dp" app:layout_constraintHorizontal_bias="0" app:layout_constraintWidth_percent="1.0" app:layout_constraintWidth_max="wrap" Loading @@ -78,7 +70,7 @@ android:layout_marginBottom="@dimen/overlay_offset_y" app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="@id/actions_container_background" android:elevation="@dimen/overlay_preview_elevation" android:elevation="7dp" app:layout_constraintEnd_toEndOf="@id/clipboard_preview_end" app:layout_constraintTop_toTopOf="@id/clipboard_preview_top" android:background="@drawable/overlay_border"/> Loading @@ -98,7 +90,7 @@ app:constraint_referenced_ids="clipboard_preview"/> <FrameLayout android:id="@+id/clipboard_preview" android:elevation="@dimen/overlay_preview_elevation" android:elevation="7dp" android:background="@drawable/overlay_preview_background" android:clipChildren="true" android:clipToOutline="true" Loading Loading @@ -134,7 +126,7 @@ android:id="@+id/dismiss_button" android:layout_width="@dimen/overlay_dismiss_button_tappable_size" android:layout_height="@dimen/overlay_dismiss_button_tappable_size" android:elevation="@dimen/overlay_dismiss_button_elevation" android:elevation="10dp" android:visibility="gone" android:alpha="0" app:layout_constraintStart_toEndOf="@id/clipboard_preview" Loading @@ -150,4 +142,3 @@ android:src="@drawable/overlay_cancel"/> </FrameLayout> </com.android.systemui.screenshot.DraggableConstraintLayout> </FrameLayout> No newline at end of file
packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java +16 −24 Original line number Diff line number Diff line Loading @@ -122,7 +122,6 @@ public class ClipboardOverlayController { private final AccessibilityManager mAccessibilityManager; private final TextClassifier mTextClassifier; private final FrameLayout mContainer; private final DraggableConstraintLayout mView; private final View mClipboardPreview; private final ImageView mImagePreview; Loading Loading @@ -177,9 +176,8 @@ public class ClipboardOverlayController { setWindowFocusable(false); mContainer = (FrameLayout) mView = (DraggableConstraintLayout) LayoutInflater.from(mContext).inflate(R.layout.clipboard_overlay, null); mView = requireNonNull(mContainer.findViewById(R.id.clipboard_ui)); mActionContainerBackground = requireNonNull(mView.findViewById(R.id.actions_container_background)); mActionContainer = requireNonNull(mView.findViewById(R.id.actions)); Loading @@ -201,13 +199,6 @@ public class ClipboardOverlayController { public void onSwipeDismissInitiated(Animator animator) { mUiEventLogger.log(CLIPBOARD_OVERLAY_SWIPE_DISMISSED); mExitAnimator = animator; animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); mContainer.animate().alpha(0).setDuration(animation.getDuration()).start(); } }); } @Override Loading @@ -231,7 +222,7 @@ public class ClipboardOverlayController { attachWindow(); withWindowAttached(() -> { mWindow.setContentView(mContainer); mWindow.setContentView(mView); updateInsets(mWindowManager.getCurrentWindowMetrics().getWindowInsets()); mView.requestLayout(); }); Loading Loading @@ -308,7 +299,7 @@ public class ClipboardOverlayController { } else { mRemoteCopyChip.setVisibility(View.GONE); } withWindowAttached(() -> mContainer.post(this::animateIn)); withWindowAttached(() -> mView.post(this::animateIn)); mTimeoutHandler.resetTimeout(); } Loading Loading @@ -508,7 +499,7 @@ public class ClipboardOverlayController { rootAnim.setInterpolator(linearInterpolator); rootAnim.setDuration(66); rootAnim.addUpdateListener(animation -> { mContainer.setAlpha(animation.getAnimatedFraction()); mView.setAlpha(animation.getAnimatedFraction()); }); ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1); Loading Loading @@ -553,7 +544,7 @@ public class ClipboardOverlayController { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mContainer.setAlpha(1); mView.setAlpha(1); mTimeoutHandler.resetTimeout(); } }); Loading @@ -568,9 +559,7 @@ public class ClipboardOverlayController { ValueAnimator rootAnim = ValueAnimator.ofFloat(0, 1); rootAnim.setInterpolator(linearInterpolator); rootAnim.setDuration(100); rootAnim.addUpdateListener(animation -> { mContainer.setAlpha(1 - animation.getAnimatedFraction()); }); rootAnim.addUpdateListener(anim -> mView.setAlpha(1 - anim.getAnimatedFraction())); ValueAnimator scaleAnim = ValueAnimator.ofFloat(0, 1); scaleAnim.setInterpolator(scaleInterpolator); Loading Loading @@ -647,7 +636,7 @@ public class ClipboardOverlayController { private void reset() { mView.setTranslationX(0); mContainer.setAlpha(0); mView.setAlpha(0); mActionContainerBackground.setVisibility(View.GONE); resetActionChips(); mTimeoutHandler.cancelTimeout(); Loading Loading @@ -706,8 +695,9 @@ public class ClipboardOverlayController { } DisplayCutout cutout = insets.getDisplayCutout(); Insets navBarInsets = insets.getInsets(WindowInsets.Type.navigationBars()); Insets imeInsets = insets.getInsets(WindowInsets.Type.ime()); if (cutout == null) { p.setMargins(0, 0, 0, navBarInsets.bottom); p.setMargins(0, 0, 0, Math.max(imeInsets.bottom, navBarInsets.bottom)); } else { Insets waterfall = cutout.getWaterfallInsets(); if (orientation == ORIENTATION_PORTRAIT) { Loading @@ -715,14 +705,16 @@ public class ClipboardOverlayController { waterfall.left, Math.max(cutout.getSafeInsetTop(), waterfall.top), waterfall.right, Math.max(imeInsets.bottom, Math.max(cutout.getSafeInsetBottom(), Math.max(navBarInsets.bottom, waterfall.bottom))); Math.max(navBarInsets.bottom, waterfall.bottom)))); } else { p.setMargins( Math.max(cutout.getSafeInsetLeft(), waterfall.left), waterfall.left, waterfall.top, Math.max(cutout.getSafeInsetRight(), waterfall.right), Math.max(navBarInsets.bottom, waterfall.bottom)); waterfall.right, Math.max(imeInsets.bottom, Math.max(navBarInsets.bottom, waterfall.bottom))); } } mView.setLayoutParams(p); Loading