Merge "Use last saved icon if pinned shortcut is unpublished" into ub-launcher3-dorval-polish
diff --git a/res/interpolator/large_folder_preview_item_interpolator.xml b/res/interpolator/large_folder_preview_item_close_interpolator.xml
similarity index 90%
copy from res/interpolator/large_folder_preview_item_interpolator.xml
copy to res/interpolator/large_folder_preview_item_close_interpolator.xml
index dcf0157..d28af63 100644
--- a/res/interpolator/large_folder_preview_item_interpolator.xml
+++ b/res/interpolator/large_folder_preview_item_close_interpolator.xml
@@ -18,7 +18,7 @@
-->
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
- android:controlX1="0"
- android:controlY1="1"
- android:controlX2="0"
+ android:controlX1="0.3"
+ android:controlY1="0"
+ android:controlX2="1"
android:controlY2="1"/>
diff --git a/res/interpolator/large_folder_preview_item_interpolator.xml b/res/interpolator/large_folder_preview_item_open_interpolator.xml
similarity index 96%
rename from res/interpolator/large_folder_preview_item_interpolator.xml
rename to res/interpolator/large_folder_preview_item_open_interpolator.xml
index dcf0157..b5661ab 100644
--- a/res/interpolator/large_folder_preview_item_interpolator.xml
+++ b/res/interpolator/large_folder_preview_item_open_interpolator.xml
@@ -20,5 +20,5 @@
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:controlX1="0"
android:controlY1="1"
- android:controlX2="0"
+ android:controlX2="0.5"
android:controlY2="1"/>
diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml
index 88b02bb..a6821df 100644
--- a/res/values-ca/strings.xml
+++ b/res/values-ca/strings.xml
@@ -77,8 +77,8 @@
<string name="allow_rotation_desc" msgid="8662546029078692509">"En girar el telèfon"</string>
<string name="allow_rotation_blocked_desc" msgid="3212602545192996253">"La configuració actual de la pantalla no permet la rotació"</string>
<string name="icon_badging_title" msgid="874121399231955394">"Punts de notificació"</string>
- <string name="icon_badging_desc_on" msgid="2627952638544674079">"Activada"</string>
- <string name="icon_badging_desc_off" msgid="5503319969924580241">"Desactivada"</string>
+ <string name="icon_badging_desc_on" msgid="2627952638544674079">"Activat"</string>
+ <string name="icon_badging_desc_off" msgid="5503319969924580241">"Desactivat"</string>
<string name="auto_add_shortcuts_label" msgid="8222286205987725611">"Afegeix la icona a la pantalla d\'inici"</string>
<string name="auto_add_shortcuts_description" msgid="7117251166066978730">"Per a les aplicacions noves"</string>
<!-- no translation found for icon_shape_override_label (2977264953998281004) -->
diff --git a/res/values/config.xml b/res/values/config.xml
index db1a75d..00db4ef 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -124,7 +124,7 @@
<item type="id" name="preview_image_id" />
<!-- Popup items -->
- <integer name="config_popupOpenCloseDuration">220</integer>
+ <integer name="config_popupOpenCloseDuration">150</integer>
<integer name="config_popupArrowOpenDuration">80</integer>
<integer name="config_removeNotificationViewDuration">300</integer>
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 5e06763..a23a674 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -120,7 +120,7 @@
}
private Drawable getFullResDefaultActivityIcon() {
- return getFullResIcon(Resources.getSystem(), android.R.mipmap.sym_def_app_icon);
+ return getFullResIcon(Resources.getSystem(), android.R.drawable.sym_def_app_icon);
}
private Drawable getFullResIcon(Resources resources, int iconId) {
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index ed225c9..dcc7a9d 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -408,9 +408,10 @@
if (getChildCount() == 0) {
return;
}
+ int prevPage = mCurrentPage;
mCurrentPage = validateNewPage(currentPage);
updateCurrentPageScroll();
- notifyPageSwitchListener();
+ notifyPageSwitchListener(prevPage);
invalidate();
}
@@ -418,7 +419,7 @@
* Should be called whenever the page changes. In the case of a scroll, we wait until the page
* has settled.
*/
- protected void notifyPageSwitchListener() {
+ protected void notifyPageSwitchListener(int prevPage) {
updatePageIndicator();
}
@@ -585,9 +586,10 @@
} else if (mNextPage != INVALID_PAGE && shouldInvalidate) {
sendScrollAccessibilityEvent();
+ int prevPage = mCurrentPage;
mCurrentPage = validateNewPage(mNextPage);
mNextPage = INVALID_PAGE;
- notifyPageSwitchListener();
+ notifyPageSwitchListener(prevPage);
// We don't want to trigger a page end moving unless the page has settled
// and the user has stopped scrolling
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index b1db7e8..56a5f9e 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -75,6 +75,7 @@
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -300,6 +301,7 @@
boolean mScrollInteractionBegan;
boolean mStartedSendingScrollEvents;
float mLastOverlayScroll = 0;
+ boolean mOverlayShown = false;
private boolean mForceDrawAdjacentPages = false;
// Total over scrollX in the overlay direction.
@@ -1405,6 +1407,20 @@
* The overlay scroll is being controlled locally, just update our overlay effect
*/
public void onOverlayScrollChanged(float scroll) {
+
+ if (Float.compare(scroll, 1f) == 0) {
+ if (!mOverlayShown) {
+ mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
+ Action.Direction.LEFT, ContainerType.WORKSPACE, 0);
+ }
+ mOverlayShown = true;
+ } else if (Float.compare(scroll, 0f) == 0) {
+ if (mOverlayShown) {
+ mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
+ Action.Direction.RIGHT, ContainerType.WORKSPACE, -1);
+ }
+ mOverlayShown = false;
+ }
float offset = 0f;
float slip = 0f;
@@ -1515,9 +1531,13 @@
}
@Override
- protected void notifyPageSwitchListener() {
- super.notifyPageSwitchListener();
-
+ protected void notifyPageSwitchListener(int prevPage) {
+ super.notifyPageSwitchListener(prevPage);
+ if (prevPage != mCurrentPage) {
+ int swipeDirection = (prevPage < mCurrentPage) ? Action.Direction.RIGHT : Action.Direction.LEFT;
+ mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
+ swipeDirection, ContainerType.WORKSPACE, prevPage);
+ }
if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) {
mCustomContentShowing = true;
if (mCustomContentCallbacks != null) {
@@ -1867,13 +1887,20 @@
return;
}
+ ArrayList<Long> prevScreenOrder = (ArrayList<Long>) mScreenOrder.clone();
mScreenOrder.clear();
int count = getChildCount();
for (int i = 0; i < count; i++) {
CellLayout cl = ((CellLayout) getChildAt(i));
mScreenOrder.add(getIdForScreen(cl));
}
- mLauncher.getUserEventDispatcher().logOverviewReorder();
+
+ for (int i = 0; i < prevScreenOrder.size(); i++) {
+ if (mScreenOrder.get(i) != prevScreenOrder.get(i)) {
+ mLauncher.getUserEventDispatcher().logOverviewReorder();
+ break;
+ }
+ }
LauncherModel.updateWorkspaceScreenOrder(mLauncher, mScreenOrder);
// Re-enable auto layout transitions for page deletion.
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 80eb74d..7e8d0c7 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -69,7 +69,8 @@
private final int mDelay;
private final TimeInterpolator mFolderInterpolator;
- private final TimeInterpolator mLargeFolderPreviewItemInterpolator;
+ private final TimeInterpolator mLargeFolderPreviewItemOpenInterpolator;
+ private final TimeInterpolator mLargeFolderPreviewItemCloseInterpolator;
private final PreviewItemDrawingParams mTmpParams = new PreviewItemDrawingParams(0, 0, 0, 0);
@@ -105,8 +106,10 @@
mFolderInterpolator = AnimationUtils.loadInterpolator(mContext,
R.interpolator.folder_interpolator);
- mLargeFolderPreviewItemInterpolator = AnimationUtils.loadInterpolator(mContext,
- R.interpolator.large_folder_preview_item_interpolator);
+ mLargeFolderPreviewItemOpenInterpolator = AnimationUtils.loadInterpolator(mContext,
+ R.interpolator.large_folder_preview_item_open_interpolator);
+ mLargeFolderPreviewItemCloseInterpolator = AnimationUtils.loadInterpolator(mContext,
+ R.interpolator.large_folder_preview_item_close_interpolator);
}
@@ -122,7 +125,7 @@
final Rect folderIconPos = new Rect();
float scaleRelativeToDragLayer = mLauncher.getDragLayer()
.getDescendantRectRelativeToSelf(mFolderIcon, folderIconPos);
- float initialSize = (mFolderIcon.mBackground.getRadius() * 2) * scaleRelativeToDragLayer;
+ float initialSize = (mPreviewBackground.getRadius() * 2) * scaleRelativeToDragLayer;
// Match size/scale of icons in the preview
float previewScale = rule.scaleForItem(0, itemsInPreview.size());
@@ -150,12 +153,11 @@
* initialScale);
// Background can have a scaled radius in drag and drop mode.
- int radiusDiff = mFolderIcon.mBackground.getScaledRadius()
- - mFolderIcon.mBackground.getRadius();
+ int radiusDiff = mPreviewBackground.getScaledRadius()- mPreviewBackground.getRadius();
- int initialX = folderIconPos.left + mFolderIcon.mBackground.getOffsetX() - paddingOffsetX
+ int initialX = folderIconPos.left + mPreviewBackground.getOffsetX() - paddingOffsetX
- previewItemOffsetX + radiusDiff;
- int initialY = folderIconPos.top + mFolderIcon.mBackground.getOffsetY() - paddingOffsetY
+ int initialY = folderIconPos.top + mPreviewBackground.getOffsetY() - paddingOffsetY
+ radiusDiff;
final float xDistance = initialX - lp.x;
final float yDistance = initialY - lp.y;
@@ -181,7 +183,7 @@
AnimatorSet a = LauncherAnimUtils.createAnimatorSet();
// Initialize the Folder items' text.
- PropertyResetListener colorResetListener = new PropertyResetListener(
+ PropertyResetListener colorResetListener = new PropertyResetListener<>(
BubbleTextView.TEXT_ALPHA_PROPERTY,
Color.alpha(Themes.getAttrColor(mContext, android.R.attr.textColorSecondary)));
for (BubbleTextView icon : mFolder.getItemsOnCurrentPage()) {
@@ -210,7 +212,7 @@
// Animate the elevation midway so that the shadow is not noticeable in the background.
int midDuration = mDuration / 2;
Animator z = getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0);
- play(a, z, midDuration, midDuration);
+ play(a, z, mIsOpening ? midDuration : 0, midDuration);
a.addListener(new AnimatorListenerAdapter() {
@Override
@@ -293,14 +295,15 @@
if (mFolder.getItemCount() > FolderIcon.NUM_ITEMS_IN_PREVIEW) {
// These delays allows the preview items to move as part of the Folder's motion,
// and its only necessary for large folders because of differing interpolators.
+ int delay = mIsOpening ? mDelay : mDelay * 2;
if (mIsOpening) {
- translationX.setStartDelay(mDelay);
- translationY.setStartDelay(mDelay);
- scaleAnimator.setStartDelay(mDelay);
+ translationX.setStartDelay(delay);
+ translationY.setStartDelay(delay);
+ scaleAnimator.setStartDelay(delay);
}
- translationX.setDuration(translationX.getDuration() - mDelay);
- translationY.setDuration(translationY.getDuration() - mDelay);
- scaleAnimator.setDuration(scaleAnimator.getDuration() - mDelay);
+ translationX.setDuration(translationX.getDuration() - delay);
+ translationY.setDuration(translationY.getDuration() - delay);
+ scaleAnimator.setDuration(scaleAnimator.getDuration() - delay);
}
animatorSet.addListener(new AnimatorListenerAdapter() {
@@ -343,7 +346,9 @@
// With larger folders, we want the preview items to reach their final positions faster
// (when opening) and later (when closing) so that they appear aligned with the rest of
// the folder items when they are both visible.
- return mLargeFolderPreviewItemInterpolator;
+ return mIsOpening
+ ? mLargeFolderPreviewItemOpenInterpolator
+ : mLargeFolderPreviewItemCloseInterpolator;
}
return mFolderInterpolator;
}
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index bc26fbe..33ac5ba 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -547,8 +547,8 @@
}
@Override
- protected void notifyPageSwitchListener() {
- super.notifyPageSwitchListener();
+ protected void notifyPageSwitchListener(int prevPage) {
+ super.notifyPageSwitchListener(prevPage);
if (mFolder != null) {
mFolder.updateTextViewFocus();
}
diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java
index 329b7d5..72a083b 100644
--- a/src/com/android/launcher3/logging/LoggerUtils.java
+++ b/src/com/android/launcher3/logging/LoggerUtils.java
@@ -66,8 +66,14 @@
}
public static String getActionStr(Action action) {
+ String str = "";
switch (action.type) {
- case Action.Type.TOUCH: return getFieldName(action.touch, Action.Touch.class);
+ case Action.Type.TOUCH:
+ str += getFieldName(action.touch, Action.Touch.class);
+ if (action.touch == Action.Touch.SWIPE) {
+ str += " direction=" + getFieldName(action.dir, Action.Direction.class);
+ }
+ return str;
case Action.Type.COMMAND: return getFieldName(action.command, Action.Command.class);
default: return UNKNOWN;
}
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index 32cf9d4..edbb88c 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -20,7 +20,6 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.os.Build;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.util.Log;
@@ -132,20 +131,14 @@
LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.TAP),
newItemTarget(v), newTarget(Target.Type.CONTAINER));
- String serial;
- if (Utilities.isAtLeastO()) {
- serial = Build.getSerial();
- } else {
- serial = Build.SERIAL;
- }
// TODO: make idx percolate up the view hierarchy if needed.
int idx = 0;
if (fillInLogContainerData(event, v)) {
ItemInfo itemInfo = (ItemInfo) v.getTag();
event.srcTarget[idx].intentHash = intentHashCode;
if (cn != null) {
- event.srcTarget[idx].packageNameHash = (cn.getPackageName() + serial).hashCode();
- event.srcTarget[idx].componentHash = (cn.flattenToString() + serial).hashCode();
+ event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode();
+ event.srcTarget[idx].componentHash = cn.hashCode();
if (mPredictedApps != null) {
event.srcTarget[idx].predictedRank = mPredictedApps.indexOf(
new ComponentKey(cn, itemInfo.user));
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 8107625..c6ae0d2 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -20,6 +20,7 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
@@ -353,6 +354,8 @@
final AnimatorSet openAnim = LauncherAnimUtils.createAnimatorSet();
final Resources res = getResources();
+ final long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
+ final TimeInterpolator revealInterpolator = new AccelerateDecelerateInterpolator();
// Rectangular reveal.
int itemsTotalHeight = 0;
@@ -366,8 +369,13 @@
mEndRect.set(0, top, getMeasuredWidth(), top + itemsTotalHeight);
final ValueAnimator revealAnim = new RoundedRectRevealOutlineProvider
(radius, radius, mStartRect, mEndRect).createRevealAnimator(this, false);
- revealAnim.setDuration((long) res.getInteger(R.integer.config_popupOpenCloseDuration));
- revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ revealAnim.setDuration(revealDuration);
+ revealAnim.setInterpolator(revealInterpolator);
+
+ Animator fadeIn = ObjectAnimator.ofFloat(this, ALPHA, 0, 1);
+ fadeIn.setDuration(revealDuration);
+ fadeIn.setInterpolator(revealInterpolator);
+ openAnim.play(fadeIn);
// Animate the arrow.
mArrow.setScaleX(0);
@@ -851,10 +859,8 @@
final AnimatorSet closeAnim = LauncherAnimUtils.createAnimatorSet();
final Resources res = getResources();
-
- // Animate the arrow.
- Animator arrowScale = createArrowScaleAnim(0).setDuration(res.getInteger(
- R.integer.config_popupArrowOpenDuration));
+ final long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
+ final TimeInterpolator revealInterpolator = new AccelerateDecelerateInterpolator();
// Rectangular reveal (reversed).
int itemsTotalHeight = 0;
@@ -870,9 +876,14 @@
}
final ValueAnimator revealAnim = new RoundedRectRevealOutlineProvider(
radius, radius, mStartRect, mEndRect).createRevealAnimator(this, true);
- long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration);
revealAnim.setDuration(revealDuration);
- revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ revealAnim.setInterpolator(revealInterpolator);
+ closeAnim.play(revealAnim);
+
+ Animator fadeOut = ObjectAnimator.ofFloat(this, ALPHA, 0);
+ fadeOut.setDuration(revealDuration);
+ fadeOut.setInterpolator(revealInterpolator);
+ closeAnim.play(fadeOut);
// Animate original icon's text back in.
Animator fadeText = mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */);
@@ -891,7 +902,6 @@
}
});
mOpenCloseAnimator = closeAnim;
- closeAnim.playSequentially(arrowScale, revealAnim);
closeAnim.start();
mOriginalIcon.forceHideBadge(false);
}