summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/ExtendedEditText.java8
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/LauncherModel.java57
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java7
-rw-r--r--src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java35
5 files changed, 72 insertions, 39 deletions
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index f7737f423..c06f727a5 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -40,11 +40,13 @@ public class ExtendedEditText extends EditText {
private OnBackKeyListener mBackKeyListener;
public ExtendedEditText(Context context) {
- this(context, null, 0);
+ // ctor chaining breaks the touch handling
+ super(context);
}
public ExtendedEditText(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ // ctor chaining breaks the touch handling
+ super(context, attrs);
}
public ExtendedEditText(Context context, AttributeSet attrs, int defStyleAttr) {
@@ -95,6 +97,6 @@ public class ExtendedEditText extends EditText {
private boolean showSoftInput() {
return requestFocus() &&
((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
- .showSoftInput(this, InputMethodManager.SHOW_FORCED);
+ .showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 123c7d8bf..b6474e6ef 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3101,7 +3101,6 @@ public class Launcher extends Activity
mWorkspace.startReordering(v);
} else {
showOverviewMode(true);
- mHotseat.requestDisallowInterceptTouchEvent(true);
}
} else {
final boolean isAllAppsButton =
@@ -3229,6 +3228,9 @@ public class Launcher extends Activity
mStateTransitionAnimation.startAnimationToWorkspace(mState, mWorkspace.getState(),
Workspace.State.OVERVIEW, animated, postAnimRunnable);
mState = State.WORKSPACE;
+ // If animated from long press, then don't allow any of the controller in the drag
+ // layer to intercept any remaining touch.
+ mWorkspace.requestDisallowInterceptTouchEvent(animated);
}
/**
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 68450e7a7..d66ce6b91 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -3380,40 +3380,55 @@ public class LauncherModel extends BroadcastReceiver
public void run() {
mDeepShortcutManager.onShortcutsChanged(mShortcuts);
- Map<String, ShortcutInfoCompat> idsToShortcuts = new HashMap<>();
- for (ShortcutInfoCompat shortcut : mShortcuts) {
- idsToShortcuts.put(shortcut.getId(), shortcut);
- }
-
// Find ShortcutInfo's that have changed on the workspace.
+ final ArrayList<ShortcutInfo> removedShortcutInfos = new ArrayList<>();
MultiHashMap<String, ShortcutInfo> idsToWorkspaceShortcutInfos = new MultiHashMap<>();
for (ItemInfo itemInfo : sBgItemsIdMap) {
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
ShortcutInfo si = (ShortcutInfo) itemInfo;
if (si.getPromisedIntent().getPackage().equals(mPackageName)
&& si.user.equals(mUser)) {
- String shortcutId = si.getDeepShortcutId();
- if (idsToShortcuts.containsKey(shortcutId)) {
- idsToWorkspaceShortcutInfos.addToList(shortcutId, si);
- }
+ idsToWorkspaceShortcutInfos.addToList(si.getDeepShortcutId(), si);
}
}
}
- // Update the workspace to reflect the changes to updated shortcuts residing on it.
- List<ShortcutInfoCompat> shortcuts = mDeepShortcutManager.queryForFullDetails(
- mPackageName, new ArrayList<>(idsToWorkspaceShortcutInfos.keySet()), mUser);
- ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
- Context context = LauncherAppState.getInstance().getContext();
- for (ShortcutInfoCompat fullDetails : shortcuts) {
- List<ShortcutInfo> shortcutInfos = idsToWorkspaceShortcutInfos
- .get(fullDetails.getId());
- for (ShortcutInfo shortcutInfo : shortcutInfos) {
- shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context);
- updatedShortcutInfos.add(shortcutInfo);
+ final Context context = LauncherAppState.getInstance().getContext();
+ final ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
+ if (!idsToWorkspaceShortcutInfos.isEmpty()) {
+ // Update the workspace to reflect the changes to updated shortcuts residing on it.
+ List<ShortcutInfoCompat> shortcuts = mDeepShortcutManager.queryForFullDetails(
+ mPackageName, new ArrayList<>(idsToWorkspaceShortcutInfos.keySet()), mUser);
+ for (ShortcutInfoCompat fullDetails : shortcuts) {
+ List<ShortcutInfo> shortcutInfos = idsToWorkspaceShortcutInfos
+ .remove(fullDetails.getId());
+ if (!fullDetails.isPinned()) {
+ // The shortcut was previously pinned but is no longer, so remove it from
+ // the workspace and our pinned shortcut counts.
+ // Note that we put this check here, after querying for full details,
+ // because there's a possible race condition between pinning and
+ // receiving this callback.
+ removedShortcutInfos.addAll(shortcutInfos);
+ continue;
+ }
+ for (ShortcutInfo shortcutInfo : shortcutInfos) {
+ shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context);
+ updatedShortcutInfos.add(shortcutInfo);
+ }
}
}
- bindUpdatedShortcuts(updatedShortcutInfos, mUser);
+
+ // If there are still entries in idsToWorkspaceShortcutInfos, that means that
+ // the corresponding shortcuts weren't passed in onShortcutsChanged(). This
+ // means they were cleared, so we remove and unpin them now.
+ for (String id : idsToWorkspaceShortcutInfos.keySet()) {
+ removedShortcutInfos.addAll(idsToWorkspaceShortcutInfos.get(id));
+ }
+
+ bindUpdatedShortcuts(updatedShortcutInfos, removedShortcutInfos, mUser);
+ if (!removedShortcutInfos.isEmpty()) {
+ deleteItemsFromDatabase(context, removedShortcutInfos);
+ }
if (mUpdateIdMap) {
// Update the deep shortcut map if the list of ids has changed for an activity.
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 9fcc6a40e..1719b0594 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -109,7 +109,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = false;
- if (mLauncher.getWorkspace().isInOverviewMode() || mLauncher.isWidgetsViewVisible()) {
+ if (!mLauncher.isAllAppsVisible() && mLauncher.getWorkspace().workspaceInModalState()) {
mNoIntercept = true;
} else if (mLauncher.isAllAppsVisible() &&
!mAppsView.shouldContainerScroll(ev)) {
@@ -160,9 +160,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
return true;
}
} else {
- if ((mLauncher.getDragLayer().isEventOverHotseat(ev)
- || mLauncher.getDragLayer().isEventOverPageIndicator(ev))
- && !grid.isVerticalBarLayout()) {
+ if (mLauncher.getDragLayer().isEventOverHotseat(ev) ||
+ mLauncher.getDragLayer().isEventOverPageIndicator(ev)) {
return true;
}
}
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 7657ed610..5ef128811 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -19,6 +19,7 @@ package com.android.launcher3.shortcuts;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
+import android.animation.TimeInterpolator;
import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
@@ -54,6 +55,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherViewPropertyAnimator;
+import com.android.launcher3.LogAccelerateInterpolator;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
@@ -228,14 +230,19 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
final long duration = getResources().getInteger(
R.integer.config_deepShortcutOpenDuration);
+ final long arrowScaleDuration = getResources().getInteger(
+ R.integer.config_deepShortcutArrowOpenDuration);
+ final long arrowScaleDelay = duration - arrowScaleDuration;
final long stagger = getResources().getInteger(
R.integer.config_deepShortcutOpenStagger);
+ final TimeInterpolator fadeInterpolator = new LogAccelerateInterpolator(100, 0);
// Animate shortcuts
DecelerateInterpolator interpolator = new DecelerateInterpolator();
for (int i = 0; i < shortcutCount; i++) {
final DeepShortcutView deepShortcutView = getShortcutAt(i);
deepShortcutView.setVisibility(INVISIBLE);
+ deepShortcutView.setAlpha(0);
Animator anim = deepShortcutView.createOpenAnimation(mIsAboveIcon, mIsLeftAligned);
anim.addListener(new AnimatorListenerAdapter() {
@@ -249,6 +256,12 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
anim.setStartDelay(stagger * animationIndex);
anim.setInterpolator(interpolator);
shortcutAnims.play(anim);
+
+ Animator fadeAnim = new LauncherViewPropertyAnimator(deepShortcutView).alpha(1);
+ fadeAnim.setInterpolator(fadeInterpolator);
+ // We want the shortcut to be fully opaque before the arrow starts animating.
+ fadeAnim.setDuration(arrowScaleDelay);
+ shortcutAnims.play(fadeAnim);
}
shortcutAnims.addListener(new AnimatorListenerAdapter() {
@Override
@@ -264,8 +277,6 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
// Animate the arrow
mArrow.setScaleX(0);
mArrow.setScaleY(0);
- final long arrowScaleDelay = duration / 6;
- final long arrowScaleDuration = duration - arrowScaleDelay;
Animator arrowScale = new LauncherViewPropertyAnimator(mArrow).scaleX(1).scaleY(1);
arrowScale.setStartDelay(arrowScaleDelay);
arrowScale.setDuration(arrowScaleDuration);
@@ -611,12 +622,13 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
}
final long duration = getResources().getInteger(
R.integer.config_deepShortcutCloseDuration);
+ final long arrowScaleDuration = getResources().getInteger(
+ R.integer.config_deepShortcutArrowOpenDuration);
final long stagger = getResources().getInteger(
R.integer.config_deepShortcutCloseStagger);
+ final TimeInterpolator fadeInterpolator = new LogAccelerateInterpolator(100, 0);
- long arrowDelay = (numOpenShortcuts - 1) * stagger + (duration * 4 / 6);
int firstOpenShortcutIndex = mIsAboveIcon ? shortcutCount - numOpenShortcuts : 0;
- int shortcutWithArrowIndex = mIsAboveIcon ? (numOpenShortcuts - 1) : 0;
for (int i = firstOpenShortcutIndex; i < firstOpenShortcutIndex + numOpenShortcuts; i++) {
final DeepShortcutView view = getShortcutAt(i);
Animator anim;
@@ -625,6 +637,13 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
int animationIndex = mIsAboveIcon ? i - firstOpenShortcutIndex
: numOpenShortcuts - i - 1;
anim.setStartDelay(stagger * animationIndex);
+
+ Animator fadeAnim = new LauncherViewPropertyAnimator(view).alpha(0);
+ // Don't start fading until the arrow is gone.
+ fadeAnim.setStartDelay(stagger * animationIndex + arrowScaleDuration);
+ fadeAnim.setDuration(duration - arrowScaleDuration);
+ fadeAnim.setInterpolator(fadeInterpolator);
+ shortcutAnims.play(fadeAnim);
} else {
// The view is being dragged. Animate it such that it collapses with the drag view
anim = view.collapseToIcon();
@@ -643,10 +662,6 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
.translationY(mIconShift.y);
anim2.setDuration(DragView.VIEW_ZOOM_DURATION);
shortcutAnims.play(anim2);
-
- if (i == shortcutWithArrowIndex) {
- arrowDelay = 0;
- }
}
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -657,8 +672,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
shortcutAnims.play(anim);
}
Animator arrowAnim = new LauncherViewPropertyAnimator(mArrow)
- .scaleX(0).scaleY(0).setDuration(duration / 6);
- arrowAnim.setStartDelay(arrowDelay);
+ .scaleX(0).scaleY(0).setDuration(arrowScaleDuration);
+ arrowAnim.setStartDelay(0);
shortcutAnims.play(arrowAnim);
shortcutAnims.addListener(new AnimatorListenerAdapter() {