Merge "Applying API changes on WallpaperColors." into ub-launcher3-dorval-polish
diff --git a/res/drawable-ldrtl/container_fastscroll_popup_bg.xml b/res/drawable-ldrtl/container_fastscroll_popup_bg.xml
deleted file mode 100644
index 2bbf5cd..0000000
--- a/res/drawable-ldrtl/container_fastscroll_popup_bg.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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="?android:attr/colorAccent" />
- <size
- android:width="64dp"
- android:height="64dp" />
- <corners
- android:topLeftRadius="64dp"
- android:topRightRadius="64dp"
- android:bottomRightRadius="64dp" />
-</shape>
\ No newline at end of file
diff --git a/res/drawable/container_fastscroll_popup_bg.xml b/res/drawable/container_fastscroll_popup_bg.xml
deleted file mode 100644
index 3dc7680..0000000
--- a/res/drawable/container_fastscroll_popup_bg.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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="?android:attr/colorAccent" />
- <size
- android:width="64dp"
- android:height="64dp" />
- <corners
- android:topLeftRadius="64dp"
- android:topRightRadius="64dp"
- android:bottomLeftRadius="64dp" />
-</shape>
\ No newline at end of file
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 09b9655..ff605f4 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -54,8 +54,8 @@
android:overScrollMode="never"
android:descendantFocusability="afterDescendants"
android:focusable="true"
- android:paddingStart="@dimen/container_fastscroll_thumb_max_width"
- android:paddingEnd="@dimen/container_fastscroll_thumb_max_width" />
+ android:paddingStart="@dimen/dynamic_grid_edge_margin"
+ android:paddingEnd="@dimen/dynamic_grid_edge_margin" />
<!-- Fast scroller popup -->
<TextView
@@ -63,7 +63,7 @@
android:layout_alignTop="@+id/apps_list_view"
android:id="@+id/fast_scroller_popup"
android:layout_alignParentEnd="true"
- android:layout_marginEnd="@dimen/container_fastscroll_popup_margin" />
+ android:layout_marginEnd="@dimen/fastscroll_popup_margin" />
<!-- Note: we are reusing/repurposing a system attribute for search layout, because of a
platform bug, which prevents using custom attributes in <include> tag -->
diff --git a/res/layout/all_apps_discovery_item.xml b/res/layout/all_apps_discovery_item.xml
index fb1755c..728283f 100644
--- a/res/layout/all_apps_discovery_item.xml
+++ b/res/layout/all_apps_discovery_item.xml
@@ -94,8 +94,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
- android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
- android:paddingRight="@dimen/container_fastscroll_thumb_max_width"
+ android:paddingLeft="@dimen/dynamic_grid_edge_margin"
+ android:paddingRight="@dimen/dynamic_grid_edge_margin"
android:src="@drawable/all_apps_divider"
android:scaleType="fitXY"
android:focusable="false" />
diff --git a/res/layout/all_apps_discovery_loading_divider.xml b/res/layout/all_apps_discovery_loading_divider.xml
index 1ad5521..005847c 100644
--- a/res/layout/all_apps_discovery_loading_divider.xml
+++ b/res/layout/all_apps_discovery_loading_divider.xml
@@ -16,8 +16,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="6dp"
- android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
- android:paddingRight="@dimen/container_fastscroll_thumb_max_width">
+ android:paddingLeft="@dimen/dynamic_grid_edge_margin"
+ android:paddingRight="@dimen/dynamic_grid_edge_margin">
<ProgressBar
android:id="@+id/loadingProgressBar"
diff --git a/res/layout/all_apps_divider.xml b/res/layout/all_apps_divider.xml
index 1eaf685..8a4f646 100644
--- a/res/layout/all_apps_divider.xml
+++ b/res/layout/all_apps_divider.xml
@@ -19,8 +19,8 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/all_apps_divider_margin_vertical"
android:paddingBottom="@dimen/all_apps_divider_margin_vertical"
- android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
- android:paddingRight="@dimen/container_fastscroll_thumb_max_width"
+ android:paddingLeft="@dimen/dynamic_grid_edge_margin"
+ android:paddingRight="@dimen/dynamic_grid_edge_margin"
android:src="@drawable/all_apps_divider"
android:scaleType="fitXY"
android:focusable="false" />
\ No newline at end of file
diff --git a/res/layout/all_apps_search_divider.xml b/res/layout/all_apps_search_divider.xml
index d2ef691..c052c66 100644
--- a/res/layout/all_apps_search_divider.xml
+++ b/res/layout/all_apps_search_divider.xml
@@ -18,8 +18,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/all_apps_divider_margin_vertical"
- android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
- android:paddingRight="@dimen/container_fastscroll_thumb_max_width"
+ android:paddingLeft="@dimen/dynamic_grid_edge_margin"
+ android:paddingRight="@dimen/dynamic_grid_edge_margin"
android:src="@drawable/all_apps_search_divider"
android:scaleType="fitXY"
android:focusable="false" />
\ No newline at end of file
diff --git a/res/layout/all_apps_search_market.xml b/res/layout/all_apps_search_market.xml
index 3f19b25..6f2dd3d 100644
--- a/res/layout/all_apps_search_market.xml
+++ b/res/layout/all_apps_search_market.xml
@@ -19,8 +19,8 @@
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
- android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
- android:paddingRight="@dimen/container_fastscroll_thumb_max_width"
+ android:paddingLeft="@dimen/dynamic_grid_edge_margin"
+ android:paddingRight="@dimen/dynamic_grid_edge_margin"
android:fontFamily="sans-serif-medium"
android:textSize="14sp"
android:textColor="?android:attr/colorAccent"
diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml
index 476901d..47b0683 100644
--- a/res/layout/widgets_view.xml
+++ b/res/layout/widgets_view.xml
@@ -53,7 +53,7 @@
style="@style/FastScrollerPopup"
android:id="@+id/fast_scroller_popup"
android:layout_gravity="top|end"
- android:layout_marginEnd="@dimen/container_fastscroll_popup_margin" />
+ android:layout_marginEnd="@dimen/fastscroll_popup_margin" />
<ProgressBar
android:layout_width="wrap_content"
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 3915759..b40aa14 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -4,9 +4,9 @@
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.
@@ -15,6 +15,13 @@
-->
<resources>
-<!-- Container -->
- <item name="container_margin" format="fraction" type="fraction">12%</item>
+ <!-- Container -->
+ <item name="container_margin" format="fraction" type="fraction">12%</item>
+
+ <!-- Fast scroll -->
+ <dimen name="fastscroll_popup_width">58dp</dimen>
+ <dimen name="fastscroll_popup_height">48dp</dimen>
+ <dimen name="fastscroll_popup_padding">10dp</dimen>
+ <dimen name="fastscroll_popup_text_size">24dp</dimen>
+
</resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 358d9b6..e836d7d 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -15,10 +15,16 @@
-->
<resources>
-<!-- All Apps -->
+ <!-- All Apps -->
<dimen name="all_apps_button_scale_down">8dp</dimen>
<dimen name="all_apps_search_bar_height">54dp</dimen>
<dimen name="all_apps_empty_search_message_top_offset">64dp</dimen>
<dimen name="all_apps_empty_search_bg_top_offset">180dp</dimen>
+ <!-- Fast scroll -->
+ <dimen name="fastscroll_popup_width">75dp</dimen>
+ <dimen name="fastscroll_popup_height">62dp</dimen>
+ <dimen name="fastscroll_popup_padding">13dp</dimen>
+ <dimen name="fastscroll_popup_text_size">32dp</dimen>
+
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 3a531b0..57b4be4 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -47,14 +47,18 @@
<dimen name="widget_handle_margin">13dp</dimen>
<dimen name="resize_frame_background_padding">24dp</dimen>
-<!-- Container -->
- <dimen name="container_fastscroll_thumb_min_width">5dp</dimen>
- <dimen name="container_fastscroll_thumb_max_width">9dp</dimen>
- <dimen name="container_fastscroll_popup_margin">18dp</dimen>
- <dimen name="container_fastscroll_thumb_height">72dp</dimen>
- <dimen name="container_fastscroll_thumb_touch_inset">-24dp</dimen>
- <dimen name="container_fastscroll_popup_size">72dp</dimen>
- <dimen name="container_fastscroll_popup_text_size">48dp</dimen>
+<!-- Fast scroll -->
+ <dimen name="fastscroll_track_min_width">6dp</dimen>
+ <dimen name="fastscroll_track_max_width">8dp</dimen>
+ <dimen name="fastscroll_thumb_padding">1dp</dimen>
+ <dimen name="fastscroll_thumb_height">52dp</dimen>
+ <dimen name="fastscroll_thumb_touch_inset">-24dp</dimen>
+
+ <dimen name="fastscroll_popup_width">75dp</dimen>
+ <dimen name="fastscroll_popup_height">62dp</dimen>
+ <dimen name="fastscroll_popup_padding">13dp</dimen>
+ <dimen name="fastscroll_popup_text_size">32dp</dimen>
+ <dimen name="fastscroll_popup_margin">19dp</dimen>
<!-- All Apps -->
<dimen name="all_apps_button_scale_down">0dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 8af6968..594c7db 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -86,11 +86,11 @@
</style>
<style name="FastScrollerPopup" >
- <item name="android:background">@drawable/container_fastscroll_popup_bg</item>
<item name="android:layout_width">wrap_content</item>
- <item name="android:minWidth">@dimen/container_fastscroll_popup_size</item>
- <item name="android:layout_height">@dimen/container_fastscroll_popup_size</item>
- <item name="android:textSize">@dimen/container_fastscroll_popup_text_size</item>
+ <item name="android:minWidth">@dimen/fastscroll_popup_width</item>
+ <item name="android:layout_height">@dimen/fastscroll_popup_height</item>
+ <item name="android:textSize">@dimen/fastscroll_popup_text_size</item>
+ <item name="android:paddingEnd">@dimen/fastscroll_popup_padding</item>
<item name="android:gravity">center</item>
<item name="android:alpha">0</item>
<item name="android:elevation">3dp</item>
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java
index 514cc07..84358ea 100644
--- a/src/com/android/launcher3/BaseRecyclerView.java
+++ b/src/com/android/launcher3/BaseRecyclerView.java
@@ -185,13 +185,6 @@
}
/**
- * Returns the track color (ignoring alpha), can be overridden by each subclass.
- */
- public int getFastScrollerTrackColor(int defaultTrackColor) {
- return defaultTrackColor;
- }
-
- /**
* Returns the scrollbar for this recycler view.
*/
public BaseRecyclerViewFastScrollBar getScrollBar() {
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
index 3039744..9e8d300 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
@@ -29,6 +29,7 @@
import android.widget.TextView;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.graphics.FastScrollThumbDrawable;
import com.android.launcher3.util.Themes;
/**
@@ -52,7 +53,7 @@
private final static int MAX_TRACK_ALPHA = 30;
private final static int SCROLL_BAR_VIS_DURATION = 150;
- private static final float FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR = 1.5f;
+ private static final float FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR = 0.75f;
private final Rect mTmpRect = new Rect();
private final BaseRecyclerView mRv;
@@ -64,12 +65,12 @@
private final int mMinWidth;
private final int mMaxWidth;
+ private final int mThumbPadding;
// Current width of the track
private int mWidth;
private ObjectAnimator mWidthAnimator;
- private final Path mThumbPath = new Path();
private final Paint mThumbPaint;
private final int mThumbHeight;
@@ -94,7 +95,7 @@
public BaseRecyclerViewFastScrollBar(BaseRecyclerView rv, Resources res) {
mRv = rv;
mTrackPaint = new Paint();
- mTrackPaint.setColor(rv.getFastScrollerTrackColor(Color.BLACK));
+ mTrackPaint.setColor(Themes.getAttrColor(rv.getContext(), android.R.attr.textColorPrimary));
mTrackPaint.setAlpha(MAX_TRACK_ALPHA);
mThumbPaint = new Paint();
@@ -102,16 +103,19 @@
mThumbPaint.setColor(Themes.getColorAccent(rv.getContext()));
mThumbPaint.setStyle(Paint.Style.FILL);
- mWidth = mMinWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_min_width);
- mMaxWidth = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_max_width);
- mThumbHeight = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_height);
- mTouchInset = res.getDimensionPixelSize(R.dimen.container_fastscroll_thumb_touch_inset);
+ mWidth = mMinWidth = res.getDimensionPixelSize(R.dimen.fastscroll_track_min_width);
+ mMaxWidth = res.getDimensionPixelSize(R.dimen.fastscroll_track_max_width);
+
+ mThumbPadding = res.getDimensionPixelSize(R.dimen.fastscroll_thumb_padding);
+ mThumbHeight = res.getDimensionPixelSize(R.dimen.fastscroll_thumb_height);
+
+ mTouchInset = res.getDimensionPixelSize(R.dimen.fastscroll_thumb_touch_inset);
mIsRtl = Utilities.isRtl(res);
- updateThumbPath();
}
public void setPopupView(View popup) {
mPopupView = (TextView) popup;
+ mPopupView.setBackground(new FastScrollThumbDrawable(mThumbPaint, mIsRtl));
}
public void setDetachThumbOnFastScroll() {
@@ -154,24 +158,6 @@
mRv.invalidate(left, top, left + mMaxWidth, top + mRv.getScrollbarTrackHeight());
mWidth = width;
- updateThumbPath();
- }
-
- /**
- * Updates the path for the thumb drawable.
- */
- private void updateThumbPath() {
- int smallWidth = mIsRtl ? mWidth : -mWidth;
- int largeWidth = mIsRtl ? mMaxWidth : -mMaxWidth;
-
- mThumbPath.reset();
- mThumbPath.moveTo(0, 0);
- mThumbPath.lineTo(0, mThumbHeight); // Left edge
- mThumbPath.lineTo(smallWidth, mThumbHeight); // bottom edge
- mThumbPath.cubicTo(smallWidth, mThumbHeight, // right edge
- largeWidth, mThumbHeight / 2,
- smallWidth, 0);
- mThumbPath.close();
}
public int getThumbHeight() {
@@ -265,15 +251,16 @@
}
int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG);
if (!mIsRtl) {
- canvas.translate(mRv.getWidth(), 0);
+ canvas.translate(mRv.getWidth() - mWidth, 0);
}
canvas.translate(0, mRv.getPaddingTop());
// Draw the track
- int thumbWidth = mIsRtl ? mWidth : -mWidth;
- canvas.drawRect(0, 0, thumbWidth, mRv.getScrollbarTrackHeight(), mTrackPaint);
+ canvas.drawRoundRect(0, 0, mWidth, mRv.getScrollbarTrackHeight(),
+ mWidth, mWidth, mTrackPaint);
- canvas.translate(0, mThumbOffsetY);
- canvas.drawPath(mThumbPath, mThumbPaint);
+ canvas.translate(-mThumbPadding, mThumbOffsetY);
+ float r = mWidth + mThumbPadding + mThumbPadding;
+ canvas.drawRoundRect(0, 0, r, mThumbHeight, r, r, mThumbPaint);
canvas.restoreToCount(saveCount);
}
@@ -320,7 +307,8 @@
private void updatePopupY(int lastTouchY) {
int height = mPopupView.getHeight();
float top = lastTouchY - (FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR * height);
- top = Math.max(mMaxWidth, Math.min(top, mRv.getScrollbarTrackHeight() - mMaxWidth - height));
+ top = Utilities.boundToRange(top,
+ mMaxWidth, mRv.getScrollbarTrackHeight() - mMaxWidth - height);
mPopupView.setTranslationY(top);
}
}
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 27e190e..b6e7328 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -16,10 +16,10 @@
package com.android.launcher3;
+import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
-import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -30,6 +30,7 @@
import android.graphics.Region;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.util.Property;
import android.util.TypedValue;
@@ -119,6 +120,19 @@
}
};
+ private static final Property<BubbleTextView, Integer> TEXT_ALPHA_PROPERTY
+ = new Property<BubbleTextView, Integer>(Integer.class, "textAlpha") {
+ @Override
+ public Integer get(BubbleTextView bubbleTextView) {
+ return bubbleTextView.getTextAlpha();
+ }
+
+ @Override
+ public void set(BubbleTextView bubbleTextView, Integer alpha) {
+ bubbleTextView.setTextAlpha(alpha);
+ }
+ };
+
@ViewDebug.ExportedProperty(category = "launcher")
private boolean mStayPressed;
@ViewDebug.ExportedProperty(category = "launcher")
@@ -533,14 +547,29 @@
}
public void setTextVisibility(boolean visible) {
- Resources res = getResources();
if (visible) {
super.setTextColor(mTextColor);
} else {
- super.setTextColor(res.getColor(android.R.color.transparent));
+ setTextAlpha(0);
}
}
+ private void setTextAlpha(int alpha) {
+ super.setTextColor(ColorUtils.setAlphaComponent(mTextColor, alpha));
+ }
+
+ private int getTextAlpha() {
+ return Color.alpha(getCurrentTextColor());
+ }
+
+ /**
+ * Creates an animator to fade the text in or out.
+ * @param fadeIn Whether the text should fade in or fade out.
+ */
+ public Animator createTextAlphaAnimator(boolean fadeIn) {
+ return ObjectAnimator.ofInt(this, TEXT_ALPHA_PROPERTY, fadeIn ? Color.alpha(mTextColor) : 0);
+ }
+
@Override
public void cancelLongPress() {
super.cancelLongPress();
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9bb56d6..83ea067 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -32,7 +32,6 @@
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.badge.BadgeRenderer;
-import com.android.launcher3.config.FeatureFlags;
import java.util.ArrayList;
@@ -181,7 +180,8 @@
overviewModeMaxIconZoneHeightPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_max_icon_zone_height);
overviewModeBarItemWidthPx =
- res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_item_width);
+ (int) (res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_item_width)
+ * (isLandscape ? 1.5f : 1f));
overviewModeBarSpacerWidthPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_spacer_width);
overviewModeIconZoneRatio =
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index ab82c98..af3abeb 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -151,7 +151,6 @@
mLauncher.setAllAppsButton(allAppsButton);
allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
allAppsButton.setOnClickListener(mLauncher);
- allAppsButton.setOnLongClickListener(mLauncher);
allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index dd0d2b8..bd006c7 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -979,8 +979,7 @@
// Don't update the predicted apps if the user is returning to launcher in the apps
// view after launching an app, as they may be depending on the UI to be static to
// switch to another app, otherwise, if it was
- showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */,
- mAppsView.shouldRestoreImeState() /* focusSearchBar */);
+ showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */);
} else if (mOnResumeState == State.WIDGETS) {
showWidgetsView(false, false);
}
@@ -2351,18 +2350,7 @@
if (!isAppsViewVisible()) {
getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.ALL_APPS_BUTTON);
- showAppsView(true /* animated */, true /* updatePredictedApps */,
- false /* focusSearchBar */);
- }
- }
-
- protected void onLongClickAllAppsButton(View v) {
- if (LOGD) Log.d(TAG, "onLongClickAllAppsButton");
- if (!isAppsViewVisible()) {
- getUserEventDispatcher().logActionOnControl(Action.Touch.LONGPRESS,
- ControlType.ALL_APPS_BUTTON);
- showAppsView(true /* animated */,
- true /* updatePredictedApps */, true /* focusSearchBar */);
+ showAppsView(true /* animated */, true /* updatePredictedApps */);
}
}
@@ -2750,13 +2738,6 @@
if (isWorkspaceLocked()) return false;
if (mState != State.WORKSPACE) return false;
- if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator) ||
- (v == mAllAppsButton && mAllAppsButton != null)) {
- onLongClickAllAppsButton(v);
- return true;
- }
-
-
boolean ignoreLongPressToOverview =
mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEventX);
@@ -2956,13 +2937,12 @@
/**
* Shows the apps view.
*/
- public void showAppsView(boolean animated, boolean updatePredictedApps,
- boolean focusSearchBar) {
+ public void showAppsView(boolean animated, boolean updatePredictedApps) {
markAppsViewShown();
if (updatePredictedApps) {
tryAndUpdatePredictedApps();
}
- showAppsOrWidgets(State.APPS, animated, focusSearchBar);
+ showAppsOrWidgets(State.APPS, animated);
}
/**
@@ -2973,7 +2953,7 @@
if (resetPageToZero) {
mWidgetsView.scrollToTop();
}
- showAppsOrWidgets(State.WIDGETS, animated, false);
+ showAppsOrWidgets(State.WIDGETS, animated);
mWidgetsView.post(new Runnable() {
@Override
@@ -2990,7 +2970,7 @@
*/
// TODO: calling method should use the return value so that when {@code false} is returned
// the workspace transition doesn't fall into invalid state.
- private boolean showAppsOrWidgets(State toState, boolean animated, boolean focusSearchBar) {
+ private boolean showAppsOrWidgets(State toState, boolean animated) {
if (!(mState == State.WORKSPACE ||
mState == State.APPS_SPRING_LOADED ||
mState == State.WIDGETS_SPRING_LOADED ||
@@ -3008,7 +2988,7 @@
}
if (toState == State.APPS) {
- mStateTransitionAnimation.startAnimationToAllApps(animated, focusSearchBar);
+ mStateTransitionAnimation.startAnimationToAllApps(animated);
} else {
mStateTransitionAnimation.startAnimationToWidgets(animated);
}
@@ -3081,8 +3061,7 @@
public void exitSpringLoadedDragMode() {
if (mState == State.APPS_SPRING_LOADED) {
- showAppsView(true /* animated */,
- false /* updatePredictedApps */, false /* focusSearchBar */);
+ showAppsView(true /* animated */, false /* updatePredictedApps */);
} else if (mState == State.WIDGETS_SPRING_LOADED) {
showWidgetsView(true, false);
} else if (mState == State.WORKSPACE_SPRING_LOADED) {
@@ -4095,7 +4074,7 @@
switch (keyCode) {
case KeyEvent.KEYCODE_A:
if (mState == State.WORKSPACE) {
- showAppsView(true, true, false);
+ showAppsView(true, true);
return true;
}
break;
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 85467e0..e7349f0 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -127,12 +127,8 @@
/**
* Starts an animation to the apps view.
- *
- * @param startSearchAfterTransition Immediately starts app search after the transition to
- * All Apps is completed.
*/
- public void startAnimationToAllApps(
- final boolean animated, final boolean startSearchAfterTransition) {
+ public void startAnimationToAllApps(final boolean animated) {
final AllAppsContainerView toView = mLauncher.getAppsView();
final View buttonView = mLauncher.getStartViewForAllAppsRevealAnimation();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks(1f) {
@@ -156,9 +152,6 @@
@Override
void onTransitionComplete() {
mLauncher.getUserEventDispatcher().resetElapsedContainerMillis();
- if (startSearchAfterTransition) {
- toView.startAppsSearch();
- }
}
};
int animType = CIRCULAR_REVEAL;
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 3fe7875..b955fe1 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -305,8 +305,6 @@
private boolean mForceDrawAdjacentPages = false;
// Total over scrollX in the overlay direction.
private float mOverlayTranslation;
- private int mFirstPageScrollX;
- private boolean mIgnoreQsbScroll;
// Handles workspace state transitions
private final WorkspaceStateTransitionAnimation mStateTransitionAnimation;
@@ -1739,32 +1737,6 @@
mWallpaperOffset.jumpToFinal();
}
super.onLayout(changed, left, top, right, bottom);
- mFirstPageScrollX = getScrollForPage(0);
-
- final LayoutTransition transition = getLayoutTransition();
- // If the transition is running defer updating max scroll, as some empty pages could
- // still be present, and a max scroll change could cause sudden jumps in scroll.
- if (transition != null && transition.isRunning()) {
- transition.addTransitionListener(new LayoutTransition.TransitionListener() {
-
- @Override
- public void startTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {
- mIgnoreQsbScroll = true;
- }
-
- @Override
- public void endTransition(LayoutTransition transition, ViewGroup container,
- View view, int transitionType) {
- // Wait until all transitions are complete.
- if (!transition.isRunning()) {
- mIgnoreQsbScroll = false;
- transition.removeTransitionListener(this);
- mFirstPageScrollX = getScrollForPage(0);
- }
- }
- });
- }
updatePageAlphaValues();
}
@@ -3548,7 +3520,7 @@
}
}
if ((d.cancelled || (beingCalledAfterUninstall && !mUninstallSuccessful))
- && mDragInfo.cell != null) {
+ && mDragInfo != null && mDragInfo.cell != null) {
mDragInfo.cell.setVisibility(VISIBLE);
}
mDragInfo = null;
@@ -4121,8 +4093,8 @@
private boolean mRefreshPending;
- public DeferredWidgetRefresh(ArrayList<LauncherAppWidgetInfo> infos,
- LauncherAppWidgetHost host) {
+ DeferredWidgetRefresh(ArrayList<LauncherAppWidgetInfo> infos,
+ LauncherAppWidgetHost host) {
mInfos = infos;
mHost = host;
mHandler = new Handler();
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index c3df073..051c161 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -196,13 +196,6 @@
}
/**
- * Focuses the search field and begins an app search.
- */
- public void startAppsSearch() {
- mSearchUiManager.startAppsSearch();
- }
-
- /**
* Resets the state of AllApps.
*/
public void reset() {
@@ -372,10 +365,6 @@
targetParent.containerType = mAppsRecyclerView.getContainerType(v);
}
- public boolean shouldRestoreImeState() {
- return mSearchUiManager.shouldRestoreImeState();
- }
-
@Override
public void setInsets(Rect insets) {
DeviceProfile grid = mLauncher.getDeviceProfile();
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index b2a74ff..0607a1e 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -376,7 +376,8 @@
if (position == NO_POSITION) {
return -1;
}
- return getCurrentScrollY(position, getLayoutManager().getDecoratedTop(child));
+ return getPaddingTop() +
+ getCurrentScrollY(position, getLayoutManager().getDecoratedTop(child));
}
public int getCurrentScrollY(int position, int offset) {
@@ -406,8 +407,7 @@
}
mCachedScrollPositions.put(position, y);
}
-
- return getPaddingTop() + y - offset;
+ return y - offset;
}
/**
@@ -416,7 +416,7 @@
*/
@Override
protected int getAvailableScrollHeight() {
- return getCurrentScrollY(mApps.getAdapterItems().size(), 0)
+ return getPaddingTop() + getCurrentScrollY(mApps.getAdapterItems().size(), 0)
- getHeight() + getPaddingBottom();
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index d79b0d19..2d8310b 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -227,9 +227,7 @@
Action.Direction.UP,
containerType);
}
- mLauncher.showAppsView(true /* animated */,
- false /* updatePredictedApps */,
- false /* focusSearchBar */);
+ mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */);
if (hasSpringAnimationHandler()) {
mSpringAnimationHandler.animateToFinalPosition(0);
}
@@ -250,9 +248,7 @@
Action.Direction.UP,
containerType);
}
- mLauncher.showAppsView(true, /* animated */
- false /* updatePredictedApps */,
- false /* focusSearchBar */);
+ mLauncher.showAppsView(true, /* animated */ false /* updatePredictedApps */);
}
}
}
diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java
index 0d013c7..c0d7850 100644
--- a/src/com/android/launcher3/allapps/SearchUiManager.java
+++ b/src/com/android/launcher3/allapps/SearchUiManager.java
@@ -44,18 +44,6 @@
*/
void preDispatchKeyEvent(KeyEvent keyEvent);
- /**
- * Returns true if the IME should be brought back.
- * TODO: Remove when removing support for opening all-apps in search mode.
- */
- boolean shouldRestoreImeState();
-
- /**
- * Starts the search UI
- * TODO: Remove when removing support for opening all-apps in search mode.
- */
- void startAppsSearch();
-
void addOnScrollRangeChangeListener(OnScrollRangeChangeListener listener);
/**
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index cb3b066..8e5452e 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -153,18 +153,6 @@
}
@Override
- public boolean shouldRestoreImeState() {
- return !TextUtils.isEmpty(mSearchInput.getText());
- }
-
- @Override
- public void startAppsSearch() {
- if (mApps != null) {
- mSearchBarController.focusSearchField();
- }
- }
-
- @Override
public void onSearchResult(String query, ArrayList<ComponentKey> apps) {
if (apps != null) {
mApps.setOrderedFilter(apps);
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 7410ae6..50ad0ff 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -165,7 +165,7 @@
? res.getDimensionPixelSize(R.dimen.pre_drag_view_scale) : 0f;
final DragView dragView = mDragObject.dragView = new DragView(mLauncher, b, registrationX,
registrationY, initialDragViewScale, scaleDps);
-
+ dragView.setItemInfo(dragInfo);
mDragObject.dragComplete = false;
if (mOptions.isAccessibleDrag) {
// For an accessible drag, we assume the view is being dragged from the center.
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 7806c98..9c6b956 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -22,25 +22,44 @@
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;
+import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
+import android.graphics.Matrix;
import android.graphics.Paint;
+import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.drawable.AdaptiveIconDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.animation.DynamicAnimation;
+import android.support.animation.SpringAnimation;
+import android.support.animation.SpringForce;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
+import com.android.launcher3.LauncherModel;
+import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.Thunk;
import java.util.Arrays;
-public class DragView extends View {
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+
+public class DragView extends FrameLayout {
public static final int COLOR_CHANGE_DURATION = 120;
public static final int VIEW_ZOOM_DURATION = 150;
@@ -57,6 +76,7 @@
private Point mDragVisualizeOffset = null;
private Rect mDragRegion = null;
+ private final Launcher mLauncher;
private final DragLayer mDragLayer;
@Thunk final DragController mDragController;
private boolean mHasDrawn = false;
@@ -76,6 +96,20 @@
private int mAnimatedShiftX;
private int mAnimatedShiftY;
+ // Below variable only needed IF FeatureFlags.LAUNCHER3_SPRING_ICONS is {@code true}
+ private SpringAnimation mSpringX, mSpringY;
+ private ImageView mFgImageView, mBgImageView;
+ private Path mScaledMaskPath;
+ // TODO: figure out if there is smarter way to retrieve these two constants below
+ private final static float ADAPTIVE_ICON_SCALE = .731121626f;
+ private final static float ADAPTIVE_ICON_MASK_SCALE = 1.165f; //1.185f;
+
+ // Following three values are fine tuned with motion ux designer
+ private final static int STIFFNESS = 4000;
+ private final static float DAMPENING_RATIO = 1f;
+ private final static int PARALLAX_MAX_IN_DP = 8;
+ private final int mDelta;
+
/**
* Construct the drag view.
* <p>
@@ -89,6 +123,7 @@
public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
final float initialScale, final float finalScaleDps) {
super(launcher);
+ mLauncher = launcher;
mDragLayer = launcher.getDragLayer();
mDragController = launcher.getDragController();
@@ -142,8 +177,119 @@
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
mBlurSizeOutline = getResources().getDimensionPixelSize(R.dimen.blur_size_medium_outline);
-
setElevation(getResources().getDimension(R.dimen.drag_elevation));
+ setWillNotDraw(false);
+ mDelta = (int)(getResources().getDisplayMetrics().density * PARALLAX_MAX_IN_DP);
+ }
+
+ /**
+ * Initialize {@code #mIconDrawable} only if the icon type is app icon (not shortcut or folder).
+ */
+ public void setItemInfo(final ItemInfo info) {
+ if (!(FeatureFlags.LAUNCHER3_SPRING_ICONS && Utilities.isAtLeastO())) {
+ return;
+ }
+ if (!(info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
+ || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT)) {
+ return;
+ }
+ // Load the adaptive icon on a background thread and add the view in ui thread.
+ final Looper workerLooper = LauncherModel.getWorkerLooper();
+ new Handler(workerLooper).postAtFrontOfQueue(new Runnable() {
+ @Override
+ public void run() {
+ PackageManager pm = (mLauncher).getPackageManager();
+ try {
+ Drawable dr = pm.getActivityIcon(info.getTargetComponent());
+ if (dr instanceof AdaptiveIconDrawable) {
+ int w = mBitmap.getWidth();
+ int h = mBitmap.getHeight();
+ AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) dr;
+ adaptiveIcon.setBounds(0, 0, w, h);
+ setupMaskPath(adaptiveIcon);
+ mFgImageView = setupImageView(adaptiveIcon.getForeground());
+ mBgImageView = setupImageView(adaptiveIcon.getBackground());
+ mSpringX = setupSpringAnimation(-w/4, w/4, DynamicAnimation.TRANSLATION_X);
+ mSpringY = setupSpringAnimation(-h/4, h/4, DynamicAnimation.TRANSLATION_Y);
+
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
+ @Override
+ public void run() {
+ addView(mBgImageView);
+ addView(mFgImageView);
+ setWillNotDraw(true);
+ }
+ });
+ }
+ } catch (PackageManager.NameNotFoundException e) { }
+ }});
+ }
+
+ private ImageView setupImageView(Drawable drawable) {
+ FrameLayout.LayoutParams params = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
+ ImageView imageViewOut = new ImageView(getContext());
+ imageViewOut.setLayoutParams(params);
+ imageViewOut.setScaleType(ImageView.ScaleType.CENTER);
+ imageViewOut.setScaleX(ADAPTIVE_ICON_SCALE);
+ imageViewOut.setScaleY(ADAPTIVE_ICON_SCALE);
+ imageViewOut.setImageDrawable(drawable);
+ return imageViewOut;
+ }
+
+ private SpringAnimation setupSpringAnimation(int minValue, int maxValue,
+ DynamicAnimation.ViewProperty property) {
+ SpringAnimation s = new SpringAnimation(mFgImageView, property, 0);
+ s.setMinValue(minValue).setMaxValue(maxValue);
+ s.setSpring(new SpringForce(0)
+ .setDampingRatio(DAMPENING_RATIO)
+ .setStiffness(STIFFNESS));
+ return s;
+ }
+
+ private void setupMaskPath(AdaptiveIconDrawable dr) {
+ Matrix m = new Matrix();
+ m.setScale(ADAPTIVE_ICON_SCALE * ADAPTIVE_ICON_MASK_SCALE,
+ ADAPTIVE_ICON_SCALE * ADAPTIVE_ICON_MASK_SCALE,
+ dr.getBounds().centerX(),
+ dr.getBounds().centerY());
+ mScaledMaskPath = new Path();
+ dr.getIconMask().transform(m, mScaledMaskPath);
+ }
+
+ private void applySpring(int x, int y) {
+ if (mSpringX == null || mSpringY == null) {
+ return;
+ }
+ mSpringX.animateToFinalPosition(Utilities.boundToRange(x, -mDelta, mDelta));
+ mSpringY.animateToFinalPosition(Utilities.boundToRange(y, -mDelta, mDelta));
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ int w = right - left;
+ int h = bottom - top;
+ for (int i = 0; i < getChildCount(); i++) {
+ getChildAt(i).layout(-w / 4, -h / 4, w + w / 4, h + h / 4);
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int w = mBitmap.getWidth();
+ int h = mBitmap.getHeight();
+ setMeasuredDimension(w, h);
+ for (int i = 0; i < getChildCount(); i++) {
+ getChildAt(i).measure(w, h);
+ }
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ if (mScaledMaskPath != null) {
+ canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
+ canvas.clipPath(mScaledMaskPath);
+ }
+ super.dispatchDraw(canvas);
}
/** Sets the scale of the view over the normal workspace icon size. */
@@ -187,11 +333,6 @@
return mDragRegion;
}
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());
- }
-
// Draws drag shadow for system DND.
@SuppressLint("WrongCall")
public void drawDragShadow(Canvas canvas) {
@@ -343,6 +484,9 @@
* @param touchY the y coordinate the user touched in DragLayer coordinates
*/
public void move(int touchX, int touchY) {
+ if (touchX > 0 && touchY > 0 && mLastTouchX > 0 && mLastTouchY > 0) {
+ applySpring(mLastTouchX - touchX, mLastTouchY - touchY);
+ }
mLastTouchX = touchX;
mLastTouchY = touchY;
applyTranslation();
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 9e30550..5794004 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -356,13 +356,14 @@
@Override
public boolean onBackKey() {
- mFolderName.setHint(sHintText);
// Convert to a string here to ensure that no other state associated with the text field
// gets saved.
String newTitle = mFolderName.getText().toString();
mInfo.setTitle(newTitle);
mLauncher.getModelWriter().updateItemInDatabase(mInfo);
+ mFolderName.setHint(sDefaultFolderName.contentEquals(newTitle) ? sHintText : null);
+
Utilities.sendCustomAccessibilityEvent(
this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
getContext().getString(R.string.folder_renamed, newTitle));
@@ -459,8 +460,10 @@
if (!sDefaultFolderName.contentEquals(mInfo.title)) {
mFolderName.setText(mInfo.title);
+ mFolderName.setHint(null);
} else {
mFolderName.setText("");
+ mFolderName.setHint(sHintText);
}
// In case any children didn't come across during loading, clean up the folder accordingly
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index 19a16b1..898a4e9 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -247,6 +247,7 @@
final BubbleTextView textView = (BubbleTextView) mInflater.inflate(
R.layout.folder_application, null, false);
textView.applyFromShortcutInfo(item);
+ textView.setHapticFeedbackEnabled(false);
textView.setOnClickListener(mFolder);
textView.setOnLongClickListener(mFolder);
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
diff --git a/src/com/android/launcher3/graphics/FastScrollThumbDrawable.java b/src/com/android/launcher3/graphics/FastScrollThumbDrawable.java
new file mode 100644
index 0000000..6ebc74e
--- /dev/null
+++ b/src/com/android/launcher3/graphics/FastScrollThumbDrawable.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2017 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.graphics;
+
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.Matrix;
+import android.graphics.Outline;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+
+public class FastScrollThumbDrawable extends Drawable {
+
+ private static final Matrix sMatrix = new Matrix();
+
+ private final Path mPath = new Path();
+ private final Paint mPaint;
+ private final boolean mIsRtl;
+
+ public FastScrollThumbDrawable(Paint paint, boolean isRtl) {
+ mPaint = paint;
+ mIsRtl = isRtl;
+ }
+
+ @Override
+ public void getOutline(Outline outline) {
+ if (mPath.isConvex()) {
+ outline.setConvexPath(mPath);
+ }
+ }
+
+ @Override
+ protected void onBoundsChange(Rect bounds) {
+ mPath.reset();
+
+ float r = bounds.height() * 0.5f;
+ // The path represents a rotate tear-drop shape, with radius of one corner is 1/5th of the
+ // other 3 corners.
+ float diameter = 2 * r;
+ float r2 = r / 5;
+ mPath.addRoundRect(bounds.left, bounds.top, bounds.left + diameter, bounds.top + diameter,
+ new float[] {r, r, r, r, r2, r2, r, r},
+ Path.Direction.CCW);
+
+ sMatrix.setRotate(-45, bounds.left + r, bounds.top + r);
+ if (mIsRtl) {
+ sMatrix.postTranslate(bounds.width(), 0);
+ sMatrix.postScale(-1, 1, bounds.width(), 0);
+ }
+ mPath.transform(sMatrix);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ canvas.drawPath(mPath, mPaint);
+ }
+
+ @Override
+ public void setAlpha(int i) {
+ // Not supported
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter colorFilter) {
+ // Not supported
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
index ae10aed..8bcb979 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
@@ -50,7 +50,6 @@
Launcher l = Launcher.getLauncher(context);
setOnTouchListener(l.getHapticFeedbackTouchListener());
setOnClickListener(l);
- setOnLongClickListener(l);
setOnFocusChangeListener(l.mFocusHandler);
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java b/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
index 91fc1f0..6b992fc 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java
@@ -137,7 +137,6 @@
mAllAppsHandle.setImageDrawable(getCaretDrawable());
mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
mAllAppsHandle.setOnClickListener(mLauncher);
- mAllAppsHandle.setOnLongClickListener(mLauncher);
mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler);
mLauncher.setAllAppsButton(mAllAppsHandle);
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 5463ef7..293bab4 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -827,6 +827,9 @@
revealAnim.setDuration((long) res.getInteger(R.integer.config_popupOpenCloseDuration));
revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ // Animate original icon's text back in.
+ closeAnim.play(mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */));
+
closeAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
diff --git a/src/com/android/launcher3/popup/PopupItemView.java b/src/com/android/launcher3/popup/PopupItemView.java
index 05cadb6..8ec051b 100644
--- a/src/com/android/launcher3/popup/PopupItemView.java
+++ b/src/com/android/launcher3/popup/PopupItemView.java
@@ -100,22 +100,24 @@
// Clip children to this item's rounded corners.
int cornerWidth = mRoundedCornerBitmap.getWidth();
int cornerHeight = mRoundedCornerBitmap.getHeight();
+ int cornerCenterX = Math.round(cornerWidth / 2f);
+ int cornerCenterY = Math.round(cornerHeight / 2f);
if ((mRoundedCorners & ROUNDED_TOP_CORNERS) != 0) {
// Clip top left corner.
mMatrix.reset();
canvas.drawBitmap(mRoundedCornerBitmap, mMatrix, mBackgroundClipPaint);
// Clip top right corner.
- mMatrix.setRotate(90, cornerWidth / 2, cornerHeight / 2);
+ mMatrix.setRotate(90, cornerCenterX, cornerCenterY);
mMatrix.postTranslate(canvas.getWidth() - cornerWidth, 0);
canvas.drawBitmap(mRoundedCornerBitmap, mMatrix, mBackgroundClipPaint);
}
if ((mRoundedCorners & ROUNDED_BOTTOM_CORNERS) != 0) {
// Clip bottom right corner.
- mMatrix.setRotate(180, cornerWidth / 2, cornerHeight / 2);
+ mMatrix.setRotate(180, cornerCenterX, cornerCenterY);
mMatrix.postTranslate(canvas.getWidth() - cornerWidth, canvas.getHeight() - cornerHeight);
canvas.drawBitmap(mRoundedCornerBitmap, mMatrix, mBackgroundClipPaint);
// Clip bottom left corner.
- mMatrix.setRotate(270, cornerWidth / 2, cornerHeight / 2);
+ mMatrix.setRotate(270, cornerCenterX, cornerCenterY);
mMatrix.postTranslate(0, canvas.getHeight() - cornerHeight);
canvas.drawBitmap(mRoundedCornerBitmap, mMatrix, mBackgroundClipPaint);
}
diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
index f47ca3eeb..9730a82 100644
--- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
@@ -59,10 +59,6 @@
setLayoutManager(new LinearLayoutManager(getContext()));
}
- public int getFastScrollerTrackColor(int defaultTrackColor) {
- return Color.WHITE;
- }
-
@Override
public void setAdapter(Adapter adapter) {
super.setAdapter(adapter);