Fixing several bugs.

- Prevent long pressing to drag when a task is already docked
- Ensure that the history button has a bit of background protection
- When fast-toggling, the second tap should actually activate the 
  second task and not the third
- Align the history view with the stack view
- Fixing regression launching affiliated tasks

Bug: 25931916

Change-Id: I9d74d0d2427ea0b11f4817d0e635013065e3a792
This commit is contained in:
Winson
2015-11-30 14:53:12 -08:00
parent 479f7446cf
commit 37fc513d01
6 changed files with 41 additions and 24 deletions

View File

@@ -19,16 +19,6 @@
android:layout_height="match_parent"
android:background="#99000000"
android:orientation="vertical">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="14dp"
android:gravity="start"
android:text="@string/recents_history_label"
android:textSize="24sp"
android:textColor="#FFFFFF"
android:fontFamily="sans-serif-medium" />
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"

View File

@@ -22,5 +22,9 @@
android:textSize="14sp"
android:textColor="#FFFFFF"
android:textAllCaps="true"
android:shadowColor="#99000000"
android:shadowDx="0"
android:shadowDy="2"
android:shadowRadius="5"
android:fontFamily="sans-serif-medium"
android:visibility="invisible" />

View File

@@ -82,7 +82,11 @@ public class RecentsActivityLaunchState {
if (launchedFromHome) {
return numTasks - 1;
} else {
return numTasks - 2;
if (flags.isFastToggleRecentsEnabled()) {
return numTasks - 1;
} else {
return numTasks - 2;
}
}
}

View File

@@ -29,6 +29,8 @@ import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.model.TaskStack;
@@ -43,6 +45,7 @@ public class RecentsHistoryView extends LinearLayout {
private RecyclerView mRecyclerView;
private RecentsHistoryAdapter mAdapter;
private boolean mIsVisible;
private Rect mSystemInsets = new Rect();
private Interpolator mFastOutSlowInInterpolator;
private Interpolator mFastOutLinearInInterpolator;
@@ -123,7 +126,8 @@ public class RecentsHistoryView extends LinearLayout {
* Updates the system insets of this history view to the provided values.
*/
public void setSystemInsets(Rect systemInsets) {
setPadding(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
mSystemInsets.set(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
requestLayout();
}
/**
@@ -141,6 +145,26 @@ public class RecentsHistoryView extends LinearLayout {
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
RecentsConfiguration config = Recents.getConfiguration();
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
// Pad the view to align the history with the stack layout
Rect taskStackBounds = new Rect();
config.getTaskStackBounds(new Rect(0, 0, width, height), mSystemInsets.top,
mSystemInsets.right, new Rect() /* searchBarSpaceBounds */, taskStackBounds);
int stackWidthPadding = (int) (config.taskStackWidthPaddingPct * taskStackBounds.width());
int stackHeightPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.recents_stack_top_padding);
mRecyclerView.setPadding(stackWidthPadding + mSystemInsets.left,
stackHeightPadding + mSystemInsets.top,
stackWidthPadding + mSystemInsets.right, mSystemInsets.bottom);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
setSystemInsets(insets.getSystemWindowInsets());

View File

@@ -431,10 +431,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
.setStartDelay(0)
.setDuration(taskViewExitToAppDuration)
.setInterpolator(mFastOutLinearInInterpolator)
.withEndAction(postAnimRunnable)
.start();
} else {
// Hide the dismiss button
mHeaderView.startLaunchTaskDismissAnimation();
mHeaderView.startLaunchTaskDismissAnimation(postAnimRunnable);
// If this is another view in the task grouping and is in front of the launch task,
// animate it away first
if (occludesLaunchTarget) {
@@ -670,21 +671,13 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
public void onTaskDataLoaded() {
SystemServicesProxy ssp = Recents.getSystemServices();
RecentsConfiguration config = Recents.getConfiguration();
if (mThumbnailView != null && mHeaderView != null) {
// Bind each of the views to the new task data
mThumbnailView.rebindToTask(mTask);
mHeaderView.rebindToTask(mTask);
// Rebind any listeners
mActionButtonView.setOnClickListener(this);
// Only enable long-click if we have a freeform workspace to drag to/from, or if we
// aren't already docked
if (ssp.hasFreeformWorkspaceSupport() || !config.hasDockedTasks) {
setOnLongClickListener(this);
} else {
setOnLongClickListener(null);
}
setOnLongClickListener(this);
}
mTaskDataLoaded = true;
}
@@ -724,7 +717,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
public boolean onLongClick(View v) {
if (v == this) {
SystemServicesProxy ssp = Recents.getSystemServices();
if (v == this && !ssp.hasDockedTask()) {
// Start listening for drag events
setClipViewInStack(false);

View File

@@ -284,7 +284,7 @@ public class TaskViewHeader extends FrameLayout
}
/** Animates this task bar dismiss button when launching a task. */
void startLaunchTaskDismissAnimation() {
void startLaunchTaskDismissAnimation(final Runnable postAnimationRunanble) {
if (mDismissButton.getVisibility() == View.VISIBLE) {
int taskViewExitToAppDuration = mContext.getResources().getInteger(
R.integer.recents_task_exit_to_app_duration);
@@ -294,6 +294,7 @@ public class TaskViewHeader extends FrameLayout
.setStartDelay(0)
.setInterpolator(mFastOutSlowInInterpolator)
.setDuration(taskViewExitToAppDuration)
.withEndAction(postAnimationRunanble)
.start();
}
}