diff options
author | Jim Miller <jaggies@google.com> | 2010-12-22 20:37:17 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-12-22 21:29:29 -0800 |
commit | f9905b437a0e98fd7fdafecb32db1cd7566f7367 (patch) | |
tree | 9bc4e50a0227863281f3f9814046e5c0d4a54288 /packages/SystemUI | |
parent | dd830c21149c336139b28560c0e6fba9f3d0e0fc (diff) | |
download | frameworks_base-f9905b437a0e98fd7fdafecb32db1cd7566f7367.zip frameworks_base-f9905b437a0e98fd7fdafecb32db1cd7566f7367.tar.gz frameworks_base-f9905b437a0e98fd7fdafecb32db1cd7566f7367.tar.bz2 |
New thumbnail generation and centering in RecentApps
This centers the thumbnail in the given glow background and
reduces compositing by one window per recent item.
Change-Id: I228648022e12214fb3d8b66067e214cef5aaf8e9
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml | 1 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java | 39 |
2 files changed, 20 insertions, 20 deletions
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml b/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml index 2989be0..3fdfdbb 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_recent_item.xml @@ -31,7 +31,6 @@ android:layout_alignParentTop="true" android:layout_marginLeft="105dip" android:scaleType="center" - android:background="@drawable/recents_thumbnail_bg" /> <ImageView android:id="@+id/app_icon" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java index 3c665fe..bd9bdb2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java @@ -23,8 +23,6 @@ import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.ActivityManager; -import android.app.IThumbnailReceiver; -import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; @@ -33,20 +31,20 @@ import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; +import android.graphics.RectF; import android.graphics.Shader.TileMode; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.os.RemoteException; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; -import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.widget.ImageView; import android.widget.LinearLayout; @@ -55,7 +53,7 @@ import android.widget.TextView; import com.android.systemui.R; public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnClickListener { - private static final int COLLAPSE_DURATION = 360; + private static final int GLOW_PADDING = 15; private static final String TAG = "RecentAppsPanel"; private static final boolean DEBUG = TabletStatusBar.DEBUG; private static final int DISPLAY_TASKS_PORTRAIT = 7; // Limited by max binder transaction size @@ -70,6 +68,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC private int mIconDpi; private AnimatorSet mAnimationSet; private View mBackgroundProtector; + private Bitmap mGlowBitmap; static class ActivityDescription { int id; @@ -121,6 +120,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; mIconDpi = xlarge ? DisplayMetrics.DENSITY_HIGH : res.getDisplayMetrics().densityDpi; + mGlowBitmap = BitmapFactory.decodeResource(res, R.drawable.recents_thumbnail_bg); } @Override @@ -225,8 +225,8 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC if (title != null && title.length() > 0 && icon != null) { if (DEBUG) Log.v(TAG, "creating activity desc for id=" + id + ", label=" + title); ActivityDescription item = new ActivityDescription( - crop(recentInfo.thumbnail), icon, title, recentInfo.description, - intent, id, index, info.packageName); + recentInfo.thumbnail, icon, title, + recentInfo.description, intent, id, index, info.packageName); activityDescriptions.add(item); ++index; } else { @@ -255,21 +255,22 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC updateUiElements(getResources().getConfiguration(), true); } - private Bitmap crop(Bitmap bitmap) { - if (bitmap == null || bitmap.getWidth() >= bitmap.getHeight()) { - return bitmap; - } - final int width = bitmap.getWidth(); - final int height = bitmap.getHeight(); - Bitmap outBitmap = Bitmap.createBitmap(height, width, bitmap.getConfig()); + private Bitmap compositeBitmap(Bitmap background, Bitmap thumbnail) { + Bitmap outBitmap = background.copy(background.getConfig(), true); Canvas canvas = new Canvas(outBitmap); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setFilterBitmap(true); - canvas.drawBitmap(bitmap, - new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight() - height * width / height), - new Rect(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), - paint); + paint.setAlpha(255); + final int srcWidth = thumbnail.getWidth(); + final int height = thumbnail.getHeight(); + final int srcHeight = srcWidth > height ? height : (height - height * srcWidth / height); + canvas.drawBitmap(thumbnail, + new Rect(0, 0, srcWidth-1, srcHeight-1), + new RectF(GLOW_PADDING, + GLOW_PADDING - 4.0f, + outBitmap.getWidth() - GLOW_PADDING + 2.0f, + outBitmap.getHeight() - GLOW_PADDING + 3.0f), paint); return outBitmap; } @@ -291,7 +292,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC TextView appLabel = (TextView) view.findViewById(R.id.app_label); TextView appDesc = (TextView) view.findViewById(R.id.app_description); final Bitmap thumb = activityDescription.thumbnail; - appThumbnail.setImageBitmap(crop(thumb)); + appThumbnail.setImageBitmap(compositeBitmap(mGlowBitmap, thumb)); appIcon.setImageDrawable(activityDescription.icon); appLabel.setText(activityDescription.label); appDesc.setText(activityDescription.description); |