diff options
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt')
-rw-r--r-- | quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index de4175ddc1..6d1b55870f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -29,8 +29,10 @@ 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 import com.android.launcher3.util.DisplayController import com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP import com.android.quickstep.util.LottieAnimationColorUtils @@ -40,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. */ @@ -57,7 +62,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : LoggableTaskbarController { private val isTooltipEnabled: Boolean - get() = !Utilities.isRunningInTestHarness() + get() = !Utilities.isRunningInTestHarness() && !isPhoneMode(activityContext.deviceProfile) private val isOpen: Boolean get() = tooltip?.isOpen ?: false val isBeforeTooltipFeaturesStep: Boolean @@ -67,11 +72,10 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : @TaskbarEduTooltipStep var tooltipStep: Int get() { - return activityContext.onboardingPrefs?.getCount(TASKBAR_EDU_TOOLTIP_STEP) - ?: TOOLTIP_STEP_NONE + return TASKBAR_EDU_TOOLTIP_STEP.get(activityContext) } private set(step) { - activityContext.onboardingPrefs?.setEventCount(step, TASKBAR_EDU_TOOLTIP_STEP) + TASKBAR_EDU_TOOLTIP_STEP.set(step, activityContext) } private var tooltip: TaskbarEduTooltip? = null @@ -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 ) } } @@ -251,5 +258,5 @@ private fun LottieAnimationView.supportLightTheme() { return } - LottieAnimationColorUtils.updateColors(this, DARK_TO_LIGHT_COLORS, context.theme) + LottieAnimationColorUtils.updateToColorResources(this, DARK_TO_LIGHT_COLORS, context.theme) } |