diff options
author | Winson Chung <winsonc@google.com> | 2014-05-20 21:42:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-20 21:42:52 +0000 |
commit | 48dfae92d24de47672d01612f66102c7b435b16f (patch) | |
tree | e49856499c2ab86bee3ee4e5316a155e84875689 /packages/SystemUI/src | |
parent | c0e439f1b7dcd937b6cc842eafc7a4e7c8abce9b (diff) | |
parent | 863db8a4e7906826bc105f49a4596dc7b336088a (diff) | |
download | frameworks_base-48dfae92d24de47672d01612f66102c7b435b16f.zip frameworks_base-48dfae92d24de47672d01612f66102c7b435b16f.tar.gz frameworks_base-48dfae92d24de47672d01612f66102c7b435b16f.tar.bz2 |
Merge "Removing the info pane."
Diffstat (limited to 'packages/SystemUI/src')
6 files changed, 7 insertions, 390 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 79545b3..fcbd0f4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -31,8 +31,6 @@ public class Constants { public static final boolean EnableTaskStackClipping = false; // Enables the use of theme colors as the task bar background public static final boolean EnableTaskBarThemeColors = true; - // Enables the info pane on long-pressing the task - public static final boolean EnableInfoPane = false; // Enables app-info pane on long-pressing the icon public static final boolean EnableDevAppInfoOnLongPress = true; // Enables the search bar layout diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index bae8a99..de696db 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -394,16 +394,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView public void onBackPressed() { boolean interceptedByInfoPanelClose = false; - // Try and return from any open info panes - if (Constants.DebugFlags.App.EnableInfoPane) { - interceptedByInfoPanelClose = mRecentsView.closeOpenInfoPanes(); - } - - // If we haven't been intercepted already, then unfilter any stacks - if (!interceptedByInfoPanelClose) { - if (!mRecentsView.unfilterFilteredStacks()) { - super.onBackPressed(); - } + // Unfilter any stacks + if (!mRecentsView.unfilterFilteredStacks()) { + super.onBackPressed(); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index c63e688..cad54fa 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -301,24 +301,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV return insets.consumeSystemWindowInsets(false, false, false, true); } - /** Closes any open info panes */ - public boolean closeOpenInfoPanes() { - if (mBSP != null) { - // Get the first stack view - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - if (child instanceof TaskStackView) { - TaskStackView stackView = (TaskStackView) child; - if (stackView.closeOpenInfoPanes()) { - return true; - } - } - } - } - return false; - } - /** Unfilters any filtered stacks */ public boolean unfilterFilteredStacks() { if (mBSP != null) { @@ -346,9 +328,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV mCb.onTaskLaunching(); } - // Close any open info panes - closeOpenInfoPanes(); - final Runnable launchRunnable = new Runnable() { @Override public void run() { diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java deleted file mode 100644 index 7b6572b..0000000 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java +++ /dev/null @@ -1,185 +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.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.content.Context; -import android.content.res.ColorStateList; -import android.graphics.Canvas; -import android.graphics.Path; -import android.graphics.Point; -import android.graphics.Rect; -import android.graphics.drawable.RippleDrawable; -import android.util.AttributeSet; -import android.widget.Button; -import android.widget.FrameLayout; -import com.android.systemui.R; -import com.android.systemui.recents.Constants; -import com.android.systemui.recents.RecentsConfiguration; -import com.android.systemui.recents.Utilities; -import com.android.systemui.recents.model.Task; - - -/* The task info view */ -class TaskInfoView extends FrameLayout { - - Button mAppInfoButton; - - // Circular clip animation - boolean mCircularClipEnabled; - Path mClipPath = new Path(); - float mClipRadius; - float mMaxClipRadius; - Point mClipOrigin = new Point(); - ObjectAnimator mCircularClipAnimator; - - public TaskInfoView(Context context) { - this(context, null); - } - - public TaskInfoView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public TaskInfoView(Context context, AttributeSet attrs, int defStyleAttr) { - this(context, attrs, defStyleAttr, 0); - } - - public TaskInfoView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - protected void onFinishInflate() { - // Initialize the buttons on the info panel - mAppInfoButton = (Button) findViewById(R.id.task_view_app_info_button); - } - - /** Updates the positions of each of the items to fit in the rect specified */ - void updateContents(Rect visibleRect) { - // Offset the app info button - mAppInfoButton.setTranslationY(visibleRect.top + - (visibleRect.height() - mAppInfoButton.getMeasuredHeight()) / 2); - } - - /** Sets the circular clip radius on this panel */ - public void setCircularClipRadius(float r) { - mClipRadius = r; - invalidate(); - } - - /** Gets the circular clip radius on this panel */ - public float getCircularClipRadius() { - return mClipRadius; - } - - /** Animates the circular clip radius on the icon */ - void animateCircularClip(Point o, float fromRadius, float toRadius, - final Runnable postRunnable, boolean animateInContent) { - if (mCircularClipAnimator != null) { - mCircularClipAnimator.cancel(); - } - - // Calculate the max clip radius to each of the corners - int w = getMeasuredWidth() - o.x; - int h = getMeasuredHeight() - o.y; - // origin to tl, tr, br, bl - mMaxClipRadius = (int) Math.ceil(Math.sqrt(o.x * o.x + o.y * o.y)); - mMaxClipRadius = (int) Math.max(mMaxClipRadius, Math.ceil(Math.sqrt(w * w + o.y * o.y))); - mMaxClipRadius = (int) Math.max(mMaxClipRadius, Math.ceil(Math.sqrt(w * w + h * h))); - mMaxClipRadius = (int) Math.max(mMaxClipRadius, Math.ceil(Math.sqrt(o.x * o.x + h * h))); - - mClipOrigin.set(o.x, o.y); - mClipRadius = fromRadius; - int duration = Utilities.calculateTranslationAnimationDuration((int) mMaxClipRadius); - mCircularClipAnimator = ObjectAnimator.ofFloat(this, "circularClipRadius", toRadius); - mCircularClipAnimator.setDuration(duration); - mCircularClipAnimator.setInterpolator( - RecentsConfiguration.getInstance().defaultBezierInterpolator); - mCircularClipAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mCircularClipEnabled = false; - if (postRunnable != null) { - postRunnable.run(); - } - } - }); - mCircularClipAnimator.start(); - mCircularClipEnabled = true; - - if (animateInContent) { - animateAppInfoButtonIn(duration); - } - } - - /** Cancels the circular clip animation. */ - void cancelCircularClipAnimation() { - if (mCircularClipAnimator != null) { - mCircularClipAnimator.cancel(); - } - } - - void animateAppInfoButtonIn(int duration) { - mAppInfoButton.setScaleX(0.75f); - mAppInfoButton.setScaleY(0.75f); - mAppInfoButton.animate() - .scaleX(1f) - .scaleY(1f) - .setDuration(duration) - .setInterpolator(RecentsConfiguration.getInstance().defaultBezierInterpolator) - .withLayer() - .start(); - } - - /** Binds the info view to the task */ - void rebindToTask(Task t, boolean animate) { - RecentsConfiguration configuration = RecentsConfiguration.getInstance(); - if (Constants.DebugFlags.App.EnableTaskBarThemeColors && t.colorPrimary != 0) { - setBackgroundColor(t.colorPrimary); - // Workaround: The button currently doesn't support setting a custom background tint - // not defined in the theme. Just lower the alpha on the button to make it blend more - // into the background. - if (mAppInfoButton.getBackground() instanceof RippleDrawable) { - RippleDrawable d = (RippleDrawable) mAppInfoButton.getBackground(); - if (d != null) { - d.setAlpha(96); - } - } - } else { - setBackgroundColor(configuration.taskBarViewDefaultBackgroundColor); - } - } - - @Override - public void draw(Canvas canvas) { - int saveCount = 0; - if (mCircularClipEnabled) { - saveCount = canvas.save(Canvas.CLIP_SAVE_FLAG); - mClipPath.reset(); - mClipPath.addCircle(mClipOrigin.x, mClipOrigin.y, mClipRadius * mMaxClipRadius, - Path.Direction.CW); - canvas.clipPath(mClipPath); - } - super.draw(canvas); - if (mCircularClipEnabled) { - canvas.restoreToCount(saveCount); - } - } -} diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 37c3c35..0687222 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -54,7 +54,7 @@ import java.util.Set; /* The visual representation of a task stack view */ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCallbacks, TaskView.TaskViewCallbacks, ViewPool.ViewPoolConsumer<TaskView, Task>, - View.OnClickListener, View.OnLongClickListener, RecentsPackageMonitor.PackageCallbacks { + View.OnClickListener, RecentsPackageMonitor.PackageCallbacks { /** The TaskView callbacks */ interface TaskStackViewCallbacks { @@ -79,7 +79,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal int mMinScroll; int mMaxScroll; int mStashedScroll; - int mLastInfoPaneStackScroll; int mFocusedTaskIndex = -1; OverScroller mScroller; ObjectAnimator mScrollAnimator; @@ -290,17 +289,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal public void setStackScroll(int value) { mStackScroll = value; requestSynchronizeStackViewsWithModel(); - - // Close any open info panes if the user has scrolled away from them - boolean isAnimatingScroll = (mScrollAnimator != null && mScrollAnimator.isRunning()); - if (mLastInfoPaneStackScroll > -1 && !isAnimatingScroll) { - RecentsConfiguration config = RecentsConfiguration.getInstance(); - if (Math.abs(mStackScroll - mLastInfoPaneStackScroll) > - config.taskStackScrollDismissInfoPaneDistance) { - // Close any open info panes - closeOpenInfoPanes(); - } - } } /** Sets the current stack scroll without synchronizing the stack view with the model */ public void setStackScrollRaw(int value) { @@ -455,21 +443,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } } - /** Closes any open info panes. */ - boolean closeOpenInfoPanes() { - if (!Constants.DebugFlags.App.EnableInfoPane) return false; - - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - TaskView tv = (TaskView) getChildAt(i); - if (tv.isInfoPaneVisible()) { - tv.hideInfoPane(); - return true; - } - } - return false; - } - /** Focuses the task at the specified index in the stack */ void focusTask(int taskIndex, boolean scrollToNewPosition) { Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "" + taskIndex); @@ -949,9 +922,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal @Override public void onStackFiltered(TaskStack newStack, final ArrayList<Task> curTasks, Task filteredTask) { - // Close any open info panes - closeOpenInfoPanes(); - // Stash the scroll and filtered task for us to restore to when we unfilter mStashedScroll = getStackScroll(); @@ -976,9 +946,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal @Override public void onStackUnfiltered(TaskStack newStack, final ArrayList<Task> curTasks) { - // Close any open info panes - closeOpenInfoPanes(); - // Calculate the current task transforms final ArrayList<TaskViewTransform> curTaskTransforms = getStackTransforms(curTasks, getStackScroll(), null, true); @@ -1058,9 +1025,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Set the callbacks and listeners for this new view tv.setOnClickListener(this); - if (Constants.DebugFlags.App.EnableInfoPane) { - tv.setOnLongClickListener(this); - } tv.setCallbacks(this); } else { attachViewToParent(tv, insertIndex, tv.getLayoutParams()); @@ -1094,17 +1058,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } @Override - public void onTaskInfoPanelShown(TaskView tv) { - // Do nothing - } - - @Override - public void onTaskInfoPanelHidden(TaskView tv) { - // Unset the saved scroll - mLastInfoPaneStackScroll = -1; - } - - @Override public void onTaskAppInfoClicked(TaskView tv) { if (mCb != null) { mCb.onTaskAppInfoLaunched(tv.getTask()); @@ -1129,52 +1082,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Thumbnail]", task + " cb: " + mCb); - // Close any open info panes if the user taps on another task - if (closeOpenInfoPanes()) { - return; - } - if (mCb != null) { mCb.onTaskLaunched(this, tv, mStack, task); } } - @Override - public boolean onLongClick(View v) { - if (!Constants.DebugFlags.App.EnableInfoPane) return false; - - TaskView tv = (TaskView) v; - - // Close any other task info panels if we launch another info pane - closeOpenInfoPanes(); - - // Scroll the task view so that it is maximally visible - float overlapHeight = Constants.Values.TaskStackView.StackOverlapPct * mTaskRect.height(); - int taskIndex = mStack.indexOfTask(tv.getTask()); - int curScroll = getStackScroll(); - int newScroll = (int) Math.max(mMinScroll, Math.min(mMaxScroll, taskIndex * overlapHeight)); - TaskViewTransform transform = getStackTransform(taskIndex, curScroll); - Rect nonOverlapRect = new Rect(transform.rect); - if (taskIndex < (mStack.getTaskCount() - 1)) { - nonOverlapRect.bottom = nonOverlapRect.top + (int) overlapHeight; - } - - // XXX: Use HW Layers - if (transform.t < 0f) { - animateScroll(curScroll, newScroll, null); - } else if (nonOverlapRect.bottom > mStackRectSansPeek.bottom) { - // Check if we are out of bounds, if so, just scroll it in such that the bottom of the - // task view is visible - newScroll = curScroll - (mStackRectSansPeek.bottom - nonOverlapRect.bottom); - animateScroll(curScroll, newScroll, null); - } - mLastInfoPaneStackScroll = newScroll; - - // Show the info pane for this task view - tv.showInfoPane(new Rect(0, 0, 0, (int) overlapHeight)); - return true; - } - /**** RecentsPackageMonitor.PackageCallbacks Implementation ****/ @Override @@ -1550,13 +1462,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { if (parent != null) { parent.requestDisallowInterceptTouchEvent(true); } - // If the info panel is currently showing on this view, then we need to dismiss it - if (Constants.DebugFlags.App.EnableInfoPane) { - TaskView tv = (TaskView) v; - if (tv.isInfoPaneVisible()) { - tv.hideInfoPane(); - } - } } @Override diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 46af4c1..780f274 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -44,8 +44,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On /** The TaskView callbacks */ interface TaskViewCallbacks { public void onTaskIconClicked(TaskView tv); - public void onTaskInfoPanelShown(TaskView tv); - public void onTaskInfoPanelHidden(TaskView tv); public void onTaskAppInfoClicked(TaskView tv); public void onTaskDismissed(TaskView tv); @@ -58,14 +56,12 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On Task mTask; boolean mTaskDataLoaded; - boolean mTaskInfoPaneVisible; boolean mIsFocused; Point mLastTouchDown = new Point(); Path mRoundedRectClipPath = new Path(); TaskThumbnailView mThumbnailView; TaskBarView mBarView; - TaskInfoView mInfoView; TaskViewCallbacks mCb; @@ -94,7 +90,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On // Bind the views mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail); mBarView = (TaskBarView) findViewById(R.id.task_view_bar); - mInfoView = (TaskInfoView) findViewById(R.id.task_view_info_pane); if (mTaskDataLoaded) { onTaskDataLoaded(false); @@ -280,63 +275,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On return outRect; } - /** Returns whether this task has an info pane visible */ - boolean isInfoPaneVisible() { - return mTaskInfoPaneVisible; - } - - /** Shows the info pane if it is not visible. */ - void showInfoPane(Rect taskVisibleRect) { - if (mTaskInfoPaneVisible) return; - - // Remove the bar view from the visible rect and update the info pane contents - taskVisibleRect.top += mBarView.getMeasuredHeight(); - mInfoView.updateContents(taskVisibleRect); - - // Show the info pane and animate it into view - mInfoView.setVisibility(View.VISIBLE); - mInfoView.animateCircularClip(mLastTouchDown, 0f, 1f, null, true); - mInfoView.setOnClickListener(this); - mTaskInfoPaneVisible = true; - - // Notify any callbacks - if (mCb != null) { - mCb.onTaskInfoPanelShown(this); - } - } - - /** Hides the info pane if it is visible. */ - void hideInfoPane() { - if (!mTaskInfoPaneVisible) return; - RecentsConfiguration config = RecentsConfiguration.getInstance(); - - // Cancel any circular clip animation - mInfoView.cancelCircularClipAnimation(); - - // Animate the info pane out - mInfoView.animate() - .alpha(0f) - .setDuration(config.taskViewInfoPaneAnimDuration) - .setInterpolator(config.defaultBezierInterpolator) - .withLayer() - .withEndAction(new Runnable() { - @Override - public void run() { - mInfoView.setVisibility(View.INVISIBLE); - mInfoView.setOnClickListener(null); - - mInfoView.setAlpha(1f); - } - }) - .start(); - mTaskInfoPaneVisible = false; - - // Notify any callbacks - if (mCb != null) { - mCb.onTaskInfoPanelHidden(this); - } - } - /** Enable the hw layers on this task view */ void enableHwLayers() { mThumbnailView.setLayerType(View.LAYER_TYPE_HARDWARE, null); @@ -408,11 +346,10 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On @Override public void onTaskDataLoaded(boolean reloadingTaskData) { - if (mThumbnailView != null && mBarView != null && mInfoView != null) { + if (mThumbnailView != null && mBarView != null) { // Bind each of the views to the new task data mThumbnailView.rebindToTask(mTask, reloadingTaskData); mBarView.rebindToTask(mTask, reloadingTaskData); - mInfoView.rebindToTask(mTask, reloadingTaskData); // Rebind any listeners mBarView.mApplicationIcon.setOnClickListener(this); mBarView.mDismissButton.setOnClickListener(this); @@ -424,16 +361,13 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On mBarView.mApplicationIcon.setOnLongClickListener(this); } } - if (Constants.DebugFlags.App.EnableInfoPane) { - mInfoView.mAppInfoButton.setOnClickListener(this); - } } mTaskDataLoaded = true; } @Override public void onTaskDataUnloaded() { - if (mThumbnailView != null && mBarView != null && mInfoView != null) { + if (mThumbnailView != null && mBarView != null) { // Unbind each of the views from the task data and remove the task callback mTask.setCallbacks(null); mThumbnailView.unbindFromTask(); @@ -444,18 +378,13 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) { mBarView.mApplicationIcon.setOnLongClickListener(null); } - if (Constants.DebugFlags.App.EnableInfoPane) { - mInfoView.mAppInfoButton.setOnClickListener(null); - } } mTaskDataLoaded = false; } @Override public void onClick(View v) { - if (v == mInfoView) { - hideInfoPane(); - } else if (v == mBarView.mApplicationIcon) { + if (v == mBarView.mApplicationIcon) { mCb.onTaskIconClicked(this); } else if (v == mBarView.mDismissButton) { // Animate out the view and call the callback @@ -466,8 +395,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On mCb.onTaskDismissed(tv); } }); - } else if (v == mInfoView.mAppInfoButton) { - mCb.onTaskAppInfoClicked(this); } } |