Merge "Add EDU lottie animations for persistent and transient." into tm-qpr-dev am: ddc7ef2eb1
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20672612 Change-Id: Ie302f00d1ba369210caf9910422a1df305a8a4ef Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
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 |
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
@@ -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
@@ -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 & 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] -->
|
||||
|
||||
@@ -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 */));
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user