summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java10
-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
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java5
5 files changed, 46 insertions, 27 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 14ce266..276ca21 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -53,6 +53,7 @@ public class SwipeHelper {
// where fade starts
static final float ALPHA_FADE_END = 0.5f; // fraction of thumbnail width
// beyond which alpha->0
+ private float mMinAlpha = 0f;
private float mPagingTouchSlop;
private Callback mCallback;
@@ -120,6 +121,10 @@ public class SwipeHelper {
v.getMeasuredHeight();
}
+ public void setMinAlpha(float minAlpha) {
+ mMinAlpha = minAlpha;
+ }
+
private float getAlphaForOffset(View view) {
float viewSize = getSize(view);
final float fadeSize = ALPHA_FADE_END * viewSize;
@@ -130,10 +135,7 @@ public class SwipeHelper {
} else if (pos < viewSize * (1.0f - ALPHA_FADE_START)) {
result = 1.0f + (viewSize * ALPHA_FADE_START + pos) / fadeSize;
}
- // Make .03 alpha the minimum so you always see the item a bit-- slightly below
- // .03, the item disappears entirely (as if alpha = 0) and that discontinuity looks
- // a bit jarring
- return Math.max(0.03f, result);
+ return Math.max(mMinAlpha, result);
}
// invalidate the view's own bounds all the way up the view hierarchy
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();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index b2d9e64..2e1f120 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -432,6 +432,11 @@ public class PhoneStatusBar extends StatusBar {
mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
mRecentsPanel));
mRecentsPanel.setVisibility(View.GONE);
+
+ // Make .03 alpha the minimum so you always see the item a bit-- slightly below
+ // .03, the item disappears entirely (as if alpha = 0) and that discontinuity looks
+ // a bit jarring
+ mRecentsPanel.setMinSwipeAlpha(0.03f);
WindowManager.LayoutParams lp = getRecentsLayoutParams(mRecentsPanel.getLayoutParams());
WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);