diff --git a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml b/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml index fa3a0f856a..4fda2a9b9b 100644 --- a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml +++ b/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml @@ -15,5 +15,5 @@ --> - + diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml b/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml index d94c665e86..fe99037ccf 100644 --- a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml +++ b/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml @@ -24,13 +24,13 @@ + android:textSize="20sp" /> + android:background="@drawable/bottom_sheet_top_border" + android:backgroundTint="?android:attr/colorAccent" /> - \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index 36f8468977..194ef2ce67 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -45,5 +45,4 @@ #1A73E8 - #f01A73E8 diff --git a/res/values/strings.xml b/res/values/strings.xml index 0775c0c530..9d0fb56a9e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -330,7 +330,7 @@ Personal apps are private & can\'t be seen by IT - Work apps are badged and monitored by IT + Work apps are badged & visible to IT Next diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 3a275ff3a5..3fc8de2915 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -482,7 +482,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, @Override public void onEnterAnimationComplete() { super.onEnterAnimationComplete(); - mAllAppsController.highlightWorkTabIfNecessary(); mRotationHelper.setCurrentTransitionRequest(REQUEST_NONE); } diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 4e5b0310c3..fcccc598ec 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -103,6 +103,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo private final MultiValueAlpha mMultiValueAlpha; + Rect mInsets = new Rect(); + public AllAppsContainerView(Context context) { this(context, null); } @@ -325,6 +327,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public void setInsets(Rect insets) { + mInsets.set(insets); DeviceProfile grid = mLauncher.getDeviceProfile(); int leftRightPadding = grid.desiredWorkspaceLeftRightMarginPx + grid.cellLayoutPaddingLeftRightPx; @@ -416,6 +419,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); this.addView(mWorkFooterContainer); + mWorkFooterContainer.setInsets(mInsets); mWorkFooterContainer.post(() -> mAH[AdapterHolder.WORK].applyPadding()); } @@ -553,17 +557,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo return mHeader != null && mHeader.getVisibility() == View.VISIBLE; } - public void onScrollUpEnd() { - highlightWorkTabIfNecessary(); - } - - void highlightWorkTabIfNecessary() { - if (mUsingTabs) { - ((PersonalWorkSlidingTabStrip) findViewById(R.id.tabs)) - .highlightWorkTabIfNecessary(); - } - } - /** * Adds an update listener to {@param animator} that adds springs to the animation. */ @@ -648,9 +641,9 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo R.layout.work_apps_paused, null); recyclerView.post(() -> { int width = recyclerView.getWidth(); - int height = recyclerView.getHeight(); - pausedOverlay.measure(makeMeasureSpec(width, EXACTLY), - makeMeasureSpec(height, EXACTLY)); + int height = recyclerView.getHeight() - mWorkFooterContainer.getHeight(); + pausedOverlay.measure(makeMeasureSpec(recyclerView.getWidth(), EXACTLY), + makeMeasureSpec(recyclerView.getHeight(), EXACTLY)); pausedOverlay.layout(0, 0, width, height); applyPadding(); }); diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 93bdac91f7..6aa3efc277 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -248,18 +248,6 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil private void onProgressAnimationEnd() { if (Float.compare(mProgress, 1f) == 0) { mAppsView.reset(false /* animate */); - } else if (isAllAppsExpanded()) { - mAppsView.onScrollUpEnd(); - } - } - - private boolean isAllAppsExpanded() { - return Float.compare(mProgress, 0f) == 0; - } - - public void highlightWorkTabIfNecessary() { - if (isAllAppsExpanded()) { - mAppsView.highlightWorkTabIfNecessary(); } } } diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index e8035eb87a..0f0fc3a249 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -35,7 +35,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.StateListener; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.pm.UserCache; /** * Abstract base class of floating view responsible for showing discovery bounce animation @@ -144,8 +143,7 @@ public class DiscoveryBounce extends AbstractFloatingView { private static void showForHomeIfNeeded(Launcher launcher, boolean withDelay) { if (!launcher.isInState(NORMAL) - || (launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false) - && !shouldShowForWorkProfile(launcher)) + || launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false) || AbstractFloatingView.getTopOpenView(launcher) != null || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) { @@ -170,8 +168,7 @@ public class DiscoveryBounce extends AbstractFloatingView { || !launcher.hasBeenResumed() || launcher.isForceInvisible() || launcher.getDeviceProfile().isVerticalBarLayout() - || (launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false) - && !shouldShowForWorkProfile(launcher)) + || launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false) || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) { return; @@ -213,12 +210,6 @@ public class DiscoveryBounce extends AbstractFloatingView { } } - private static boolean shouldShowForWorkProfile(Launcher launcher) { - return !launcher.getSharedPrefs().getBoolean( - PersonalWorkSlidingTabStrip.KEY_SHOWED_PEEK_WORK_TAB, false) - && UserCache.INSTANCE.get(launcher).hasWorkProfile(); - } - private static void incrementShelfBounceCount(Launcher launcher) { SharedPreferences sharedPrefs = launcher.getSharedPrefs(); int count = sharedPrefs.getInt(SHELF_BOUNCE_COUNT, 0); diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index 9d0ecd3a6c..25db0e7f1d 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -63,6 +63,14 @@ public class LauncherAllAppsContainerView extends AllAppsContainerView { .setScrollRangeDelta(mSearchUiManager.getScrollRangeDelta(insets)); } + @Override + public void setupHeader() { + super.setupHeader(); + if (mWorkTabListener != null && !mUsingTabs) { + mLauncher.getStateManager().removeStateListener(mWorkTabListener); + } + } + @Override public void onTabChanged(int pos) { super.onTabChanged(pos); diff --git a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java index 6204f31900..0e39bbe40f 100644 --- a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java +++ b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java @@ -16,7 +16,6 @@ package com.android.launcher3.allapps; import android.content.Context; -import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; @@ -39,11 +38,8 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd private static final int POSITION_PERSONAL = 0; private static final int POSITION_WORK = 1; - public static final String KEY_SHOWED_PEEK_WORK_TAB = "showed_peek_work_tab"; - private final Paint mSelectedIndicatorPaint; private final Paint mDividerPaint; - private final SharedPreferences mSharedPreferences; private int mSelectedIndicatorHeight; private int mIndicatorLeft = -1; @@ -72,7 +68,6 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd mDividerPaint.setStrokeWidth( getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height)); - mSharedPreferences = Utilities.getPrefs(context); mIsRtl = Utilities.isRtl(getResources()); } @@ -128,25 +123,6 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd mIndicatorRight, getHeight(), mSelectedIndicatorPaint); } - public void highlightWorkTabIfNecessary() { - if (mSharedPreferences.getBoolean(KEY_SHOWED_PEEK_WORK_TAB, false)) { - return; - } - if (mLastActivePage != POSITION_PERSONAL) { - return; - } - highlightWorkTab(); - mSharedPreferences.edit().putBoolean(KEY_SHOWED_PEEK_WORK_TAB, true).apply(); - } - - private void highlightWorkTab() { - View v = getChildAt(POSITION_WORK); - v.post(() -> { - v.setPressed(true); - v.setPressed(false); - }); - } - @Override public void setScroll(int currentScroll, int totalScroll) { float scrollOffset = ((float) currentScroll) / totalScroll; diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java index 9334c46a41..bdba39c371 100644 --- a/src/com/android/launcher3/views/AbstractSlideInView.java +++ b/src/com/android/launcher3/views/AbstractSlideInView.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.views; +import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; + import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import android.animation.Animator; @@ -62,6 +64,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView protected final ObjectAnimator mOpenCloseAnimator; protected View mContent; + private final View mColorScrim; protected Interpolator mScrollInterpolator; // range [0, 1], 0=> completely open, 1=> completely closed @@ -85,11 +88,30 @@ public abstract class AbstractSlideInView extends AbstractFloatingView announceAccessibilityChanges(); } }); + int scrimColor = getScrimColor(mLauncher); + mColorScrim = scrimColor != -1 ? createColorScrim(mLauncher, scrimColor) : null; + } + + protected void attachToContainer() { + if (mColorScrim != null) { + getPopupContainer().addView(mColorScrim); + } + getPopupContainer().addView(this); + } + + /** + * Returns a scrim color for a sliding view. if returned value is -1, no scrim is added. + */ + protected int getScrimColor(Context context) { + return -1; } protected void setTranslationShift(float translationShift) { mTranslationShift = translationShift; mContent.setTranslationY(mTranslationShift * mContent.getHeight()); + if (mColorScrim != null) { + mColorScrim.setAlpha(1 - mTranslationShift); + } } @Override @@ -127,7 +149,8 @@ public abstract class AbstractSlideInView extends AbstractFloatingView /* SingleAxisSwipeDetector.Listener */ @Override - public void onDragStart(boolean start) { } + public void onDragStart(boolean start) { + } @Override public boolean onDrag(float displacement) { @@ -185,9 +208,25 @@ public abstract class AbstractSlideInView extends AbstractFloatingView protected void onCloseComplete() { mIsOpen = false; getPopupContainer().removeView(this); + if (mColorScrim != null) { + getPopupContainer().removeView(mColorScrim); + } } protected BaseDragLayer getPopupContainer() { return mLauncher.getDragLayer(); } + + + protected static View createColorScrim(Context context, int bgColor) { + View view = new View(context); + view.forceHasOverlappingRendering(false); + view.setBackgroundColor(bgColor); + + BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(MATCH_PARENT, MATCH_PARENT); + lp.ignoreInsets = true; + view.setLayoutParams(lp); + + return view; + } } diff --git a/src/com/android/launcher3/views/WorkEduView.java b/src/com/android/launcher3/views/WorkEduView.java index b6c81ae4f9..81f8327dc5 100644 --- a/src/com/android/launcher3/views/WorkEduView.java +++ b/src/com/android/launcher3/views/WorkEduView.java @@ -52,11 +52,15 @@ public class WorkEduView extends AbstractSlideInView implements Insettable { private static final int WORK_EDU_PERSONAL_APPS = 1; private static final int WORK_EDU_WORK_APPS = 2; + protected static final int FINAL_SCRIM_BG_COLOR = 0x88000000; + + private Rect mInsets = new Rect(); private View mViewWrapper; private Button mProceedButton; private TextView mContentText; private AllAppsPagedView mAllAppsPagedView; + private int mNextWorkEduStep = WORK_EDU_PERSONAL_APPS; @@ -141,10 +145,15 @@ public class WorkEduView extends AbstractSlideInView implements Insettable { } private void show() { - mLauncher.getDragLayer().addView(this); + attachToContainer(); animateOpen(); } + @Override + protected int getScrimColor(Context context) { + return FINAL_SCRIM_BG_COLOR; + } + private void goToFirstPage() { if (mAllAppsPagedView != null) { mAllAppsPagedView.snapToPageImmediately(AllAppsContainerView.AdapterHolder.MAIN); diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java index 6cae43da9e..df1a4696db 100644 --- a/src/com/android/launcher3/widget/BaseWidgetSheet.java +++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java @@ -15,8 +15,6 @@ */ package com.android.launcher3.widget; -import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; - import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; @@ -42,7 +40,6 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.util.Themes; import com.android.launcher3.views.AbstractSlideInView; -import com.android.launcher3.views.BaseDragLayer; /** * Base class for various widgets popup @@ -55,11 +52,14 @@ abstract class BaseWidgetSheet extends AbstractSlideInView /* Touch handling related member variables. */ private Toast mWidgetInstructionToast; - protected final View mColorScrim; - public BaseWidgetSheet(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - mColorScrim = createColorScrim(context); + } + + protected int getScrimColor(Context context) { + WallpaperColorInfo colors = WallpaperColorInfo.INSTANCE.get(context); + int alpha = context.getResources().getInteger(R.integer.extracted_color_gradient_alpha); + return setColorAlphaBound(colors.getSecondaryColor(), alpha); } @Override @@ -98,16 +98,6 @@ abstract class BaseWidgetSheet extends AbstractSlideInView return true; } - protected void attachToContainer() { - getPopupContainer().addView(mColorScrim); - getPopupContainer().addView(this); - } - - protected void setTranslationShift(float translationShift) { - super.setTranslationShift(translationShift); - mColorScrim.setAlpha(1 - mTranslationShift); - } - private boolean beginDraggingWidget(WidgetCell v) { // Get the widget preview as the drag representation WidgetImageView image = v.getWidgetView(); @@ -138,7 +128,6 @@ abstract class BaseWidgetSheet extends AbstractSlideInView protected void onCloseComplete() { super.onCloseComplete(); - getPopupContainer().removeView(mColorScrim); clearNavBarColor(); } @@ -177,19 +166,4 @@ abstract class BaseWidgetSheet extends AbstractSlideInView protected SystemUiController getSystemUiController() { return mLauncher.getSystemUiController(); } - - private static View createColorScrim(Context context) { - View view = new View(context); - view.forceHasOverlappingRendering(false); - - WallpaperColorInfo colors = WallpaperColorInfo.INSTANCE.get(context); - int alpha = context.getResources().getInteger(R.integer.extracted_color_gradient_alpha); - view.setBackgroundColor(setColorAlphaBound(colors.getSecondaryColor(), alpha)); - - BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(MATCH_PARENT, MATCH_PARENT); - lp.ignoreInsets = true; - view.setLayoutParams(lp); - - return view; - } }