Loading quickstep/res/layout/taskbar_edu.xml +99 −23 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <com.android.launcher3.taskbar.TaskbarEduView 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" xmlns:launcher="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" Loading @@ -33,46 +34,121 @@ android:paddingHorizontal="36dp" android:paddingTop="64dp"> <com.android.launcher3.taskbar.TaskbarEduPagedView android:id="@+id/content" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="378dp" app:layout_constraintTop_toTopOf="parent" launcher:pageIndicator="@+id/content_page_indicator"> <LinearLayout android:id="@+id/page_splitscreen" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:id="@+id/edu_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" app:layout_constraintTop_toTopOf="parent" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_header_1" android:text="@string/taskbar_edu_splitscreen" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:id="@+id/edu_illustration" android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> <LinearLayout android:id="@+id/page_customize" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_customize" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@id/edu_header" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> <LinearLayout android:id="@+id/page_dock" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_dock" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> </com.android.launcher3.taskbar.TaskbarEduPagedView> <Button android:id="@+id/edu_close_button" android:id="@+id/edu_start_button" android:layout_width="wrap_content" android:layout_height="36dp" android:layout_marginBottom="92dp" app:layout_constraintTop_toBottomOf="@id/edu_illustration" app:layout_constraintTop_toBottomOf="@id/content" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:text="@string/taskbar_edu_close" style="@style/TaskbarEdu.Button.Close" android:textColor="?android:attr/textColorPrimary"/> <com.android.launcher3.pageindicators.PageIndicatorDots android:id="@+id/content_page_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/edu_start_button" app:layout_constraintBottom_toBottomOf="@id/edu_start_button" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:elevation="1dp" /> <Button android:id="@+id/edu_next_button" android:id="@+id/edu_end_button" android:layout_width="wrap_content" android:layout_height="36dp" android:layout_marginBottom="92dp" app:layout_constraintTop_toBottomOf="@id/edu_illustration" app:layout_constraintTop_toBottomOf="@id/content" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:text="@string/taskbar_edu_next" Loading quickstep/res/values/strings.xml +19 −5 Original line number Diff line number Diff line Loading @@ -205,11 +205,25 @@ <string name="gesture_tutorial_action_button_label_skip">Skip</string> <!-- ******* Taskbar Edu ******* --> <!-- Text in dialog that lets a user know how they can use the taskbar on their device. [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_header_1">Use 2 apps at once and switch apps with the taskbar</string> <!-- Text on button to go to the next screen of a tutorial [CHAR_LIMIT=30] --> <!-- Accessibility text spoken when the taskbar education panel appears [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_opened">Taskbar education appeared</string> <!-- Accessibility text spoken when the taskbar education panel disappears [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_closed">Taskbar education closed</string> <!-- Text in dialog that lets a user know how they can use the taskbar to use multiple apps on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_splitscreen" translatable="false">Use 2 apps at once and switch apps with the taskbar</string> <!-- Text in dialog that lets a user know how they can customize the taskbar on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_customize" translatable="false">Add your favorite apps and get automatic suggestions</string> <!-- Text in dialog that lets a user know how they can hide the taskbar on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_dock">Touch & hold to hide the taskbar anytime</string> <!-- Text on button to go to the next screen of a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_next">Next</string> <!-- Text on button to exit a tutorial [CHAR_LIMIT=30] --> <!-- Text on button to go to the previous screen of a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_previous">Back</string> <!-- Text on button to exit a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_close">Close</string> <!-- Text on button to finish a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_done">Done</string> </resources> quickstep/res/values/styles.xml +2 −0 Original line number Diff line number Diff line Loading @@ -144,11 +144,13 @@ <item name="android:background">@drawable/button_taskbar_edu_bordered</item> <item name="android:stateListAnimator">@null</item> <item name="android:textSize">16sp</item> <item name="android:padding">4dp</item> </style> <style name="TaskbarEdu.Button.Next" parent="@android:style/Widget.Material.Button"> <item name="android:background">@drawable/button_taskbar_edu_colored</item> <item name="android:stateListAnimator">@null</item> <item name="android:textSize">16sp</item> <item name="android:padding">4dp</item> </style> </resources> No newline at end of file quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java +25 −3 Original line number Diff line number Diff line Loading @@ -32,9 +32,8 @@ public class TaskbarEduController { mActivity.getDragLayer().post(() -> { mTaskbarEduView = (TaskbarEduView) mActivity.getLayoutInflater().inflate( R.layout.taskbar_edu, mActivity.getDragLayer(), false); mTaskbarEduView.addOnCloseListener(() -> { mTaskbarEduView = null; }); mTaskbarEduView.init(new TaskbarEduCallbacks()); mTaskbarEduView.addOnCloseListener(() -> mTaskbarEduView = null); mTaskbarEduView.show(); }); } Loading @@ -44,4 +43,27 @@ public class TaskbarEduController { mTaskbarEduView.close(true /* animate */); } } /** * Callbacks for {@link TaskbarEduView} to interact with its controller. */ class TaskbarEduCallbacks { void onPageChanged(int currentPage, int pageCount) { if (currentPage == 0) { mTaskbarEduView.updateStartButton(R.string.taskbar_edu_close, v -> mTaskbarEduView.close(true /* animate */)); } else { mTaskbarEduView.updateStartButton(R.string.taskbar_edu_previous, v -> mTaskbarEduView.snapToPage(currentPage - 1)); } if (currentPage == pageCount - 1) { mTaskbarEduView.updateEndButton(R.string.taskbar_edu_done, v -> mTaskbarEduView.close(true /* animate */)); } else { mTaskbarEduView.updateEndButton(R.string.taskbar_edu_next, v -> mTaskbarEduView.snapToPage(currentPage + 1)); } } } } quickstep/src/com/android/launcher3/taskbar/TaskbarEduPagedView.java 0 → 100644 +79 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.taskbar; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_EDUCATION_DIALOG; import android.content.Context; import android.util.AttributeSet; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.pageindicators.PageIndicatorDots; import com.android.launcher3.taskbar.TaskbarEduController.TaskbarEduCallbacks; import com.android.launcher3.views.ActivityContext; /** Horizontal carousel of tutorial screens for Taskbar Edu. */ public class TaskbarEduPagedView extends PagedView<PageIndicatorDots> { private TaskbarEduView mTaskbarEduView; private TaskbarEduCallbacks mControllerCallbacks; public TaskbarEduPagedView(Context context, AttributeSet attrs) { super(context, attrs); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } void setTaskbarEduView(TaskbarEduView taskbarEduView) { mTaskbarEduView = taskbarEduView; mPageIndicator = taskbarEduView.findViewById(R.id.content_page_indicator); initParentViews(taskbarEduView); } void setControllerCallbacks(TaskbarEduCallbacks controllerCallbacks) { mControllerCallbacks = controllerCallbacks; mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount()); } @Override protected int getChildGap() { return mTaskbarEduView.getPaddingLeft() + mTaskbarEduView.getPaddingRight(); } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mMaxScroll > 0) { mPageIndicator.setScroll(l, mMaxScroll); } } @Override protected void notifyPageSwitchListener(int prevPage) { super.notifyPageSwitchListener(prevPage); mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount()); } @Override protected boolean canScroll(float absVScroll, float absHScroll) { return AbstractFloatingView.getTopOpenViewWithType( ActivityContext.lookupContext(getContext()), TYPE_ALL & ~TYPE_TASKBAR_EDUCATION_DIALOG) == null; } } Loading
quickstep/res/layout/taskbar_edu.xml +99 −23 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <com.android.launcher3.taskbar.TaskbarEduView 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" xmlns:launcher="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" Loading @@ -33,46 +34,121 @@ android:paddingHorizontal="36dp" android:paddingTop="64dp"> <com.android.launcher3.taskbar.TaskbarEduPagedView android:id="@+id/content" android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="378dp" app:layout_constraintTop_toTopOf="parent" launcher:pageIndicator="@+id/content_page_indicator"> <LinearLayout android:id="@+id/page_splitscreen" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:id="@+id/edu_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" app:layout_constraintTop_toTopOf="parent" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_header_1" android:text="@string/taskbar_edu_splitscreen" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:id="@+id/edu_illustration" android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> <LinearLayout android:id="@+id/page_customize" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_customize" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@id/edu_header" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> <LinearLayout android:id="@+id/page_dock" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" android:gravity="center_horizontal" style="@style/TextHeadline" android:text="@string/taskbar_edu_dock" android:fontFamily="google-sans" android:textColor="?android:attr/textColorPrimary" android:textSize="24sp" android:maxLines="2"/> <ImageView android:layout_width="322dp" android:layout_height="282dp" android:layout_marginTop="16dp" android:src="@drawable/taskbar_edu_splitscreen"/> </LinearLayout> </com.android.launcher3.taskbar.TaskbarEduPagedView> <Button android:id="@+id/edu_close_button" android:id="@+id/edu_start_button" android:layout_width="wrap_content" android:layout_height="36dp" android:layout_marginBottom="92dp" app:layout_constraintTop_toBottomOf="@id/edu_illustration" app:layout_constraintTop_toBottomOf="@id/content" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" android:text="@string/taskbar_edu_close" style="@style/TaskbarEdu.Button.Close" android:textColor="?android:attr/textColorPrimary"/> <com.android.launcher3.pageindicators.PageIndicatorDots android:id="@+id/content_page_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/edu_start_button" app:layout_constraintBottom_toBottomOf="@id/edu_start_button" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:elevation="1dp" /> <Button android:id="@+id/edu_next_button" android:id="@+id/edu_end_button" android:layout_width="wrap_content" android:layout_height="36dp" android:layout_marginBottom="92dp" app:layout_constraintTop_toBottomOf="@id/edu_illustration" app:layout_constraintTop_toBottomOf="@id/content" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:text="@string/taskbar_edu_next" Loading
quickstep/res/values/strings.xml +19 −5 Original line number Diff line number Diff line Loading @@ -205,11 +205,25 @@ <string name="gesture_tutorial_action_button_label_skip">Skip</string> <!-- ******* Taskbar Edu ******* --> <!-- Text in dialog that lets a user know how they can use the taskbar on their device. [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_header_1">Use 2 apps at once and switch apps with the taskbar</string> <!-- Text on button to go to the next screen of a tutorial [CHAR_LIMIT=30] --> <!-- Accessibility text spoken when the taskbar education panel appears [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_opened">Taskbar education appeared</string> <!-- Accessibility text spoken when the taskbar education panel disappears [CHAR_LIMIT=NONE] --> <string name="taskbar_edu_closed">Taskbar education closed</string> <!-- Text in dialog that lets a user know how they can use the taskbar to use multiple apps on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_splitscreen" translatable="false">Use 2 apps at once and switch apps with the taskbar</string> <!-- Text in dialog that lets a user know how they can customize the taskbar on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_customize" translatable="false">Add your favorite apps and get automatic suggestions</string> <!-- Text in dialog that lets a user know how they can hide the taskbar on their device. [CHAR_LIMIT=60] --> <string name="taskbar_edu_dock">Touch & hold to hide the taskbar anytime</string> <!-- Text on button to go to the next screen of a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_next">Next</string> <!-- Text on button to exit a tutorial [CHAR_LIMIT=30] --> <!-- Text on button to go to the previous screen of a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_previous">Back</string> <!-- Text on button to exit a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_close">Close</string> <!-- Text on button to finish a tutorial [CHAR_LIMIT=16] --> <string name="taskbar_edu_done">Done</string> </resources>
quickstep/res/values/styles.xml +2 −0 Original line number Diff line number Diff line Loading @@ -144,11 +144,13 @@ <item name="android:background">@drawable/button_taskbar_edu_bordered</item> <item name="android:stateListAnimator">@null</item> <item name="android:textSize">16sp</item> <item name="android:padding">4dp</item> </style> <style name="TaskbarEdu.Button.Next" parent="@android:style/Widget.Material.Button"> <item name="android:background">@drawable/button_taskbar_edu_colored</item> <item name="android:stateListAnimator">@null</item> <item name="android:textSize">16sp</item> <item name="android:padding">4dp</item> </style> </resources> No newline at end of file
quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java +25 −3 Original line number Diff line number Diff line Loading @@ -32,9 +32,8 @@ public class TaskbarEduController { mActivity.getDragLayer().post(() -> { mTaskbarEduView = (TaskbarEduView) mActivity.getLayoutInflater().inflate( R.layout.taskbar_edu, mActivity.getDragLayer(), false); mTaskbarEduView.addOnCloseListener(() -> { mTaskbarEduView = null; }); mTaskbarEduView.init(new TaskbarEduCallbacks()); mTaskbarEduView.addOnCloseListener(() -> mTaskbarEduView = null); mTaskbarEduView.show(); }); } Loading @@ -44,4 +43,27 @@ public class TaskbarEduController { mTaskbarEduView.close(true /* animate */); } } /** * Callbacks for {@link TaskbarEduView} to interact with its controller. */ class TaskbarEduCallbacks { void onPageChanged(int currentPage, int pageCount) { if (currentPage == 0) { mTaskbarEduView.updateStartButton(R.string.taskbar_edu_close, v -> mTaskbarEduView.close(true /* animate */)); } else { mTaskbarEduView.updateStartButton(R.string.taskbar_edu_previous, v -> mTaskbarEduView.snapToPage(currentPage - 1)); } if (currentPage == pageCount - 1) { mTaskbarEduView.updateEndButton(R.string.taskbar_edu_done, v -> mTaskbarEduView.close(true /* animate */)); } else { mTaskbarEduView.updateEndButton(R.string.taskbar_edu_next, v -> mTaskbarEduView.snapToPage(currentPage + 1)); } } } }
quickstep/src/com/android/launcher3/taskbar/TaskbarEduPagedView.java 0 → 100644 +79 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.taskbar; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_EDUCATION_DIALOG; import android.content.Context; import android.util.AttributeSet; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.pageindicators.PageIndicatorDots; import com.android.launcher3.taskbar.TaskbarEduController.TaskbarEduCallbacks; import com.android.launcher3.views.ActivityContext; /** Horizontal carousel of tutorial screens for Taskbar Edu. */ public class TaskbarEduPagedView extends PagedView<PageIndicatorDots> { private TaskbarEduView mTaskbarEduView; private TaskbarEduCallbacks mControllerCallbacks; public TaskbarEduPagedView(Context context, AttributeSet attrs) { super(context, attrs); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } void setTaskbarEduView(TaskbarEduView taskbarEduView) { mTaskbarEduView = taskbarEduView; mPageIndicator = taskbarEduView.findViewById(R.id.content_page_indicator); initParentViews(taskbarEduView); } void setControllerCallbacks(TaskbarEduCallbacks controllerCallbacks) { mControllerCallbacks = controllerCallbacks; mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount()); } @Override protected int getChildGap() { return mTaskbarEduView.getPaddingLeft() + mTaskbarEduView.getPaddingRight(); } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mMaxScroll > 0) { mPageIndicator.setScroll(l, mMaxScroll); } } @Override protected void notifyPageSwitchListener(int prevPage) { super.notifyPageSwitchListener(prevPage); mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount()); } @Override protected boolean canScroll(float absVScroll, float absHScroll) { return AbstractFloatingView.getTopOpenViewWithType( ActivityContext.lookupContext(getContext()), TYPE_ALL & ~TYPE_TASKBAR_EDUCATION_DIALOG) == null; } }