summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppState.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-10-25 15:24:24 -0700
committerDanesh M <daneshm90@gmail.com>2014-06-05 23:25:37 -0700
commitc46482fe2103a62e24b07d09975af346540079d8 (patch)
tree33e464ce79decfe207b796a7c0dc3a6fc34c9d15 /src/com/android/launcher3/LauncherAppState.java
parentd9fa00579bf09fc9f637ad9a36223ec09849c939 (diff)
downloadandroid_packages_apps_Trebuchet-c46482fe2103a62e24b07d09975af346540079d8.tar.gz
android_packages_apps_Trebuchet-c46482fe2103a62e24b07d09975af346540079d8.tar.bz2
android_packages_apps_Trebuchet-c46482fe2103a62e24b07d09975af346540079d8.zip
Initial changes to support smaller landscape layouts.
Change-Id: If0abe2b82eb08bae4f1ce65b805362d548acb876
Diffstat (limited to 'src/com/android/launcher3/LauncherAppState.java')
-rw-r--r--src/com/android/launcher3/LauncherAppState.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 4cf64edd8..1790d28b3 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -28,7 +28,7 @@ import com.android.launcher3.settings.SettingsProvider;
import java.lang.ref.WeakReference;
-public class LauncherAppState {
+public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
private static final String TAG = "LauncherAppState";
private static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
@@ -189,16 +189,17 @@ public class LauncherAppState {
DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight,
int width, int height,
int availableWidth, int availableHeight) {
-
- mDynamicGrid = new DynamicGrid(context,
- context.getResources(),
- minWidth, minHeight, width, height,
- availableWidth, availableHeight);
+ if (mDynamicGrid == null) {
+ mDynamicGrid = new DynamicGrid(context,
+ context.getResources(),
+ minWidth, minHeight, width, height,
+ availableWidth, availableHeight);
+ mDynamicGrid.getDeviceProfile().addCallback(this);
+ }
// Update the icon size
DeviceProfile grid = mDynamicGrid.getDeviceProfile();
- Utilities.setIconSize(grid.iconSizePx);
- grid.updateFromConfiguration(context.getResources(), width, height,
+ grid.updateFromConfiguration(context, context.getResources(), width, height,
availableWidth, availableHeight);
return grid;
}
@@ -227,4 +228,9 @@ public class LauncherAppState {
public int getLongPressTimeout() {
return mLongPressTimeout;
}
+
+ @Override
+ public void onAvailableSizeChanged(DeviceProfile grid) {
+ Utilities.setIconSize(grid.iconSizePx);
+ }
}