summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-10-01 13:58:29 +0200
committerMichael Jurka <mikejurka@google.com>2012-10-02 21:18:26 +0200
commit9bdaada95c481b8164417696649a1ffb584552f1 (patch)
tree04318ab516d58475a585cc1e99eb0ec464300b1d /packages/SystemUI/src/com/android
parent30ed33b141dd1add916466c193b6735cd0bf8315 (diff)
downloadframeworks_base-9bdaada95c481b8164417696649a1ffb584552f1.zip
frameworks_base-9bdaada95c481b8164417696649a1ffb584552f1.tar.gz
frameworks_base-9bdaada95c481b8164417696649a1ffb584552f1.tar.bz2
Fix bug 7138446: Icon blips in during Recents animation
Add animation where icon and description of the primary activity fades and translates in Change-Id: Ie21b5302ac9e58ee6af219b7cde98d12a8e82697
Diffstat (limited to 'packages/SystemUI/src/com/android')
-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
4 files changed, 93 insertions, 6 deletions
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));
}