Merge "Cleanup ENABLE_TASKBAR_EDU_TOOLTIP: remove EDU sheet." into udc-dev

This commit is contained in:
Brian Isganitis
2023-04-10 19:17:47 +00:00
committed by Android (Google) Code Review
17 changed files with 5 additions and 666 deletions
-79
View File
@@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<com.android.launcher3.taskbar.TaskbarEduView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom"
android:orientation="vertical"
android:layout_marginHorizontal="108dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/edu_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_rounded_corner_bottom_sheet"
android:gravity="center_horizontal"
android:paddingHorizontal="36dp"
android:paddingTop="64dp">
<com.android.launcher3.taskbar.TaskbarEduPagedView
android:id="@+id/content"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="378dp"
app:layout_constraintTop_toTopOf="parent"
launcher:pageIndicator="@+id/content_page_indicator" />
<Button
android:id="@+id/edu_start_button"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginBottom="18dp"
android:layout_marginTop="32dp"
app:layout_constraintTop_toBottomOf="@id/content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="@string/taskbar_edu_close"
style="@style/TaskbarEdu.Button.Close"
android:textColor="?android:attr/textColorPrimary"/>
<com.android.launcher3.pageindicators.PageIndicatorDots
android:id="@+id/content_page_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/edu_start_button"
app:layout_constraintBottom_toBottomOf="@id/edu_start_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:elevation="1dp" />
<Button
android:id="@+id/edu_end_button"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@id/edu_start_button"
app:layout_constraintBottom_toBottomOf="@id/edu_start_button"
app:layout_constraintEnd_toEndOf="parent"
android:text="@string/taskbar_edu_next"
style="@style/TaskbarEdu.Button.Next"
android:textColor="?androidprv:attr/textColorOnAccent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.android.launcher3.taskbar.TaskbarEduView>
@@ -106,7 +106,7 @@
<Button
android:id="@+id/done_button"
style="@style/TaskbarEdu.Button.Next"
style="@style/TaskbarEdu.Button.Done"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginTop="32dp"
@@ -1,58 +0,0 @@
<?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>
@@ -1,78 +0,0 @@
<?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
-8
View File
@@ -241,10 +241,6 @@
<!-- ******* Taskbar Edu ******* -->
<!-- Accessibility title for the Taskbar education window. [CHAR_LIMIT=NONE] -->
<string name="taskbar_edu_a11y_title">Taskbar education</string>
<!-- Accessibility text spoken when the Taskbar education panel appears [CHAR_LIMIT=NONE] -->
<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 use multiple apps at once on their device. [CHAR_LIMIT=60] -->
<string name="taskbar_edu_splitscreen">Drag an app 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] -->
@@ -255,10 +251,6 @@
<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 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 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] -->
<string name="taskbar_edu_previous">Back</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] -->
+1 -18
View File
@@ -195,30 +195,13 @@
<item name="iconDisplay">taskbar</item>
</style>
<style name="TaskbarEdu.Button.Close" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/button_taskbar_edu_bordered</item>
<item name="android:stateListAnimator">@null</item>
<item name="android:textSize">16sp</item>
<item name="android:padding">4dp</item>
</style>
<style name="TaskbarEdu.Button.Next" parent="@android:style/Widget.Material.Button">
<style name="TaskbarEdu.Button.Done" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/button_taskbar_edu_colored</item>
<item name="android:stateListAnimator">@null</item>
<item name="android:textSize">16sp</item>
<item name="android:padding">4dp</item>
</style>
<style name="TextAppearance.TaskbarEdu.Title"
parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle" >
<item name="android:layout_marginHorizontal">16dp</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:fontFamily">google-sans</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">24sp</item>
<item name="android:lines">2</item>
</style>
<style name="TextAppearance.TaskbarEduTooltip.Title" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
<item name="android:gravity">center_horizontal</item>
<item name="android:fontFamily">google-sans</item>
@@ -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.ENABLE_TASKBAR_EDU_TOOLTIP;
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_RESUMED;
@@ -252,13 +251,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
return;
}
// Transient and persistent bottom sheet.
if (!ENABLE_TASKBAR_EDU_TOOLTIP.get()) {
mLauncher.getOnboardingPrefs().markChecked(OnboardingPrefs.TASKBAR_EDU_SEEN);
mControllers.taskbarEduController.showEdu();
return;
}
// Persistent features EDU tooltip.
if (!DisplayController.isTransientTaskbar(mLauncher)) {
mControllers.taskbarEduTooltipController.maybeShowFeaturesEdu();
@@ -277,11 +269,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
return false;
}
// Transient and persistent bottom sheet.
if (!ENABLE_TASKBAR_EDU_TOOLTIP.get()) {
return !mLauncher.getOnboardingPrefs().getBoolean(OnboardingPrefs.TASKBAR_EDU_SEEN);
}
// Persistent features EDU tooltip.
if (!DisplayController.isTransientTaskbar(mLauncher)) {
return !mLauncher.getOnboardingPrefs().hasReachedMaxCount(
@@ -224,7 +224,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
new TaskbarKeyguardController(this),
new StashedHandleViewController(this, stashedHandleView),
new TaskbarStashController(this),
new TaskbarEduController(this),
new TaskbarAutohideSuspendController(this),
new TaskbarPopupController(this),
new TaskbarForceVisibleImmersiveController(this),
@@ -48,7 +48,6 @@ public class TaskbarControllers {
public final TaskbarKeyguardController taskbarKeyguardController;
public final StashedHandleViewController stashedHandleViewController;
public final TaskbarStashController taskbarStashController;
public final TaskbarEduController taskbarEduController;
public final TaskbarAutohideSuspendController taskbarAutohideSuspendController;
public final TaskbarPopupController taskbarPopupController;
public final TaskbarForceVisibleImmersiveController taskbarForceVisibleImmersiveController;
@@ -95,7 +94,6 @@ public class TaskbarControllers {
TaskbarKeyguardController taskbarKeyguardController,
StashedHandleViewController stashedHandleViewController,
TaskbarStashController taskbarStashController,
TaskbarEduController taskbarEduController,
TaskbarAutohideSuspendController taskbarAutoHideSuspendController,
TaskbarPopupController taskbarPopupController,
TaskbarForceVisibleImmersiveController taskbarForceVisibleImmersiveController,
@@ -120,7 +118,6 @@ public class TaskbarControllers {
this.taskbarKeyguardController = taskbarKeyguardController;
this.stashedHandleViewController = stashedHandleViewController;
this.taskbarStashController = taskbarStashController;
this.taskbarEduController = taskbarEduController;
this.taskbarAutohideSuspendController = taskbarAutoHideSuspendController;
this.taskbarPopupController = taskbarPopupController;
this.taskbarForceVisibleImmersiveController = taskbarForceVisibleImmersiveController;
@@ -155,7 +152,6 @@ public class TaskbarControllers {
taskbarSpringOnStashController.init(this);
stashedHandleViewController.init(this);
taskbarStashController.init(this, sharedState.setupUIVisible, mSharedState);
taskbarEduController.init(this);
taskbarPopupController.init(this);
taskbarForceVisibleImmersiveController.init(this);
taskbarOverlayController.init(this);
@@ -172,7 +168,7 @@ public class TaskbarControllers {
taskbarDragController, navButtonController, navbarButtonsViewController,
taskbarDragLayerController, taskbarScrimViewController, taskbarViewController,
taskbarUnfoldAnimationController, taskbarKeyguardController,
stashedHandleViewController, taskbarStashController, taskbarEduController,
stashedHandleViewController, taskbarStashController,
taskbarAutohideSuspendController, taskbarPopupController, taskbarInsetsController,
voiceInteractionWindowController, taskbarTranslationController,
taskbarEduTooltipController, keyboardQuickSwitchController
@@ -1,131 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
package com.android.launcher3.taskbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.launcher3.DeviceProfile;
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;
/** Handles the Taskbar Education flow. */
public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarController {
private final TaskbarActivityContext mActivity;
// Initialized in init.
TaskbarControllers mControllers;
private TaskbarEduView mTaskbarEduView;
private TaskbarEduPagedView mPagedView;
public TaskbarEduController(TaskbarActivityContext activity) {
mActivity = activity;
}
public void init(TaskbarControllers controllers) {
mControllers = controllers;
}
void showEdu() {
TaskbarOverlayController overlayController = mControllers.taskbarOverlayController;
TaskbarOverlayContext overlayContext = overlayController.requestWindow();
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);
// Provide enough room for taskbar.
View startButton = mTaskbarEduView.findViewById(R.id.edu_start_button);
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams) startButton.getLayoutParams();
DeviceProfile dp = overlayContext.getDeviceProfile();
layoutParams.bottomMargin += dp.taskbarHeight + dp.taskbarBottomMargin;
mTaskbarEduView.init(new TaskbarEduCallbacks());
mControllers.navbarButtonsViewController.setSlideInViewVisible(true);
mTaskbarEduView.setOnCloseBeginListener(
() -> mControllers.navbarButtonsViewController.setSlideInViewVisible(false));
mTaskbarEduView.addOnCloseListener(() -> mTaskbarEduView = null);
mTaskbarEduView.show();
}
@Override
public void dumpLogs(String prefix, PrintWriter pw) {
pw.println(prefix + "TaskbarEduController:");
pw.println(prefix + "\tisShowingEdu=" + (mTaskbarEduView != null));
}
/**
* Callbacks for {@link TaskbarEduView} to interact with its controller.
*/
class TaskbarEduCallbacks {
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 */));
} else {
mTaskbarEduView.updateStartButton(R.string.taskbar_edu_previous,
v -> mTaskbarEduView.snapToPage(currentPage - 1));
}
if (currentPage == pageCount - 1) {
mTaskbarEduView.updateEndButton(R.string.taskbar_edu_done,
v -> mTaskbarEduView.close(true /* animate */));
} else {
mTaskbarEduView.updateEndButton(R.string.taskbar_edu_next,
v -> mTaskbarEduView.snapToPage(currentPage + 1));
}
}
int getIconLayoutBoundsWidth() {
return mControllers.taskbarViewController.getIconLayoutWidth();
}
int getOpenDuration() {
return mControllers.taskbarOverlayController.getOpenDuration();
}
int getCloseDuration() {
return mControllers.taskbarOverlayController.getCloseDuration();
}
}
}
@@ -1,79 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
package com.android.launcher3.taskbar;
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_EDUCATION_DIALOG;
import android.content.Context;
import android.util.AttributeSet;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.pageindicators.PageIndicatorDots;
import com.android.launcher3.taskbar.TaskbarEduController.TaskbarEduCallbacks;
import com.android.launcher3.views.ActivityContext;
/** Horizontal carousel of tutorial screens for Taskbar Edu. */
public class TaskbarEduPagedView extends PagedView<PageIndicatorDots> {
private TaskbarEduView mTaskbarEduView;
private TaskbarEduCallbacks mControllerCallbacks;
public TaskbarEduPagedView(Context context, AttributeSet attrs) {
super(context, attrs);
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
}
void setTaskbarEduView(TaskbarEduView taskbarEduView) {
mTaskbarEduView = taskbarEduView;
mPageIndicator = taskbarEduView.findViewById(R.id.content_page_indicator);
initParentViews(taskbarEduView);
}
void setControllerCallbacks(TaskbarEduCallbacks controllerCallbacks) {
mControllerCallbacks = controllerCallbacks;
mControllerCallbacks.onPageChanged(getCurrentPage(), getCurrentPage(), getPageCount());
}
@Override
protected int getChildGap(int fromIndex, int toIndex) {
return mTaskbarEduView.getPaddingLeft() + mTaskbarEduView.getPaddingRight();
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mMaxScroll > 0) {
mPageIndicator.setScroll(l, mMaxScroll);
}
}
@Override
protected void notifyPageSwitchListener(int prevPage) {
super.notifyPageSwitchListener(prevPage);
mControllerCallbacks.onPageChanged(prevPage, getCurrentPage(), getPageCount());
}
@Override
protected boolean canScroll(float absVScroll, float absHScroll) {
return AbstractFloatingView.getTopOpenViewWithType(
ActivityContext.lookupContext(getContext()),
TYPE_ALL & ~TYPE_TASKBAR_EDUCATION_DIALOG) == null;
}
}
@@ -31,7 +31,6 @@ import com.airbnb.lottie.LottieProperty.COLOR_FILTER
import com.airbnb.lottie.model.KeyPath
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_EDU_TOOLTIP
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.launcher3.util.DisplayController
@@ -59,7 +58,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) :
LoggableTaskbarController {
private val isTooltipEnabled: Boolean
get() = !Utilities.isRunningInTestHarness() && ENABLE_TASKBAR_EDU_TOOLTIP.get()
get() = !Utilities.isRunningInTestHarness()
private val isOpen: Boolean
get() = tooltip?.isOpen ?: false
val isBeforeTooltipFeaturesStep: Boolean
@@ -1,183 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
package com.android.launcher3.taskbar;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.Button;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.views.AbstractSlideInView;
/** Education view about the Taskbar. */
public class TaskbarEduView extends AbstractSlideInView<TaskbarOverlayContext>
implements Insettable {
private final Rect mInsets = new Rect();
// Initialized in init.
private TaskbarEduController.TaskbarEduCallbacks mTaskbarEduCallbacks;
private Button mStartButton;
private Button mEndButton;
private TaskbarEduPagedView mPagedView;
public TaskbarEduView(Context context, AttributeSet attr) {
this(context, attr, 0);
}
public TaskbarEduView(Context context, AttributeSet attrs,
int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
protected void init(TaskbarEduController.TaskbarEduCallbacks callbacks) {
if (mPagedView != null) {
mPagedView.setControllerCallbacks(callbacks);
}
mTaskbarEduCallbacks = callbacks;
}
@Override
protected void handleClose(boolean animate) {
handleClose(animate, mTaskbarEduCallbacks.getCloseDuration());
}
@Override
protected Interpolator getIdleInterpolator() {
return EMPHASIZED;
}
@Override
protected boolean isOfType(int type) {
return (type & TYPE_TASKBAR_EDUCATION_DIALOG) != 0;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mContent = findViewById(R.id.edu_view);
mStartButton = findViewById(R.id.edu_start_button);
mEndButton = findViewById(R.id.edu_end_button);
mPagedView = findViewById(R.id.content);
mPagedView.setTaskbarEduView(this);
}
@Override
public void setInsets(Rect insets) {
mInsets.set(insets);
mContent.setPadding(mContent.getPaddingStart(),
mContent.getPaddingTop(), mContent.getPaddingEnd(), insets.bottom);
}
@Override
protected void attachToContainer() {
if (mColorScrim != null) {
getPopupContainer().addView(mColorScrim, 0);
}
getPopupContainer().addView(this, 1);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING, 0);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int contentWidth = Math.min(getContentAreaWidth(), getMeasuredWidth());
contentWidth = Math.max(contentWidth, mTaskbarEduCallbacks.getIconLayoutBoundsWidth());
int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY);
mContent.measure(contentAreaWidthSpec, MeasureSpec.UNSPECIFIED);
}
private int getContentAreaWidth() {
return mTaskbarEduCallbacks.getIconLayoutBoundsWidth()
+ getResources().getDimensionPixelSize(R.dimen.taskbar_edu_horizontal_margin) * 2;
}
/** Show the Education flow. */
public void show() {
attachToContainer();
animateOpen();
}
@Override
protected Pair<View, String> getAccessibilityTarget() {
return Pair.create(mContent, mIsOpen ? getContext().getString(R.string.taskbar_edu_opened)
: getContext().getString(R.string.taskbar_edu_closed));
}
@Override
protected int getScrimColor(Context context) {
return context.getResources().getColor(R.color.widgets_picker_scrim);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int width = r - l;
int height = b - t;
// Lay out the content as center bottom aligned.
int contentWidth = mContent.getMeasuredWidth();
int contentLeft = (width - contentWidth - mInsets.left - mInsets.right) / 2 + mInsets.left;
mContent.layout(contentLeft, height - mContent.getMeasuredHeight(),
contentLeft + contentWidth, height);
setTranslationShift(mTranslationShift);
}
private void animateOpen() {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
}
mIsOpen = true;
mOpenCloseAnimator.setValues(
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setInterpolator(EMPHASIZED);
mOpenCloseAnimator.setDuration(mTaskbarEduCallbacks.getOpenDuration()).start();
}
void snapToPage(int page) {
mPagedView.snapToPage(page);
}
void updateStartButton(int textResId, OnClickListener onClickListener) {
mStartButton.setText(textResId);
mStartButton.setOnClickListener(onClickListener);
}
void updateEndButton(int textResId, OnClickListener onClickListener) {
mEndButton.setText(textResId);
mEndButton.setOnClickListener(onClickListener);
}
}
@@ -40,7 +40,6 @@ abstract class TaskbarBaseTestCase {
@Mock lateinit var taskbarKeyguardController: TaskbarKeyguardController
@Mock lateinit var stashedHandleViewController: StashedHandleViewController
@Mock lateinit var taskbarStashController: TaskbarStashController
@Mock lateinit var taskbarEduController: TaskbarEduController
@Mock lateinit var taskbarAutohideSuspendController: TaskbarAutohideSuspendController
@Mock lateinit var taskbarPopupController: TaskbarPopupController
@Mock
@@ -81,7 +80,6 @@ abstract class TaskbarBaseTestCase {
taskbarKeyguardController,
stashedHandleViewController,
taskbarStashController,
taskbarEduController,
taskbarAutohideSuspendController,
taskbarPopupController,
taskbarForceVisibleImmersiveController,
@@ -331,10 +331,6 @@ public final class FeatureFlags {
"ENABLE_FORCED_MONO_ICON", DISABLED,
"Enable the ability to generate monochromatic icons, if it is not provided by the app");
public static final BooleanFlag ENABLE_TASKBAR_EDU_TOOLTIP = getDebugFlag(270396268,
"ENABLE_TASKBAR_EDU_TOOLTIP", ENABLED,
"Enable the tooltip version of the Taskbar education flow.");
public static final BooleanFlag ENABLE_MULTI_INSTANCE = getDebugFlag(270396680,
"ENABLE_MULTI_INSTANCE", DISABLED,
"Enables creation and filtering of multiple task instances in overview");
@@ -41,7 +41,6 @@ public class OnboardingPrefs<T extends ActivityContext> {
public static final String SEARCH_KEYBOARD_EDU_SEEN = "launcher.search_edu_seen";
public static final String SEARCH_SNACKBAR_COUNT = "launcher.keyboard_snackbar_count";
public static final String SEARCH_ONBOARDING_COUNT = "launcher.search_onboarding_count";
public static final String TASKBAR_EDU_SEEN = "launcher.taskbar_edu_seen2";
public static final String ALL_APPS_VISITED_COUNT = "launcher.all_apps_visited_count";
public static final String QSB_SEARCH_ONBOARDING_CARD_DISMISSED = "launcher.qsb_edu_dismiss";
public static final String TASKBAR_EDU_TOOLTIP_STEP = "launcher.taskbar_edu_tooltip_step";
@@ -52,7 +51,7 @@ public class OnboardingPrefs<T extends ActivityContext> {
HOTSEAT_LONGPRESS_TIP_SEEN },
"Search Education", new String[] { SEARCH_KEYBOARD_EDU_SEEN, SEARCH_SNACKBAR_COUNT,
SEARCH_ONBOARDING_COUNT, QSB_SEARCH_ONBOARDING_CARD_DISMISSED},
"Taskbar Education", new String[] { TASKBAR_EDU_SEEN, TASKBAR_EDU_TOOLTIP_STEP },
"Taskbar Education", new String[] { TASKBAR_EDU_TOOLTIP_STEP },
"All Apps Visited Count", new String[] {ALL_APPS_VISITED_COUNT}
);
@@ -63,7 +62,6 @@ public class OnboardingPrefs<T extends ActivityContext> {
HOME_BOUNCE_SEEN,
HOTSEAT_LONGPRESS_TIP_SEEN,
SEARCH_KEYBOARD_EDU_SEEN,
TASKBAR_EDU_SEEN,
QSB_SEARCH_ONBOARDING_CARD_DISMISSED
})
@Retention(RetentionPolicy.SOURCE)