From 622a97646d316ca753c577752ac9010415e9a472 Mon Sep 17 00:00:00 2001 From: Peter Ng Date: Mon, 29 Aug 2011 10:56:53 -0700 Subject: updating visuals of Recent Apps - replacing background PNGs with 9 patches - removing border around thumbnails by default - when swiping thumbnails, draw a border around them - fix callout line length - make recents window smaller on tablets - deleting unused assets Change-Id: If5bb1ba0d55a6d10e36ee14274c23596f0ba73b9 --- .../src/com/android/systemui/SwipeHelper.java | 3 ++ .../recent/RecentsHorizontalScrollView.java | 5 +++ .../android/systemui/recent/RecentsPanelView.java | 38 ++++++++-------------- .../systemui/recent/RecentsVerticalScrollView.java | 5 +++ .../statusbar/policy/NotificationRowLayout.java | 3 ++ .../systemui/statusbar/tablet/TabletStatusBar.java | 2 +- 6 files changed, 31 insertions(+), 25 deletions(-) (limited to 'packages/SystemUI/src/com') diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 6cfbc1b..14743f4 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -307,6 +307,7 @@ public class SwipeHelper { dismissChild(mCurrView, childSwipedFastEnough ? velocity : 0f); } else { // snappity + mCallback.onDragCancelled(mCurrView); snapChild(mCurrView, velocity); } } @@ -325,5 +326,7 @@ public class SwipeHelper { void onBeginDrag(View v); void onChildDismissed(View v); + + void onDragCancelled(View v); } } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 7ad7484..85cde7c 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -127,6 +127,11 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView // We do this so the underlying ScrollView knows that it won't get // the chance to intercept events anymore requestDisallowInterceptTouchEvent(true); + v.setActivated(true); + } + + public void onDragCancelled(View v) { + v.setActivated(false); } public View getChildAtPosition(MotionEvent ev) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 233ed6c..d19b98a2 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -84,12 +84,8 @@ public class RecentsPanelView extends RelativeLayout private View mRecentsScrim; private View mRecentsGlowView; private ViewGroup mRecentsContainer; - private Bitmap mGlowBitmap; - // TODO: add these widgets attributes to the layout file - private int mGlowBitmapPaddingLeftPx; - private int mGlowBitmapPaddingTopPx; - private int mGlowBitmapPaddingRightPx; - private int mGlowBitmapPaddingBottomPx; + private Bitmap mAppThumbnailBackground; + private boolean mShowing; private Choreographer mChoreo; private View mRecentsDismissButton; @@ -129,7 +125,7 @@ public class RecentsPanelView extends RelativeLayout } public void setThumbnail(Bitmap thumbnail) { - mThumbnail = compositeBitmap(mGlowBitmap, thumbnail); + mThumbnail = compositeBitmap(mAppThumbnailBackground, thumbnail); } public Bitmap getThumbnail() { @@ -327,15 +323,12 @@ public class RecentsPanelView extends RelativeLayout mIconDpi = xlarge ? DisplayMetrics.DENSITY_HIGH : res.getDisplayMetrics().densityDpi; - mGlowBitmap = BitmapFactory.decodeResource(res, R.drawable.recents_thumbnail_bg); - mGlowBitmapPaddingLeftPx = - res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_left); - mGlowBitmapPaddingTopPx = - res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_top); - mGlowBitmapPaddingRightPx = - res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_right); - mGlowBitmapPaddingBottomPx = - res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_bottom); + int width = (int) res.getDimension(R.dimen.status_bar_recents_thumbnail_width); + int height = (int) res.getDimension(R.dimen.status_bar_recents_thumbnail_height); + int color = res.getColor(R.drawable.status_bar_recents_app_thumbnail_background); + mAppThumbnailBackground = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(mAppThumbnailBackground); + c.drawColor(color); } @Override @@ -570,6 +563,9 @@ public class RecentsPanelView extends RelativeLayout mThumbnailLoader = null; } mActivityDescriptions = getRecentTasks(); + for (ActivityDescription ad : mActivityDescriptions) { + ad.setThumbnail(mAppThumbnailBackground); + } mListAdapter.notifyDataSetInvalidated(); if (mActivityDescriptions.size() > 0) { if (DEBUG) Log.v(TAG, "Showing " + mActivityDescriptions.size() + " apps"); @@ -644,14 +640,8 @@ public class RecentsPanelView extends RelativeLayout paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setAlpha(255); - final int srcWidth = thumbnail.getWidth(); - final int srcHeight = thumbnail.getHeight(); - if (DEBUG) Log.v(TAG, "Source thumb: " + srcWidth + "x" + srcHeight); - canvas.drawBitmap(thumbnail, - new Rect(0, 0, srcWidth-1, srcHeight-1), - new RectF(mGlowBitmapPaddingLeftPx, mGlowBitmapPaddingTopPx, - outBitmap.getWidth() - mGlowBitmapPaddingRightPx, - outBitmap.getHeight() - mGlowBitmapPaddingBottomPx), paint); + canvas.drawBitmap(thumbnail, null, + new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint); canvas.setBitmap(null); } return outBitmap; diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 1b6daa5..3acef08 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -142,6 +142,11 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper // We do this so the underlying ScrollView knows that it won't get // the chance to intercept events anymore requestDisallowInterceptTouchEvent(true); + v.setActivated(true); + } + + public void onDragCancelled(View v) { + v.setActivated(false); } public View getChildAtPosition(MotionEvent ev) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java index 469b462..e287b7a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java @@ -124,6 +124,9 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call requestDisallowInterceptTouchEvent(true); } + public void onDragCancelled(View v) { + } + public View getChildAtPosition(MotionEvent ev) { // find the view under the pointer, accounting for GONE views final int count = getChildCount(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 2ab667d..7133b29 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -306,7 +306,7 @@ public class TabletStatusBar extends StatusBar implements mStatusBarView.setIgnoreChildren(2, mRecentButton, mRecentsPanel); lp = new WindowManager.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, + (int) res.getDimension(R.dimen.status_bar_recents_width), ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN -- cgit v1.1