summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recent
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-02-29 15:51:49 -0800
committerMichael Jurka <mikejurka@google.com>2012-02-29 16:49:01 -0800
commit4eaa983f253d0215d4de777edd8616318610ea22 (patch)
tree319d74f73c3f13bb26e6fd598666a18fe2e37107 /packages/SystemUI/src/com/android/systemui/recent
parent69db4df48713d695e40144833c7008020e0720f0 (diff)
downloadframeworks_base-4eaa983f253d0215d4de777edd8616318610ea22.zip
frameworks_base-4eaa983f253d0215d4de777edd8616318610ea22.tar.gz
frameworks_base-4eaa983f253d0215d4de777edd8616318610ea22.tar.bz2
Fix alpha when swiping recents on tablets
When you swipe to dismiss a recent item on a tablet, fade the item to 0 alpha Also, create common interface for Recents-specific methods for Recents[Horizontal/Vertical]ScrollView Bug: 5953654 Change-Id: I0a72b49b3cfae0607b42dbf8f6d4da9898d7e491
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recent')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java45
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java7
3 files changed, 35 insertions, 23 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 76e6ee8..97c9553 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -44,7 +44,7 @@ import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter;
import java.util.ArrayList;
public class RecentsHorizontalScrollView extends HorizontalScrollView
- implements SwipeHelper.Callback {
+ implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView {
private static final String TAG = RecentsPanelView.TAG;
private static final boolean DEBUG = RecentsPanelView.DEBUG;
private LinearLayout mLinearLayout;
@@ -65,6 +65,10 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mRecycledViews = new ArrayList<View>();
}
+ public void setMinSwipeAlpha(float minAlpha) {
+ mSwipeHelper.setMinAlpha(minAlpha);
+ }
+
private int scrollPositionOfMostRecent() {
return mLinearLayout.getWidth() - getWidth();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 18132ff..61aaa43 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -92,6 +92,13 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
public void onRecentsPanelVisibilityChanged(boolean visible);
}
+ public static interface RecentsScrollView {
+ public int numItemsInOneScreenful();
+ public void setAdapter(TaskDescriptionAdapter adapter);
+ public void setCallback(RecentsCallback callback);
+ public void setMinSwipeAlpha(float minAlpha);
+ }
+
private final class OnLongClickDelegate implements View.OnLongClickListener {
View mOtherView;
OnLongClickDelegate(View other) {
@@ -196,16 +203,11 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public int numItemsInOneScreenful() {
- if (mRecentsContainer instanceof RecentsHorizontalScrollView){
- RecentsHorizontalScrollView scrollView
- = (RecentsHorizontalScrollView) mRecentsContainer;
- return scrollView.numItemsInOneScreenful();
- } else if (mRecentsContainer instanceof RecentsVerticalScrollView){
- RecentsVerticalScrollView scrollView
- = (RecentsVerticalScrollView) mRecentsContainer;
+ if (mRecentsContainer instanceof RecentsScrollView){
+ RecentsScrollView scrollView
+ = (RecentsScrollView) mRecentsContainer;
return scrollView.numItemsInOneScreenful();
- }
- else {
+ } else {
throw new IllegalArgumentException("missing Recents[Horizontal]ScrollView");
}
}
@@ -427,18 +429,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
mListAdapter = new TaskDescriptionAdapter(mContext);
- if (mRecentsContainer instanceof RecentsHorizontalScrollView){
- RecentsHorizontalScrollView scrollView
- = (RecentsHorizontalScrollView) mRecentsContainer;
- scrollView.setAdapter(mListAdapter);
- scrollView.setCallback(this);
- } else if (mRecentsContainer instanceof RecentsVerticalScrollView){
- RecentsVerticalScrollView scrollView
- = (RecentsVerticalScrollView) mRecentsContainer;
+ if (mRecentsContainer instanceof RecentsScrollView){
+ RecentsScrollView scrollView
+ = (RecentsScrollView) mRecentsContainer;
scrollView.setAdapter(mListAdapter);
scrollView.setCallback(this);
- }
- else {
+ } else {
throw new IllegalArgumentException("missing Recents[Horizontal]ScrollView");
}
@@ -467,6 +463,14 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
};
}
+ public void setMinSwipeAlpha(float minAlpha) {
+ if (mRecentsContainer instanceof RecentsScrollView){
+ RecentsScrollView scrollView
+ = (RecentsScrollView) mRecentsContainer;
+ scrollView.setMinSwipeAlpha(minAlpha);
+ }
+ }
+
private void createCustomAnimations(LayoutTransition transitioner) {
transitioner.setDuration(200);
transitioner.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
@@ -523,8 +527,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
synchronized (td) {
if (mRecentsContainer != null) {
ViewGroup container = mRecentsContainer;
- if (container instanceof HorizontalScrollView
- || container instanceof ScrollView) {
+ if (container instanceof RecentsScrollView) {
container = (ViewGroup) container.findViewById(
R.id.recents_linear_layout);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 1bfd000..f4e516c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -43,7 +43,8 @@ import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter;
import java.util.ArrayList;
-public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper.Callback {
+public class RecentsVerticalScrollView extends ScrollView
+ implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView {
private static final String TAG = RecentsPanelView.TAG;
private static final boolean DEBUG = RecentsPanelView.DEBUG;
private LinearLayout mLinearLayout;
@@ -65,6 +66,10 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
mRecycledViews = new ArrayList<View>();
}
+ public void setMinSwipeAlpha(float minAlpha) {
+ mSwipeHelper.setMinAlpha(minAlpha);
+ }
+
private int scrollPositionOfMostRecent() {
return mLinearLayout.getHeight() - getHeight();
}