Lazily instantiate LauncherAppState.
The application context for LauncherAppState is supplied by
the application whenever it starts; don't ask for an
instance before that.
Change-Id: I1ca8ea04238a357a682f79250f08813ead7ae532
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c216572..40e44d1 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -44,17 +44,14 @@
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
-import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@@ -82,7 +79,6 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.*;
-import com.android.launcher3.R;
import com.android.launcher3.DropTarget.DragObject;
import java.io.DataInputStream;
@@ -2671,7 +2667,9 @@
dispatchOnLauncherTransitionEnd(fromView, animated, false);
dispatchOnLauncherTransitionEnd(toView, animated, false);
- if (mWorkspace != null && !springLoaded && !LauncherAppState.isScreenLarge()) {
+ if (mWorkspace != null
+ && !springLoaded
+ && !LauncherAppState.getInstance().isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
hideDockDivider();
@@ -2741,7 +2739,7 @@
toView.setVisibility(View.VISIBLE);
toView.bringToFront();
- if (!springLoaded && !LauncherAppState.isScreenLarge()) {
+ if (!springLoaded && !LauncherAppState.getInstance().isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
hideDockDivider();
@@ -3032,7 +3030,7 @@
* Shows the hotseat area.
*/
void showHotseat(boolean animated) {
- if (!LauncherAppState.isScreenLarge()) {
+ if (!LauncherAppState.getInstance().isScreenLarge()) {
if (animated) {
if (mHotseat.getAlpha() != 1f) {
int duration = 0;
@@ -3051,7 +3049,7 @@
* Hides the hotseat area.
*/
void hideHotseat(boolean animated) {
- if (!LauncherAppState.isScreenLarge()) {
+ if (!LauncherAppState.getInstance().isScreenLarge()) {
if (animated) {
if (mHotseat.getAlpha() != 0f) {
int duration = 0;
@@ -3818,7 +3816,8 @@
// If we can't find a valid position, then just add a new screen.
// This takes time so we need to re-queue the add until the new
// page is added.
- long screenId = LauncherAppState.getInstance().getLauncherProvider().generateNewScreenId();
+ long screenId = LauncherAppState.getInstance().getLauncherProvider()
+ .generateNewScreenId();
mWorkspace.insertNewWorkspaceScreen(screenId, false);
model.updateWorkspaceScreenOrder(launcher, mWorkspace.getScreenOrder(),
new Runnable() {