diff --git a/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml b/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml index 04e87be412..4e676298c8 100644 --- a/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml +++ b/quickstep/res/layout-land/keyboard_quick_switch_taskview.xml @@ -59,6 +59,29 @@ app:layout_constraintStart_toEndOf="@id/thumbnail1" app:layout_constraintEnd_toEndOf="parent"/> + + + + diff --git a/quickstep/res/layout/keyboard_quick_switch_taskview.xml b/quickstep/res/layout/keyboard_quick_switch_taskview.xml index 691df6e8f6..4d213fadbb 100644 --- a/quickstep/res/layout/keyboard_quick_switch_taskview.xml +++ b/quickstep/res/layout/keyboard_quick_switch_taskview.xml @@ -59,6 +59,29 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"/> + + + + diff --git a/quickstep/res/layout/keyboard_quick_switch_thumbnail.xml b/quickstep/res/layout/keyboard_quick_switch_thumbnail.xml index cd6587cc06..dde9cac05a 100644 --- a/quickstep/res/layout/keyboard_quick_switch_thumbnail.xml +++ b/quickstep/res/layout/keyboard_quick_switch_thumbnail.xml @@ -19,4 +19,5 @@ android:layout_height="match_parent" android:scaleType="centerCrop" android:background="@drawable/keyboard_quick_switch_task_view_background" - android:clipToOutline="true"/> + android:clipToOutline="true" + android:importantForAccessibility="no"/> diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index d69b1552ef..e3081f32f5 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -372,6 +372,8 @@ 4dp 104dp 134dp + 28dp + 4dp 20dp 56dp 16dp diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java index c4962cd016..2d14ed91e1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java @@ -181,7 +181,7 @@ public final class KeyboardQuickSwitchController implements mModel.getThumbnailCache().updateThumbnailInBackground(task, callback); } - void updateTitleInBackground(Task task, Consumer callback) { + void updateIconInBackground(Task task, Consumer callback) { mModel.getIconCache().updateIconInBackground(task, callback); } diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java index 8b2bca11e9..49dfe46c6a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java @@ -47,6 +47,8 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { @Nullable private ImageView mThumbnailView1; @Nullable private ImageView mThumbnailView2; + @Nullable private ImageView mIcon1; + @Nullable private ImageView mIcon2; @Nullable private View mContent; public KeyboardQuickSwitchTaskView(@NonNull Context context) { @@ -101,9 +103,10 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { @Override protected void onFinishInflate() { super.onFinishInflate(); - mThumbnailView1 = findViewById(R.id.thumbnail1); mThumbnailView2 = findViewById(R.id.thumbnail2); + mIcon1 = findViewById(R.id.icon1); + mIcon2 = findViewById(R.id.icon2); mContent = findViewById(R.id.content); } @@ -122,11 +125,11 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { @NonNull Task task1, @Nullable Task task2, @Nullable ThumbnailUpdateFunction thumbnailUpdateFunction, - @Nullable TitleUpdateFunction titleUpdateFunction) { + @Nullable IconUpdateFunction iconUpdateFunction) { applyThumbnail(mThumbnailView1, task1, thumbnailUpdateFunction); applyThumbnail(mThumbnailView2, task2, thumbnailUpdateFunction); - if (titleUpdateFunction == null) { + if (iconUpdateFunction == null) { setContentDescription(task2 == null ? task1.titleDescription : getContext().getString( @@ -135,16 +138,23 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { task2.titleDescription)); return; } - titleUpdateFunction.updateTitleInBackground(task1, t -> - setContentDescription(task1.titleDescription)); + iconUpdateFunction.updateIconInBackground(task1, t -> { + applyIcon(mIcon1, task1); + if (task2 != null) { + return; + } + setContentDescription(task1.titleDescription); + }); if (task2 == null) { return; } - titleUpdateFunction.updateTitleInBackground(task2, t -> - setContentDescription(getContext().getString( - R.string.quick_switch_split_task, - task1.titleDescription, - task2.titleDescription))); + iconUpdateFunction.updateIconInBackground(task2, t -> { + applyIcon(mIcon2, task2); + setContentDescription(getContext().getString( + R.string.quick_switch_split_task, + task1.titleDescription, + task2.titleDescription)); + }); } private void applyThumbnail( @@ -173,13 +183,21 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { thumbnailView.setImageBitmap(bm); } + private void applyIcon(@Nullable ImageView iconView, @NonNull Task task) { + if (iconView == null) { + return; + } + iconView.setVisibility(VISIBLE); + iconView.setImageDrawable(task.icon); + } + protected interface ThumbnailUpdateFunction { void updateThumbnailInBackground(Task task, Consumer callback); } - protected interface TitleUpdateFunction { + protected interface IconUpdateFunction { - void updateTitleInBackground(Task task, Consumer callback); + void updateIconInBackground(Task task, Consumer callback); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java index 745defc18b..50691d4a00 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java @@ -145,20 +145,20 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { taskView.setOnClickListener(v -> mViewCallbacks.launchTappedTask(index)); LayoutParams lp = new LayoutParams(width, mTaskViewHeight); - // Create a right-to-left ordering of views (or left-to-right in RTL locales) + // Create a left-to-right ordering of views (or right-to-left in RTL locales) if (previousView != null) { - lp.endToStart = previousView.getId(); + lp.startToEnd = previousView.getId(); } else { - lp.endToEnd = PARENT_ID; + lp.startToStart = PARENT_ID; } lp.topToTop = PARENT_ID; lp.bottomToBottom = PARENT_ID; // Add spacing between views - lp.setMarginEnd(mSpacing); + lp.setMarginStart(mSpacing); if (isFinalView) { - // Add spacing to the start of the final view so that scrolling ends with some padding. - lp.startToStart = PARENT_ID; - lp.setMarginStart(mSpacing); + // Add spacing to the end of the final view so that scrolling ends with some padding. + lp.endToEnd = PARENT_ID; + lp.setMarginEnd(mSpacing); lp.horizontalBias = 1f; } @@ -167,7 +167,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { groupTask.task1, groupTask.task2, updateTasks ? mViewCallbacks::updateThumbnailInBackground : null, - updateTasks ? mViewCallbacks::updateTitleInBackground : null); + updateTasks ? mViewCallbacks::updateIconInBackground : null); mContent.addView(taskView, lp); return taskView; @@ -187,8 +187,8 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { ConstraintLayout.LayoutParams lp = new ConstraintLayout.LayoutParams( width, mTaskViewHeight); - lp.startToStart = PARENT_ID; - lp.endToStart = previousView.getId(); + lp.endToEnd = PARENT_ID; + lp.startToEnd = previousView.getId(); lp.topToTop = PARENT_ID; lp.bottomToBottom = PARENT_ID; lp.setMarginEnd(mSpacing); @@ -402,16 +402,16 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { } else if (toIndex > fromIndex || toIndex == 0) { // Scrolling to next task view if (mIsRtl) { - scrollRightTo(focusedTask); - } else { scrollLeftTo(focusedTask); + } else { + scrollRightTo(focusedTask); } } else { // Scrolling to previous task view if (mIsRtl) { - scrollLeftTo(focusedTask); - } else { scrollRightTo(focusedTask); + } else { + scrollLeftTo(focusedTask); } } if (mViewCallbacks != null) { diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index 836bf79b34..75091084e2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -216,8 +216,8 @@ public class KeyboardQuickSwitchViewController { mControllerCallbacks.updateThumbnailInBackground(task, callback); } - void updateTitleInBackground(Task task, Consumer callback) { - mControllerCallbacks.updateTitleInBackground(task, callback); + void updateIconInBackground(Task task, Consumer callback) { + mControllerCallbacks.updateIconInBackground(task, callback); } } }