summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/util
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-04-02 11:23:39 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-07-28 10:13:30 -0700
commitb5b9ad68b707154fcc2c3b04b1b6c0b17127e415 (patch)
tree1ed2cd99b473ae33122f6225d9d302c74acbf6e5 /src/com/android/launcher3/util
parenta2454ad2d8dcffa94f670853eb464726c73597f1 (diff)
downloadandroid_packages_apps_Trebuchet-b5b9ad68b707154fcc2c3b04b1b6c0b17127e415.tar.gz
android_packages_apps_Trebuchet-b5b9ad68b707154fcc2c3b04b1b6c0b17127e415.tar.bz2
android_packages_apps_Trebuchet-b5b9ad68b707154fcc2c3b04b1b6c0b17127e415.zip
Fading in the first screen, when launcher loads for the first time
Bug: 29007436 Bug: 27705838 Change-Id: I95891d0bad19a67985b689bb96d6068dcd85004a
Diffstat (limited to 'src/com/android/launcher3/util')
-rw-r--r--src/com/android/launcher3/util/ViewOnDrawExecutor.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/com/android/launcher3/util/ViewOnDrawExecutor.java b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
index 01808ba57..9bd288244 100644
--- a/src/com/android/launcher3/util/ViewOnDrawExecutor.java
+++ b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
@@ -16,6 +16,7 @@
package com.android.launcher3.util;
+import android.util.Log;
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.ViewTreeObserver.OnDrawListener;
@@ -39,6 +40,9 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
private View mAttachedView;
private boolean mCompleted;
+ private boolean mLoadAnimationCompleted;
+ private boolean mFirstDrawCompleted;
+
public ViewOnDrawExecutor(DeferredHandler handler) {
mHandler = handler;
}
@@ -72,19 +76,31 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
@Override
public void onDraw() {
+ mFirstDrawCompleted = true;
mAttachedView.post(this);
}
+ public void onLoadAnimationCompleted() {
+ mLoadAnimationCompleted = true;
+ if (mAttachedView != null) {
+ mAttachedView.post(this);
+ }
+ }
+
@Override
public void run() {
- for (final Runnable r : mTasks) {
- mHandler.post(r);
+ // Post the pending tasks after both onDraw and onLoadAnimationCompleted have been called.
+ if (mLoadAnimationCompleted && mFirstDrawCompleted && !mCompleted) {
+ for (final Runnable r : mTasks) {
+ mHandler.post(r);
+ }
+ markCompleted();
}
- markCompleted();
}
public void markCompleted() {
mTasks.clear();
+ mCompleted = true;
if (mAttachedView != null) {
mAttachedView.getViewTreeObserver().removeOnDrawListener(this);
mAttachedView.removeOnAttachStateChangeListener(this);