Scale widgets in multi-window mode.

To keep this CL small and focused, I'm going to create
a separate CL that handles the scaling for the widget in
drag and drop mode.

Bug: 32176631
Change-Id: Id6557d070edb664aa1f4851de7abf494cf8a0677
This commit is contained in:
Jon Miranda committed 2016-11-23 10:32:42 -08:00
1 parent feba90fe80
commit 7ae64ffbe1
4 files changed
+52 -13

No files matched your search

@@ -21,6 +21,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.view.Gravity;
@@ -123,6 +124,9 @@ public class DeviceProfile {
public int allAppsIconDrawablePaddingPx;
public float allAppsIconTextSizePx;
// Widgets
public final PointF appWidgetScale = new PointF(1.0f, 1.0f);
// Drop Target
public int dropTargetBarSizePx;
@@ -220,6 +224,12 @@ public class DeviceProfile {
// The nav bar is black so we add bottom padding to visually center hotseat icons.
profile.hotseatBarBottomPaddingPx = profile.hotseatBarTopPaddingPx;
// We use these scales to measure and layout the widgets using their full invariant profile
// sizes and then draw them scaled and centered to fit in their multi-window mode cellspans.
float appWidgetScaleX = (float) profile.getCellSize().x / getCellSize().x;
float appWidgetScaleY = (float) profile.getCellSize().y / getCellSize().y;
profile.appWidgetScale.set(appWidgetScaleX, appWidgetScaleY);
return profile;
}