diff options
Diffstat (limited to 'packages')
9 files changed, 64 insertions, 27 deletions
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml index e99888c..0d17b55 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml @@ -37,7 +37,6 @@ android:layout_alignParentTop="true" android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin" android:scaleType="center" - android:clickable="true" android:background="@drawable/recents_thumbnail_overlay"> <ImageView android:id="@+id/app_thumbnail_image" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml index 73ca335..84c89f7 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml @@ -33,7 +33,6 @@ android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" - android:clickable="true" android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin" android:scaleType="center" android:background="@drawable/recents_thumbnail_overlay"> diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml index dd25cf9..ed9ea7a 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml @@ -38,6 +38,7 @@ android:orientation="horizontal" android:clipChildren="false" android:layout_marginTop="@*android:dimen/status_bar_height"> + <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container" android:layout_width="match_parent" @@ -62,7 +63,6 @@ </com.android.systemui.recent.RecentsVerticalScrollView> - </LinearLayout> </FrameLayout> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml index cab90fd..9dc6378 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml @@ -29,7 +29,6 @@ android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" - android:clickable="true" android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin" android:scaleType="center" android:background="@drawable/recents_thumbnail_overlay"> diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 14743f4..0354fd7 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -165,11 +165,13 @@ public class SwipeHelper { case MotionEvent.ACTION_DOWN: mDragging = false; mCurrView = mCallback.getChildAtPosition(ev); - mCurrAnimView = mCallback.getChildContentView(mCurrView); - mCanCurrViewBeDimissed = mCallback.canChildBeDismissed(mCurrView); mVelocityTracker.clear(); - mVelocityTracker.addMovement(ev); - mInitialTouchPos = getPos(ev); + if (mCurrView != null) { + mCurrAnimView = mCallback.getChildContentView(mCurrView); + mCanCurrViewBeDimissed = mCallback.canChildBeDismissed(mCurrView); + mVelocityTracker.addMovement(ev); + mInitialTouchPos = getPos(ev); + } break; case MotionEvent.ACTION_MOVE: if (mCurrView != null) { @@ -196,7 +198,11 @@ public class SwipeHelper { final View animView = mCallback.getChildContentView(view); final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(view); float newPos; - if (velocity < 0 || (velocity == 0 && getTranslation(animView) < 0)) { + + if (velocity < 0 + || (velocity == 0 && getTranslation(animView) < 0) + // if we use the Menu to dismiss an item in landscape, animate up + || (velocity == 0 && getTranslation(animView) == 0 && mSwipeDirection == Y)) { newPos = -getSize(animView); } else { newPos = getSize(animView); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java index 2de4185..e3c4eb7 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java @@ -28,6 +28,7 @@ public interface RecentsCallback { void handleSwipe(View selectedView); void handleLongPress(View selectedView, View anchorView); void handleShowBackground(boolean show); + void dismiss(); // TODO: find another way to get this info from RecentsPanelView boolean isRecentsVisible(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index c3137d6..fc33931 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -243,8 +243,11 @@ public class RecentsPanelView extends RelativeLayout } } + public void dismiss() { + hide(true); + } + public void hide(boolean animate) { - mShowing = false; if (!animate) { setVisibility(View.GONE); } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 3acef08..1978d69 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -84,15 +84,26 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper if (old == null) { view.setClickable(true); view.setOnLongClickListener(mOnLongClick); - - final View thumbnail = view.findViewById(R.id.app_thumbnail); - // thumbnail is set to clickable in the layout file - thumbnail.setOnClickListener(new OnClickListener() { + view.setOnClickListener(new OnClickListener() { public void onClick(View v) { - mCallback.handleOnClick(view); + mCallback.dismiss(); } }); + OnClickListener launchAppListener = new OnClickListener() { + public void onClick(View v) { + mCallback.handleOnClick(view); + } + }; + final View thumbnail = view.findViewById(R.id.app_thumbnail); + thumbnail.setClickable(true); + thumbnail.setOnClickListener(launchAppListener); + final View appTitle = view.findViewById(R.id.app_label); + appTitle.setClickable(true); + appTitle.setOnClickListener(launchAppListener); + final View calloutLine = view.findViewById(R.id.recents_callout_line); + calloutLine.setClickable(true); + calloutLine.setOnClickListener(launchAppListener); mLinearLayout.addView(view); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index d9cb4e8..4a1cafd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -28,6 +28,10 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; import android.widget.RelativeLayout; import com.android.systemui.R; @@ -52,6 +56,8 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, ViewGroup mContentParent; TabletStatusBar mBar; View mClearButton; + static Interpolator sAccelerateInterpolator = new AccelerateInterpolator(); + static Interpolator sDecelerateInterpolator = new DecelerateInterpolator(); // amount to slide mContentParent down by when mContentFrame is missing float mContentFrameMissingTranslation; @@ -117,8 +123,13 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, mShowing = show; if (show) { setVisibility(View.VISIBLE); + // Don't start the animation until we've created the layer, which is done + // right before we are drawn + mContentParent.setLayerType(View.LAYER_TYPE_HARDWARE, null); + getViewTreeObserver().addOnPreDrawListener(mPreDrawListener); + } else { + mChoreo.startAnimation(show); } - mChoreo.startAnimation(show); } } else { mShowing = show; @@ -127,6 +138,20 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, } /** + * This is used only when we've created a hardware layer and are waiting until it's + * been created in order to start the appearing animation. + */ + private ViewTreeObserver.OnPreDrawListener mPreDrawListener = + new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + getViewTreeObserver().removeOnPreDrawListener(this); + mChoreo.startAnimation(true); + return true; + } + }; + + /** * Whether the panel is showing, or, if it's animating, whether it will be * when the animation is done. */ @@ -330,8 +355,8 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, AnimatorSet mContentAnim; // should group this into a multi-property animation - final static int OPEN_DURATION = 300; - final static int CLOSE_DURATION = 300; + final static int OPEN_DURATION = 250; + final static int CLOSE_DURATION = 250; // the panel will start to appear this many px from the end final int HYPERSPACE_OFFRAMP = 200; @@ -362,19 +387,15 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, Animator posAnim = ObjectAnimator.ofFloat(mContentParent, "translationY", start, end); - posAnim.setInterpolator(appearing - ? new android.view.animation.DecelerateInterpolator(1.0f) - : new android.view.animation.AccelerateInterpolator(1.0f)); + posAnim.setInterpolator(appearing ? sDecelerateInterpolator : sAccelerateInterpolator); if (mContentAnim != null && mContentAnim.isRunning()) { mContentAnim.cancel(); } Animator fadeAnim = ObjectAnimator.ofFloat(mContentParent, "alpha", - mContentParent.getAlpha(), appearing ? 1.0f : 0.0f); - fadeAnim.setInterpolator(appearing - ? new android.view.animation.AccelerateInterpolator(2.0f) - : new android.view.animation.DecelerateInterpolator(2.0f)); + appearing ? 1.0f : 0.0f); + fadeAnim.setInterpolator(appearing ? sAccelerateInterpolator : sDecelerateInterpolator); mContentAnim = new AnimatorSet(); mContentAnim @@ -389,8 +410,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, if (DEBUG) Slog.d(TAG, "startAnimation(appearing=" + appearing + ")"); createAnimation(appearing); - - mContentParent.setLayerType(View.LAYER_TYPE_HARDWARE, null); mContentAnim.start(); mVisible = appearing; |