summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/ShortcutAndWidgetContainer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/ShortcutAndWidgetContainer.java')
-rw-r--r--src/com/android/launcher3/ShortcutAndWidgetContainer.java28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index ff0604540..157b48a39 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -45,10 +45,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
private int mCountX;
private int mCountY;
+ private Launcher mLauncher;
+
private boolean mInvertIfRtl = false;
public ShortcutAndWidgetContainer(Context context) {
super(context);
+ mLauncher = (Launcher) context;
mWallpaperManager = WallpaperManager.getInstance(context);
}
@@ -76,14 +79,6 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
return null;
}
- public void addView(View child, int index, LayoutParams params, boolean inLayout) {
- if (!inLayout) {
- addView(child, index, params);
- } else {
- addViewInLayout(child, index, params, false);
- }
- }
-
@Override
protected void dispatchDraw(Canvas canvas) {
@SuppressWarnings("all") // suppress dead code warning
@@ -133,22 +128,19 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
}
int getCellContentWidth() {
- final LauncherAppState app = LauncherAppState.getInstance();
- final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ final DeviceProfile grid = mLauncher.getDeviceProfile();
return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
grid.hotseatCellWidthPx: grid.cellWidthPx);
}
int getCellContentHeight() {
- final LauncherAppState app = LauncherAppState.getInstance();
- final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ final DeviceProfile grid = mLauncher.getDeviceProfile();
return Math.min(getMeasuredHeight(), mIsHotseatLayout ?
grid.hotseatCellHeightPx : grid.cellHeightPx);
}
public void measureChild(View child) {
- final LauncherAppState app = LauncherAppState.getInstance();
- final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+ final DeviceProfile grid = mLauncher.getDeviceProfile();
final int cellWidth = mCellWidth;
final int cellHeight = mCellHeight;
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
@@ -177,12 +169,8 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
- private boolean invertLayoutHorizontally() {
- return mInvertIfRtl && isLayoutRtl();
- }
-
- public boolean isLayoutRtl() {
- return (getLayoutDirection() == LAYOUT_DIRECTION_RTL);
+ public boolean invertLayoutHorizontally() {
+ return mInvertIfRtl && Utilities.isRtl(getResources());
}
@Override