diff --git a/quickstep/res/layout/taskbar_edu_circle_to_search.xml b/quickstep/res/layout/taskbar_edu_search.xml similarity index 80% rename from quickstep/res/layout/taskbar_edu_circle_to_search.xml rename to quickstep/res/layout/taskbar_edu_search.xml index 6c95f25e04..ca84f351ce 100644 --- a/quickstep/res/layout/taskbar_edu_circle_to_search.xml +++ b/quickstep/res/layout/taskbar_edu_search.xml @@ -23,35 +23,35 @@ style="@style/TextAppearance.TaskbarEduTooltip.Title" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="@string/taskbar_edu_circle_to_search_title" + android:text="@string/taskbar_search_edu_title" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toTopOf="@+id/circle_to_search_animation" /> + app:layout_constraintBottom_toTopOf="@+id/search_edu_animation" /> diff --git a/quickstep/res/raw/taskbar_edu_circle_to_search.json b/quickstep/res/raw/taskbar_edu_search.json similarity index 100% rename from quickstep/res/raw/taskbar_edu_circle_to_search.json rename to quickstep/res/raw/taskbar_edu_search.json diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index 28cdb99df0..b3502db6ed 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -35,6 +35,7 @@ com.android.launcher3.taskbar.TaskbarViewCallbacksFactory com.android.quickstep.LauncherRestoreEventLoggerImpl com.android.launcher3.uioverrides.plugins.PluginManagerWrapperImpl + com.android.launcher3.taskbar.TaskbarEduTooltipController diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 9ca806004d..dbf075cda3 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -403,7 +403,7 @@ 412dp 428dp 624dp - 12sp + 12sp 300dp diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml index fc3c0e347c..278c66af53 100644 --- a/quickstep/res/values/strings.xml +++ b/quickstep/res/values/strings.xml @@ -275,10 +275,10 @@ Always show the Taskbar To always show the Taskbar on the bottom of your screen, touch & hold the divider - - Touch & hold the action key to search what\'s on your screen + + Touch & hold the action key to search what\'s on your screen - This product uses the selected part of your screen to search. Google\'s <a href=\"%1$s\">Privacy Policy</a> and <a href=\"%2$s\">Terms of Service</a> apply. + This product uses the selected part of your screen to search. Google\'s <a href=\"%1$s\">Privacy Policy</a> and <a href=\"%2$s\">Terms of Service</a> apply. Close diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 489102f7d5..2c2311a476 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -16,7 +16,6 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.QuickstepTransitionManager.TRANSIENT_TASKBAR_TRANSITION_DURATION; -import static com.android.launcher3.config.FeatureFlags.enableSplitContextually; import static com.android.launcher3.statemanager.BaseState.FLAG_NON_INTERACTIVE; import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES; import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_VISIBLE; @@ -306,8 +305,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { */ public void showEduOnAppLaunch() { if (!shouldShowEduOnAppLaunch()) { - // Called in case the edu finishes and circle to search edu is still pending - mControllers.taskbarEduTooltipController.maybeShowCircleToSearchEdu(); + // Called in case the edu finishes and search edu is still pending + mControllers.taskbarEduTooltipController.maybeShowSearchEdu(); return; } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 679528b7b0..1a94424323 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -306,7 +306,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarTranslationController(this), new TaskbarSpringOnStashController(this), createTaskbarRecentAppsController(isPcMode), - new TaskbarEduTooltipController(this), + TaskbarEduTooltipController.newInstance(this), new KeyboardQuickSwitchController(), new TaskbarPinningController(this), bubbleControllersOptional); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index e53f627ec4..d43055d56a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -15,6 +15,7 @@ */ package com.android.launcher3.taskbar +import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle @@ -42,8 +43,10 @@ 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.util.DisplayController -import com.android.launcher3.util.OnboardingPrefs.TASKBAR_CIRCLE_TO_SEARCH_EDU_SEEN import com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP +import com.android.launcher3.util.OnboardingPrefs.TASKBAR_SEARCH_EDU_SEEN +import com.android.launcher3.util.ResourceBasedOverride +import com.android.launcher3.views.ActivityContext import com.android.launcher3.views.BaseDragLayer import com.android.quickstep.util.LottieAnimationColorUtils import java.io.PrintWriter @@ -72,9 +75,11 @@ private const val TOS_BASE_URL = "https://policies.google.com/terms?hl=" annotation class TaskbarEduTooltipStep /** Controls stepping through the Taskbar tooltip EDU. */ -class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : - LoggableTaskbarController { +open class TaskbarEduTooltipController(context: Context) : + ResourceBasedOverride, LoggableTaskbarController { + protected val activityContext: TaskbarActivityContext = ActivityContext.lookupContext(context) + open val shouldShowSearchEdu = false private val isTooltipEnabled: Boolean get() = !Utilities.isRunningInTestHarness() && !activityContext.isPhoneMode private val isOpen: Boolean @@ -83,13 +88,13 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : get() = isTooltipEnabled && tooltipStep <= TOOLTIP_STEP_FEATURES private lateinit var controllers: TaskbarControllers - // Keep track of whether the user has seen the Circle to Search Edu - private var userHasSeenCircleToSearchEdu: Boolean + // Keep track of whether the user has seen the Search Edu + private var userHasSeenSearchEdu: Boolean get() { - return TASKBAR_CIRCLE_TO_SEARCH_EDU_SEEN.get(activityContext) + return TASKBAR_SEARCH_EDU_SEEN.get(activityContext) } private set(seen) { - LauncherPrefs.get(activityContext).put(TASKBAR_CIRCLE_TO_SEARCH_EDU_SEEN, seen) + LauncherPrefs.get(activityContext).put(TASKBAR_SEARCH_EDU_SEEN, seen) } @TaskbarEduTooltipStep @@ -105,8 +110,8 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : fun init(controllers: TaskbarControllers) { this.controllers = controllers - // We want to show the Circle To Search Edu right after pinning, so we post it here - activityContext.dragLayer.post { maybeShowCircleToSearchEdu() } + // We want to show the Search Edu right after pinning the taskbar, so we post it here + activityContext.dragLayer.post { maybeShowSearchEdu() } } /** Shows swipe EDU tooltip if it is the current [tooltipStep]. */ @@ -136,7 +141,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : fun maybeShowFeaturesEdu() { if (!isTooltipEnabled || tooltipStep > TOOLTIP_STEP_FEATURES) { maybeShowPinningEdu() - maybeShowCircleToSearchEdu() + maybeShowSearchEdu() return } @@ -233,26 +238,26 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : } /** - * Shows standalone Circle To Search EDU tooltip if this EDU has not been seen. + * Shows standalone Search EDU tooltip if this EDU has not been seen. * - * We show this standalone edu for users to learn to how to trigger Circle To Search from the - * pinned taskbar + * We show this standalone edu for users to learn to how to trigger Search from the pinned + * taskbar */ - fun maybeShowCircleToSearchEdu() { + fun maybeShowSearchEdu() { if ( !enableTaskbarPinning() || !DisplayController.isPinnedTaskbar(activityContext) || !isTooltipEnabled || - userHasSeenCircleToSearchEdu + !shouldShowSearchEdu || + userHasSeenSearchEdu ) { return } - userHasSeenCircleToSearchEdu = true - inflateTooltip(R.layout.taskbar_edu_circle_to_search) + userHasSeenSearchEdu = true + inflateTooltip(R.layout.taskbar_edu_search) tooltip?.run { - requireViewById(R.id.circle_to_search_animation) - .supportLightTheme() - val eduSubtitle: TextView = requireViewById(R.id.circle_to_search_text) + requireViewById(R.id.search_edu_animation).supportLightTheme() + val eduSubtitle: TextView = requireViewById(R.id.search_edu_text) showDisclosureText(eduSubtitle) updateLayoutParams { if (DisplayController.isTransientTaskbar(activityContext)) { @@ -285,7 +290,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : */ private fun TaskbarEduTooltip.showDisclosureText( textView: TextView, - stringId: Int = R.string.taskbar_edu_circle_to_search_disclosure, + stringId: Int = R.string.taskbar_edu_search_disclosure, ) { val locale = resources.configuration.locales[0] val text = @@ -395,6 +400,17 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : pw?.println("$prefix\tisOpen=$isOpen") pw?.println("$prefix\ttooltipStep=$tooltipStep") } + + companion object { + @JvmStatic + fun newInstance(context: Context): TaskbarEduTooltipController { + return ResourceBasedOverride.Overrides.getObject( + TaskbarEduTooltipController::class.java, + context, + R.string.taskbar_edu_tooltip_controller_class + ) + } + } } /** diff --git a/res/values/config.xml b/res/values/config.xml index 393a197f15..648a50cbf1 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -76,6 +76,7 @@ + diff --git a/src/com/android/launcher3/util/OnboardingPrefs.kt b/src/com/android/launcher3/util/OnboardingPrefs.kt index 370b4c8cee..ac6e97c5b2 100644 --- a/src/com/android/launcher3/util/OnboardingPrefs.kt +++ b/src/com/android/launcher3/util/OnboardingPrefs.kt @@ -76,7 +76,5 @@ object OnboardingPrefs { @JvmField val HOTSEAT_LONGPRESS_TIP_SEEN = backedUpItem("launcher.hotseat_longpress_tip_seen", false) - @JvmField - val TASKBAR_CIRCLE_TO_SEARCH_EDU_SEEN = - backedUpItem("launcher.taskbar_circle_to_search_edu_seen", false) + @JvmField val TASKBAR_SEARCH_EDU_SEEN = backedUpItem("launcher.taskbar_search_edu_seen", false) }