summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-07-27 14:36:07 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-07-31 12:03:33 -0700
commite5bb705fb79f18df8680958dcf2c5460e16c90b6 (patch)
tree33c20c832cf07556ca8d0d3c114489c95190a3f0 /src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
parente40e77b34f6521d3caaa8eb49b9e073258e91f56 (diff)
downloadandroid_packages_apps_Trebuchet-e5bb705fb79f18df8680958dcf2c5460e16c90b6.tar.gz
android_packages_apps_Trebuchet-e5bb705fb79f18df8680958dcf2c5460e16c90b6.tar.bz2
android_packages_apps_Trebuchet-e5bb705fb79f18df8680958dcf2c5460e16c90b6.zip
Homescreen migration from a larger grid to a smaller grid.
Adding support for restoring from a larger device, if the grid size difference is not more that 1. During restore add all the items in the DB, and run a one-time migration the next time launcher starts. The migration strategy is defined in ShrinkWorkspaceTask.java which involves resizing, moving and removing some items. Change-Id: I6ee411f6db5bf0152b527e16146a88c56dec2d97
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetProviderInfo.java')
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetProviderInfo.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
index 85af92f30..9ba78530d 100644
--- a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
@@ -5,6 +5,7 @@ import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
@@ -110,4 +111,15 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo {
mMinSpanY = minResizeSpan[1];
}
}
+
+ public Point getMinSpans(InvariantDeviceProfile idp, Context context) {
+ // Calculate the spans corresponding to any one of the orientations as it should not change
+ // based on orientation.
+ // TODO: Use the max of both profiles
+ int[] minSpans = CellLayout.rectToCell(
+ idp.portraitProfile, context, minResizeWidth, minResizeHeight, null);
+ return new Point(
+ (resizeMode & RESIZE_HORIZONTAL) != 0 ? minSpans[0] : -1,
+ (resizeMode & RESIZE_VERTICAL) != 0 ? minSpans[1] : -1);
+ }
}