summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/Choreographer.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java113
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java74
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java110
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java160
6 files changed, 361 insertions, 100 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
index 37a9913..2d327c4 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
@@ -53,8 +53,6 @@ import android.view.View;
void createAnimation(boolean appearing) {
float start, end;
- if (RecentsPanelView.DEBUG) Log.e(TAG, "createAnimation()", new Exception());
-
// 0: on-screen
// height: off-screen
float y = mContentView.getTranslationY();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
index 5d29e2a..797f94c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java
@@ -26,5 +26,5 @@ public interface RecentsCallback {
void handleOnClick(View selectedView);
void handleSwipe(View selectedView, int direction);
- void handleLongPress(View selectedView);
+ void handleLongPress(View selectedView, View anchorView);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index f984aac..2a5d1dd 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -20,6 +20,7 @@ import com.android.systemui.recent.RecentsPanelView.ActivityDescriptionAdapter;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
+import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
@@ -30,7 +31,6 @@ import android.database.DataSetObserver;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -42,10 +42,9 @@ import android.widget.LinearLayout;
import com.android.systemui.R;
-public class RecentsHorizontalScrollView extends HorizontalScrollView
- implements View.OnClickListener, View.OnTouchListener {
- private static final boolean DEBUG_INVALIDATE = false;
+public class RecentsHorizontalScrollView extends HorizontalScrollView {
private static final String TAG = RecentsPanelView.TAG;
+ private static final boolean DEBUG_INVALIDATE = false;
private static final boolean DEBUG = RecentsPanelView.DEBUG;
private LinearLayout mLinearLayout;
private ActivityDescriptionAdapter mAdapter;
@@ -57,6 +56,15 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
private VelocityTracker mVelocityTracker;
private float mDensityScale;
private float mPagingTouchSlop;
+ private OnLongClickListener mOnLongClick = new OnLongClickListener() {
+ public boolean onLongClick(View v) {
+ final View anchorView = v.findViewById(R.id.app_description);
+ mCurrentView = v;
+ mCallback.handleLongPress(v, anchorView);
+ mCurrentView = null; // make sure we don't accept the return click from this
+ return true;
+ }
+ };
public RecentsHorizontalScrollView(Context context) {
this(context, null);
@@ -72,13 +80,12 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
return mLinearLayout.getWidth() - getWidth();
}
- public void update() {
+ private void update() {
mLinearLayout.removeAllViews();
for (int i = 0; i < mAdapter.getCount(); i++) {
- View view = mAdapter.getView(i, null, mLinearLayout);
+ final View view = mAdapter.getView(i, null, mLinearLayout);
view.setClickable(true);
- view.setOnClickListener(this);
- view.setOnTouchListener(this);
+ view.setOnLongClickListener(mOnLongClick);
mLinearLayout.addView(view);
}
// Scroll to end after layout.
@@ -91,7 +98,20 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
}
@Override
+ public void removeViewInLayout(final View view) {
+ ObjectAnimator anim = animateClosed(view, Constants.MAX_ESCAPE_ANIMATION_DURATION,
+ "y", view.getY(), view.getY() + view.getHeight());
+ anim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ RecentsHorizontalScrollView.super.removeView(view);
+ }
+ });
+ anim.start();
+ }
+
+ @Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
@@ -100,6 +120,18 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
case MotionEvent.ACTION_DOWN:
mDragging = false;
mLastY = ev.getY();
+ final float x = ev.getX() + getScrollX();
+ final float y = ev.getY() + getScrollY();
+ mCurrentView = null;
+ for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
+ View item = mLinearLayout.getChildAt(i);
+ if (x >= item.getLeft() && x < item.getRight()
+ && y >= item.getTop() && y < item.getBottom()) {
+ mCurrentView = item;
+ if (DEBUG) Log.v(TAG, "Hit item " + item);
+ break;
+ }
+ }
break;
case MotionEvent.ACTION_MOVE:
@@ -111,6 +143,9 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
break;
case MotionEvent.ACTION_UP:
+ if (mCurrentView != null) {
+ mCallback.handleOnClick(mCurrentView);
+ }
mDragging = false;
break;
}
@@ -125,7 +160,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
} else if (view.getY() < thumbHeight * (1.0f - Constants.ALPHA_FADE_START)) {
result = 1.0f + (thumbHeight * Constants.ALPHA_FADE_START + view.getY()) / fadeHeight;
}
- if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
return result;
}
@@ -138,12 +172,12 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mVelocityTracker.addMovement(ev);
final View animView = mCurrentView;
- // TODO: Cache thumbnail
- final View thumb = animView.findViewById(R.id.app_thumbnail);
+
switch (ev.getAction()) {
case MotionEvent.ACTION_MOVE:
if (animView != null) {
final float delta = ev.getY() - mLastY;
+ final View thumb = animView.findViewById(R.id.app_thumbnail);
animView.setY(animView.getY() + delta);
animView.setAlpha(getAlphaForOffset(animView, thumb.getHeight()));
invalidateGlobalRegion(animView);
@@ -167,35 +201,18 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
long duration =
(long) (Math.abs(newY - curY) * 1000.0f / Math.abs(velocityY));
duration = Math.min(duration, Constants.MAX_ESCAPE_ANIMATION_DURATION);
- anim = ObjectAnimator.ofFloat(animView, "y", curY, newY);
- anim.setInterpolator(new LinearInterpolator());
- final int swipeDirection = animView.getY() >= 0.0f ?
- RecentsCallback.SWIPE_RIGHT : RecentsCallback.SWIPE_LEFT;
- anim.addListener(new AnimatorListener() {
- public void onAnimationStart(Animator animation) {
- }
- public void onAnimationRepeat(Animator animation) {
- }
- public void onAnimationEnd(Animator animation) {
- mLinearLayout.removeView(mCurrentView);
- mCallback.handleSwipe(animView, swipeDirection);
- }
- public void onAnimationCancel(Animator animation) {
- mLinearLayout.removeView(mCurrentView);
- mCallback.handleSwipe(animView, swipeDirection);
- }
- });
- anim.setDuration(duration);
+ anim = animateClosed(animView, duration, "y", curY, newY);
} else { // Animate back to position
long duration = Math.abs(velocityY) > 0.0f ?
(long) (Math.abs(newY - curY) * 1000.0f / Math.abs(velocityY))
: Constants.SNAP_BACK_DURATION;
duration = Math.min(duration, Constants.SNAP_BACK_DURATION);
anim = ObjectAnimator.ofFloat(animView, "y", animView.getY(), 0.0f);
- anim.setInterpolator(new DecelerateInterpolator(2.0f));
+ anim.setInterpolator(new DecelerateInterpolator(4.0f));
anim.setDuration(duration);
}
+ final View thumb = animView.findViewById(R.id.app_thumbnail);
anim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
animView.setAlpha(getAlphaForOffset(animView, thumb.getHeight()));
@@ -212,6 +229,26 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
return true;
}
+ private ObjectAnimator animateClosed(final View animView, long duration,
+ String attr, float from, float to) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(animView, attr, from, to);
+ anim.setInterpolator(new LinearInterpolator());
+ final int swipeDirection = animView.getX() >= 0.0f ?
+ RecentsCallback.SWIPE_RIGHT : RecentsCallback.SWIPE_LEFT;
+ anim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ mLinearLayout.removeView(animView);
+ mCallback.handleSwipe(animView, swipeDirection);
+ }
+ public void onAnimationCancel(Animator animation) {
+ mLinearLayout.removeView(animView);
+ mCallback.handleSwipe(animView, swipeDirection);
+ }
+ });
+ anim.setDuration(duration);
+ return anim;
+ }
+
void invalidateGlobalRegion(View view) {
RectF childBounds
= new RectF(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
@@ -236,13 +273,8 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- LayoutInflater inflater = (LayoutInflater)
- mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
setScrollbarFadingEnabled(true);
-
mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
-
final int leftPadding = mContext.getResources()
.getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
setOverScrollEffectPadding(leftPadding, 0);
@@ -306,16 +338,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mLinearLayout.setLayoutTransition(transition);
}
- public void onClick(View view) {
- mCallback.handleOnClick(view);
- }
-
public void setCallback(RecentsCallback callback) {
mCallback = callback;
}
-
- public boolean onTouch(View v, MotionEvent event) {
- mCurrentView = v;
- return false;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index a55fe9c..bc0a508 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -22,6 +22,7 @@ import java.util.List;
import android.animation.Animator;
import android.animation.LayoutTransition;
import android.app.ActivityManager;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -39,16 +40,22 @@ import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.net.Uri;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
+import android.widget.Button;
import android.widget.ImageView;
+import android.widget.PopupMenu;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -69,7 +76,7 @@ public class RecentsPanelView extends RelativeLayout
private int mIconDpi;
private View mRecentsScrim;
private View mRecentsGlowView;
- private View mRecentsContainer;
+ private ViewGroup mRecentsContainer;
private Bitmap mGlowBitmap;
// TODO: add these widgets attributes to the layout file
private int mGlowBitmapPaddingLeftPx;
@@ -107,8 +114,18 @@ public class RecentsPanelView extends RelativeLayout
}
};
+ private final class OnLongClickDelegate implements View.OnLongClickListener {
+ View mOtherView;
+ OnLongClickDelegate(View other) {
+ mOtherView = other;
+ }
+ public boolean onLongClick(View v) {
+ return mOtherView.performLongClick();
+ }
+ }
+
/* package */ final static class ViewHolder {
- ImageView thumbnailView;
+ View thumbnailView;
ImageView iconView;
TextView labelView;
TextView descriptionView;
@@ -139,7 +156,7 @@ public class RecentsPanelView extends RelativeLayout
if (convertView == null) {
convertView = mInflater.inflate(R.layout.status_bar_recent_item, null);
holder = new ViewHolder();
- holder.thumbnailView = (ImageView) convertView.findViewById(R.id.app_thumbnail);
+ holder.thumbnailView = convertView.findViewById(R.id.app_thumbnail);
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);
@@ -153,11 +170,12 @@ public class RecentsPanelView extends RelativeLayout
final ActivityDescription activityDescription = mActivityDescriptions.get(activityId);
final Bitmap thumb = activityDescription.thumbnail;
- holder.thumbnailView.setImageBitmap(compositeBitmap(mGlowBitmap, thumb));
+ updateDrawable(holder.thumbnailView, compositeBitmap(mGlowBitmap, thumb));
holder.iconView.setImageDrawable(activityDescription.icon);
holder.labelView.setText(activityDescription.label);
holder.descriptionView.setText(activityDescription.description);
holder.thumbnailView.setTag(activityDescription);
+ holder.thumbnailView.setOnLongClickListener(new OnLongClickDelegate(convertView));
holder.activityDescription = activityDescription;
return convertView;
@@ -174,6 +192,20 @@ public class RecentsPanelView extends RelativeLayout
return x >= l && x < r && y >= t && y < b;
}
+ private void updateDrawable(View thumbnailView, Bitmap bitmap) {
+ Drawable d = thumbnailView.getBackground();
+ if (d instanceof LayerDrawable) {
+ LayerDrawable layerD = (LayerDrawable) d;
+ Drawable thumb = layerD.findDrawableByLayerId(R.id.base_layer);
+ if (thumb != null) {
+ layerD.setDrawableByLayerId(R.id.base_layer,
+ new BitmapDrawable(getResources(), bitmap));
+ return;
+ }
+ }
+ Log.w(TAG, "Failed to update drawable");
+ }
+
public void show(boolean show, boolean animate) {
if (animate) {
if (mShowing != show) {
@@ -260,7 +292,7 @@ public class RecentsPanelView extends RelativeLayout
protected void onFinishInflate() {
super.onFinishInflate();
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mRecentsContainer = findViewById(R.id.recents_container);
+ mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
mListAdapter = new ActivityDescriptionAdapter(mContext);
if (mRecentsContainer instanceof RecentsListView) {
RecentsListView listView = (RecentsListView) mRecentsContainer;
@@ -503,7 +535,35 @@ public class RecentsPanelView extends RelativeLayout
am.removeTask(ad.taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
}
- public void handleLongPress(View selectedView) {
- // TODO show context menu : "Remove from list", "Show properties"
+ private void startApplicationDetailsActivity(String packageName) {
+ Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
+ Uri.fromParts("package", packageName, null));
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ getContext().startActivity(intent);
+ }
+
+ public void handleLongPress(final View selectedView, final View anchorView) {
+ PopupMenu popup = new PopupMenu(mContext, anchorView == null ? selectedView : anchorView);
+ popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu());
+ popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(MenuItem item) {
+ if (item.getItemId() == R.id.recent_remove_item) {
+ mRecentsContainer.removeViewInLayout(selectedView);
+ } else if (item.getItemId() == R.id.recent_inspect_item) {
+ ViewHolder viewHolder = (ViewHolder) selectedView.getTag();
+ if (viewHolder != null) {
+ final ActivityDescription ad = viewHolder.activityDescription;
+ startApplicationDetailsActivity(ad.packageName);
+ mBar.animateCollapse();
+ } else {
+ throw new IllegalStateException("Oops, no tag on view " + selectedView);
+ }
+ } else {
+ return false;
+ }
+ return true;
+ }
+ });
+ 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 27bb0b5..47ee4aa 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -20,6 +20,7 @@ import com.android.systemui.recent.RecentsPanelView.ActivityDescriptionAdapter;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
+import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
@@ -42,8 +43,7 @@ import android.widget.ScrollView;
import com.android.systemui.R;
-public class RecentsVerticalScrollView extends ScrollView
- implements View.OnClickListener, View.OnTouchListener {
+public class RecentsVerticalScrollView extends ScrollView {
private static final String TAG = RecentsPanelView.TAG;
private static final boolean DEBUG_INVALIDATE = false;
private static final boolean DEBUG = RecentsPanelView.DEBUG;
@@ -57,6 +57,15 @@ public class RecentsVerticalScrollView extends ScrollView
private VelocityTracker mVelocityTracker;
private float mDensityScale;
private float mPagingTouchSlop;
+ private OnLongClickListener mOnLongClick = new OnLongClickListener() {
+ public boolean onLongClick(View v) {
+ final View anchorView = v.findViewById(R.id.app_description);
+ mCurrentView = v;
+ mCallback.handleLongPress(v, anchorView);
+ mCurrentView = null; // make sure we don't accept the return click from this
+ return true;
+ }
+ };
public RecentsVerticalScrollView(Context context) {
this(context, null);
@@ -72,13 +81,12 @@ public class RecentsVerticalScrollView extends ScrollView
return mLinearLayout.getHeight() - getHeight();
}
- public void update() {
+ private void update() {
mLinearLayout.removeAllViews();
for (int i = 0; i < mAdapter.getCount(); i++) {
- View view = mAdapter.getView(i, null, mLinearLayout);
+ final View view = mAdapter.getView(i, null, mLinearLayout);
view.setClickable(true);
- view.setOnClickListener(this);
- view.setOnTouchListener(this);
+ view.setOnLongClickListener(mOnLongClick);
mLinearLayout.addView(view);
}
// Scroll to end after layout.
@@ -91,7 +99,20 @@ public class RecentsVerticalScrollView extends ScrollView
}
@Override
+ public void removeViewInLayout(final View view) {
+ ObjectAnimator anim = animateClosed(view, Constants.MAX_ESCAPE_ANIMATION_DURATION,
+ "x", view.getX(), view.getX() + view.getWidth());
+ anim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ RecentsVerticalScrollView.super.removeView(view);
+ }
+ });
+ anim.start();
+ }
+
+ @Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
@@ -100,6 +121,18 @@ public class RecentsVerticalScrollView extends ScrollView
case MotionEvent.ACTION_DOWN:
mDragging = false;
mLastX = ev.getX();
+ final float x = ev.getX() + getScrollX();
+ final float y = ev.getY() + getScrollY();
+ mCurrentView = null;
+ for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
+ View item = mLinearLayout.getChildAt(i);
+ if (x >= item.getLeft() && x < item.getRight()
+ && y >= item.getTop() && y < item.getBottom()) {
+ mCurrentView = item;
+ Log.v(TAG, "Hit item " + item);
+ break;
+ }
+ }
break;
case MotionEvent.ACTION_MOVE:
@@ -111,6 +144,9 @@ public class RecentsVerticalScrollView extends ScrollView
break;
case MotionEvent.ACTION_UP:
+ if (mCurrentView != null) {
+ mCallback.handleOnClick(mCurrentView);
+ }
mDragging = false;
break;
}
@@ -125,7 +161,6 @@ public class RecentsVerticalScrollView extends ScrollView
} else if (view.getX() < thumbWidth* (1.0f - Constants.ALPHA_FADE_START)) {
result = 1.0f + (thumbWidth*Constants.ALPHA_FADE_START + view.getX()) / fadeWidth;
}
- if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
return result;
}
@@ -138,12 +173,12 @@ public class RecentsVerticalScrollView extends ScrollView
mVelocityTracker.addMovement(ev);
final View animView = mCurrentView;
- // TODO: Cache thumbnail
- final View thumb = animView.findViewById(R.id.app_thumbnail);
+
switch (ev.getAction()) {
case MotionEvent.ACTION_MOVE:
if (animView != null) {
final float delta = ev.getX() - mLastX;
+ final View thumb = animView.findViewById(R.id.app_thumbnail);
animView.setX(animView.getX() + delta);
animView.setAlpha(getAlphaForOffset(animView, thumb.getWidth()));
invalidateGlobalRegion(animView);
@@ -163,29 +198,11 @@ public class RecentsVerticalScrollView extends ScrollView
final float maxVelocity = Constants.ESCAPE_VELOCITY * mDensityScale;
if (Math.abs(velocityX) > Math.abs(velocityY)
&& Math.abs(velocityX) > maxVelocity
- && (velocityX > 0.0f) == (animView.getX() >= 0)) {
+ && (velocityX >= 0.0f) == (animView.getX() >= 0)) {
long duration =
(long) (Math.abs(newX-curX) * 1000.0f / Math.abs(velocityX));
duration = Math.min(duration, Constants.MAX_ESCAPE_ANIMATION_DURATION);
- anim = ObjectAnimator.ofFloat(animView, "x", curX, newX);
- anim.setInterpolator(new LinearInterpolator());
- final int swipeDirection = animView.getX() >= 0.0f ?
- RecentsCallback.SWIPE_RIGHT : RecentsCallback.SWIPE_LEFT;
- anim.addListener(new AnimatorListener() {
- public void onAnimationStart(Animator animation) {
- }
- public void onAnimationRepeat(Animator animation) {
- }
- public void onAnimationEnd(Animator animation) {
- mLinearLayout.removeView(mCurrentView);
- mCallback.handleSwipe(animView, swipeDirection);
- }
- public void onAnimationCancel(Animator animation) {
- mLinearLayout.removeView(mCurrentView);
- mCallback.handleSwipe(animView, swipeDirection);
- }
- });
- anim.setDuration(duration);
+ anim = animateClosed(animView, duration, "x", curX, newX);
} else { // Animate back to position
long duration = Math.abs(velocityX) > 0.0f ?
(long) (Math.abs(newX-curX) * 1000.0f / Math.abs(velocityX))
@@ -196,6 +213,7 @@ public class RecentsVerticalScrollView extends ScrollView
anim.setDuration(duration);
}
+ final View thumb = animView.findViewById(R.id.app_thumbnail);
anim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
animView.setAlpha(getAlphaForOffset(animView, thumb.getWidth()));
@@ -212,6 +230,26 @@ public class RecentsVerticalScrollView extends ScrollView
return true;
}
+ private ObjectAnimator animateClosed(final View animView, long duration,
+ String attr, float from, float to) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(animView, attr, from, to);
+ anim.setInterpolator(new LinearInterpolator());
+ final int swipeDirection = animView.getX() >= 0.0f ?
+ RecentsCallback.SWIPE_RIGHT : RecentsCallback.SWIPE_LEFT;
+ anim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ mLinearLayout.removeView(animView);
+ mCallback.handleSwipe(animView, swipeDirection);
+ }
+ public void onAnimationCancel(Animator animation) {
+ mLinearLayout.removeView(animView);
+ mCallback.handleSwipe(animView, swipeDirection);
+ }
+ });
+ anim.setDuration(duration);
+ return anim;
+ }
+
void invalidateGlobalRegion(View view) {
RectF childBounds
= new RectF(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
@@ -236,13 +274,8 @@ public class RecentsVerticalScrollView extends ScrollView
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- LayoutInflater inflater = (LayoutInflater)
- mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
setScrollbarFadingEnabled(true);
-
mLinearLayout = (LinearLayout) findViewById(R.id.recents_linear_layout);
-
final int leftPadding = mContext.getResources()
.getDimensionPixelOffset(R.dimen.status_bar_recents_thumbnail_left_margin);
setOverScrollEffectPadding(leftPadding, 0);
@@ -306,16 +339,7 @@ public class RecentsVerticalScrollView extends ScrollView
mLinearLayout.setLayoutTransition(transition);
}
- public void onClick(View view) {
- mCallback.handleOnClick(view);
- }
-
public void setCallback(RecentsCallback callback) {
mCallback = callback;
}
-
- public boolean onTouch(View v, MotionEvent event) {
- mCurrentView = v;
- return false;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index dedbe5d..af5c72d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -218,9 +218,165 @@ public class PhoneStatusBarPolicy {
R.drawable.stat_sys_roaming_cdma_0,
R.drawable.stat_sys_roaming_cdma_0,
R.drawable.stat_sys_roaming_cdma_0,
- R.drawable.stat_sys_roaming_cdma_0 //83
+ R.drawable.stat_sys_roaming_cdma_0, //83
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0,
+ R.drawable.stat_sys_roaming_cdma_0 //239
- // 128-255 Reserved
+ // 240-255 Reserved
};
//***** Data connection icons