diff options
author | Winson Chung <winsonc@google.com> | 2013-08-12 16:19:28 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-08-20 10:56:05 -0700 |
commit | 5f8afe6280eae34620067696173e71943e1a30a3 (patch) | |
tree | eb0ebdf56f2ad0950894424a49de9d1e8dc832e0 /src/com/android/launcher3/LauncherAppState.java | |
parent | 8a6870101c3d99257fc050d11bb69f50f5240622 (diff) | |
download | android_packages_apps_Trebuchet-5f8afe6280eae34620067696173e71943e1a30a3.tar.gz android_packages_apps_Trebuchet-5f8afe6280eae34620067696173e71943e1a30a3.tar.bz2 android_packages_apps_Trebuchet-5f8afe6280eae34620067696173e71943e1a30a3.zip |
Initial Changes for Dynamic Grid
Change-Id: I9e6f1e5167791cf8dc140778dfa447f86424e9bf
Diffstat (limited to 'src/com/android/launcher3/LauncherAppState.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAppState.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 03d2d3395..0c577e548 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -21,11 +21,14 @@ import android.content.*; import android.content.res.Configuration; import android.database.ContentObserver; import android.os.Handler; +import android.provider.Settings; import android.util.Log; +import android.view.Display; import java.lang.ref.WeakReference; public class LauncherAppState { + private static final String TAG = "LauncherAppState"; private static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs"; private LauncherModel mModel; @@ -41,6 +44,8 @@ public class LauncherAppState { private static Object mLock = new Object(); private static LauncherAppState INSTANCE; + private DynamicGrid mDynamicGrid; + public static LauncherAppState getInstance() { if (INSTANCE == null) { INSTANCE = new LauncherAppState(); @@ -71,7 +76,7 @@ public class LauncherAppState { } // set sIsScreenXLarge and mScreenDensity *before* creating icon cache - mIsScreenLarge = sContext.getResources().getBoolean(R.bool.is_large_screen); + mIsScreenLarge = sContext.getResources().getBoolean(R.bool.is_large_tablet); mScreenDensity = sContext.getResources().getDisplayMetrics().density; mWidgetPreviewCacheDb = new WidgetPreviewLoader.CacheDb(sContext); @@ -158,6 +163,27 @@ public class LauncherAppState { return SHARED_PREFERENCES_KEY; } + DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, int width, int height) { + boolean created = false; + if (mDynamicGrid == null) { + mDynamicGrid = new DynamicGrid(context.getResources(), + minWidth, minHeight, width, height); + created = true; + } + + DeviceProfile grid = mDynamicGrid.getDeviceProfile(); + if (created) { + LauncherModel.updateWorkspaceLayoutCells((int) grid.numColumns, (int) grid.numRows); + } + // Update the icon size + Utilities.setIconSize(grid.iconSizePx); + grid.updateFromConfiguration(context.getResources(), width, height); + return grid; + } + DynamicGrid getDynamicGrid() { + return mDynamicGrid; + } + public boolean isScreenLarge() { return mIsScreenLarge; } |