Merge "Use separate color for popup when on top of another surface (folder/all apps)." into sc-dev
This commit is contained in:
commit
19c1b86bc3
|
@ -17,9 +17,11 @@
|
|||
*/
|
||||
-->
|
||||
<resources>
|
||||
<color name="popup_color_neutral_light">@android:color/system_neutral1_0</color>
|
||||
<color name="popup_color_primary_light">@android:color/system_neutral1_50</color>
|
||||
<color name="popup_color_secondary_light">@android:color/system_neutral2_100</color>
|
||||
<color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color>
|
||||
<color name="popup_color_neutral_dark">@android:color/system_neutral1_1000</color>
|
||||
<color name="popup_color_primary_dark">@android:color/system_neutral1_800</color>
|
||||
<color name="popup_color_secondary_dark">@android:color/system_neutral1_900</color>
|
||||
<color name="popup_color_tertiary_dark">@android:color/system_neutral2_700</color>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<attr name="allAppsInterimScrimAlpha" format="integer" />
|
||||
<attr name="allAppsNavBarScrimColor" format="color" />
|
||||
<attr name="allAppsTheme" format="reference" />
|
||||
<attr name="popupColorNeutral" format="color" />
|
||||
<attr name="popupColorPrimary" format="color" />
|
||||
<attr name="popupColorSecondary" format="color" />
|
||||
<attr name="popupColorTertiary" format="color" />
|
||||
|
|
|
@ -41,9 +41,11 @@
|
|||
<color name="gesture_tutorial_action_button_label_color">#FF000000</color>
|
||||
<color name="gesture_tutorial_primary_color">#B7F29F</color> <!-- Light Green -->
|
||||
|
||||
<color name="popup_color_neutral_light">#FFF</color>
|
||||
<color name="popup_color_primary_light">#FFF</color>
|
||||
<color name="popup_color_secondary_light">#F1F3F4</color>
|
||||
<color name="popup_color_tertiary_light">#E0E0E0</color> <!-- Gray 300 -->
|
||||
<color name="popup_color_neutral_dark">#3C4043</color> <!-- Gray 800 -->
|
||||
<color name="popup_color_primary_dark">#3C4043</color> <!-- Gray 800 -->
|
||||
<color name="popup_color_secondary_dark">#202124</color>
|
||||
<color name="popup_color_tertiary_dark">#757575</color> <!-- Gray 600 -->
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<item name="allAppsInterimScrimAlpha">46</item>
|
||||
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
|
||||
<item name="allAppsTheme">@style/AllAppsTheme</item>
|
||||
<item name="popupColorNeutral">@color/popup_color_neutral_light</item>
|
||||
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
|
||||
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
|
||||
<item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
|
||||
|
@ -99,6 +100,7 @@
|
|||
<item name="allAppsInterimScrimAlpha">102</item>
|
||||
<item name="allAppsNavBarScrimColor">#80000000</item>
|
||||
<item name="allAppsTheme">@style/AllAppsTheme.Dark</item>
|
||||
<item name="popupColorNeutral">@color/popup_color_neutral_dark</item>
|
||||
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
|
||||
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
|
||||
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.android.launcher3.popup;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS;
|
||||
|
||||
|
@ -48,12 +49,14 @@ import com.android.launcher3.AbstractFloatingView;
|
|||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.InsettableFrameLayout;
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.RevealOutlineAnimation;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
|
@ -65,7 +68,8 @@ import java.util.Collections;
|
|||
*
|
||||
* @param <T> The activity on with the popup shows
|
||||
*/
|
||||
public abstract class ArrowPopup<T extends BaseDraggingActivity> extends AbstractFloatingView {
|
||||
public abstract class ArrowPopup<T extends StatefulActivity<LauncherState>>
|
||||
extends AbstractFloatingView {
|
||||
|
||||
// +1 for system shortcut view
|
||||
private static final int MAX_NUM_CHILDREN = MAX_SHORTCUTS + 1;
|
||||
|
@ -139,14 +143,21 @@ public abstract class ArrowPopup<T extends BaseDraggingActivity> extends Abstrac
|
|||
mRoundedBottom.setCornerRadii(new float[] { smallerRadius, smallerRadius, smallerRadius,
|
||||
smallerRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius, mOutlineRadius});
|
||||
|
||||
int primaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
|
||||
int secondaryColor = Themes.getAttrColor(context, R.attr.popupColorSecondary);
|
||||
ArgbEvaluator argb = new ArgbEvaluator();
|
||||
mColors = new int[MAX_NUM_CHILDREN];
|
||||
// Interpolate between the two colors, exclusive.
|
||||
float step = 1f / (MAX_NUM_CHILDREN + 1);
|
||||
for (int i = 0; i < mColors.length; ++i) {
|
||||
mColors[i] = (int) argb.evaluate((i + 1) * step, primaryColor, secondaryColor);
|
||||
boolean isAboveAnotherSurface = getTopOpenViewWithType(mLauncher, TYPE_FOLDER) != null
|
||||
|| mLauncher.getStateManager().getState() == LauncherState.ALL_APPS;
|
||||
if (isAboveAnotherSurface) {
|
||||
mColors = new int[] { Themes.getAttrColor(context, R.attr.popupColorNeutral) };
|
||||
} else {
|
||||
int primaryColor = Themes.getAttrColor(context, R.attr.popupColorPrimary);
|
||||
int secondaryColor = Themes.getAttrColor(context, R.attr.popupColorSecondary);
|
||||
ArgbEvaluator argb = new ArgbEvaluator();
|
||||
mColors = new int[MAX_NUM_CHILDREN];
|
||||
// Interpolate between the two colors, exclusive.
|
||||
float step = 1f / (MAX_NUM_CHILDREN + 1);
|
||||
for (int i = 0; i < mColors.length; ++i) {
|
||||
mColors[i] =
|
||||
(int) argb.evaluate((i + 1) * step, primaryColor, secondaryColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.android.launcher3.DragSource;
|
|||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
|
||||
|
@ -60,10 +61,10 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
|
|||
import com.android.launcher3.notification.NotificationInfo;
|
||||
import com.android.launcher3.notification.NotificationItemView;
|
||||
import com.android.launcher3.notification.NotificationKeyData;
|
||||
import com.android.launcher3.notification.NotificationMainView;
|
||||
import com.android.launcher3.popup.PopupDataProvider.PopupDataChangeListener;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.touch.ItemLongClickListener;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.ShortcutUtil;
|
||||
|
@ -81,8 +82,8 @@ import java.util.stream.Collectors;
|
|||
*
|
||||
* @param <T> The activity on with the popup shows
|
||||
*/
|
||||
public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends ArrowPopup<T>
|
||||
implements DragSource, DragController.DragListener {
|
||||
public class PopupContainerWithArrow<T extends StatefulActivity<LauncherState>>
|
||||
extends ArrowPopup<T> implements DragSource, DragController.DragListener {
|
||||
|
||||
private final List<DeepShortcutView> mShortcuts = new ArrayList<>();
|
||||
private final PointF mInterceptTouchDown = new PointF();
|
||||
|
|
Loading…
Reference in New Issue