Loading libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml→libs/WindowManager/Shell/res/layout/desktop_windowing_education_horizontal_arrow_tooltip.xml +2 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:elevation="1dp" android:orientation="horizontal"> android:orientation="horizontal" android:gravity="start"> <!-- ImageView for the arrow icon, positioned horizontally at the start of the tooltip container. --> Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/education/AppHandleEducationController.kt +18 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context import android.content.res.Resources import android.graphics.Point import android.os.SystemProperties import android.view.View.LAYOUT_DIRECTION_RTL import com.android.window.flags.Flags import com.android.wm.shell.R import com.android.wm.shell.desktopmode.CaptionState Loading Loading @@ -187,9 +188,14 @@ class AppHandleEducationController( getSize(R.dimen.desktop_mode_handle_menu_pill_spacing_margin) val appHandleBounds = captionState.globalAppHandleBounds val appHandleCenterX = appHandleBounds.left + appHandleBounds.width() / 2 val tooltipGlobalCoordinates = Point( appHandleBounds.left + appHandleBounds.width() / 2 + appHandleMenuWidth / 2, if (isRtl()) { appHandleCenterX - appHandleMenuWidth / 2 } else { appHandleCenterX + appHandleMenuWidth / 2 }, appHandleBounds.top + appHandleMenuMargins + appInfoPillHeight + Loading @@ -199,7 +205,7 @@ class AppHandleEducationController( // tooltip. val windowingImageButtonTooltipConfig = TooltipEducationViewConfig( tooltipViewLayout = R.layout.desktop_windowing_education_left_arrow_tooltip, tooltipViewLayout = R.layout.desktop_windowing_education_horizontal_arrow_tooltip, tooltipColorScheme = TooltipColorScheme( tertiaryFixedColor, Loading @@ -210,7 +216,7 @@ class AppHandleEducationController( tooltipText = getString(R.string.windowing_desktop_mode_image_button_education_tooltip), arrowDirection = DesktopWindowingEducationTooltipController.TooltipArrowDirection.LEFT, DesktopWindowingEducationTooltipController.TooltipArrowDirection.HORIZONTAL, onEducationClickAction = { toDesktopModeCallback( captionState.runningTaskInfo.taskId, Loading @@ -233,13 +239,17 @@ class AppHandleEducationController( val globalAppChipBounds = captionState.globalAppChipBounds val tooltipGlobalCoordinates = Point( globalAppChipBounds.right, if (isRtl()) { globalAppChipBounds.left } else { globalAppChipBounds.right }, globalAppChipBounds.top + globalAppChipBounds.height() / 2, ) // Populate information important to inflate exit desktop mode education tooltip. val exitWindowingTooltipConfig = TooltipEducationViewConfig( tooltipViewLayout = R.layout.desktop_windowing_education_left_arrow_tooltip, tooltipViewLayout = R.layout.desktop_windowing_education_horizontal_arrow_tooltip, tooltipColorScheme = TooltipColorScheme( tertiaryFixedColor, Loading @@ -249,7 +259,7 @@ class AppHandleEducationController( tooltipViewGlobalCoordinates = tooltipGlobalCoordinates, tooltipText = getString(R.string.windowing_desktop_mode_exit_education_tooltip), arrowDirection = DesktopWindowingEducationTooltipController.TooltipArrowDirection.LEFT, DesktopWindowingEducationTooltipController.TooltipArrowDirection.HORIZONTAL, onDismissAction = { // TODO: b/341320146 - Log previous tooltip was dismissed }, Loading Loading @@ -299,6 +309,8 @@ class AppHandleEducationController( private fun getString(@StringRes resId: Int): String = context.resources.getString(resId) private fun isRtl() = context.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL companion object { const val TAG = "AppHandleEducationController" val APP_HANDLE_EDUCATION_DELAY_MILLIS: Long Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +5 −2 Original line number Diff line number Diff line Loading @@ -734,7 +734,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin // [AppHeaderViewHolder]. ((AppHeaderViewHolder) mWindowDecorViewHolder).runOnAppChipGlobalLayout( () -> { notifyAppChipStateChanged(); notifyAppHeaderStateChanged(); return Unit.INSTANCE; }); } Loading Loading @@ -766,7 +766,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mResult.mCaptionHeight); } private void notifyAppChipStateChanged() { private void notifyAppHeaderStateChanged() { if (isAppHandle(mWindowDecorViewHolder) || mWindowDecorViewHolder == null) { return; } final Rect appChipPositionInWindow = ((AppHeaderViewHolder) mWindowDecorViewHolder).getAppChipLocationInWindow(); final Rect taskBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/education/DesktopWindowingEducationTooltipController.kt +11 −4 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.util.Size import android.view.LayoutInflater import android.view.MotionEvent import android.view.View import android.view.View.LAYOUT_DIRECTION_RTL import android.view.View.MeasureSpec.UNSPECIFIED import android.view.WindowManager import android.widget.ImageView Loading Loading @@ -199,6 +200,7 @@ class DesktopWindowingEducationTooltipController( requireViewById<ImageView>(R.id.arrow_icon).apply { val wrappedDrawable = DrawableCompat.wrap(this.drawable) DrawableCompat.setTint(wrappedDrawable, tooltipColorScheme.container) if (isRtl()) scaleX = -1f } requireViewById<TextView>(R.id.tooltip_text).apply { setTextColor(tooltipColorScheme.text) } requireViewById<ImageView>(R.id.tooltip_icon).apply { Loading Loading @@ -227,6 +229,9 @@ class DesktopWindowingEducationTooltipController( // Arrow is placed at vertical center on the left edge of the tooltip. Hence decrement // half of tooltip height from [tooltipY] to vertically position the tooltip. tooltipY -= tooltipDimen.height / 2 if (isRtl()) { tooltipX -= tooltipDimen.width } } return Point(tooltipX, tooltipY) } Loading Loading @@ -260,6 +265,8 @@ class DesktopWindowingEducationTooltipController( return context.resources.getDimensionPixelSize(resourceId) } private fun isRtl() = context.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL /** * The configuration for education view features: * Loading Loading @@ -297,6 +304,6 @@ class DesktopWindowingEducationTooltipController( /** Direction of arrow of the tooltip */ enum class TooltipArrowDirection { UP, LEFT, HORIZONTAL } } No newline at end of file libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/education/DesktopWindowingEducationTooltipControllerTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -154,12 +154,12 @@ class DesktopWindowingEducationTooltipControllerTest : ShellTestCase() { } @Test fun showEducationTooltip_tooltipPointsLeft_verticallyPositionTooltip() { fun showEducationTooltip_tooltipPointsHorizontally_verticallyPositionTooltip() { val initialTooltipX = 0 val initialTooltipY = 0 val tooltipViewConfig = createTooltipConfig( arrowDirection = TooltipArrowDirection.LEFT, arrowDirection = TooltipArrowDirection.HORIZONTAL, tooltipViewGlobalCoordinates = Point(initialTooltipX, initialTooltipY)) val tooltipYArgumentCaptor = argumentCaptor<Int>() val tooltipHeightArgumentCaptor = argumentCaptor<Int>() Loading Loading
libs/WindowManager/Shell/res/layout/desktop_windowing_education_left_arrow_tooltip.xml→libs/WindowManager/Shell/res/layout/desktop_windowing_education_horizontal_arrow_tooltip.xml +2 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:elevation="1dp" android:orientation="horizontal"> android:orientation="horizontal" android:gravity="start"> <!-- ImageView for the arrow icon, positioned horizontally at the start of the tooltip container. --> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/education/AppHandleEducationController.kt +18 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context import android.content.res.Resources import android.graphics.Point import android.os.SystemProperties import android.view.View.LAYOUT_DIRECTION_RTL import com.android.window.flags.Flags import com.android.wm.shell.R import com.android.wm.shell.desktopmode.CaptionState Loading Loading @@ -187,9 +188,14 @@ class AppHandleEducationController( getSize(R.dimen.desktop_mode_handle_menu_pill_spacing_margin) val appHandleBounds = captionState.globalAppHandleBounds val appHandleCenterX = appHandleBounds.left + appHandleBounds.width() / 2 val tooltipGlobalCoordinates = Point( appHandleBounds.left + appHandleBounds.width() / 2 + appHandleMenuWidth / 2, if (isRtl()) { appHandleCenterX - appHandleMenuWidth / 2 } else { appHandleCenterX + appHandleMenuWidth / 2 }, appHandleBounds.top + appHandleMenuMargins + appInfoPillHeight + Loading @@ -199,7 +205,7 @@ class AppHandleEducationController( // tooltip. val windowingImageButtonTooltipConfig = TooltipEducationViewConfig( tooltipViewLayout = R.layout.desktop_windowing_education_left_arrow_tooltip, tooltipViewLayout = R.layout.desktop_windowing_education_horizontal_arrow_tooltip, tooltipColorScheme = TooltipColorScheme( tertiaryFixedColor, Loading @@ -210,7 +216,7 @@ class AppHandleEducationController( tooltipText = getString(R.string.windowing_desktop_mode_image_button_education_tooltip), arrowDirection = DesktopWindowingEducationTooltipController.TooltipArrowDirection.LEFT, DesktopWindowingEducationTooltipController.TooltipArrowDirection.HORIZONTAL, onEducationClickAction = { toDesktopModeCallback( captionState.runningTaskInfo.taskId, Loading @@ -233,13 +239,17 @@ class AppHandleEducationController( val globalAppChipBounds = captionState.globalAppChipBounds val tooltipGlobalCoordinates = Point( globalAppChipBounds.right, if (isRtl()) { globalAppChipBounds.left } else { globalAppChipBounds.right }, globalAppChipBounds.top + globalAppChipBounds.height() / 2, ) // Populate information important to inflate exit desktop mode education tooltip. val exitWindowingTooltipConfig = TooltipEducationViewConfig( tooltipViewLayout = R.layout.desktop_windowing_education_left_arrow_tooltip, tooltipViewLayout = R.layout.desktop_windowing_education_horizontal_arrow_tooltip, tooltipColorScheme = TooltipColorScheme( tertiaryFixedColor, Loading @@ -249,7 +259,7 @@ class AppHandleEducationController( tooltipViewGlobalCoordinates = tooltipGlobalCoordinates, tooltipText = getString(R.string.windowing_desktop_mode_exit_education_tooltip), arrowDirection = DesktopWindowingEducationTooltipController.TooltipArrowDirection.LEFT, DesktopWindowingEducationTooltipController.TooltipArrowDirection.HORIZONTAL, onDismissAction = { // TODO: b/341320146 - Log previous tooltip was dismissed }, Loading Loading @@ -299,6 +309,8 @@ class AppHandleEducationController( private fun getString(@StringRes resId: Int): String = context.resources.getString(resId) private fun isRtl() = context.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL companion object { const val TAG = "AppHandleEducationController" val APP_HANDLE_EDUCATION_DELAY_MILLIS: Long Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +5 −2 Original line number Diff line number Diff line Loading @@ -734,7 +734,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin // [AppHeaderViewHolder]. ((AppHeaderViewHolder) mWindowDecorViewHolder).runOnAppChipGlobalLayout( () -> { notifyAppChipStateChanged(); notifyAppHeaderStateChanged(); return Unit.INSTANCE; }); } Loading Loading @@ -766,7 +766,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin mResult.mCaptionHeight); } private void notifyAppChipStateChanged() { private void notifyAppHeaderStateChanged() { if (isAppHandle(mWindowDecorViewHolder) || mWindowDecorViewHolder == null) { return; } final Rect appChipPositionInWindow = ((AppHeaderViewHolder) mWindowDecorViewHolder).getAppChipLocationInWindow(); final Rect taskBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/education/DesktopWindowingEducationTooltipController.kt +11 −4 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.util.Size import android.view.LayoutInflater import android.view.MotionEvent import android.view.View import android.view.View.LAYOUT_DIRECTION_RTL import android.view.View.MeasureSpec.UNSPECIFIED import android.view.WindowManager import android.widget.ImageView Loading Loading @@ -199,6 +200,7 @@ class DesktopWindowingEducationTooltipController( requireViewById<ImageView>(R.id.arrow_icon).apply { val wrappedDrawable = DrawableCompat.wrap(this.drawable) DrawableCompat.setTint(wrappedDrawable, tooltipColorScheme.container) if (isRtl()) scaleX = -1f } requireViewById<TextView>(R.id.tooltip_text).apply { setTextColor(tooltipColorScheme.text) } requireViewById<ImageView>(R.id.tooltip_icon).apply { Loading Loading @@ -227,6 +229,9 @@ class DesktopWindowingEducationTooltipController( // Arrow is placed at vertical center on the left edge of the tooltip. Hence decrement // half of tooltip height from [tooltipY] to vertically position the tooltip. tooltipY -= tooltipDimen.height / 2 if (isRtl()) { tooltipX -= tooltipDimen.width } } return Point(tooltipX, tooltipY) } Loading Loading @@ -260,6 +265,8 @@ class DesktopWindowingEducationTooltipController( return context.resources.getDimensionPixelSize(resourceId) } private fun isRtl() = context.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL /** * The configuration for education view features: * Loading Loading @@ -297,6 +304,6 @@ class DesktopWindowingEducationTooltipController( /** Direction of arrow of the tooltip */ enum class TooltipArrowDirection { UP, LEFT, HORIZONTAL } } No newline at end of file
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/education/DesktopWindowingEducationTooltipControllerTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -154,12 +154,12 @@ class DesktopWindowingEducationTooltipControllerTest : ShellTestCase() { } @Test fun showEducationTooltip_tooltipPointsLeft_verticallyPositionTooltip() { fun showEducationTooltip_tooltipPointsHorizontally_verticallyPositionTooltip() { val initialTooltipX = 0 val initialTooltipY = 0 val tooltipViewConfig = createTooltipConfig( arrowDirection = TooltipArrowDirection.LEFT, arrowDirection = TooltipArrowDirection.HORIZONTAL, tooltipViewGlobalCoordinates = Point(initialTooltipX, initialTooltipY)) val tooltipYArgumentCaptor = argumentCaptor<Int>() val tooltipHeightArgumentCaptor = argumentCaptor<Int>() Loading