Snap for 7414767 from cdc73b512e to sc-release

Change-Id: Ibf643375ee848a5cf594134853a0225dd8b7a7b1
This commit is contained in:
android-build-team Robot
2021-06-02 01:08:51 +00:00
48 changed files with 719 additions and 190 deletions
@@ -28,10 +28,6 @@
android:layout_gravity="top|center_horizontal"
android:orientation="horizontal">
<Space
android:layout_width="@dimen/go_overview_button_width"
android:layout_height="1dp" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
@@ -50,9 +46,8 @@
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
android:layout_width="@dimen/go_overview_button_container_margin"
android:layout_height="1dp" />
<LinearLayout
style="@style/GoOverviewActionButtonContainer">
@@ -68,9 +63,8 @@
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
android:layout_width="@dimen/go_overview_button_container_margin"
android:layout_height="1dp" />
<LinearLayout
style="@style/GoOverviewActionButtonContainer">
@@ -90,10 +84,6 @@
android:layout_height="1dp"
android:layout_weight="1" />
<Space
android:layout_width="@dimen/go_overview_button_width"
android:layout_height="1dp" />
<!-- Will be enabled in a future version. -->
<LinearLayout
style="@style/GoOverviewActionButtonContainer"
@@ -0,0 +1,39 @@
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.quickstep.views.LauncherRecentsView
android:id="@+id/overview_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:accessibilityPaneTitle="@string/accessibility_recent_apps"
android:clipChildren="false"
android:clipToPadding="false"
android:background="?attr/overviewBackgroundColor"
android:visibility="invisible" />
<com.android.quickstep.views.SplitPlaceholderView
android:id="@+id/split_placeholder"
android:layout_width="match_parent"
android:layout_height="@dimen/split_placeholder_size"
android:background="@android:color/darker_gray"
android:visibility="gone" />
<include
android:id="@+id/overview_actions_view"
layout="@layout/overview_actions_container" />
</merge>
+23
View File
@@ -0,0 +1,23 @@
<?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.
-->
<resources>
<!-- Attributes used for Overview theming -->
<attr name="overviewBackgroundColor" format="color" />
<attr name="overviewButtonTextColor" format="color" />
<attr name="overviewButtonIconColor" format="color" />
<attr name="overviewButtonBackgroundColor" format="color" />
</resources>
+5 -1
View File
@@ -16,6 +16,10 @@
-->
<resources>
<!-- Overview -->
<color name="go_overview_button_icon_color">#3C4043</color>
<color name="go_overview_background_color">#DADADA</color>
<color name="go_overview_background_color_dark">#000000</color>
<color name="go_overview_text_color">#3C4043</color>
<color name="go_overview_text_color_dark">#F8F9FA</color>
<color name="go_overview_button_color">#70FFFFFF</color>
<color name="go_overview_button_color_dark">#303030</color>
</resources>
+1
View File
@@ -22,6 +22,7 @@
<dimen name="go_overview_button_width">60dp</dimen>
<dimen name="go_overview_button_height">60dp</dimen>
<dimen name="go_overview_button_container_width">80dp</dimen>
<dimen name="go_overview_button_container_margin">16dp</dimen>
<dimen name="go_overview_button_caption_margin">8dp</dimen>
<dimen name="overview_actions_height">96dp</dimen>
<dimen name="overview_proactive_row_height">0dp</dimen>
+19 -3
View File
@@ -15,9 +15,25 @@
limitations under the License.
-->
<resources>
<!-- App themes -->
<style name="AppTheme" parent="@style/LauncherTheme">
<item name="overviewBackgroundColor">@color/go_overview_background_color</item>
<item name="overviewButtonTextColor">@color/go_overview_text_color</item>
<item name="overviewButtonIconColor">@color/go_overview_text_color</item>
<item name="overviewButtonBackgroundColor">@color/go_overview_button_color</item>
</style>
<style name="AppTheme.Dark" parent="@style/LauncherTheme.Dark">
<item name="overviewBackgroundColor">@color/go_overview_background_color_dark</item>
<item name="overviewButtonTextColor">@color/go_overview_text_color_dark</item>
<item name="overviewButtonIconColor">@color/go_overview_text_color_dark</item>
<item name="overviewButtonBackgroundColor">@color/go_overview_button_color_dark</item>
</style>
<!-- Overview -->
<style name="GoOverviewActionButton">
<item name="android:tint">@color/go_overview_button_icon_color</item>
<item name="android:backgroundTint">@color/go_overview_button_color</item>
<item name="android:tint">?attr/overviewButtonIconColor</item>
<item name="android:backgroundTint">?attr/overviewButtonBackgroundColor</item>
<item name="android:background">@drawable/round_rect_button</item>
<item name="android:layout_width">@dimen/go_overview_button_width</item>
<item name="android:layout_height">@dimen/go_overview_button_height</item>
@@ -27,7 +43,7 @@
<style name="GoOverviewActionButtonCaption">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">14dp</item>
<item name="android:textColor">@color/go_overview_button_icon_color</item>
<item name="android:textColor">?attr/overviewButtonTextColor</item>
<item name="android:lineHeight">20dp</item>
<item name="android:textAlignment">center</item>
<item name="android:importantForAccessibility">no</item>
+1 -1
View File
@@ -64,7 +64,7 @@
<dimen name="quickstep_fling_threshold_speed">0.5dp</dimen>
<!-- Launcher app transition -->
<dimen name="content_trans_y">50dp</dimen>
<item name="content_scale" format="float" type="dimen">0.97</item>
<dimen name="closing_window_trans_y">115dp</dimen>
<dimen name="recents_empty_message_text_size">16sp</dimen>
@@ -23,11 +23,14 @@ import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_PENDING_FLAGS;
import static com.android.launcher3.BaseActivity.PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
import static com.android.launcher3.anim.Interpolators.EXAGGERATED_EASE;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -50,10 +53,12 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.CancellationSignal;
import android.os.Handler;
@@ -67,6 +72,7 @@ import android.view.animation.PathInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.anim.AnimationSuccessListener;
@@ -75,10 +81,11 @@ import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.views.ScrimView;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.SystemUiProxy;
@@ -160,7 +167,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
private static final int CLOSING_TRANSITION_DURATION_MS = 250;
public static final int CONTENT_ALPHA_DURATION = 217;
protected static final int CONTENT_TRANSLATION_DURATION = 350;
protected static final int CONTENT_SCALE_DURATION = 350;
protected static final int CONTENT_SCRIM_DURATION = 350;
private static final int MAX_NUM_TASKS = 5;
@@ -173,9 +181,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
private final AlphaProperty mDragLayerAlpha;
final Handler mHandler;
private final boolean mIsRtl;
private final float mContentTransY;
private final float mContentScale;
private final float mClosingWindowTransY;
private final float mMaxShadowRadius;
@@ -212,11 +219,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mDragLayer = mLauncher.getDragLayer();
mDragLayerAlpha = mDragLayer.getAlphaProperty(ALPHA_INDEX_TRANSITIONS);
mHandler = new Handler(Looper.getMainLooper());
mIsRtl = Utilities.isRtl(mLauncher.getResources());
mDeviceProfile = mLauncher.getDeviceProfile();
Resources res = mLauncher.getResources();
mContentTransY = res.getDimensionPixelSize(R.dimen.content_trans_y);
mContentScale = res.getFloat(R.dimen.content_scale);
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
@@ -335,8 +341,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
windowTargetBounds, areAllTargetsTranslucent(appTargets), rotationChange));
if (launcherClosing) {
Pair<AnimatorSet, Runnable> launcherContentAnimator =
getLauncherContentAnimator(true /* isAppOpening */,
new float[] {0, -mContentTransY});
getLauncherContentAnimator(true /* isAppOpening */);
anim.play(launcherContentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -436,10 +441,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
*
* @param isAppOpening True when this is called when an app is opening.
* False when this is called when an app is closing.
* @param trans Array that contains the start and end translation values for the content.
*/
private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening,
float[] trans) {
private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening) {
AnimatorSet launcherAnimator = new AnimatorSet();
Runnable endListener;
@@ -447,13 +450,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
? new float[] {1, 0}
: new float[] {0, 1};
float[] scales = isAppOpening
? new float[] {1, mContentScale}
: new float[] {mContentScale, 1};
if (mLauncher.isInState(ALL_APPS)) {
// All Apps in portrait mode is full screen, so we only animate AllAppsContainerView.
final View appsView = mLauncher.getAppsView();
final float startAlpha = appsView.getAlpha();
final float startY = appsView.getTranslationY();
final float startScale = SCALE_PROPERTY.get(appsView);
appsView.setAlpha(alphas[0]);
appsView.setTranslationY(trans[0]);
SCALE_PROPERTY.set(appsView, scales[0]);
ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION);
@@ -465,30 +472,22 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
appsView.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
ObjectAnimator transY = ObjectAnimator.ofFloat(appsView, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
ObjectAnimator scale = ObjectAnimator.ofFloat(appsView, SCALE_PROPERTY, scales);
scale.setInterpolator(AGGRESSIVE_EASE);
scale.setDuration(CONTENT_SCALE_DURATION);
launcherAnimator.play(alpha);
launcherAnimator.play(transY);
launcherAnimator.play(scale);
endListener = () -> {
appsView.setAlpha(startAlpha);
appsView.setTranslationY(startY);
SCALE_PROPERTY.set(appsView, startScale);
appsView.setLayerType(View.LAYER_TYPE_NONE, null);
};
} else if (mLauncher.isInState(OVERVIEW)) {
endListener = composeViewContentAnimator(launcherAnimator, alphas, trans);
endListener = composeViewContentAnimator(launcherAnimator, alphas, scales);
} else {
mDragLayerAlpha.setValue(alphas[0]);
ObjectAnimator alpha =
ObjectAnimator.ofFloat(mDragLayerAlpha, MultiValueAlpha.VALUE, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION);
alpha.setInterpolator(LINEAR);
launcherAnimator.play(alpha);
List<View> viewsToAnimate = new ArrayList<>();
Workspace workspace = mLauncher.getWorkspace();
workspace.forEachVisiblePage(
view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));
@@ -499,18 +498,38 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
viewsToAnimate.forEach(view -> {
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
launcherAnimator.play(ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, trans));
ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(view, SCALE_PROPERTY, scales)
.setDuration(CONTENT_SCALE_DURATION);
scaleAnim.setInterpolator(DEACCEL_1_5);
launcherAnimator.play(scaleAnim);
});
int scrimColor = Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
int scrimColorTrans = ColorUtils.setAlphaComponent(scrimColor, 0);
int[] colors = isAppOpening
? new int[] {scrimColorTrans, scrimColor}
: new int[] {scrimColor, scrimColorTrans};
ScrimView scrimView = mLauncher.getScrimView();
if (scrimView.getBackground() instanceof ColorDrawable) {
scrimView.setBackgroundColor(colors[0]);
ObjectAnimator scrim = ObjectAnimator.ofArgb(scrimView, VIEW_BACKGROUND_COLOR,
colors);
scrim.setDuration(CONTENT_SCRIM_DURATION);
scrim.setInterpolator(DEACCEL_1_5);
launcherAnimator.play(scrim);
}
// Pause page indicator animations as they lead to layer trashing.
mLauncher.getWorkspace().getPageIndicator().pauseAnimations();
endListener = () -> {
viewsToAnimate.forEach(view -> {
view.setTranslationY(0);
SCALE_PROPERTY.set(view, 1f);
view.setLayerType(View.LAYER_TYPE_NONE, null);
});
mDragLayerAlpha.setValue(1f);
scrimView.setBackgroundColor(Color.TRANSPARENT);
mLauncher.getWorkspace().getPageIndicator().skipAnimationsToEnd();
};
}
@@ -522,11 +541,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
*
* @param anim the animator set to add to
* @param alphas the alphas to animate to over time
* @param trans the translation Y values to animator to over time
* @param scales the scale values to animator to over time
* @return listener to run when the animation ends
*/
protected Runnable composeViewContentAnimator(@NonNull AnimatorSet anim,
float[] alphas, float[] trans) {
float[] alphas, float[] scales) {
RecentsView overview = mLauncher.getOverviewPanel();
ObjectAnimator alpha = ObjectAnimator.ofFloat(overview,
RecentsView.CONTENT_ALPHA, alphas);
@@ -535,14 +554,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
anim.play(alpha);
overview.setFreezeViewVisibility(true);
ObjectAnimator transY = ObjectAnimator.ofFloat(overview, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
anim.play(transY);
ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(overview, SCALE_PROPERTY, scales);
scaleAnim.setInterpolator(AGGRESSIVE_EASE);
scaleAnim.setDuration(CONTENT_SCALE_DURATION);
anim.play(scaleAnim);
return () -> {
overview.setFreezeViewVisibility(false);
overview.setTranslationY(0);
SCALE_PROPERTY.set(overview, 1f);
mLauncher.getStateManager().reapplyState();
};
}
@@ -1223,8 +1242,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
if (mLauncher.isInState(LauncherState.ALL_APPS)) {
Pair<AnimatorSet, Runnable> contentAnimator =
getLauncherContentAnimator(false /* isAppOpening */,
new float[] {-mContentTransY, 0});
getLauncherContentAnimator(false /* isAppOpening */);
contentAnimator.first.setStartDelay(LAUNCHER_RESUME_START_DELAY);
anim.play(contentAnimator.first);
anim.addListener(new AnimatorListenerAdapter() {
@@ -103,10 +103,10 @@ import com.android.quickstep.util.MotionPauseDetector;
import com.android.quickstep.util.ProtoTracer;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.SwipePipToHomeAnimator;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.util.WorkspaceRevealAnim;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -202,7 +202,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED;
public static final long MAX_SWIPE_DURATION = 350;
public static final long HOME_DURATION = WorkspaceRevealAnim.DURATION_MS;
public static final long HOME_DURATION = StaggeredWorkspaceAnim.DURATION_MS;
public static final float MIN_PROGRESS_FOR_OVERVIEW = 0.7f;
private static final float SWIPE_DURATION_MULTIPLIER =
@@ -394,6 +394,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
return;
}
// RecentsView never updates the display rotation until swipe-up, force update
// RecentsOrientedState before passing to TaskViewSimulator.
mRecentsView.updateRecentsRotation();
mTaskViewSimulator.setOrientationState(mRecentsView.getPagedViewOrientedState());
// If we've already ended the gesture and are going home, don't prepare recents UI,
@@ -2641,19 +2641,20 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
if (LIVE_TILE.get() && mEnableDrawingLiveTile && newConfig.orientation != mOrientation) {
switchToScreenshot(
() -> finishRecentsAnimation(true /* toRecents */,
this::onConfigurationChangedInternal));
this::updateRecentsRotation));
mEnableDrawingLiveTile = false;
} else {
onConfigurationChangedInternal();
updateRecentsRotation();
}
mOrientation = newConfig.orientation;
}
private void onConfigurationChangedInternal() {
/**
* Updates {@link RecentsOrientedState}'s cached RecentsView rotation.
*/
public void updateRecentsRotation() {
final int rotation = mActivity.getDisplay().getRotation();
if (mOrientationState.setRecentsRotation(rotation)) {
updateOrientationHandler();
}
mOrientationState.setRecentsRotation(rotation);
}
public void setLayoutRotation(int touchRotation, int displayRotation) {
+1 -1
View File
@@ -19,5 +19,5 @@
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white" />
<item android:color="?android:attr/textColorPrimaryInverse" />
</selector>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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.
*/
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?android:attr/colorAccent" />
</selector>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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.
*/
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?android:attr/textColorPrimaryInverse" />
</selector>
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius"
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius" />
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inset
android:insetLeft="@dimen/pin_widget_button_inset_horizontal"
android:insetRight="@dimen/pin_widget_button_inset_horizontal"
android:insetTop="@dimen/pin_widget_button_inset_vertical"
android:insetBottom="@dimen/pin_widget_button_inset_vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<ripple
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:tint="?android:attr/colorAccent" android:shape="rectangle">
<corners android:radius="18dp" />
<solid android:color="#FFFFFF" />
<padding
android:left="@dimen/pin_widget_button_padding_horizontal"
android:top="@dimen/pin_widget_button_padding_vertical"
android:right="@dimen/pin_widget_button_padding_horizontal"
android:bottom="@dimen/pin_widget_button_padding_vertical" />
</shape>
</item>
</ripple>
</inset>
@@ -15,5 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/arrow_tip_view_bg" />
<corners android:radius="8dp" />
<corners android:radius="@dimen/dialogCornerRadius" />
</shape>
@@ -0,0 +1,23 @@
<?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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/dialogCornerRadius"
android:topRightRadius="@dimen/dialogCornerRadius" />
</shape>
+1 -1
View File
@@ -14,6 +14,6 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners android:radius="24dp" />
</shape>
@@ -0,0 +1,32 @@
<?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.
-->
<inset
xmlns:android="http://schemas.android.com/apk/res/android">
<ripple
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
<corners
android:topLeftRadius="4dp"
android:topRightRadius="4dp"
android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp" />
<solid android:color="@color/button_bg"/>
</shape>
</item>
</ripple>
</inset>
@@ -0,0 +1,28 @@
<?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.
-->
<inset
xmlns:android="http://schemas.android.com/apk/res/android">
<ripple
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
<corners android:radius="12dp"/>
<solid android:color="@color/button_bg"/>
</shape>
</item>
</ripple>
</inset>
@@ -0,0 +1,35 @@
<?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.
-->
<inset
xmlns:android="http://schemas.android.com/apk/res/android">
<ripple
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp" />
<solid android:color="@color/surface"/>
<stroke
android:width="2dp"
android:color="@color/button_bg"/>
</shape>
</item>
</ripple>
</inset>
@@ -0,0 +1,28 @@
<?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.
-->
<inset
xmlns:android="http://schemas.android.com/apk/res/android">
<ripple
android:color="?android:attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_bg"/>
<corners android:radius="28dp"/>
</shape>
</item>
</ripple>
</inset>
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/default_dialog_corner_radius"
android:topRightRadius="@dimen/default_dialog_corner_radius"
+2 -2
View File
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
@@ -31,7 +31,7 @@
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
+2 -2
View File
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
@@ -32,7 +32,7 @@
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_content_corner_radius"
android:topRightRadius="@dimen/widget_list_content_corner_radius"
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
@@ -31,7 +31,7 @@
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
+2 -2
View File
@@ -21,7 +21,7 @@
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
@@ -32,7 +32,7 @@
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners
android:topLeftRadius="@dimen/widget_list_top_bottom_corner_radius"
android:topRightRadius="@dimen/widget_list_top_bottom_corner_radius"
@@ -19,6 +19,6 @@
-->
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/widgets_picker_surface" />
<solid android:color="@color/surface" />
<corners android:radius="@dimen/widget_list_top_bottom_corner_radius"/>
</shape>
+17 -12
View File
@@ -53,7 +53,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingVertical="8dp"
android:paddingTop="8dp"
android:text="@string/add_item_request_drag_hint"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
@@ -70,28 +70,33 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:padding="8dp"
android:gravity="center_vertical|end"
android:paddingHorizontal="24dp"
android:paddingVertical="8dp"
android:orientation="horizontal">
<Button
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
style="@style/Button.FullRounded.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="36dp"
android:paddingHorizontal="16dp"
android:onClick="onCancelClick"
android:text="@android:string/cancel" />
android:textSize="14sp"
android:textColor="@color/button_text"
android:text="@android:string/cancel"
android:onClick="onCancelClick"/>
<Space
android:layout_width="4dp"
android:layout_width="8dp"
android:layout_height="wrap_content" />
<Button
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
style="@style/Button.FullRounded.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="36dp"
android:paddingHorizontal="16dp"
android:onClick="onPlaceAutomaticallyClick"
android:text="@string/add_to_home_screen"/>
android:textSize="14sp"
android:textColor="@color/button_text"
android:text="@string/add_to_home_screen"
android:onClick="onPlaceAutomaticallyClick"/>
</LinearLayout>
</com.android.launcher3.widget.AddItemWidgetsBottomSheet>
+9 -33
View File
@@ -14,46 +14,22 @@
limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<LinearLayout
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="24dp"
android:paddingEnd="4dp"
android:background="@drawable/arrow_toast_rounded_background"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:padding="16dp"
android:background="@drawable/arrow_toast_rounded_background"
android:elevation="2dp"
android:orientation="horizontal">
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:gravity="center"
android:layout_gravity="center_vertical"
android:textColor="@color/arrow_tip_view_content"
android:textSize="16sp" />
<ImageView
android:id="@+id/dismiss"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:padding="10dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:alpha="0.7"
android:src="@drawable/ic_remove_no_shadow"
android:tint="@color/arrow_tip_view_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/accessibility_close" />
</LinearLayout>
android:textColor="@color/arrow_tip_view_content"
android:textSize="14sp"/>
<View
android:id="@+id/arrow"
+66
View File
@@ -0,0 +1,66 @@
<?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.views.WidgetsEduView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom"
android:orientation="vertical">
<LinearLayout
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:orientation="vertical"
android:paddingHorizontal="@dimen/bottom_sheet_edu_padding"
android:paddingTop="@dimen/bottom_sheet_edu_padding">
<TextView
style="@style/TextHeadline"
android:id="@+id/edu_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/widget_education_header"
android:textColor="?android:attr/textColorPrimary"
android:textSize="24sp"
android:layout_marginBottom="16dp"/>
<TextView
android:id="@+id/edu_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/widget_education_content"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginBottom="24dp"/>
<Button
android:id="@+id/edu_close_button"
style="@style/Button.Rounded.Colored"
android:layout_width="match_parent"
android:layout_height="56dp"
android:text="@string/widget_education_close_button"
android:textSize="16sp"
android:textColor="@color/button_text"
android:layout_marginBottom="8dp"/>
</LinearLayout>
</com.android.launcher3.views.WidgetsEduView>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<resources>
<dimen name="dialogCornerRadius">?android:attr/dialogCornerRadius</dimen>
</resources>
+8 -2
View File
@@ -124,6 +124,11 @@
<dimen name="recommended_widgets_table_vertical_padding">8dp</dimen>
<!-- Bottom margin for the search and recommended widgets container without work profile -->
<dimen name="search_and_recommended_widgets_container_bottom_margin">16dp</dimen>
<!-- Bottom margin for the search and recommended widgets container with work profile -->
<dimen name="search_and_recommended_widgets_container_small_bottom_margin">10dp</dimen>
<dimen name="widget_list_top_bottom_corner_radius">28dp</dimen>
<dimen name="widget_list_content_corner_radius">4dp</dimen>
@@ -144,10 +149,10 @@
<dimen name="widget_row_padding">8dp</dimen>
<dimen name="widget_row_divider">2dp</dimen>
<dimen name="widget_picker_education_tip_width">120dp</dimen>
<dimen name="widget_picker_education_tip_max_width">308dp</dimen>
<dimen name="widget_picker_education_tip_min_margin">4dp</dimen>
<dimen name="widget_picker_view_pager_top_padding">16dp</dimen>
<dimen name="widget_picker_view_pager_top_padding">10dp</dimen>
<!-- Padding applied to shortcut previews -->
<dimen name="shortcut_preview_padding_left">0dp</dimen>
@@ -283,6 +288,7 @@
<!-- Theming related -->
<dimen name="default_dialog_corner_radius">8dp</dimen>
<dimen name="dialogCornerRadius">@dimen/default_dialog_corner_radius</dimen>
<!-- Onboarding bottomsheet related -->
<dimen name="bottom_sheet_edu_padding">24dp</dimen>
+9
View File
@@ -99,6 +99,15 @@
<!-- A widget category label for grouping widgets related to conversations. [CHAR_LIMIT=30] -->
<string name="widget_category_conversations">Conversations</string>
<!-- Title of a dialog. This dialog lets a user know how they can use widgets on their phone.
[CHAR_LIMIT=NONE] -->
<string name="widget_education_header">Useful info at your fingertips</string>
<!-- Dialog text. This dialog lets a user know how they can use widgets on their phone.
[CHAR_LIMIT=NONE] -->
<string name="widget_education_content">To get info without opening apps, you can add widgets to your Home screen</string>
<!-- Text on the button that closes the education dialog about widgets. [CHAR_LIMIT=50] -->
<string name="widget_education_close_button">Got it</string>
<!-- All Apps -->
<!-- Search bar text in the apps view. [CHAR_LIMIT=50] -->
<string name="all_apps_search_bar_hint">Search apps</string>
+29 -9
View File
@@ -48,7 +48,7 @@
<item name="workspaceStatusBarScrim">@drawable/workspace_bg</item>
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
<item name="folderDotColor">?android:attr/colorPrimary</item>
<item name="folderFillColor">?android:attr/colorBackground</item>
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
<item name="folderTextColor">?android:attr/textColorPrimary</item>
<item name="isFolderDarkText">true</item>
@@ -71,7 +71,7 @@
</style>
<style name="LauncherTheme.DarkMainColor" parent="@style/LauncherTheme">
<item name="folderFillColor">#FF3C4043</item> <!-- 100% GM2 800 -->
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderTextColor">?attr/workspaceTextColor</item>
<item name="isFolderDarkText">?attr/isWorkspaceDarkText</item>
<item name="folderHintColor">@color/folder_hint_text_color_dark</item>
@@ -87,7 +87,7 @@
<item name="isWorkspaceDarkText">true</item>
<item name="workspaceStatusBarScrim">@null</item>
<item name="folderDotColor">#FF464646</item>
<item name="folderFillColor">#CDFFFFFF</item>
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderIconBorderColor">#FF80868B</item>
<item name="folderTextColor">?attr/workspaceTextColor</item>
<item name="isFolderDarkText">true</item>
@@ -109,7 +109,7 @@
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
<item name="folderDotColor">?android:attr/colorPrimary</item>
<item name="folderFillColor">?android:attr/colorBackground</item>
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderIconBorderColor">?android:attr/colorPrimary</item>
<item name="folderTextColor">?android:attr/textColorPrimary</item>
<item name="isFolderDarkText">false</item>
@@ -123,7 +123,7 @@
</style>
<style name="LauncherTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark">
<item name="folderFillColor">#FF3C4043</item> <!-- 100% GM2 800 -->
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderTextColor">@android:color/white</item>
<item name="isFolderDarkText">false</item>
<item name="folderHintColor">@color/folder_hint_text_color_light</item>
@@ -132,7 +132,7 @@
<style name="LauncherTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark">
<item name="android:colorControlHighlight">#19212121</item>
<item name="folderFillColor">#CDFFFFFF</item>
<item name="folderFillColor">?android:attr/colorBackgroundFloating</item>
<item name="folderTextColor">?attr/workspaceTextColor</item>
<item name="isFolderDarkText">?attr/isWorkspaceDarkText</item>
<item name="folderHintColor">@color/folder_hint_text_color_dark</item>
@@ -240,7 +240,7 @@
<!-- Icon displayed on the workspace -->
<style name="BaseIcon.Workspace" >
<style name="BaseIcon.Workspace.Shadows" parent="BaseIcon">
<item name="android:shadowRadius">2.0</item>
<item name="android:shadowColor">?attr/workspaceShadowColor</item>
<item name="ambientShadowColor">?attr/workspaceAmbientShadowColor</item>
@@ -251,6 +251,10 @@
<item name="keyShadowOffsetY">.5dp</item>
</style>
<!-- Intentionally empty so we can override -->
<style name="BaseIcon.Workspace" parent="BaseIcon.Workspace.Shadows">
</style>
<!-- Theme for the popup container -->
<style name="PopupItem">
<item name="android:colorControlHighlight">?attr/popupColorTertiary</item>
@@ -287,8 +291,24 @@
<item name="android:colorForeground">@color/all_apps_bg_hand_fill_dark</item>
</style>
<style name="Widget.DeviceDefault.Button.Rounded.Colored" parent="@android:style/Widget.DeviceDefault.Button.Colored">
<item name="android:background">@drawable/add_item_dialog_button_background</item>
<style name="Button.TopRounded.Bordered" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/button_top_rounded_bordered_ripple</item>
<item name="android:stateListAnimator">@null</item>
</style>
<style name="Button.BottomRounded.Colored" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/button_bottom_rounded_colored_ripple</item>
<item name="android:stateListAnimator">@null</item>
</style>
<style name="Button.Rounded.Colored" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/button_rounded_colored_ripple</item>
<item name="android:stateListAnimator">@null</item>
</style>
<style name="Button.FullRounded.Colored" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/full_rounded_colored_ripple</item>
<item name="android:stateListAnimator">@null</item>
</style>
<style name="AddItemActivityTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
+2 -2
View File
@@ -62,10 +62,10 @@
<device-padding
launcher:maxEmptySpace="9999dp">
<workspaceTopPadding
launcher:a="0.38"
launcher:a="0.40"
launcher:c="36dp"/>
<workspaceBottomPadding
launcher:a="0.62"
launcher:a="0.60"
launcher:c="36dp"/>
<hotseatBottomPadding
launcher:a="0"
@@ -19,7 +19,6 @@ package com.android.launcher3.widget.picker.search;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -131,18 +130,14 @@ public class WidgetsSearchBarControllerTest {
public void cancelSearch_shouldInformSearchModeListenerToClearResultsAndExitSearch() {
mCancelButton.performClick();
// 1 time explicitly from the cancel button on click listener.
// Another from the setText("") the cancel button on click listener causing afterTextChange.
verify(mSearchModeListener, times(2)).exitSearchMode();
verify(mSearchModeListener).exitSearchMode();
}
@Test
public void cancelSearch_shouldCancelSearch() {
mCancelButton.performClick();
// 1 time explicitly from the cancel button on click listener.
// Another from the setText("") the cancel button on click listener causing afterTextChange.
verify(mSearchAlgorithm, times(2)).cancel(true);
verify(mSearchAlgorithm).cancel(true);
verifyNoMoreInteractions(mSearchAlgorithm);
}
@@ -63,7 +63,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
TYPE_TASK_MENU,
TYPE_OPTIONS_POPUP,
TYPE_ICON_SURFACE,
TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP,
TYPE_WIDGETS_EDUCATION_DIALOG
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
@@ -85,17 +86,19 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
public static final int TYPE_ICON_SURFACE = 1 << 13;
public static final int TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP = 1 << 14;
public static final int TYPE_WIDGETS_EDUCATION_DIALOG = 1 << 15;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
| TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE | TYPE_TASK_MENU
| TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP;
| TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP
| TYPE_WIDGETS_EDUCATION_DIALOG;
// Type of popups which should be kept open during launcher rebind
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
| TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE;
| TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG;
// Usually we show the back button when a floating view is open. Instead, hide for these types.
public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
@@ -238,7 +238,7 @@ public final class FeatureFlags {
"Sends a notification whenever launcher encounters an uncaught exception.");
public static final BooleanFlag PROTOTYPE_APP_CLOSE = getDebugFlag(
"PROTOTYPE_APP_CLOSE", true, "Enables new app close");
"PROTOTYPE_APP_CLOSE", false, "Enables new app close");
public static final BooleanFlag ENABLE_WALLPAPER_SCRIM = getDebugFlag(
"ENABLE_WALLPAPER_SCRIM", false,
@@ -89,8 +89,8 @@ public class PreviewBackground extends CellLayout.DelegatedCellDrawing {
private static final float ACCEPT_COLOR_MULTIPLIER = 1.5f;
// Expressed on a scale from 0 to 255.
private static final int BG_OPACITY = 160;
private static final int MAX_BG_OPACITY = 225;
private static final int BG_OPACITY = 255;
private static final int MAX_BG_OPACITY = 255;
private static final int SHADOW_OPACITY = 40;
private ValueAnimator mScaleAnimator;
@@ -105,10 +105,6 @@ public class ArrowTipView extends AbstractFloatingView {
private void init(Context context) {
inflate(context, R.layout.arrow_toast, this);
setOrientation(LinearLayout.VERTICAL);
View dismissButton = findViewById(R.id.dismiss);
dismissButton.setOnClickListener(view -> {
handleClose(true);
});
View arrowView = findViewById(R.id.arrow);
ViewGroup.LayoutParams arrowLp = arrowView.getLayoutParams();
@@ -194,18 +190,18 @@ public class ArrowTipView extends AbstractFloatingView {
public ArrowTipView showAtLocation(String text, int arrowXCoord, int yCoord) {
ViewGroup parent = mActivity.getDragLayer();
@Px int parentViewWidth = parent.getWidth();
@Px int textViewWidth = getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_education_tip_width);
@Px int maxTextViewWidth = getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_education_tip_max_width);
@Px int minViewMargin = getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_education_tip_min_margin);
if (parentViewWidth < textViewWidth + 2 * minViewMargin) {
if (parentViewWidth < maxTextViewWidth + 2 * minViewMargin) {
Log.w(TAG, "Cannot display tip on a small screen of size: " + parentViewWidth);
return null;
}
TextView textView = findViewById(R.id.text);
textView.setText(text);
textView.setWidth(textViewWidth);
textView.setMaxWidth(maxTextViewWidth);
parent.addView(this);
requestLayout();
@@ -0,0 +1,118 @@
/*
* 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.views;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
/**
* Education view about widgets.
*/
public class WidgetsEduView extends AbstractSlideInView<Launcher> implements Insettable {
private static final int DEFAULT_CLOSE_DURATION = 200;
protected static final int FINAL_SCRIM_BG_COLOR = 0x88000000;
private Rect mInsets = new Rect();
private View mEduView;
public WidgetsEduView(Context context, AttributeSet attr) {
this(context, attr, 0);
}
public WidgetsEduView(Context context, AttributeSet attrs,
int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContent = this;
}
@Override
protected void handleClose(boolean animate) {
handleClose(true, DEFAULT_CLOSE_DURATION);
}
@Override
protected boolean isOfType(int type) {
return (type & TYPE_WIDGETS_EDUCATION_DIALOG) != 0;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mEduView = findViewById(R.id.edu_view);
findViewById(R.id.edu_close_button)
.setOnClickListener(v -> close(/* animate= */ true));
}
@Override
public void setInsets(Rect insets) {
int leftInset = insets.left - mInsets.left;
int rightInset = insets.right - mInsets.right;
int bottomInset = insets.bottom - mInsets.bottom;
mInsets.set(insets);
setPadding(leftInset, getPaddingTop(), rightInset, 0);
mEduView.setPaddingRelative(mEduView.getPaddingStart(),
mEduView.getPaddingTop(), mEduView.getPaddingEnd(), bottomInset);
}
private void show() {
attachToContainer();
animateOpen();
}
@Override
protected int getScrimColor(Context context) {
return FINAL_SCRIM_BG_COLOR;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
setTranslationShift(mTranslationShift);
}
private void animateOpen() {
if (mIsOpen || mOpenCloseAnimator.isRunning()) {
return;
}
mIsOpen = true;
mOpenCloseAnimator.setValues(
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setInterpolator(FAST_OUT_SLOW_IN);
mOpenCloseAnimator.start();
}
/** Shows widget education dialog. */
public static WidgetsEduView showEducationDialog(Launcher launcher) {
LayoutInflater layoutInflater = LayoutInflater.from(launcher);
WidgetsEduView v = (WidgetsEduView) layoutInflater.inflate(
R.layout.widgets_edu, launcher.getDragLayer(), false);
v.show();
return v;
}
}
@@ -49,11 +49,14 @@ import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.RecyclerViewFastScroller;
import com.android.launcher3.views.TopRoundedCornerView;
import com.android.launcher3.views.WidgetsEduView;
import com.android.launcher3.widget.BaseWidgetSheet;
import com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
@@ -79,12 +82,16 @@ public class WidgetsFullSheet extends BaseWidgetSheet
private static final long DEFAULT_OPEN_DURATION = 267;
private static final long FADE_IN_DURATION = 150;
private static final long EDUCATION_TIP_DELAY_MS = 200;
private static final long EDUCATION_DIALOG_DELAY_MS = 500;
private static final float VERTICAL_START_POSITION = 0.3f;
// The widget recommendation table can easily take over the entire screen on devices with small
// resolution or landscape on phone. This ratio defines the max percentage of content area that
// the table can display.
private static final float RECOMMENDATION_TABLE_HEIGHT_RATIO = 0.75f;
private static final String KEY_WIDGETS_EDUCATION_DIALOG_SEEN =
"launcher.widgets_education_dialog_seen";
private final Rect mInsets = new Rect();
private final boolean mHasWorkProfile;
private final SparseArray<AdapterHolder> mAdapters = new SparseArray();
@@ -93,6 +100,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
entry -> mCurrentUser.equals(entry.mPkgItem.user);
private final Predicate<WidgetsListBaseEntry> mWorkWidgetsFilter =
mPrimaryWidgetsFilter.negate();
@Nullable private ArrowTipView mLatestEducationalTip;
private final OnLayoutChangeListener mLayoutChangeListenerToShowTips =
new OnLayoutChangeListener() {
@Override
@@ -116,13 +124,15 @@ public class WidgetsFullSheet extends BaseWidgetSheet
removeOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
return;
}
View viewForTip = getViewToShowEducationTip();
if (showEducationTipOnViewIfPossible(viewForTip) != null) {
mLatestEducationalTip = showEducationTipOnViewIfPossible(getViewToShowEducationTip());
if (mLatestEducationalTip != null) {
removeOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
}
};
private final int mTabsHeight;
private final int mViewPagerTopPadding;
private final int mSearchAndRecommendationContainerBottomMargin;
private final int mWidgetCellHorizontalPadding;
@Nullable private WidgetsRecyclerView mCurrentWidgetsRecyclerView;
@@ -149,6 +159,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
? getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_view_pager_top_padding)
: 0;
mSearchAndRecommendationContainerBottomMargin = getContext().getResources()
.getDimensionPixelSize(mHasWorkProfile
? R.dimen.search_and_recommended_widgets_container_small_bottom_margin
: R.dimen.search_and_recommended_widgets_container_bottom_margin);
mWidgetCellHorizontalPadding = 2 * getResources().getDimensionPixelOffset(
R.dimen.widget_cell_horizontal_padding);
}
@@ -192,6 +206,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mNoWidgetsView = findViewById(R.id.no_widgets_text);
mSearchAndRecommendationViewHolder = new SearchAndRecommendationViewHolder(
findViewById(R.id.search_and_recommendations_container));
TopRoundedCornerView.LayoutParams layoutParams =
(TopRoundedCornerView.LayoutParams)
mSearchAndRecommendationViewHolder.mContainer.getLayoutParams();
layoutParams.bottomMargin = mSearchAndRecommendationContainerBottomMargin;
mSearchAndRecommendationViewHolder.mContainer.setLayoutParams(layoutParams);
mSearchAndRecommendationsScrollController = new SearchAndRecommendationsScrollController(
mHasWorkProfile,
mTabsHeight,
@@ -211,9 +230,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mSearchAndRecommendationViewHolder.mSearchBar.initialize(
mActivityContext.getPopupDataProvider(), /* searchModeListener= */ this);
if (!hasSeenEducationTip()) {
addOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
}
setUpEducationViewsIfNeeded();
}
@Override
@@ -598,6 +615,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
@Override
protected void onCloseComplete() {
super.onCloseComplete();
removeCallbacks(mShowEducationTipTask);
if (mLatestEducationalTip != null) {
mLatestEducationalTip.close(false);
}
AccessibilityManagerCompat.sendStateEventToTest(getContext(), NORMAL_STATE_ORDINAL);
}
@@ -670,6 +691,38 @@ public class WidgetsFullSheet extends BaseWidgetSheet
return null;
}
/** Shows education dialog for widgets. */
private WidgetsEduView showEducationDialog() {
mActivityContext.getSharedPrefs().edit()
.putBoolean(KEY_WIDGETS_EDUCATION_DIALOG_SEEN, true).apply();
return WidgetsEduView.showEducationDialog(mActivityContext);
}
/** Returns {@code true} if education dialog has previously been shown. */
protected boolean hasSeenEducationDialog() {
return mActivityContext.getSharedPrefs()
.getBoolean(KEY_WIDGETS_EDUCATION_DIALOG_SEEN, false)
|| Utilities.IS_RUNNING_IN_TEST_HARNESS;
}
private void setUpEducationViewsIfNeeded() {
if (!hasSeenEducationDialog()) {
postDelayed(() -> {
WidgetsEduView eduDialog = showEducationDialog();
eduDialog.addOnCloseListener(() -> {
if (!hasSeenEducationTip()) {
addOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
// Call #requestLayout() to trigger layout change listener in order to show
// arrow tip immediately if there is a widget to show it on.
requestLayout();
}
});
}, EDUCATION_DIALOG_DELAY_MS);
} else if (!hasSeenEducationTip()) {
addOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
}
}
/** A holder class for holding adapters & their corresponding recycler view. */
private final class AdapterHolder {
static final int PRIMARY = 0;
@@ -101,10 +101,8 @@ public class WidgetsSearchBarController implements TextWatcher,
@Override
public void clearSearchResult() {
mSearchAlgorithm.cancel(/* interruptActiveRequests= */ true);
// Any existing search session will be cancelled by setting text to empty.
mInput.setText("");
clearFocus();
mSearchModeListener.exitSearchMode();
}
/**