summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/ShortcutAndWidgetContainer.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-11-18 23:44:48 -0800
committerSunny Goyal <sunnygoyal@google.com>2016-11-21 15:20:16 +0530
commitc13403c612748bfdf06436510600230c4c4b55ec (patch)
treeb6b8266eb906cb7f4a2c920f7924d1801de1b97e /src/com/android/launcher3/ShortcutAndWidgetContainer.java
parentaa8a871e337fe42e9339b96833eaf37bf2b64b2f (diff)
downloadandroid_packages_apps_Trebuchet-c13403c612748bfdf06436510600230c4c4b55ec.tar.gz
android_packages_apps_Trebuchet-c13403c612748bfdf06436510600230c4c4b55ec.tar.bz2
android_packages_apps_Trebuchet-c13403c612748bfdf06436510600230c4c4b55ec.zip
Defining various modes for CellLayout: Workspace, Hotseat & Folder
> Moving the definition of modes to xml > Defining attributes in xml Change-Id: I7a569fdbeb833d569eeeef2f2cbc8214e608ad11
Diffstat (limited to 'src/com/android/launcher3/ShortcutAndWidgetContainer.java')
-rw-r--r--src/com/android/launcher3/ShortcutAndWidgetContainer.java32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 5f89af6ca..9568d5792 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -19,29 +19,19 @@ package com.android.launcher3;
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Rect;
-import android.support.annotation.IntDef;
import android.view.View;
import android.view.ViewGroup;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
+import com.android.launcher3.CellLayout.ContainerType;
public class ShortcutAndWidgetContainer extends ViewGroup {
static final String TAG = "ShortcutAndWidgetContainer";
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({DEFAULT, HOTSEAT, FOLDER})
- public @interface ContainerType{}
- public static final int DEFAULT = 0;
- public static final int HOTSEAT = 1;
- public static final int FOLDER = 2;
-
- private int mContainerType = DEFAULT;
-
// These are temporary variables to prevent having to allocate a new object just to
// return an (x, y) value from helper functions. Do NOT use them to maintain other state.
private final int[] mTmpCellXY = new int[2];
+ @ContainerType private final int mContainerType;
private final WallpaperManager mWallpaperManager;
private int mCellWidth;
@@ -50,13 +40,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
private int mCountX;
private Launcher mLauncher;
-
private boolean mInvertIfRtl = false;
- public ShortcutAndWidgetContainer(Context context) {
+ public ShortcutAndWidgetContainer(Context context, @ContainerType int containerType) {
super(context);
mLauncher = Launcher.getLauncher(context);
mWallpaperManager = WallpaperManager.getInstance(context);
+ mContainerType = containerType;
}
public void setCellDimensions(int cellWidth, int cellHeight, int countX, int countY) {
@@ -104,19 +94,9 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
mInvertIfRtl = invert;
}
- public void setContainerType(@ContainerType int containerType) {
- mContainerType = containerType;
- }
-
int getCellContentHeight() {
- final DeviceProfile grid = mLauncher.getDeviceProfile();
- int cellContentHeight = grid.cellHeightPx;
- if (mContainerType == HOTSEAT) {
- cellContentHeight = grid.hotseatCellHeightPx;
- } else if (mContainerType == FOLDER) {
- cellContentHeight = grid.folderCellHeightPx;
- }
- return Math.min(getMeasuredHeight(), cellContentHeight);
+ return Math.min(getMeasuredHeight(),
+ mLauncher.getDeviceProfile().getCellHeight(mContainerType));
}
public void measureChild(View child) {