am 799819af: Merge "Removing unused/dead code related to footer and screenshot transition." into lmp-mr1-dev

* commit '799819af74b7e82536be54c4ed1a46c08647f27b':
  Removing unused/dead code related to footer and screenshot transition.
This commit is contained in:
Winson Chung
2014-10-14 23:11:53 +00:00
committed by Android Git Automerger
10 changed files with 41 additions and 492 deletions

View File

@@ -59,7 +59,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
final public static String EXTRA_FROM_HOME = "recents.triggeredOverHome";
final public static String EXTRA_FROM_SEARCH_HOME = "recents.triggeredOverSearchHome";
final public static String EXTRA_FROM_APP_THUMBNAIL = "recents.animatingWithThumbnail";
final public static String EXTRA_FROM_APP_FULL_SCREENSHOT = "recents.thumbnail";
final public static String EXTRA_FROM_TASK_ID = "recents.activeTaskId";
final public static String EXTRA_TRIGGERED_FROM_ALT_TAB = "recents.triggeredFromAltTab";
final public static String EXTRA_TRIGGERED_FROM_HOME_KEY = "recents.triggeredFromHomeKey";
@@ -74,7 +73,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
final static String sRecentsPackage = "com.android.systemui";
final static String sRecentsActivity = "com.android.systemui.recents.RecentsActivity";
static Bitmap sLastScreenshot;
static RecentsComponent.Callbacks sRecentsComponentCallbacks;
Context mContext;
@@ -256,7 +254,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
public void onConfigurationChanged(Configuration newConfig) {
// Reload the header bar layout
reloadHeaderBarLayout();
sLastScreenshot = null;
}
/** Prepares the header bar layout. */
@@ -394,20 +391,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
*/
ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo topTask,
boolean isTopTaskHome) {
if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
// Recycle the last screenshot
consumeLastScreenshot();
// Take the full screenshot
sLastScreenshot = mSystemServicesProxy.takeAppScreenshot();
if (sLastScreenshot != null) {
mStartAnimationTriggered = false;
return ActivityOptions.makeCustomAnimation(mContext,
R.anim.recents_from_app_enter,
R.anim.recents_from_app_exit, mHandler, this);
}
}
// Update the destination rect
Task toTask = new Task();
TaskViewTransform toTransform = getThumbnailTransitionTransform(topTask.id, isTopTaskHome,
@@ -493,11 +476,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Try starting with a thumbnail transition
ActivityOptions opts = getThumbnailTransitionActivityOptions(topTask, isTopTaskHome);
if (opts != null) {
if (sLastScreenshot != null) {
startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_APP_FULL_SCREENSHOT);
} else {
startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_APP_THUMBNAIL);
}
startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_APP_THUMBNAIL);
} else {
// Fall through below to the non-thumbnail transition
useThumbnailTransition = false;
@@ -561,19 +540,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
}
/** Returns the last screenshot taken, this will be called by the RecentsActivity. */
public static Bitmap getLastScreenshot() {
return sLastScreenshot;
}
/** Recycles the last screenshot taken, this will be called by the RecentsActivity. */
public static void consumeLastScreenshot() {
if (sLastScreenshot != null) {
sLastScreenshot.recycle();
sLastScreenshot = null;
}
}
/** Sets the RecentsComponent callbacks. */
public void setRecentsComponentCallback(RecentsComponent.Callbacks cb) {
sRecentsComponentCallbacks = cb;

View File

@@ -25,8 +25,6 @@ public class Constants {
public static final boolean Verbose = false;
public static class App {
// Enables the screenshot app->Recents transition
public static final boolean EnableScreenshotAppTransition = false;
// Enables debug drawing for the transition thumbnail
public static final boolean EnableTransitionThumbnailDebugMode = false;
// Enables the filtering of tasks according to their grouping

View File

@@ -189,8 +189,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
AlternateRecentsComponent.EXTRA_FROM_HOME, false);
mConfig.launchedFromAppWithThumbnail = launchIntent.getBooleanExtra(
AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL, false);
mConfig.launchedFromAppWithScreenshot = launchIntent.getBooleanExtra(
AlternateRecentsComponent.EXTRA_FROM_APP_FULL_SCREENSHOT, false);
mConfig.launchedToTaskId = launchIntent.getIntExtra(
AlternateRecentsComponent.EXTRA_FROM_TASK_ID, -1);
mConfig.launchedWithAltTab = launchIntent.getBooleanExtra(

View File

@@ -307,7 +307,6 @@ public class RecentsConfiguration {
launchedWithAltTab = false;
launchedWithNoRecentTasks = false;
launchedFromAppWithThumbnail = false;
launchedFromAppWithScreenshot = false;
launchedFromHome = false;
launchedToTaskId = -1;
}

View File

@@ -17,12 +17,10 @@
package com.android.systemui.recents.views;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.graphics.Outline;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewOutlineProvider;
import com.android.systemui.recents.RecentsConfiguration;
/* An outline provider that has a clip and outline that can be animated. */
@@ -31,35 +29,27 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
RecentsConfiguration mConfig;
TaskView mSourceView;
Rect mTmpRect = new Rect();
Rect mClipRect = new Rect();
Rect mClipBounds = new Rect();
Rect mOutlineClipRect = new Rect();
int mCornerRadius;
float mAlpha = 1f;
final float mMinAlpha = 0.25f;
ObjectAnimator mClipTopAnimator;
ObjectAnimator mClipRightAnimator;
ObjectAnimator mClipBottomAnimator;
public AnimateableViewBounds(TaskView source, int cornerRadius) {
mConfig = RecentsConfiguration.getInstance();
mSourceView = source;
mCornerRadius = cornerRadius;
setClipTop(getClipTop());
setClipRight(getClipRight());
setClipBottom(getClipBottom());
setOutlineClipBottom(getOutlineClipBottom());
}
@Override
public void getOutline(View view, Outline outline) {
outline.setAlpha(mMinAlpha + mAlpha / (1f - mMinAlpha));
outline.setRoundRect(Math.max(mClipRect.left, mOutlineClipRect.left),
Math.max(mClipRect.top, mOutlineClipRect.top),
mSourceView.getWidth() - Math.max(mClipRect.right, mOutlineClipRect.right),
mSourceView.getHeight() - Math.max(mClipRect.bottom, mOutlineClipRect.bottom),
outline.setRoundRect(mClipRect.left, mClipRect.top,
mSourceView.getWidth() - mClipRect.right,
mSourceView.getHeight() - mClipRect.bottom,
mCornerRadius);
}
@@ -71,73 +61,6 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
}
}
/** Animates the top clip. */
void animateClipTop(int top, int duration, ValueAnimator.AnimatorUpdateListener updateListener) {
if (mClipTopAnimator != null) {
mClipTopAnimator.removeAllListeners();
mClipTopAnimator.cancel();
}
mClipTopAnimator = ObjectAnimator.ofInt(this, "clipTop", top);
mClipTopAnimator.setDuration(duration);
mClipTopAnimator.setInterpolator(mConfig.fastOutSlowInInterpolator);
if (updateListener != null) {
mClipTopAnimator.addUpdateListener(updateListener);
}
mClipTopAnimator.start();
}
/** Sets the top clip. */
public void setClipTop(int top) {
if (top != mClipRect.top) {
mClipRect.top = top;
mSourceView.invalidateOutline();
updateClipBounds();
}
}
/** Returns the top clip. */
public int getClipTop() {
return mClipRect.top;
}
/** Animates the right clip. */
void animateClipRight(int right, int duration) {
if (mClipRightAnimator != null) {
mClipRightAnimator.removeAllListeners();
mClipRightAnimator.cancel();
}
mClipRightAnimator = ObjectAnimator.ofInt(this, "clipRight", right);
mClipRightAnimator.setDuration(duration);
mClipRightAnimator.setInterpolator(mConfig.fastOutSlowInInterpolator);
mClipRightAnimator.start();
}
/** Sets the right clip. */
public void setClipRight(int right) {
if (right != mClipRect.right) {
mClipRect.right = right;
mSourceView.invalidateOutline();
updateClipBounds();
}
}
/** Returns the right clip. */
public int getClipRight() {
return mClipRect.right;
}
/** Animates the bottom clip. */
void animateClipBottom(int bottom, int duration) {
if (mClipBottomAnimator != null) {
mClipBottomAnimator.removeAllListeners();
mClipBottomAnimator.cancel();
}
mClipBottomAnimator = ObjectAnimator.ofInt(this, "clipBottom", bottom);
mClipBottomAnimator.setDuration(duration);
mClipBottomAnimator.setInterpolator(mConfig.fastOutSlowInInterpolator);
mClipBottomAnimator.start();
}
/** Sets the bottom clip. */
public void setClipBottom(int bottom) {
if (bottom != mClipRect.bottom) {
@@ -156,19 +79,6 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
return mClipRect.bottom;
}
/** Sets the outline bottom clip. */
public void setOutlineClipBottom(int bottom) {
if (bottom != mOutlineClipRect.bottom) {
mOutlineClipRect.bottom = bottom;
mSourceView.invalidateOutline();
}
}
/** Gets the outline bottom clip. */
public int getOutlineClipBottom() {
return mOutlineClipRect.bottom;
}
private void updateClipBounds() {
mClipBounds.set(mClipRect.left, mClipRect.top,
mSourceView.getWidth() - mClipRect.right,

View File

@@ -598,22 +598,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
TaskView tv = (TaskView) getChildAt(i);
if (tv.isFullScreenView()) {
tv.measure(widthMeasureSpec, heightMeasureSpec);
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
mTmpRect.setEmpty();
}
tv.measure(
MeasureSpec.makeMeasureSpec(
mLayoutAlgorithm.mTaskRect.width() + mTmpRect.left + mTmpRect.right,
MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(
mLayoutAlgorithm.mTaskRect.height() + mTmpRect.top + mTmpRect.bottom +
tv.getMaxFooterHeight(), MeasureSpec.EXACTLY));
mTmpRect.setEmpty();
}
tv.measure(
MeasureSpec.makeMeasureSpec(
mLayoutAlgorithm.mTaskRect.width() + mTmpRect.left + mTmpRect.right,
MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(
mLayoutAlgorithm.mTaskRect.height() + mTmpRect.top + mTmpRect.bottom,
MeasureSpec.EXACTLY));
}
setMeasuredDimension(width, height);
@@ -630,20 +626,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
TaskView tv = (TaskView) getChildAt(i);
if (tv.isFullScreenView()) {
tv.layout(left, top, left + tv.getMeasuredWidth(), top + tv.getMeasuredHeight());
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
if (tv.getBackground() != null) {
tv.getBackground().getPadding(mTmpRect);
} else {
mTmpRect.setEmpty();
}
tv.layout(mLayoutAlgorithm.mTaskRect.left - mTmpRect.left,
mLayoutAlgorithm.mTaskRect.top - mTmpRect.top,
mLayoutAlgorithm.mTaskRect.right + mTmpRect.right,
mLayoutAlgorithm.mTaskRect.bottom + mTmpRect.bottom +
tv.getMaxFooterHeight());
mTmpRect.setEmpty();
}
tv.layout(mLayoutAlgorithm.mTaskRect.left - mTmpRect.left,
mLayoutAlgorithm.mTaskRect.top - mTmpRect.top,
mLayoutAlgorithm.mTaskRect.right + mTmpRect.right,
mLayoutAlgorithm.mTaskRect.bottom + mTmpRect.bottom);
}
if (mAwaitingFirstLayout) {
@@ -960,13 +951,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// Rebind the task and request that this task's data be filled into the TaskView
tv.onTaskBound(task);
// Mark the launch task as fullscreen
if (Constants.DebugFlags.App.EnableScreenshotAppTransition && mAwaitingFirstLayout) {
if (task.isLaunchTarget) {
tv.setIsFullScreen(true);
}
}
// Load the task data
RecentsTaskLoader.getInstance().loadTaskData(task);
@@ -1078,11 +1062,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
}
@Override
public void onTaskViewFullScreenTransitionCompleted() {
requestSynchronizeStackViewsWithModel();
}
@Override
public void onTaskViewFocusChanged(TaskView tv, boolean focused) {
if (focused) {

View File

@@ -379,8 +379,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
tv.setClipViewInStack(false);
// Disallow touch events from this task view
tv.setTouchEnabled(false);
// Hide the footer
tv.animateFooterVisibility(false, mSv.mConfig.taskViewLockToAppShortAnimDuration);
// Disallow parents from intercepting touch events
final ViewParent parent = mSv.getParent();
if (parent != null) {
@@ -411,8 +409,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
tv.setClipViewInStack(true);
// Re-enable touch events from this task view
tv.setTouchEnabled(true);
// Restore the footer
tv.animateFooterVisibility(true, mSv.mConfig.taskViewLockToAppShortAnimDuration);
}
@Override

View File

@@ -37,7 +37,7 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar;
/* A task view */
public class TaskView extends FrameLayout implements Task.TaskCallbacks,
TaskViewFooter.TaskFooterViewCallbacks, View.OnClickListener, View.OnLongClickListener {
View.OnClickListener, View.OnLongClickListener {
/** The TaskView callbacks */
interface TaskViewCallbacks {
@@ -46,7 +46,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
public void onTaskViewClicked(TaskView tv, Task task, boolean lockToTask);
public void onTaskViewDismissed(TaskView tv);
public void onTaskViewClipStateChanged(TaskView tv);
public void onTaskViewFullScreenTransitionCompleted();
public void onTaskViewFocusChanged(TaskView tv, boolean focused);
}
@@ -64,7 +63,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
boolean mTaskDataLoaded;
boolean mIsFocused;
boolean mFocusAnimationsEnabled;
boolean mIsFullScreenView;
boolean mClipViewInStack;
AnimateableViewBounds mViewBounds;
Paint mLayerPaint = new Paint();
@@ -72,7 +70,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
View mContent;
TaskViewThumbnail mThumbnailView;
TaskViewHeader mHeaderView;
TaskViewFooter mFooterView;
View mActionButtonView;
TaskViewCallbacks mCb;
@@ -142,9 +139,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight());
}
});
if (mFooterView != null) {
mFooterView.setCallbacks(this);
}
}
@Override
@@ -159,29 +153,16 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
mContent.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY));
// Measure the bar view, thumbnail, and footer
// Measure the bar view, and action button
mHeaderView.measure(MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mConfig.taskBarHeight, MeasureSpec.EXACTLY));
if (mFooterView != null) {
mFooterView.measure(
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mConfig.taskViewLockToAppButtonHeight,
MeasureSpec.EXACTLY));
}
mActionButtonView.measure(
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.AT_MOST),
MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.AT_MOST));
if (mIsFullScreenView) {
// Measure the thumbnail height to be the full dimensions
mThumbnailView.measure(
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.EXACTLY));
} else {
// Measure the thumbnail to be square
mThumbnailView.measure(
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY));
}
// Measure the thumbnail to be square
mThumbnailView.measure(
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY));
setMeasuredDimension(width, height);
invalidateOutline();
}
@@ -193,16 +174,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, int duration,
ValueAnimator.AnimatorUpdateListener updateCallback) {
// If we are a full screen view, then only update the Z to keep it in order
// XXX: Also update/animate the dim as well
if (mIsFullScreenView) {
if (!mConfig.fakeShadows &&
toTransform.hasTranslationZChangedFrom(getTranslationZ())) {
setTranslationZ(toTransform.translationZ);
}
return;
}
// Apply the transform
toTransform.applyToTaskView(this, duration, mConfig.fastOutSlowInInterpolator, false,
!mConfig.fakeShadows, updateCallback);
@@ -253,17 +224,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
void prepareEnterRecentsAnimation(boolean isTaskViewLaunchTargetTask,
boolean occludesLaunchTarget, int offscreenY) {
int initialDim = getDim();
if (mConfig.launchedFromAppWithScreenshot) {
if (isTaskViewLaunchTargetTask) {
// Hide the footer during the transition in, and animate it out afterwards?
if (mFooterView != null) {
mFooterView.animateFooterVisibility(false, 0);
}
} else {
// Don't do anything for the side views when animating in
}
} else if (mConfig.launchedFromAppWithThumbnail) {
if (mConfig.launchedFromAppWithThumbnail) {
if (isTaskViewLaunchTargetTask) {
// Set the dim to 0 so we can animate it in
initialDim = 0;
@@ -290,74 +251,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
final TaskViewTransform transform = ctx.currentTaskTransform;
int startDelay = 0;
if (mConfig.launchedFromAppWithScreenshot) {
if (mTask.isLaunchTarget) {
Rect taskRect = ctx.currentTaskRect;
int duration = mConfig.taskViewEnterFromHomeDuration * 10;
int windowInsetTop = mConfig.systemInsets.top; // XXX: Should be for the window
float taskScale = ((float) taskRect.width() / getMeasuredWidth()) * transform.scale;
float scaledYOffset = ((1f - taskScale) * getMeasuredHeight()) / 2;
float scaledWindowInsetTop = (int) (taskScale * windowInsetTop);
float scaledTranslationY = taskRect.top + transform.translationY -
(scaledWindowInsetTop + scaledYOffset);
startDelay = mConfig.taskViewEnterFromHomeStaggerDelay;
// Animate the top clip
mViewBounds.animateClipTop(windowInsetTop, duration,
new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int y = (Integer) animation.getAnimatedValue();
mHeaderView.setTranslationY(y);
}
});
// Animate the bottom or right clip
int size = Math.round((taskRect.width() / taskScale));
if (mConfig.hasHorizontalLayout()) {
mViewBounds.animateClipRight(getMeasuredWidth() - size, duration);
} else {
mViewBounds.animateClipBottom(getMeasuredHeight() - (windowInsetTop + size), duration);
}
// Animate the task bar of the first task view
animate()
.scaleX(taskScale)
.scaleY(taskScale)
.translationY(scaledTranslationY)
.setDuration(duration)
.withEndAction(new Runnable() {
@Override
public void run() {
setIsFullScreen(false);
requestLayout();
// Reset the clip
mViewBounds.setClipTop(0);
mViewBounds.setClipBottom(0);
mViewBounds.setClipRight(0);
// Reset the bar translation
mHeaderView.setTranslationY(0);
// Animate the footer into view (if it is the front most task)
animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration);
// Unbind the thumbnail from the screenshot
RecentsTaskLoader.getInstance().loadTaskData(mTask);
// Recycle the full screen screenshot
AlternateRecentsComponent.consumeLastScreenshot();
mCb.onTaskViewFullScreenTransitionCompleted();
// Decrement the post animation trigger
ctx.postAnimationTrigger.decrement();
}
})
.start();
} else {
// Animate the footer into view
animateFooterVisibility(true, 0);
}
ctx.postAnimationTrigger.increment();
} else if (mConfig.launchedFromAppWithThumbnail) {
if (mConfig.launchedFromAppWithThumbnail) {
if (mTask.isLaunchTarget) {
// Animate the dim/overlay
if (Constants.DebugFlags.App.EnableThumbnailAlphaOnFrontmost) {
@@ -379,11 +273,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
}
ctx.postAnimationTrigger.increment();
// Animate the footer into view
animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration);
// Animate the action button in
fadeInActionButton(true);
} else {
// Animate the task up if it was occluding the launch target
if (ctx.currentTaskOccludesLaunchTarget) {
@@ -435,14 +326,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
})
.start();
ctx.postAnimationTrigger.increment();
// Animate the footer into view
animateFooterVisibility(true, mConfig.taskViewEnterFromHomeDuration);
startDelay = delay;
} else {
// Animate the footer into view
animateFooterVisibility(true, 0);
}
// Enable the focus animations from this point onwards so that they aren't affected by the
@@ -468,8 +352,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
animator.setStartDelay(mConfig.taskBarEnterAnimDelay);
}
animator.start();
}
/** Animates this task view as it leaves recents by pressing home. */
@@ -579,23 +461,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
mCb.onTaskViewDismissed(tv);
}
});
// Hide the footer
animateFooterVisibility(false, mConfig.taskViewRemoveAnimDuration);
}
/** Sets whether this task view is full screen or not. */
void setIsFullScreen(boolean isFullscreen) {
mIsFullScreenView = isFullscreen;
mHeaderView.setIsFullscreen(isFullscreen);
if (isFullscreen) {
// If we are full screen, then disable the bottom outline clip for the footer
mViewBounds.setOutlineClipBottom(0);
}
}
/** Returns whether this task view should currently be drawn as a full screen view. */
boolean isFullScreenView() {
return mIsFullScreenView;
}
/**
@@ -603,7 +468,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
* view.
*/
boolean shouldClipViewInStack() {
return mClipViewInStack && !mIsFullScreenView && (getVisibility() == View.VISIBLE);
return mClipViewInStack && (getVisibility() == View.VISIBLE);
}
/** Sets whether this view should be clipped, or clipped against. */
@@ -614,27 +479,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
}
}
/** Gets the max footer height. */
public int getMaxFooterHeight() {
if (mFooterView != null) {
return mFooterView.mMaxFooterHeight;
} else {
return 0;
}
}
/** Animates the footer into and out of view. */
void animateFooterVisibility(boolean visible, int duration) {
// Hide the footer if we are a full screen view
if (mIsFullScreenView) return;
// Hide the footer if the current task can not be locked to
if (!mTask.lockToTaskEnabled || !mTask.lockToThisTask) return;
// Otherwise, animate the visibility
if (mFooterView != null) {
mFooterView.animateFooterVisibility(visible, duration);
}
}
/** Sets the current task progress. */
public void setTaskProgress(float p) {
mTaskProgress = p;
@@ -786,17 +630,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
public void onTaskBound(Task t) {
mTask = t;
mTask.setCallbacks(this);
if (getMeasuredWidth() == 0) {
// If we haven't yet measured, we should just set the footer height with any animation
animateFooterVisibility(t.lockToThisTask, 0);
} else {
animateFooterVisibility(t.lockToThisTask, mConfig.taskViewLockToAppLongAnimDuration);
}
updateLockButtonVisibility(t);
}
private void updateLockButtonVisibility(Task t) {
// Hide the action button if lock to app is disabled for this view
int lockButtonVisibility = (!t.lockToTaskEnabled || !t.lockToThisTask) ? GONE : VISIBLE;
if (mActionButtonView.getVisibility() != lockButtonVisibility) {
@@ -809,18 +643,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
public void onTaskDataLoaded() {
if (mThumbnailView != null && mHeaderView != null) {
// Bind each of the views to the new task data
if (mIsFullScreenView) {
mThumbnailView.bindToScreenshot(AlternateRecentsComponent.getLastScreenshot());
} else {
mThumbnailView.rebindToTask(mTask);
}
mThumbnailView.rebindToTask(mTask);
mHeaderView.rebindToTask(mTask);
// Rebind any listeners
mHeaderView.mApplicationIcon.setOnClickListener(this);
mHeaderView.mDismissButton.setOnClickListener(this);
if (mFooterView != null) {
mFooterView.setOnClickListener(this);
}
mActionButtonView.setOnClickListener(this);
if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) {
if (mConfig.developerOptionsEnabled) {
@@ -841,9 +668,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
// Unbind any listeners
mHeaderView.mApplicationIcon.setOnClickListener(null);
mHeaderView.mDismissButton.setOnClickListener(null);
if (mFooterView != null) {
mFooterView.setOnClickListener(null);
}
mActionButtonView.setOnClickListener(null);
if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) {
mHeaderView.mApplicationIcon.setOnLongClickListener(null);
@@ -857,19 +681,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
setOnClickListener(enabled ? this : null);
}
/**** TaskViewFooter.TaskFooterViewCallbacks ****/
@Override
public void onTaskFooterHeightChanged(int height, int maxHeight) {
if (mIsFullScreenView) {
// Disable the bottom outline clip when fullscreen
mViewBounds.setOutlineClipBottom(0);
} else {
// Update the bottom clip in our outline provider
mViewBounds.setOutlineClipBottom(maxHeight - height);
}
}
/**** View.OnClickListener Implementation ****/
@Override
@@ -893,8 +704,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
// Reset the translation of the action button before we animate it out
mActionButtonView.setTranslationZ(0f);
}
mCb.onTaskViewClicked(tv, tv.getTask(),
(v == mFooterView || v == mActionButtonView));
mCb.onTaskViewClicked(tv, tv.getTask(), (v == mActionButtonView));
}
}

View File

@@ -1,98 +0,0 @@
/*
* Copyright (C) 2014 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.systemui.recents.views;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.android.systemui.recents.RecentsConfiguration;
/** The task footer view */
public class TaskViewFooter extends FrameLayout {
interface TaskFooterViewCallbacks {
public void onTaskFooterHeightChanged(int height, int maxHeight);
}
RecentsConfiguration mConfig;
TaskFooterViewCallbacks mCb;
int mFooterHeight;
int mMaxFooterHeight;
ObjectAnimator mFooterAnimator;
public TaskViewFooter(Context context) {
this(context, null);
}
public TaskViewFooter(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
mMaxFooterHeight = mConfig.taskViewLockToAppButtonHeight;
setFooterHeight(getFooterHeight());
}
/** Sets the callbacks for when the footer height changes. */
void setCallbacks(TaskFooterViewCallbacks cb) {
mCb = cb;
mCb.onTaskFooterHeightChanged(mFooterHeight, mMaxFooterHeight);
}
/** Sets the footer height. */
public void setFooterHeight(int footerHeight) {
if (footerHeight != mFooterHeight) {
mFooterHeight = footerHeight;
mCb.onTaskFooterHeightChanged(footerHeight, mMaxFooterHeight);
}
}
/** Gets the footer height. */
public int getFooterHeight() {
return mFooterHeight;
}
/** Animates the footer into and out of view. */
void animateFooterVisibility(final boolean visible, int duration) {
// Return early if there is no footer
if (mMaxFooterHeight <= 0) return;
// Cancel the previous animation
if (mFooterAnimator != null) {
mFooterAnimator.removeAllListeners();
mFooterAnimator.cancel();
}
int finalHeight = visible ? mMaxFooterHeight : 0;
if (duration > 0) {
mFooterAnimator = ObjectAnimator.ofInt(this, "footerHeight", finalHeight);
mFooterAnimator.setDuration(duration);
mFooterAnimator.setInterpolator(mConfig.fastOutSlowInInterpolator);
mFooterAnimator.start();
} else {
setFooterHeight(finalHeight);
}
}
}

View File

@@ -66,10 +66,8 @@ public class TaskViewHeader extends FrameLayout {
Drawable mLightDismissDrawable;
Drawable mDarkDismissDrawable;
AnimatorSet mFocusAnimator;
ValueAnimator backgroundColorAnimator;
PorterDuffColorFilter mDimFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
boolean mIsFullscreen;
boolean mCurrentPrimaryColorIsDark;
int mCurrentPrimaryColor;
@@ -159,21 +157,14 @@ public class TaskViewHeader extends FrameLayout {
@Override
protected void onDraw(Canvas canvas) {
if (!mIsFullscreen) {
// Draw the highlight at the top edge (but put the bottom edge just out of view)
float offset = (float) Math.ceil(mConfig.taskViewHighlightPx / 2f);
float radius = mConfig.taskViewRoundedCornerRadiusPx;
int count = canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.drawRoundRect(-offset, 0f, (float) getMeasuredWidth() + offset,
getMeasuredHeight() + radius, radius, radius, sHighlightPaint);
canvas.restoreToCount(count);
}
}
/** Sets whether the current task is full screen or not. */
void setIsFullscreen(boolean isFullscreen) {
mIsFullscreen = isFullscreen;
// Draw the highlight at the top edge (but put the bottom edge just out of view)
float offset = (float) Math.ceil(mConfig.taskViewHighlightPx / 2f);
float radius = mConfig.taskViewRoundedCornerRadiusPx;
int count = canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.drawRoundRect(-offset, 0f, (float) getMeasuredWidth() + offset,
getMeasuredHeight() + radius, radius, radius, sHighlightPaint);
canvas.restoreToCount(count);
}
@Override