Add EDU lottie animations for persistent and transient.

This CL introduces separate lottie assets for light and dark themes, as
well as each step. Each asset contains all of the steps currently but is
constrained to a min and max frame. In future CLs, we will optimize the
storage these take up by using the global assets and controlling min and
max frames programmatically, or trimming each individual asset.
Additionally, we should only be importing one theme variant and then
converting to the opposite programmatically, but the color mappings are
not ready yet.

Future polish to the EDU sheet, such as better handling the stashed
taskbar, will be introduced in future CLs.

Test: Manual in transient and persistent modes.
Bug: 217261955
Change-Id: I5b219ea02e25de0c5c887b5b5640f909e1219287
This commit is contained in:
Brian Isganitis 2022-12-08 01:11:31 +00:00
parent 6ba531d1aa
commit 77de0d5a28
19 changed files with 185 additions and 78 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -40,68 +40,7 @@
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_switch_apps"
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"
style="@style/TextAppearance.TaskbarEdu.Title"
android:text="@string/taskbar_edu_switch_apps"/>
<ImageView
android:layout_width="322dp"
android:layout_height="282dp"
android:layout_marginTop="16dp"
android:src="@drawable/taskbar_edu_switch_apps"/>
</LinearLayout>
<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:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.TaskbarEdu.Title"
android:text="@string/taskbar_edu_splitscreen"/>
<ImageView
android:layout_width="322dp"
android:layout_height="282dp"
android:layout_marginTop="16dp"
android:src="@drawable/taskbar_edu_splitscreen"/>
</LinearLayout>
<LinearLayout
android:id="@+id/page_stashing"
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"
style="@style/TextAppearance.TaskbarEdu.Title"
android:text="@string/taskbar_edu_stashing"/>
<ImageView
android:layout_width="322dp"
android:layout_height="282dp"
android:layout_marginTop="16dp"
android:src="@drawable/taskbar_edu_stashing"/>
</LinearLayout>
</com.android.launcher3.taskbar.TaskbarEduPagedView>
launcher:pageIndicator="@+id/content_page_indicator" />
<Button
android:id="@+id/edu_start_button"

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2022 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.TaskbarEdu.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_splitscreen" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:lottie_rawRes="@raw/taskbar_edu_splitscreen_persistent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.TaskbarEdu.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_suggestions" />
<com.airbnb.lottie.LottieAnimationView
android:id="@id/animation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:lottie_rawRes="@raw/taskbar_edu_suggestions_persistent" />
</LinearLayout>
</merge>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2022 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.TaskbarEdu.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_stashing" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:lottie_rawRes="@raw/taskbar_edu_stashing_transient" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.TaskbarEdu.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_splitscreen" />
<com.airbnb.lottie.LottieAnimationView
android:id="@id/animation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:lottie_rawRes="@raw/taskbar_edu_splitscreen_transient" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
style="@style/TextAppearance.TaskbarEdu.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_suggestions" />
<com.airbnb.lottie.LottieAnimationView
android:id="@id/animation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:lottie_rawRes="@raw/taskbar_edu_suggestions_transient" />
</LinearLayout>
</merge>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -230,15 +230,12 @@
<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 switch apps on their device.
[CHAR_LIMIT=60] -->
<string name="taskbar_edu_switch_apps">Use the taskbar to switch apps</string>
<!-- Text in dialog that lets a user know how they can use the taskbar to use multiple apps at once on their device.
[CHAR_LIMIT=60] -->
<string name="taskbar_edu_splitscreen">Drag to the side to use two apps at once</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_stashing">Touch &amp; hold to hide the taskbar</string>
<!-- Text in dialog that lets a user know how they can use the taskbar to use multiple apps at once on their device. [CHAR_LIMIT=60] -->
<string name="taskbar_edu_splitscreen">Drag to the side to use 2 apps at once</string>
<!-- Text in dialog that lets a user know how they can show the taskbar on their device. [CHAR_LIMIT=60] -->
<string name="taskbar_edu_stashing">Short swipe up to show the taskbar</string>
<!-- Text in dialog that lets a user know how the taskbar suggests apps based on their usage. [CHAR_LIMIT=60] -->
<string name="taskbar_edu_suggestions">The taskbar suggests apps based on your routine</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 go to the previous screen of a tutorial [CHAR_LIMIT=16] -->

