summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/CellLayout.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2016-11-21 16:18:46 -0800
committerJon Miranda <jonmiranda@google.com>2016-11-23 10:32:42 -0800
commit7ae64ffbe11a629e54ced0c5c99cd47228b28821 (patch)
tree4923ae2227ef72ba5e6ec5b9942496bf42fe1fd9 /src/com/android/launcher3/CellLayout.java
parentfeba90fe802cb54e02dd961dbea265c044ad5f9e (diff)
downloadandroid_packages_apps_Trebuchet-7ae64ffbe11a629e54ced0c5c99cd47228b28821.tar.gz
android_packages_apps_Trebuchet-7ae64ffbe11a629e54ced0c5c99cd47228b28821.tar.bz2
android_packages_apps_Trebuchet-7ae64ffbe11a629e54ced0c5c99cd47228b28821.zip
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
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r--src/com/android/launcher3/CellLayout.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 3564cecee..9eaef90ce 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -2690,6 +2690,18 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
}
public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount) {
+ setup(cellWidth, cellHeight, invertHorizontally, colCount, 1.0f, 1.0f);
+ }
+
+ /**
+ * Use this method, as opposed to {@link #setup(int, int, boolean, int)}, if the view needs
+ * to be scaled.
+ *
+ * ie. In multi-window mode, we setup widgets so that they are measured and laid out
+ * using their full/invariant device profile sizes.
+ */
+ public void setup(int cellWidth, int cellHeight, boolean invertHorizontally, int colCount,
+ float cellScaleX, float cellScaleY) {
if (isLockedToGrid) {
final int myCellHSpan = cellHSpan;
final int myCellVSpan = cellVSpan;
@@ -2700,8 +2712,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
myCellX = colCount - myCellX - cellHSpan;
}
- width = myCellHSpan * cellWidth - leftMargin - rightMargin;
- height = myCellVSpan * cellHeight - topMargin - bottomMargin;
+ width = (int) (myCellHSpan * cellWidth / cellScaleX - leftMargin - rightMargin);
+ height = (int) (myCellVSpan * cellHeight / cellScaleY - topMargin - bottomMargin);
x = (myCellX * cellWidth + leftMargin);
y = (myCellY * cellHeight + topMargin);
}