summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/CellLayout.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-04-16 14:56:57 -0700
committerAdam Cohen <adamcohen@google.com>2013-04-16 14:57:47 -0700
commit2374abfda3e53f84e005df8923170308e4df8c03 (patch)
treea6e7aca634b56c16006fdbf59b906d6d9cf0d92e /src/com/android/launcher2/CellLayout.java
parentae45db052a5e3e7817a09461558158a6670c013e (diff)
downloadandroid_packages_apps_Trebuchet-2374abfda3e53f84e005df8923170308e4df8c03.tar.gz
android_packages_apps_Trebuchet-2374abfda3e53f84e005df8923170308e4df8c03.tar.bz2
android_packages_apps_Trebuchet-2374abfda3e53f84e005df8923170308e4df8c03.zip
Making folders work in RTL (issue 8569879)
Change-Id: I3c726b96a2181c07be38cd84cf220e29e9b36f78
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r--src/com/android/launcher2/CellLayout.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index ddb9b6418..024bb37af 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -283,7 +283,9 @@ public class CellLayout extends ViewGroup {
mForegroundRect = new Rect();
mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context);
- mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
+ mCountX);
+
addView(mShortcutsAndWidgets);
}
@@ -331,9 +333,16 @@ public class CellLayout extends ViewGroup {
mOccupied = new boolean[mCountX][mCountY];
mTmpOccupied = new boolean[mCountX][mCountY];
mTempRectStack.clear();
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
+ mCountX);
requestLayout();
}
+ // Set whether or not to invert the layout horizontally if the layout is in RTL mode.
+ public void setInvertIfRtl(boolean invert) {
+ mShortcutsAndWidgets.setInvertIfRtl(invert);
+ }
+
private void invalidateBubbleTextView(BubbleTextView icon) {
final int padding = icon.getPressedOrFocusedBackgroundPadding();
invalidate(icon.getLeft() + getPaddingLeft() - padding,
@@ -985,7 +994,8 @@ public class CellLayout extends ViewGroup {
int vFreeSpace = vSpace - (mCountY * mCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
- mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
+ mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
+ mCountX);
} else {
mWidthGap = mOriginalWidthGap;
mHeightGap = mOriginalHeightGap;
@@ -3242,12 +3252,17 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
this.cellVSpan = cellVSpan;
}
- public void setup(int cellWidth, int cellHeight, int widthGap, int heightGap) {
+ public void setup(int cellWidth, int cellHeight, int widthGap, int heightGap,
+ boolean invertHorizontally, int colCount) {
if (isLockedToGrid) {
final int myCellHSpan = cellHSpan;
final int myCellVSpan = cellVSpan;
- final int myCellX = useTmpCoords ? tmpCellX : cellX;
- final int myCellY = useTmpCoords ? tmpCellY : cellY;
+ int myCellX = useTmpCoords ? tmpCellX : cellX;
+ int myCellY = useTmpCoords ? tmpCellY : cellY;
+
+ if (invertHorizontally) {
+ myCellX = colCount - myCellX - cellHSpan;
+ }
width = myCellHSpan * cellWidth + ((myCellHSpan - 1) * widthGap) -
leftMargin - rightMargin;