diff options
author | Michael Jurka <mikejurka@google.com> | 2012-11-27 11:30:58 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-11-27 11:30:58 -0800 |
commit | e020af835b147e35ebf683957a8c1a5e52442d69 (patch) | |
tree | 273094d8bc4b73563c28f980cbcc9453e0082a2a | |
parent | 037e8ee26f9fa6e2f30d9501a4db43161904c905 (diff) | |
parent | ab972a6dce0d3d75fa9db2b5f9c0a88505e237fd (diff) | |
download | frameworks_base-e020af835b147e35ebf683957a8c1a5e52442d69.zip frameworks_base-e020af835b147e35ebf683957a8c1a5e52442d69.tar.gz frameworks_base-e020af835b147e35ebf683957a8c1a5e52442d69.tar.bz2 |
am ab972a6d: Merge "Fix bug where icon animation is sometimes skipped" into jb-mr1.1-dev
* commit 'ab972a6dce0d3d75fa9db2b5f9c0a88505e237fd':
Fix bug where icon animation is sometimes skipped
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() { |