summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recent
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-11-20 16:46:09 -0800
committerMichael Jurka <mikejurka@google.com>2012-11-21 11:55:23 -0800
commitd894c8cdd127975d97aaa7709454f0f4b4a7f91e (patch)
treeaa941d782baefcdee99cb630f1ef1aec13d33e86 /packages/SystemUI/src/com/android/systemui/recent
parent2656abe09895088eca25caafc3e92869217d1447 (diff)
downloadframeworks_base-d894c8cdd127975d97aaa7709454f0f4b4a7f91e.zip
frameworks_base-d894c8cdd127975d97aaa7709454f0f4b4a7f91e.tar.gz
frameworks_base-d894c8cdd127975d97aaa7709454f0f4b4a7f91e.tar.bz2
Fix bug where icon animation is sometimes skipped
Bug: 7406230 Bug: 7406304 Change-Id: I9058acffa6587a5f8e757f1031750a8ba578c635
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recent')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java40
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java13
3 files changed, 27 insertions, 39 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 6cb7dec..3330301 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -336,19 +336,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
});
}
- @Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- // scroll to bottom after reloading
- if (visibility == View.VISIBLE && changedView == this) {
- post(new Runnable() {
- public void run() {
- update();
- }
- });
- }
- }
-
public void setAdapter(TaskDescriptionAdapter adapter) {
mAdapter = adapter;
mAdapter.registerDataSetObserver(new DataSetObserver() {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index cd3bc42..76cd33f 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -77,9 +77,10 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
private boolean mShowing;
private boolean mWaitingToShow;
- private int mNumItemsWaitingForThumbnailsAndIcons;
private ViewHolder mItemToAnimateInWhenWindowAnimationIsFinished;
+ private boolean mAnimateIconOfFirstTask;
private boolean mWaitingForWindowAnimation;
+ private long mWindowAnimationStartTime;
private RecentTasksLoader mRecentTasksLoader;
private ArrayList<TaskDescription> mRecentTaskDescriptions;
@@ -174,10 +175,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
if (td.isLoaded()) {
updateThumbnail(holder, td.getThumbnail(), true, false);
updateIcon(holder, td.getIcon(), true, false);
- mNumItemsWaitingForThumbnailsAndIcons--;
}
if (index == 0) {
- if (mWaitingForWindowAnimation) {
+ if (mAnimateIconOfFirstTask) {
if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
holder.iconView.setAlpha(1f);
holder.iconView.setTranslationX(0f);
@@ -206,6 +206,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
holder.iconView.setAlpha(0f);
holder.iconView.setTranslationY(translation);
}
+ if (!mWaitingForWindowAnimation) {
+ animateInIconOfFirstTask();
+ }
}
}
@@ -220,7 +223,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
updateThumbnail(holder, mRecentTasksLoader.getDefaultThumbnail(), false, false);
holder.iconView.setImageBitmap(mRecentTasksLoader.getDefaultIcon());
holder.iconView.setVisibility(INVISIBLE);
+ holder.iconView.animate().cancel();
holder.labelView.setText(null);
+ holder.labelView.animate().cancel();
holder.thumbnailView.setContentDescription(null);
holder.thumbnailView.setTag(null);
holder.thumbnailView.setOnLongClickListener(null);
@@ -235,6 +240,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
holder.calloutLine.setAlpha(1f);
holder.calloutLine.setTranslationX(0f);
holder.calloutLine.setTranslationY(0f);
+ holder.calloutLine.animate().cancel();
}
holder.taskDescription = null;
holder.loadedThumbnailAndIcon = false;
@@ -291,8 +297,9 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void show(boolean show, ArrayList<TaskDescription> recentTaskDescriptions,
- boolean firstScreenful, boolean waitingForWindowAnimation) {
- mWaitingForWindowAnimation = waitingForWindowAnimation;
+ boolean firstScreenful, boolean animateIconOfFirstTask) {
+ mAnimateIconOfFirstTask = animateIconOfFirstTask;
+ mWaitingForWindowAnimation = animateIconOfFirstTask;
if (show) {
mWaitingToShow = true;
refreshRecentTasksList(recentTaskDescriptions, firstScreenful);
@@ -527,7 +534,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
updateIcon(h, td.getIcon(), true, animateShow);
updateThumbnail(h, td.getThumbnail(), true, animateShow);
h.loadedThumbnailAndIcon = true;
- mNumItemsWaitingForThumbnailsAndIcons--;
}
}
}
@@ -536,9 +542,14 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
showIfReady();
}
- public void onWindowAnimationStart() {
- if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
- final int startDelay = 150;
+ private void animateInIconOfFirstTask() {
+ if (mItemToAnimateInWhenWindowAnimationIsFinished != null &&
+ !mRecentTasksLoader.isFirstScreenful()) {
+ int timeSinceWindowAnimation =
+ (int) (System.currentTimeMillis() - mWindowAnimationStartTime);
+ final int minStartDelay = 150;
+ final int startDelay = Math.max(0, Math.min(
+ minStartDelay - timeSinceWindowAnimation, minStartDelay));
final int duration = 250;
final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
@@ -550,10 +561,16 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
}
mItemToAnimateInWhenWindowAnimationIsFinished = null;
- mWaitingForWindowAnimation = false;
+ mAnimateIconOfFirstTask = false;
}
}
+ public void onWindowAnimationStart() {
+ mWaitingForWindowAnimation = false;
+ mWindowAnimationStartTime = System.currentTimeMillis();
+ animateInIconOfFirstTask();
+ }
+
public void clearRecentTasksList() {
// Clear memory used by screenshots
if (mRecentTaskDescriptions != null) {
@@ -590,9 +607,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
}
public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenful) {
- mNumItemsWaitingForThumbnailsAndIcons = firstScreenful
- ? tasks.size() : mRecentTaskDescriptions == null
- ? 0 : mRecentTaskDescriptions.size();
if (mRecentTaskDescriptions == null) {
mRecentTaskDescriptions = new ArrayList<TaskDescription>(tasks);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 47b0113..b3adbaf 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -345,19 +345,6 @@ public class RecentsVerticalScrollView extends ScrollView
});
}
- @Override
- protected void onVisibilityChanged(View changedView, int visibility) {
- super.onVisibilityChanged(changedView, visibility);
- // scroll to bottom after reloading
- if (visibility == View.VISIBLE && changedView == this) {
- post(new Runnable() {
- public void run() {
- update();
- }
- });
- }
- }
-
public void setAdapter(TaskDescriptionAdapter adapter) {
mAdapter = adapter;
mAdapter.registerDataSetObserver(new DataSetObserver() {