Add standalone taskbar edu tooltip for the pinnable taskbar feature

This change adds in a standalone edu window for the pinnable taskbar
feature. The reason for the change is to educate users about pinnable
taskbar to those who have already seen taskbar edu before.

Fixes: 302589411, 300161174
Test: Went through taskbar education taskbar with the flag on and off.
Check that the standalone pinning taskbar only shows up if previous
taskbar education was already completed.
Flag:  ACONFIG com.android.launcher3.enable_taskbar_pinning DISABLED

Change-Id: I03a5fb05ae5f15892421a57355f6d503de56d9fd
This commit is contained in:
Saumya Prakash
2024-01-05 20:17:03 +00:00
parent c715781453
commit dddebdff0c
13 changed files with 125 additions and 18 deletions

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
style="@style/TextAppearance.TaskbarEduTooltip.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_pinning_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/standalone_pinning_animation" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/standalone_pinning_animation"
android:layout_width="@dimen/taskbar_edu_swipe_lottie_width"
android:layout_height="@dimen/taskbar_edu_swipe_lottie_height"
android:layout_marginTop="@dimen/taskbar_edu_tooltip_vertical_margin"
app:layout_constraintBottom_toTopOf="@id/pinning_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title"
app:lottie_rawRes="@raw/taskbar_edu_pinning"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<TextView
android:id="@+id/pinning_text"
style="@style/TextAppearance.TaskbarEduTooltip.Subtext"
android:layout_width="@dimen/taskbar_edu_swipe_lottie_width"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/taskbar_edu_pinning_standalone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/standalone_pinning_animation"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -400,6 +400,7 @@
<dimen name="taskbar_edu_features_lottie_width">170dp</dimen>
<dimen name="taskbar_edu_features_lottie_height">106dp</dimen>
<dimen name="taskbar_edu_features_horizontal_spacing">24dp</dimen>
<dimen name="taskbar_edu_features_tooltip_width_with_one_feature">412dp</dimen>
<dimen name="taskbar_edu_features_tooltip_width_with_two_features">428dp</dimen>
<dimen name="taskbar_edu_features_tooltip_width_with_three_features">624dp</dimen>

View File

@@ -264,6 +264,10 @@
<string name="taskbar_edu_pinning">Long press on the divider to pin the Taskbar</string>
<!-- Title in dialog that shows a user what they can do with the Taskbar. [CHAR_LIMIT=60] -->
<string name="taskbar_edu_features">Do more with the Taskbar</string>
<!-- Title in dialog that shows a user how to pin the Taskbar. [CHAR_LIMIT 60] -->
<string name="taskbar_edu_pinning_title">Always show the Taskbar</string>
<!-- Text in dialog that shows a user how to pin the Taskbar. [CHAR_LIMIT 60] -->
<string name="taskbar_edu_pinning_standalone">To always show the Taskbar on the bottom of your screen, touch &amp; hold the divider</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] -->

View File

@@ -16,6 +16,7 @@
package com.android.launcher3.taskbar
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
@@ -29,12 +30,13 @@ import androidx.core.view.updateLayoutParams
import com.airbnb.lottie.LottieAnimationView
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.config.FeatureFlags.enableTaskbarPinningEdu
import com.android.launcher3.config.FeatureFlags.enableTaskbarPinning
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.launcher3.taskbar.TaskbarManager.isPhoneMode
import com.android.launcher3.util.DisplayController
import com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP
import com.android.launcher3.views.BaseDragLayer
import com.android.quickstep.util.LottieAnimationColorUtils
import java.io.PrintWriter
@@ -110,6 +112,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
*/
fun maybeShowFeaturesEdu() {
if (!isTooltipEnabled || tooltipStep > TOOLTIP_STEP_FEATURES) {
maybeShowPinningEdu()
return
}
@@ -126,7 +129,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
if (DisplayController.isTransientTaskbar(activityContext)) {
splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_transient)
suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_transient)
pinningEdu.visibility = if (enableTaskbarPinningEdu()) VISIBLE else GONE
pinningEdu.visibility = if (enableTaskbarPinning()) VISIBLE else GONE
} else {
splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_persistent)
suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_persistent)
@@ -139,7 +142,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
if (DisplayController.isTransientTaskbar(activityContext)) {
width =
resources.getDimensionPixelSize(
if (enableTaskbarPinningEdu())
if (enableTaskbarPinning())
R.dimen.taskbar_edu_features_tooltip_width_with_three_features
else R.dimen.taskbar_edu_features_tooltip_width_with_two_features
)
@@ -158,6 +161,52 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
}
}
/**
* Shows standalone Pinning EDU tooltip if this EDU has not been seen.
*
* We show this standalone edu if users have seen the previous version of taskbar education,
* which did not include the pinning feature.
*/
private fun maybeShowPinningEdu() {
// use old value of tooltipStep that was set to the previous value of TOOLTIP_STEP_NONE (2
// for the original 2 edu steps) as a proxy to needing to show the separate pinning edu
if (
!enableTaskbarPinning() ||
!isTooltipEnabled ||
tooltipStep > TOOLTIP_STEP_PINNING ||
tooltipStep < TOOLTIP_STEP_FEATURES
) {
return
}
tooltipStep = TOOLTIP_STEP_NONE
inflateTooltip(R.layout.taskbar_edu_pinning)
tooltip?.run {
requireViewById<LottieAnimationView>(R.id.standalone_pinning_animation)
.supportLightTheme()
updateLayoutParams<BaseDragLayer.LayoutParams> {
if (DisplayController.isTransientTaskbar(activityContext)) {
bottomMargin += activityContext.deviceProfile.taskbarHeight
}
// Unlike other tooltips, we want to align with taskbar divider rather than center.
gravity = Gravity.BOTTOM
marginStart = 0
width =
resources.getDimensionPixelSize(
R.dimen.taskbar_edu_features_tooltip_width_with_one_feature
)
}
// Calculate the amount the tooltip must be shifted by to align with the taskbar divider
val taskbarDividerView = controllers.taskbarViewController.taskbarDividerView
val dividerLocation = taskbarDividerView.x + taskbarDividerView.width / 2
x = dividerLocation - layoutParams.width / 2
show()
}
}
/** Closes the current [tooltip]. */
fun hide() = tooltip?.close(true)

View File

@@ -506,6 +506,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
return reveal;
}
public View getTaskbarDividerView() {
return mTaskbarView.getTaskbarDividerView();
}
/**
* Defers any updates to the UI for the setup wizard animation.
*/

View File

@@ -322,14 +322,6 @@ public final class FeatureFlags {
return ENABLE_TASKBAR_PINNING.get() || Flags.enableTaskbarPinning();
}
/**
* Use a static boolean to gate the taskbar pinning education step
*/
public static boolean enableTaskbarPinningEdu() {
boolean enableTaskbarPinningEdu = false;
return enableTaskbarPinning() && enableTaskbarPinningEdu;
}
public static final BooleanFlag MOVE_STARTUP_DATA_TO_DEVICE_PROTECTED_STORAGE = getDebugFlag(
251502424, "ENABLE_BOOT_AWARE_STARTUP_DATA", DISABLED,
"Marks LauncherPref data as (and allows it to) available while the device is"