summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-10-02 12:28:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-02 12:28:38 -0700
commitf175525be4107649581259d04711f9ead905d447 (patch)
tree27c8db90f0310e52b65b0d7f5126bb1d7ee68207 /packages
parent141efcb5b633f76056260f6763652270931853f3 (diff)
parent9bdaada95c481b8164417696649a1ffb584552f1 (diff)
downloadframeworks_base-f175525be4107649581259d04711f9ead905d447.zip
frameworks_base-f175525be4107649581259d04711f9ead905d447.tar.gz
frameworks_base-f175525be4107649581259d04711f9ead905d447.tar.bz2
Merge "Fix bug 7138446: Icon blips in during Recents animation" into jb-mr1-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout-land/status_bar_recent_item.xml7
-rw-r--r--packages/SystemUI/res/layout/status_bar_recent_item.xml4
-rw-r--r--packages/SystemUI/res/values/dimens.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIApplication.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java49
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java11
7 files changed, 105 insertions, 9 deletions
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 c293fe6..10e313e 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
@@ -24,13 +24,16 @@
android:layout_width="wrap_content"
android:paddingLeft="@dimen/status_bar_recents_item_padding"
android:paddingRight="@dimen/status_bar_recents_item_padding"
- android:importantForAccessibility="no">
+ android:importantForAccessibility="no"
+ android:clipChildren="false">
<RelativeLayout android:id="@+id/recent_item"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:paddingTop="@*android:dimen/status_bar_height">
+ android:paddingTop="@*android:dimen/status_bar_height"
+ android:clipChildren="false"
+ android:clipToPadding="false">
<FrameLayout android:id="@+id/app_thumbnail"
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/layout/status_bar_recent_item.xml b/packages/SystemUI/res/layout/status_bar_recent_item.xml
index fc247d6..e2b5723 100644
--- a/packages/SystemUI/res/layout/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout/status_bar_recent_item.xml
@@ -24,12 +24,14 @@
android:layout_width="match_parent"
android:paddingTop="@dimen/status_bar_recents_item_padding"
android:paddingBottom="@dimen/status_bar_recents_item_padding"
+ android:clipChildren="false"
android:importantForAccessibility="no">
<RelativeLayout android:id="@+id/recent_item"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
- android:layout_width="wrap_content">
+ android:layout_width="wrap_content"
+ android:clipChildren="false">
<TextView android:id="@+id/app_label"
android:layout_width="@dimen/status_bar_recents_app_label_width"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 62289fb..5023d23 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -50,6 +50,10 @@
<dimen name="status_bar_recents_app_label_left_margin">0dip</dimen>
<!-- Padding between recents items -->
<dimen name="status_bar_recents_item_padding">0dip</dimen>
+ <!-- When recents first appears, how far the icon and label of the primary activity
+ travel -->
+ <dimen name="status_bar_recents_app_icon_translate_distance">100dp</dimen>
+
<!-- Where to place the app icon over the thumbnail -->
<dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen>
<dimen name="status_bar_recents_app_icon_top_margin">8dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
index f97d4ff..c120690 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java
@@ -19,9 +19,12 @@ package com.android.systemui;
import android.app.Application;
import com.android.systemui.recent.RecentTasksLoader;
+import com.android.systemui.recent.RecentsActivity;
public class SystemUIApplication extends Application {
private RecentTasksLoader mRecentTasksLoader;
+ private boolean mWaitingForWinAnimStart;
+ private RecentsActivity.WindowAnimationStartListener mWinAnimStartListener;
public RecentTasksLoader getRecentTasksLoader() {
if (mRecentTasksLoader == null) {
@@ -29,4 +32,28 @@ public class SystemUIApplication extends Application {
}
return mRecentTasksLoader;
}
+
+ public void setWaitingForWinAnimStart(boolean waiting) {
+ mWaitingForWinAnimStart = waiting;
+ }
+
+ public void setWindowAnimationStartListener(
+ RecentsActivity.WindowAnimationStartListener startListener) {
+ mWinAnimStartListener = startListener;
+ }
+
+ public RecentsActivity.WindowAnimationStartListener getWindowAnimationListener() {
+ return mWinAnimStartListener;
+ }
+
+ public void onWindowAnimationStart() {
+ if (mWinAnimStartListener != null) {
+ mWinAnimStartListener.onWindowAnimationStart();
+ }
+ mWaitingForWinAnimStart = false;
+ }
+
+ public boolean isWaitingForWindowAnimationStart() {
+ return mWaitingForWinAnimStart;
+ }
} \ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
index 7ff7b17..f93da08 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
@@ -51,6 +51,10 @@ public class RecentsActivity extends Activity {
}
};
+ public static interface WindowAnimationStartListener {
+ void onWindowAnimationStart();
+ }
+
public class TouchOutsideListener implements View.OnTouchListener {
private StatusBarPanel mPanel;
@@ -88,15 +92,15 @@ public class RecentsActivity extends Activity {
@Override
public void onStart() {
mShowing = true;
+ if (mRecentsPanel != null) {
+ mRecentsPanel.refreshViews();
+ }
super.onStart();
}
@Override
public void onResume() {
mForeground = true;
- if (mRecentsPanel != null) {
- mRecentsPanel.refreshViews();
- }
super.onResume();
}
@@ -150,6 +154,7 @@ public class RecentsActivity extends Activity {
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(CLOSE_RECENTS_INTENT);
registerReceiver(mIntentReceiver, mIntentFilter);
+ app.setWindowAnimationStartListener(mRecentsPanel);
super.onCreate(savedInstanceState);
}
@@ -164,6 +169,7 @@ public class RecentsActivity extends Activity {
final RecentTasksLoader recentTasksLoader = app.getRecentTasksLoader();
recentTasksLoader.setRecentsPanel(null, mRecentsPanel);
unregisterReceiver(mIntentReceiver);
+ app.setWindowAnimationStartListener(null);
super.onDestroy();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 005b4a2..3a89059 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -18,12 +18,15 @@ package com.android.systemui.recent;
import android.animation.Animator;
import android.animation.LayoutTransition;
+import android.animation.TimeInterpolator;
+import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
@@ -45,6 +48,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
+import android.view.animation.DecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
@@ -55,6 +59,7 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import com.android.systemui.R;
+import com.android.systemui.SystemUIApplication;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.tablet.StatusBarPanel;
@@ -63,7 +68,7 @@ import com.android.systemui.statusbar.tablet.TabletStatusBar;
import java.util.ArrayList;
public class RecentsPanelView extends FrameLayout implements OnItemClickListener, RecentsCallback,
- StatusBarPanel, Animator.AnimatorListener {
+ StatusBarPanel, Animator.AnimatorListener, RecentsActivity.WindowAnimationStartListener {
static final String TAG = "RecentsPanelView";
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
private PopupMenu mPopup;
@@ -75,6 +80,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
private boolean mShowing;
private boolean mWaitingToShow;
private int mNumItemsWaitingForThumbnailsAndIcons;
+ private ViewHolder mItemToAnimateInWhenWindowAnimationIsFinished;
private RecentTasksLoader mRecentTasksLoader;
private ArrayList<TaskDescription> mRecentTaskDescriptions;
@@ -109,6 +115,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
ImageView iconView;
TextView labelView;
TextView descriptionView;
+ View calloutLine;
TaskDescription taskDescription;
boolean loadedThumbnailAndIcon;
}
@@ -148,6 +155,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
holder.iconView.setImageBitmap(mRecentTasksLoader.getDefaultIcon());
}
holder.labelView = (TextView) convertView.findViewById(R.id.app_label);
+ holder.calloutLine = convertView.findViewById(R.id.recents_callout_line);
holder.descriptionView = (TextView) convertView.findViewById(R.id.app_description);
convertView.setTag(holder);
@@ -173,6 +181,28 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
updateIcon(holder, td.getIcon(), true, false);
mNumItemsWaitingForThumbnailsAndIcons--;
}
+ if (index == 0) {
+ final Activity activity = (Activity) RecentsPanelView.this.getContext();
+ final SystemUIApplication app = (SystemUIApplication) activity.getApplication();
+ if (app.isWaitingForWindowAnimationStart()) {
+ mItemToAnimateInWhenWindowAnimationIsFinished = holder;
+ final int translation = -getResources().getDimensionPixelSize(
+ R.dimen.status_bar_recents_app_icon_translate_distance);
+ final Configuration config = getResources().getConfiguration();
+ if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
+ for (View v :
+ new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
+ if (v != null) {
+ v.setAlpha(0f);
+ v.setTranslationX(translation);
+ }
+ }
+ } else {
+ holder.iconView.setAlpha(0f);
+ holder.iconView.setTranslationY(translation);
+ }
+ }
+ }
holder.thumbnailView.setTag(td);
holder.thumbnailView.setOnLongClickListener(new OnLongClickDelegate(convertView));
@@ -506,6 +536,23 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
return null;
}
+ public void onWindowAnimationStart() {
+ if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
+ final int startDelay = 100;
+ final int duration = 250;
+ final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
+ final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
+ for (View v :
+ new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
+ if (v != null) {
+ v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay)
+ .setDuration(duration).setInterpolator(cubic);
+ }
+ }
+ mItemToAnimateInWhenWindowAnimationIsFinished = null;
+ }
+ }
+
public void clearRecentTasksList() {
// Clear memory used by screenshots
if (mRecentTaskDescriptions != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index d7b1b35..e88f9cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -544,7 +544,7 @@ public abstract class BaseStatusBar extends SystemUI implements
- p.getFontMetricsInt().top;
float descriptionTextSize = res
.getDimensionPixelSize(R.dimen.status_bar_recents_app_description_text_size);
- p.setTextSize(labelTextSize);
+ p.setTextSize(descriptionTextSize);
float descriptionTextHeight = p.getFontMetricsInt().bottom
- p.getFontMetricsInt().top;
@@ -567,10 +567,17 @@ public abstract class BaseStatusBar extends SystemUI implements
+ recentsItemTopPadding + thumbBgPadding + statusBarHeight);
}
+ final SystemUIApplication app =
+ (SystemUIApplication) ((Service) mContext).getApplication();
+ app.setWaitingForWinAnimStart(true);
ActivityOptions opts = ActivityOptions.makeThumbnailScaleDownAnimation(
getStatusBarView(),
first, x, y,
- null);
+ new ActivityOptions.OnAnimationStartedListener() {
+ public void onAnimationStarted() {
+ app.onWindowAnimationStart();
+ }
+ });
mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(
UserHandle.USER_CURRENT));
}