diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml
index 20b148537f..363840a217 100644
--- a/quickstep/recents_ui_overrides/res/values/dimens.xml
+++ b/quickstep/recents_ui_overrides/res/values/dimens.xml
@@ -31,9 +31,6 @@
16dp
8dp
14sp
- 8dp
-
- 2dp
80dp
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
index b3bb850806..079a738036 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java
@@ -24,13 +24,13 @@ import static com.android.quickstep.logging.UserEventDispatcherExtension.ALL_APP
import android.os.UserManager;
import com.android.launcher3.AbstractFloatingView;
-import com.android.launcher3.ArrowTipView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.FloatingHeaderView;
+import com.android.launcher3.views.ArrowTipView;
import com.android.systemui.shared.system.LauncherEventUtil;
/**
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
index 5b01185ca3..773c6c8a6a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
@@ -26,7 +26,6 @@ import android.view.View;
import androidx.core.app.NotificationCompat;
-import com.android.launcher3.ArrowTipView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.Hotseat;
@@ -43,6 +42,7 @@ import com.android.launcher3.util.ActivityTracker;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.Themes;
+import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.Snackbar;
import java.util.ArrayDeque;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 56e3632dcd..71aaef1267 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -812,8 +812,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
super.onInitializeAccessibilityNodeInfo(info);
info.addAction(
- new AccessibilityNodeInfo.AccessibilityAction(R.string.accessibility_close_task,
- getContext().getText(R.string.accessibility_close_task)));
+ new AccessibilityNodeInfo.AccessibilityAction(R.string.accessibility_close,
+ getContext().getText(R.string.accessibility_close)));
final Context context = getContext();
for (SystemShortcut s : TaskOverlayFactory.getEnabledShortcuts(this)) {
@@ -837,7 +837,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
- if (action == R.string.accessibility_close_task) {
+ if (action == R.string.accessibility_close) {
getRecentsView().dismissTask(this, true /*animateTaskView*/,
true /*removeTask*/);
return true;
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 40d7c7a7c0..32e07aff1e 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -32,9 +32,6 @@
No recent items
-
- Close
-
App usage settings
diff --git a/quickstep/recents_ui_overrides/res/drawable/arrow_toast_rounded_background.xml b/res/drawable/arrow_toast_rounded_background.xml
similarity index 100%
rename from quickstep/recents_ui_overrides/res/drawable/arrow_toast_rounded_background.xml
rename to res/drawable/arrow_toast_rounded_background.xml
diff --git a/quickstep/recents_ui_overrides/res/layout/arrow_toast.xml b/res/layout/arrow_toast.xml
similarity index 99%
rename from quickstep/recents_ui_overrides/res/layout/arrow_toast.xml
rename to res/layout/arrow_toast.xml
index 980bb5a805..087e45a4dd 100644
--- a/quickstep/recents_ui_overrides/res/layout/arrow_toast.xml
+++ b/res/layout/arrow_toast.xml
@@ -50,7 +50,7 @@
android:src="@drawable/ic_remove_no_shadow"
android:tint="@android:color/white"
android:background="?android:attr/selectableItemBackgroundBorderless"
- android:contentDescription="@string/accessibility_close_task"/>
+ android:contentDescription="@string/accessibility_close"/>
12dp
1dp
+ 8dp
+
+ 2dp
+
20dp
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b1077be1a0..ac04262ae8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -316,6 +316,9 @@
Dismiss
+
+ Close
+
Notification dismissed
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index f935e4d40c..05db18e91f 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -17,8 +17,6 @@ package com.android.launcher3.allapps;
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Rect;
@@ -27,7 +25,6 @@ import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.AttributeSet;
-import android.view.MotionEvent;
import android.widget.Switch;
import com.android.launcher3.Insettable;
@@ -35,6 +32,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.pm.UserCache;
+import com.android.launcher3.views.ArrowTipView;
import java.lang.ref.WeakReference;
@@ -43,27 +41,21 @@ import java.lang.ref.WeakReference;
*/
public class WorkModeSwitch extends Switch implements Insettable {
- private Rect mInsets = new Rect();
- protected ObjectAnimator mOpenCloseAnimator;
+ private static final int WORK_TIP_THRESHOLD = 2;
+ public static final String KEY_WORK_TIP_COUNTER = "worked_tip_counter";
+ private Rect mInsets = new Rect();
public WorkModeSwitch(Context context) {
super(context);
- init();
}
public WorkModeSwitch(Context context, AttributeSet attrs) {
super(context, attrs);
- init();
}
public WorkModeSwitch(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- init();
- }
-
- private void init() {
- mOpenCloseAnimator = ObjectAnimator.ofPropertyValuesHolder(this);
}
@Override
@@ -73,6 +65,9 @@ public class WorkModeSwitch extends Switch implements Insettable {
@Override
public void toggle() {
+ Launcher launcher = Launcher.getLauncher(getContext());
+ // don't show tip if user uses toggle
+ launcher.getSharedPrefs().edit().putInt(KEY_WORK_TIP_COUNTER, -1).apply();
trySetQuietModeEnabledToAllProfilesAsync(isChecked());
}
@@ -95,11 +90,6 @@ public class WorkModeSwitch extends Switch implements Insettable {
this.setVisibility(shouldShowWorkSwitch() ? VISIBLE : GONE);
}
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return ev.getActionMasked() == MotionEvent.ACTION_MOVE || super.onTouchEvent(ev);
- }
-
private void trySetQuietModeEnabledToAllProfilesAsync(boolean enabled) {
new SetQuietModeEnabledAsyncTask(enabled, new WeakReference<>(this)).execute();
}
@@ -117,9 +107,15 @@ public class WorkModeSwitch extends Switch implements Insettable {
*/
public void setWorkTabVisible(boolean workTabVisible) {
if (!shouldShowWorkSwitch()) return;
-
- mOpenCloseAnimator.setValues(PropertyValuesHolder.ofFloat(ALPHA, workTabVisible ? 1 : 0));
- mOpenCloseAnimator.start();
+ clearAnimation();
+ if (workTabVisible) {
+ setVisibility(VISIBLE);
+ setAlpha(0);
+ animate().alpha(1).start();
+ showTipifNeeded();
+ } else {
+ animate().alpha(0).withEndAction(() -> this.setVisibility(GONE)).start();
+ }
}
private static final class SetQuietModeEnabledAsyncTask
@@ -179,4 +175,17 @@ public class WorkModeSwitch extends Switch implements Insettable {
|| launcher.checkSelfPermission("android.permission.MODIFY_QUIET_MODE")
== PackageManager.PERMISSION_GRANTED);
}
+
+ /**
+ * Shows a work tip on the Nth work tab open
+ */
+ public void showTipifNeeded() {
+ Launcher launcher = Launcher.getLauncher(getContext());
+ int tipCounter = launcher.getSharedPrefs().getInt(KEY_WORK_TIP_COUNTER, WORK_TIP_THRESHOLD);
+ if (tipCounter < 0) return;
+ if (tipCounter == 0) {
+ new ArrowTipView(launcher).show(launcher.getString(R.string.work_switch_tip), getTop());
+ }
+ launcher.getSharedPrefs().edit().putInt(KEY_WORK_TIP_COUNTER, tipCounter - 1).apply();
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/ArrowTipView.java b/src/com/android/launcher3/views/ArrowTipView.java
similarity index 97%
rename from quickstep/recents_ui_overrides/src/com/android/launcher3/ArrowTipView.java
rename to src/com/android/launcher3/views/ArrowTipView.java
index a5ea523a27..60470dc57f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/ArrowTipView.java
+++ b/src/com/android/launcher3/views/ArrowTipView.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.launcher3;
+package com.android.launcher3.views;
import android.content.Context;
import android.graphics.CornerPathEffect;
@@ -31,6 +31,9 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
+import com.android.launcher3.AbstractFloatingView;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.graphics.TriangleShape;