Loading AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,13 @@ </intent-filter> </receiver> <receiver android:name="com.android.launcher3.WallpaperChangedReceiver"> <intent-filter> <action android:name="android.intent.action.WALLPAPER_CHANGED" /> </intent-filter> </receiver> <!-- Intent received used to install shortcuts from other applications --> <receiver android:name="com.android.launcher3.InstallShortcutReceiver" Loading src/com/android/launcher3/LauncherAppState.java +11 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { private boolean mIsScreenLarge; private float mScreenDensity; private int mLongPressTimeout = 300; private boolean mWallpaperChangedSinceLastCheck; private static WeakReference<LauncherProvider> sLauncherProvider; private static Context sContext; Loading Loading @@ -217,6 +218,16 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { return mLongPressTimeout; } public void onWallpaperChanged() { mWallpaperChangedSinceLastCheck = true; } public boolean hasWallpaperChangedSinceLastCheck() { boolean result = mWallpaperChangedSinceLastCheck; mWallpaperChangedSinceLastCheck = false; return result; } @Override public void onAvailableSizeChanged(DeviceProfile grid) { Utilities.setIconSize(grid.iconSizePx); Loading src/com/android/launcher3/WallpaperChangedReceiver.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class WallpaperChangedReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent data) { LauncherAppState appState = LauncherAppState.getInstance(); appState.onWallpaperChanged(); } } src/com/android/launcher3/WallpaperCropActivity.java +35 −34 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ public class WallpaperCropActivity extends Activity { public static final int MAX_BMAP_IN_INTENT = 750000; private static final float WALLPAPER_SCREENS_SPAN = 2f; protected static Point sDefaultWallpaperSize; protected CropView mCropView; protected Uri mUri; Loading Loading @@ -204,6 +206,7 @@ public class WallpaperCropActivity extends Activity { } static protected Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) { if (sDefaultWallpaperSize == null) { Point minDims = new Point(); Point maxDims = new Point(); windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); Loading @@ -219,8 +222,7 @@ public class WallpaperCropActivity extends Activity { } // We need to ensure that there is enough extra space in the wallpaper // for the intended // parallax effects // for the intended parallax effects final int defaultWidth, defaultHeight; if (isScreenLarge(res)) { defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); Loading @@ -229,7 +231,9 @@ public class WallpaperCropActivity extends Activity { defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim); defaultHeight = maxDim; } return new Point(defaultWidth, defaultHeight); sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight); } return sDefaultWallpaperSize; } public static int getRotationFromExif(String path) { Loading Loading @@ -785,16 +789,13 @@ public class WallpaperCropActivity extends Activity { WindowManager windowManager, final WallpaperManager wallpaperManager) { final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager); new AsyncTask<Void, Void, Void>() { public Void doInBackground(Void ... args) { // If we have saved a wallpaper width/height, use that instead int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, defaultWallpaperSize.x); int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, defaultWallpaperSize.y); if (savedWidth != wallpaperManager.getDesiredMinimumWidth() || savedHeight != wallpaperManager.getDesiredMinimumHeight()) { wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } protected static RectF getMaxCropRect( Loading src/com/android/launcher3/Workspace.java +20 −5 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.IBinder; import android.os.Parcelable; import android.support.v4.view.ViewCompat; Loading Loading @@ -437,6 +438,9 @@ public class Workspace extends SmoothPagedView mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx); mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity); // Set the wallpaper dimensions when Launcher starts up setWallpaperDimension(); } private void setupLayoutTransition() { Loading Loading @@ -1232,10 +1236,16 @@ public class Workspace extends SmoothPagedView } protected void setWallpaperDimension() { new AsyncTask<Void, Void, Void>() { public Void doInBackground(Void ... args) { String spKey = WallpaperCropActivity.getSharedPreferencesKey(); SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); WallpaperPickerActivity.suggestWallpaperDimension(mLauncher.getResources(), sp, mLauncher.getWindowManager(), mWallpaperManager); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } protected void snapToPage(int whichPage, Runnable r) { Loading Loading @@ -1693,6 +1703,12 @@ public class Workspace extends SmoothPagedView AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); sAccessibilityEnabled = am.isEnabled(); // Update wallpaper dimensions if they were changed since last onResume // (we also always set the wallpaper dimensions in the constructor) if (LauncherAppState.getInstance().hasWallpaperChangedSinceLastCheck()) { setWallpaperDimension(); } } @Override Loading Loading @@ -4001,7 +4017,6 @@ public class Workspace extends SmoothPagedView // hardware layers on children are enabled on startup, but should be disabled until // needed updateChildrenLayersEnabled(false); setWallpaperDimension(); } /** Loading Loading
AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,13 @@ </intent-filter> </receiver> <receiver android:name="com.android.launcher3.WallpaperChangedReceiver"> <intent-filter> <action android:name="android.intent.action.WALLPAPER_CHANGED" /> </intent-filter> </receiver> <!-- Intent received used to install shortcuts from other applications --> <receiver android:name="com.android.launcher3.InstallShortcutReceiver" Loading
src/com/android/launcher3/LauncherAppState.java +11 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { private boolean mIsScreenLarge; private float mScreenDensity; private int mLongPressTimeout = 300; private boolean mWallpaperChangedSinceLastCheck; private static WeakReference<LauncherProvider> sLauncherProvider; private static Context sContext; Loading Loading @@ -217,6 +218,16 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { return mLongPressTimeout; } public void onWallpaperChanged() { mWallpaperChangedSinceLastCheck = true; } public boolean hasWallpaperChangedSinceLastCheck() { boolean result = mWallpaperChangedSinceLastCheck; mWallpaperChangedSinceLastCheck = false; return result; } @Override public void onAvailableSizeChanged(DeviceProfile grid) { Utilities.setIconSize(grid.iconSizePx); Loading
src/com/android/launcher3/WallpaperChangedReceiver.java 0 → 100644 +28 −0 Original line number Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class WallpaperChangedReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent data) { LauncherAppState appState = LauncherAppState.getInstance(); appState.onWallpaperChanged(); } }
src/com/android/launcher3/WallpaperCropActivity.java +35 −34 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ public class WallpaperCropActivity extends Activity { public static final int MAX_BMAP_IN_INTENT = 750000; private static final float WALLPAPER_SCREENS_SPAN = 2f; protected static Point sDefaultWallpaperSize; protected CropView mCropView; protected Uri mUri; Loading Loading @@ -204,6 +206,7 @@ public class WallpaperCropActivity extends Activity { } static protected Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) { if (sDefaultWallpaperSize == null) { Point minDims = new Point(); Point maxDims = new Point(); windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); Loading @@ -219,8 +222,7 @@ public class WallpaperCropActivity extends Activity { } // We need to ensure that there is enough extra space in the wallpaper // for the intended // parallax effects // for the intended parallax effects final int defaultWidth, defaultHeight; if (isScreenLarge(res)) { defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); Loading @@ -229,7 +231,9 @@ public class WallpaperCropActivity extends Activity { defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim); defaultHeight = maxDim; } return new Point(defaultWidth, defaultHeight); sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight); } return sDefaultWallpaperSize; } public static int getRotationFromExif(String path) { Loading Loading @@ -785,16 +789,13 @@ public class WallpaperCropActivity extends Activity { WindowManager windowManager, final WallpaperManager wallpaperManager) { final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager); new AsyncTask<Void, Void, Void>() { public Void doInBackground(Void ... args) { // If we have saved a wallpaper width/height, use that instead int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, defaultWallpaperSize.x); int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, defaultWallpaperSize.y); if (savedWidth != wallpaperManager.getDesiredMinimumWidth() || savedHeight != wallpaperManager.getDesiredMinimumHeight()) { wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } protected static RectF getMaxCropRect( Loading
src/com/android/launcher3/Workspace.java +20 −5 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.IBinder; import android.os.Parcelable; import android.support.v4.view.ViewCompat; Loading Loading @@ -437,6 +438,9 @@ public class Workspace extends SmoothPagedView mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx); mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity); // Set the wallpaper dimensions when Launcher starts up setWallpaperDimension(); } private void setupLayoutTransition() { Loading Loading @@ -1232,10 +1236,16 @@ public class Workspace extends SmoothPagedView } protected void setWallpaperDimension() { new AsyncTask<Void, Void, Void>() { public Void doInBackground(Void ... args) { String spKey = WallpaperCropActivity.getSharedPreferencesKey(); SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); SharedPreferences sp = mLauncher.getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); WallpaperPickerActivity.suggestWallpaperDimension(mLauncher.getResources(), sp, mLauncher.getWindowManager(), mWallpaperManager); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } protected void snapToPage(int whichPage, Runnable r) { Loading Loading @@ -1693,6 +1703,12 @@ public class Workspace extends SmoothPagedView AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); sAccessibilityEnabled = am.isEnabled(); // Update wallpaper dimensions if they were changed since last onResume // (we also always set the wallpaper dimensions in the constructor) if (LauncherAppState.getInstance().hasWallpaperChangedSinceLastCheck()) { setWallpaperDimension(); } } @Override Loading Loading @@ -4001,7 +4017,6 @@ public class Workspace extends SmoothPagedView // hardware layers on children are enabled on startup, but should be disabled until // needed updateChildrenLayersEnabled(false); setWallpaperDimension(); } /** Loading