summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_dragging.9.png (renamed from packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png)bin235 -> 235 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.pngbin207 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_dragging.9.png (renamed from packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png)bin252 -> 252 bytes
-rw-r--r--packages/SystemUI/res/drawable/recents_thumbnail_bg.xml (renamed from packages/SystemUI/res/drawable/recents_thumbnail_overlay.xml)3
-rw-r--r--packages/SystemUI/res/layout-land/status_bar_recent_item.xml3
-rw-r--r--packages/SystemUI/res/layout-port/status_bar_recent_item.xml3
-rw-r--r--packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml3
-rw-r--r--packages/SystemUI/res/values-hdpi/dimens.xml4
-rw-r--r--packages/SystemUI/res/values-mdpi/dimens.xml22
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java3
13 files changed, 67 insertions, 15 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_dragging.9.png
index 1ad16f76035c..1ad16f76035c 100644
--- a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.9.png
+++ b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_dragging.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png
deleted file mode 100644
index 82ba0913926d..000000000000
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_dragging.9.png
index 0352aca3af0c..0352aca3af0c 100644
--- a/packages/SystemUI/res/drawable-xhdpi/recents_thumbnail_bg.9.png
+++ b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_dragging.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/recents_thumbnail_overlay.xml b/packages/SystemUI/res/drawable/recents_thumbnail_bg.xml
index 6d0509511ecc..320ed402460a 100644
--- a/packages/SystemUI/res/drawable/recents_thumbnail_overlay.xml
+++ b/packages/SystemUI/res/drawable/recents_thumbnail_bg.xml
@@ -14,7 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/recents_thumbnail_bg_press" android:state_pressed="true" />
- <item android:drawable="@drawable/recents_thumbnail_bg" android:state_activated="true" />
+ <item android:drawable="@drawable/recents_thumbnail_bg_dragging" android:state_activated="true" />
<item android:drawable="@*android:color/transparent"/>
</selector>
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 0d17b5589bf4..4b2468ac723d 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
@@ -18,7 +18,6 @@
*/
-->
-<!-- android:background="@drawable/status_bar_closed_default_background" -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
@@ -37,7 +36,7 @@
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
- android:background="@drawable/recents_thumbnail_overlay">
+ android:background="@drawable/recents_thumbnail_bg">
<ImageView android:id="@+id/app_thumbnail_image"
android:layout_width="match_parent"
android:layout_height="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 84c89f7f5c0f..a327d4220a35 100644
--- a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
@@ -18,7 +18,6 @@
*/
-->
-<!-- android:background="@drawable/status_bar_closed_default_background" -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
@@ -35,7 +34,7 @@
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
- android:background="@drawable/recents_thumbnail_overlay">
+ android:background="@drawable/recents_thumbnail_bg">
<ImageView android:id="@+id/app_thumbnail_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
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 9dc637872680..0f45bcdfb664 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
@@ -18,7 +18,6 @@
*/
-->
-<!-- android:background="@drawable/status_bar_closed_default_background" -->
<RelativeLayout android:id="@+id/recent_item"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
@@ -31,7 +30,7 @@
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_left_margin"
android:scaleType="center"
- android:background="@drawable/recents_thumbnail_overlay">
+ android:background="@drawable/recents_thumbnail_bg">
<ImageView android:id="@+id/app_thumbnail_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/res/values-hdpi/dimens.xml b/packages/SystemUI/res/values-hdpi/dimens.xml
index 6b6fd4d63736..277626eefd00 100644
--- a/packages/SystemUI/res/values-hdpi/dimens.xml
+++ b/packages/SystemUI/res/values-hdpi/dimens.xml
@@ -16,6 +16,10 @@
*/
-->
<resources>
+ <!-- padding of pressed drawable for recents thumbnails (should be the same on left, right,
+ top, and bottom -->
+ <dimen name="recents_thumbnail_bg_press_padding">3px</dimen>
+
<!-- thickness (height) of each notification row, including any separators or padding -->
<!-- Note: this is 64dip + 1px divider = 97px. -->
<dimen name="notification_height">97px</dimen>
diff --git a/packages/SystemUI/res/values-mdpi/dimens.xml b/packages/SystemUI/res/values-mdpi/dimens.xml
new file mode 100644
index 000000000000..d16d549b9b26
--- /dev/null
+++ b/packages/SystemUI/res/values-mdpi/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2011, 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.
+*/
+-->
+<resources>
+ <!-- padding of pressed drawable for recents thumbnails (should be the same on left, right,
+ top, and bottom -->
+ <dimen name="recents_thumbnail_bg_press_padding">2px</dimen>
+</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
index e3c4eb721f0d..78050a2abde4 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
@@ -26,7 +26,7 @@ public interface RecentsCallback {
void handleOnClick(View selectedView);
void handleSwipe(View selectedView);
- void handleLongPress(View selectedView, View anchorView);
+ void handleLongPress(View selectedView, View anchorView, View thumbnailView);
void handleShowBackground(boolean show);
void dismiss();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 5c1bbf0dc208..fc03a27a54c4 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -26,7 +26,6 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
-import android.view.View.OnClickListener;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
@@ -48,7 +47,8 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
private OnLongClickListener mOnLongClick = new OnLongClickListener() {
public boolean onLongClick(View v) {
final View anchorView = v.findViewById(R.id.app_description);
- mCallback.handleLongPress(v, anchorView);
+ final View thumbnailView = v.findViewById(R.id.app_thumbnail);
+ mCallback.handleLongPress(v, anchorView, thumbnailView);
return true;
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index fc33931d6625..43905dd95919 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -30,15 +30,14 @@ 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.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Handler;
@@ -57,6 +56,7 @@ import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.PopupMenu;
@@ -85,6 +85,7 @@ public class RecentsPanelView extends RelativeLayout
private View mRecentsGlowView;
private ViewGroup mRecentsContainer;
private Bitmap mDefaultThumbnailBackground;
+ private BitmapDrawable mPressedDrawable;
private boolean mShowing;
private Choreographer mChoreo;
@@ -182,6 +183,13 @@ public class RecentsPanelView extends RelativeLayout
holder.iconView = (ImageView) convertView.findViewById(R.id.app_icon);
holder.labelView = (TextView) convertView.findViewById(R.id.app_label);
holder.descriptionView = (TextView) convertView.findViewById(R.id.app_description);
+
+ StateListDrawable thumbnailForegroundDrawable = new StateListDrawable();
+ thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_pressed },
+ mPressedDrawable);
+ thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_selected },
+ mPressedDrawable);
+ ((FrameLayout)holder.thumbnailView).setForeground(thumbnailForegroundDrawable);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
@@ -339,9 +347,23 @@ public class RecentsPanelView extends RelativeLayout
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);
+
+ // Render the default thumbnail background
mDefaultThumbnailBackground = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(mDefaultThumbnailBackground);
c.drawColor(color);
+
+ // Render the pressed state (setting the 9 patch drawable directly causes padding issues)
+ int bgPadding = (int) res.getDimension(R.dimen.recents_thumbnail_bg_press_padding);
+ Bitmap pressedOverlay = Bitmap.createBitmap(
+ width + 2 * bgPadding, height + 2 * bgPadding, Bitmap.Config.ARGB_8888);
+ c.setBitmap(pressedOverlay);
+
+ Drawable pressedDrawable9Patch = res.getDrawable(R.drawable.recents_thumbnail_bg_press);
+ pressedDrawable9Patch.getCurrent().setBounds(
+ 0, 0, pressedOverlay.getWidth(), pressedOverlay.getHeight());
+ pressedDrawable9Patch.draw(c);
+ mPressedDrawable = new BitmapDrawable(res, pressedOverlay);
}
@Override
@@ -715,7 +737,9 @@ public class RecentsPanelView extends RelativeLayout
getContext().startActivity(intent);
}
- public void handleLongPress(final View selectedView, final View anchorView) {
+ public void handleLongPress(
+ final View selectedView, final View anchorView, final View thumbnailView) {
+ thumbnailView.setSelected(true);
PopupMenu popup = new PopupMenu(mContext, anchorView == null ? selectedView : anchorView);
popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@@ -737,6 +761,11 @@ public class RecentsPanelView extends RelativeLayout
return true;
}
});
+ popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
+ public void onDismiss(PopupMenu menu) {
+ thumbnailView.setSelected(false);
+ }
+ });
popup.show();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 1978d69d192f..b12387ad2d53 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -46,7 +46,8 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
private OnLongClickListener mOnLongClick = new OnLongClickListener() {
public boolean onLongClick(View v) {
final View anchorView = v.findViewById(R.id.app_description);
- mCallback.handleLongPress(v, anchorView);
+ final View thumbnailView = v.findViewById(R.id.app_thumbnail);
+ mCallback.handleLongPress(v, anchorView, thumbnailView);
return true;
}
};