summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jorim Jaggi <jjaggi@google.com> 2015-12-02 18:17:07 -0800
committer Jorim Jaggi <jjaggi@google.com> 2015-12-03 16:11:16 -0800
commit213cbe665b1c45112f46c006f8b7db19b0c7663c (patch)
treed19b4b444bba12489eb153921abe0f6766dc1dff
parent04c2fbd6fe389bcfa3a6368d8ae2c20c9e81e4f4 (diff)
When dragging from the left side, dock on the right
In landscape, when dragging up from the left side, dock the current app on the right side. Change-Id: I3b1229e0d347db6cc1f55272c7d76694417977d0
-rw-r--r--packages/SystemUI/src/com/android/systemui/RecentsComponent.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Recents.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java4
5 files changed, 17 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
index 4cb8a3cdad4a..7f6cda036515 100644
--- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
@@ -32,7 +32,7 @@ public interface RecentsComponent {
/**
* Docks the top-most task and opens recents.
*/
- void dockTopTask(boolean draggingInRecents, Rect initialBounds);
+ void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds);
/**
* Called during a drag-from-navbar-in gesture.
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index c98ecb591fce..b81c23a6e0a7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -365,8 +365,8 @@ public class Recents extends SystemUI
}
@Override
- public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
- mImpl.dockTopTask(draggingInRecents, initialBounds);
+ public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) {
+ mImpl.dockTopTask(draggingInRecents, stackCreateMode,initialBounds);
if (draggingInRecents) {
mDraggingInRecentsCurrentUser = sSystemServicesProxy.getCurrentUser();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 3efb0cc846ae..2a4017aae6ad 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -539,12 +539,11 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
showRelativeAffiliatedTask(false);
}
- public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
+ public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) {
SystemServicesProxy ssp = Recents.getSystemServices();
ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
if (topTask != null && !SystemServicesProxy.isHomeStack(topTask.stackId)) {
- ssp.moveTaskToDockedStack(topTask.id,
- ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, initialBounds);
+ ssp.moveTaskToDockedStack(topTask.id, stackCreateMode, initialBounds);
showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */,
true /* reloadTasks*/);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
index d91bfb925277..b4e0692f4258 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.phone;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -53,6 +54,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
private RecentsComponent mRecentsComponent;
private Divider mDivider;
+ private Context mContext;
private boolean mIsVertical;
private boolean mIsRTL;
@@ -69,6 +71,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
private int mDragMode;
public NavigationBarGestureHelper(Context context) {
+ mContext = context;
ViewConfiguration configuration = ViewConfiguration.get(context);
Resources r = context.getResources();
mScrollTouchSlop = r.getDimensionPixelSize(R.dimen.navigation_bar_min_swipe_distance);
@@ -172,6 +175,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
== DOCKED_INVALID) {
mDragMode = calculateDragMode();
Rect initialBounds = null;
+ int createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
if (mDragMode == DRAG_MODE_DIVIDER) {
initialBounds = new Rect();
mDivider.getView().calculateBoundsForPosition(mIsVertical
@@ -181,8 +185,12 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
? DOCKED_TOP
: DOCKED_LEFT,
initialBounds);
+ } else if (mDragMode == DRAG_MODE_RECENTS && mTouchDownX
+ < mContext.getResources().getDisplayMetrics().widthPixels / 2) {
+ createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
}
- mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, initialBounds);
+ mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, createMode,
+ initialBounds);
if (mDragMode == DRAG_MODE_DIVIDER) {
mDivider.getView().startDragging();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index c8974d9324b8..e51cf7ac218f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1133,7 +1133,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
@Override
public boolean onLongClick(View v) {
if (mRecents != null) {
- mRecents.dockTopTask(false /* draggingInRecents */, null /* initialBounds */);
+ mRecents.dockTopTask(false /* draggingInRecents */,
+ ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT,
+ null /* initialBounds */);
return true;
}
return false;