View File

@ -18,9 +18,14 @@ package com.android.launcher3.taskbar;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_EDU;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import android.view.LayoutInflater;
import com.android.launcher3.R;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.launcher3.util.DisplayController;
import com.airbnb.lottie.LottieAnimationView;
import java.io.PrintWriter;
@ -33,6 +38,7 @@ public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarC
TaskbarControllers mControllers;
private TaskbarEduView mTaskbarEduView;
private TaskbarEduPagedView mPagedView;
public TaskbarEduController(TaskbarActivityContext activity) {
mActivity = activity;
@ -45,11 +51,20 @@ public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarC
void showEdu() {
TaskbarOverlayController overlayController = mControllers.taskbarOverlayController;
TaskbarOverlayContext overlayContext = overlayController.requestWindow();
mTaskbarEduView = (TaskbarEduView) overlayContext.getLayoutInflater().inflate(
R.layout.taskbar_edu, overlayContext.getDragLayer(), false);
mTaskbarEduView.init(new TaskbarEduCallbacks());
mControllers.navbarButtonsViewController.setSlideInViewVisible(true);
LayoutInflater layoutInflater = overlayContext.getLayoutInflater();
mTaskbarEduView = (TaskbarEduView) layoutInflater.inflate(
R.layout.taskbar_edu, overlayContext.getDragLayer(), false);
mPagedView = mTaskbarEduView.findViewById(R.id.content);
layoutInflater.inflate(
DisplayController.isTransientTaskbar(overlayContext)
? R.layout.taskbar_edu_pages_transient
: R.layout.taskbar_edu_pages_persistent,
mPagedView,
true);
mTaskbarEduView.init(new TaskbarEduCallbacks());
mControllers.navbarButtonsViewController.setSlideInViewVisible(true);
TaskbarStashController stashController = mControllers.taskbarStashController;
stashController.updateStateForFlag(FLAG_STASHED_IN_APP_EDU, true);
stashController.applyState(overlayController.getOpenDuration());
@ -75,7 +90,17 @@ public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarC
* Callbacks for {@link TaskbarEduView} to interact with its controller.
*/
class TaskbarEduCallbacks {
void onPageChanged(int currentPage, int pageCount) {
void onPageChanged(int prevPage, int currentPage, int pageCount) {
// Reset previous pages' animation.
LottieAnimationView prevAnimation = mPagedView.getChildAt(prevPage)
.findViewById(R.id.animation);
prevAnimation.cancelAnimation();
prevAnimation.setFrame(0);
mPagedView.getChildAt(currentPage)
.<LottieAnimationView>findViewById(R.id.animation)
.playAnimation();
if (currentPage == 0) {
mTaskbarEduView.updateStartButton(R.string.taskbar_edu_close,
v -> mTaskbarEduView.close(true /* animate */));

View File

@ -48,7 +48,7 @@ public class TaskbarEduPagedView extends PagedView<PageIndicatorDots> {
void setControllerCallbacks(TaskbarEduCallbacks controllerCallbacks) {
mControllerCallbacks = controllerCallbacks;
mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount());
mControllerCallbacks.onPageChanged(getCurrentPage(), getCurrentPage(), getPageCount());
}
@Override
@ -67,7 +67,7 @@ public class TaskbarEduPagedView extends PagedView<PageIndicatorDots> {
@Override
protected void notifyPageSwitchListener(int prevPage) {
super.notifyPageSwitchListener(prevPage);
mControllerCallbacks.onPageChanged(getCurrentPage(), getPageCount());
mControllerCallbacks.onPageChanged(prevPage, getCurrentPage(), getPageCount());
}
@Override