diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-12-12 20:45:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-12-12 20:45:17 +0000 |
commit | 776ca257cefcf2a94e06bf89df6267c945708afe (patch) | |
tree | cac47db17673d314669327d41ec8baabdcc6baba /src/com/android/launcher3/ShortcutAndWidgetContainer.java | |
parent | 177bb5a9ba7c94a0ba5bfca842b2abf883b02bb7 (diff) | |
parent | c13403c612748bfdf06436510600230c4c4b55ec (diff) | |
download | android_packages_apps_Trebuchet-776ca257cefcf2a94e06bf89df6267c945708afe.tar.gz android_packages_apps_Trebuchet-776ca257cefcf2a94e06bf89df6267c945708afe.tar.bz2 android_packages_apps_Trebuchet-776ca257cefcf2a94e06bf89df6267c945708afe.zip |
Merge "Defining various modes for CellLayout: Workspace, Hotseat & Folder" into ub-launcher3-master
Diffstat (limited to 'src/com/android/launcher3/ShortcutAndWidgetContainer.java')
-rw-r--r-- | src/com/android/launcher3/ShortcutAndWidgetContainer.java | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index 342479f74..6c7376230 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -20,29 +20,19 @@ import android.app.WallpaperManager; import android.content.Context; import android.graphics.PointF; 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; @@ -51,13 +41,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) { @@ -105,19 +95,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) { |