Merge "Add taskbar pinning education for new users and update other steps" into main

This commit is contained in:
Saumya Prakash
2023-11-30 20:08:13 +00:00
committed by Android (Google) Code Review
12 changed files with 48 additions and 32 deletions

View File

@@ -51,40 +51,40 @@
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_splitscreen"
app:layout_constraintEnd_toStartOf="@id/settings_text"
app:layout_constraintEnd_toStartOf="@id/pinning_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/splitscreen_animation" />
<androidx.constraintlayout.widget.Group
android:id="@+id/settings_edu"
android:id="@+id/pinning_edu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="settings_animation,settings_text" />
app:constraint_referenced_ids="pinning_animation,pinning_text" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/settings_animation"
android:id="@+id/pinning_animation"
android:layout_width="@dimen/taskbar_edu_features_lottie_width"
android:layout_height="@dimen/taskbar_edu_features_lottie_height"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/taskbar_edu_settings"
app:lottie_rawRes="@raw/taskbar_edu_pinning"
app:layout_constraintEnd_toEndOf="@id/settings_text"
app:layout_constraintStart_toStartOf="@id/settings_text"
app:layout_constraintEnd_toEndOf="@id/pinning_text"
app:layout_constraintStart_toStartOf="@id/pinning_text"
app:layout_constraintTop_toBottomOf="@id/title" />
<TextView
android:id="@+id/settings_text"
android:id="@+id/pinning_text"
style="@style/TextAppearance.TaskbarEduTooltip.Subtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/taskbar_edu_settings_persistent"
android:text="@string/taskbar_edu_pinning"
android:layout_marginStart="@dimen/taskbar_edu_features_horizontal_spacing"
app:layout_constraintEnd_toStartOf="@id/suggestions_text"
app:layout_constraintStart_toEndOf="@id/splitscreen_text"
app:layout_constraintTop_toBottomOf="@id/settings_animation" />
app:layout_constraintEnd_toStartOf="@id/suggestions_text"
app:layout_constraintTop_toBottomOf="@id/pinning_animation" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/suggestions_animation"
@@ -107,7 +107,7 @@
android:layout_marginStart="@dimen/taskbar_edu_features_horizontal_spacing"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/settings_text"
app:layout_constraintStart_toEndOf="@id/pinning_text"
app:layout_constraintTop_toBottomOf="@id/suggestions_animation" />
<androidx.constraintlayout.widget.Barrier
@@ -115,7 +115,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="splitscreen_text,settings_text,suggestions_text" />
app:constraint_referenced_ids="splitscreen_text,pinning_text,suggestions_text" />
<Button
android:id="@+id/done_button"

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,8 +400,8 @@
<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_persistent">624dp</dimen>
<dimen name="taskbar_edu_features_tooltip_width_transient">428dp</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>
<!--- Taskbar Pinning -->
<dimen name="taskbar_pinning_popup_menu_width">300dp</dimen>

View File

@@ -260,8 +260,8 @@
<string name="taskbar_edu_stashing">Slow-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">Get app suggestions based on your routine</string>
<!-- Text in dialog that lets a user know that Taskbar will auto-hide, if the user switches to gesture navigation in system settings. [CHAR_LIMIT=90] -->
<string name="taskbar_edu_settings_persistent">Turn on gesture navigation in Settings to auto-hide the Taskbar</string>
<!-- Title in dialog that shows a user how to pin the Taskbar. [CHAR_LIMIT 60] -->
<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>
<!-- Text on button to exit a tutorial [CHAR_LIMIT=16] -->

View File

@@ -29,6 +29,7 @@ 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.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.launcher3.taskbar.TaskbarManager.isPhoneMode
@@ -41,16 +42,19 @@ import java.io.PrintWriter
const val TOOLTIP_STEP_SWIPE = 0
/** Second EDU step for explaining Taskbar functionality when unstashed. */
const val TOOLTIP_STEP_FEATURES = 1
/** Third EDU step for explaining Taskbar pinning. */
const val TOOLTIP_STEP_PINNING = 2
/**
* EDU is completed.
*
* This value should match the maximum count for [TASKBAR_EDU_TOOLTIP_STEP].
*/
const val TOOLTIP_STEP_NONE = 2
const val TOOLTIP_STEP_NONE = 3
/** Current step in the tooltip EDU flow. */
@Retention(AnnotationRetention.SOURCE)
@IntDef(TOOLTIP_STEP_SWIPE, TOOLTIP_STEP_FEATURES, TOOLTIP_STEP_NONE)
@IntDef(TOOLTIP_STEP_SWIPE, TOOLTIP_STEP_FEATURES, TOOLTIP_STEP_PINNING, TOOLTIP_STEP_NONE)
annotation class TaskbarEduTooltipStep
/** Controls stepping through the Taskbar tooltip EDU. */
@@ -114,19 +118,19 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
tooltip?.run {
val splitscreenAnim = requireViewById<LottieAnimationView>(R.id.splitscreen_animation)
val suggestionsAnim = requireViewById<LottieAnimationView>(R.id.suggestions_animation)
val settingsAnim = requireViewById<LottieAnimationView>(R.id.settings_animation)
val settingsEdu = requireViewById<View>(R.id.settings_edu)
val pinningAnim = requireViewById<LottieAnimationView>(R.id.pinning_animation)
val pinningEdu = requireViewById<View>(R.id.pinning_edu)
splitscreenAnim.supportLightTheme()
suggestionsAnim.supportLightTheme()
settingsAnim.supportLightTheme()
pinningAnim.supportLightTheme()
if (DisplayController.isTransientTaskbar(activityContext)) {
splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_transient)
suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_transient)
settingsEdu.visibility = GONE
pinningEdu.visibility = if (enableTaskbarPinningEdu()) VISIBLE else GONE
} else {
splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_persistent)
suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_persistent)
settingsEdu.visibility = VISIBLE
pinningEdu.visibility = GONE
}
// Set up layout parameters.
@@ -135,13 +139,16 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
if (DisplayController.isTransientTaskbar(activityContext)) {
width =
resources.getDimensionPixelSize(
R.dimen.taskbar_edu_features_tooltip_width_transient
if (enableTaskbarPinningEdu())
R.dimen.taskbar_edu_features_tooltip_width_with_three_features
else R.dimen.taskbar_edu_features_tooltip_width_with_two_features
)
bottomMargin += activityContext.deviceProfile.taskbarHeight
} else {
width =
resources.getDimensionPixelSize(
R.dimen.taskbar_edu_features_tooltip_width_persistent
R.dimen.taskbar_edu_features_tooltip_width_with_two_features
)
}
}

View File

@@ -321,6 +321,14 @@ 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"

View File

@@ -62,7 +62,7 @@ object OnboardingPrefs {
}
}
@JvmField val TASKBAR_EDU_TOOLTIP_STEP = CountedItem("launcher.taskbar_edu_tooltip_step", 2)
@JvmField val TASKBAR_EDU_TOOLTIP_STEP = CountedItem("launcher.taskbar_edu_tooltip_step", 3)
@JvmField val HOME_BOUNCE_COUNT = CountedItem("launcher.home_bounce_count", 3)