From b5b9ad68b707154fcc2c3b04b1b6c0b17127e415 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Sat, 2 Apr 2016 11:23:39 -0700 Subject: Fading in the first screen, when launcher loads for the first time Bug: 29007436 Bug: 27705838 Change-Id: I95891d0bad19a67985b689bb96d6068dcd85004a --- src/com/android/launcher3/Launcher.java | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/com/android/launcher3/Launcher.java') diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d668d2a74..df856c1b6 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -465,7 +465,11 @@ public class Launcher extends Activity } else { // We only load the page synchronously if the user rotates (or triggers a // configuration change) while launcher is in the foreground - mModel.startLoader(mWorkspace.getRestorePage()); + if (!mModel.startLoader(mWorkspace.getRestorePage())) { + // If we are not binding synchronously, show a fade in animation when + // the first page bind completes. + mDragLayer.setAlpha(0); + } } } @@ -4003,6 +4007,32 @@ public class Launcher extends Activity } } + @Override + public void finishFirstPageBind(final ViewOnDrawExecutor executor) { + Runnable r = new Runnable() { + public void run() { + finishFirstPageBind(executor); + } + }; + if (waitUntilResume(r)) { + return; + } + + Runnable onComplete = new Runnable() { + @Override + public void run() { + if (executor != null) { + executor.onLoadAnimationCompleted(); + } + } + }; + if (mDragLayer.getAlpha() < 1) { + mDragLayer.animate().alpha(1).withEndAction(onComplete).start(); + } else { + onComplete.run(); + } + } + /** * Callback saying that there aren't any more items to bind. * -- cgit v1.2.3