summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FolderPagedView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-04-07 09:27:07 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-04-07 12:52:37 -0700
commit3b0883fcda88dd192549055a387fb41e1c2c17ad (patch)
tree29cf23c47c4febd8e4c7d1c6d1b6918a22da5038 /src/com/android/launcher3/FolderPagedView.java
parent50062408bfa63fda4485807aa6a4f93ed1e0eac8 (diff)
downloadandroid_packages_apps_Trebuchet-3b0883fcda88dd192549055a387fb41e1c2c17ad.tar.gz
android_packages_apps_Trebuchet-3b0883fcda88dd192549055a387fb41e1c2c17ad.tar.bz2
android_packages_apps_Trebuchet-3b0883fcda88dd192549055a387fb41e1c2c17ad.zip
Fixing some RTL issues with scrollable folder
> folder name alingment > scroll hint direction > Fake animation direction for icons changing pages Change-Id: Ia17ab2861a6d72c876806427e2de1682976b7671
Diffstat (limited to 'src/com/android/launcher3/FolderPagedView.java')
-rw-r--r--src/com/android/launcher3/FolderPagedView.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 61ad10db4..1c42d2592 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -19,6 +19,7 @@ package com.android.launcher3;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
+import android.util.LayoutDirection;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -53,11 +54,18 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
private static final int SORT_ANIM_HIDE_DURATION = 130;
private static final int SORT_ANIM_SHOW_DURATION = 160;
+ /**
+ * Fraction of the width to scroll when showing the next page hint.
+ */
+ private static final float SCROLL_HINT_FRACTION = 0.07f;
+
private static final int[] sTempPosArray = new int[2];
// TODO: Remove this restriction
private static final int MAX_ITEMS_PER_PAGE = 4;
+ public final boolean rtlLayout;
+
private final LayoutInflater mInflater;
private final IconCache mIconCache;
@@ -94,6 +102,8 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
mInflater = LayoutInflater.from(context);
mIconCache = app.getIconCache();
+
+ rtlLayout = getResources().getConfiguration().getLayoutDirection() == LayoutDirection.RTL;
}
@Override
@@ -484,7 +494,7 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
if (getPageCount() > 1) {
mPageIndicator.setVisibility(View.VISIBLE);
mSortButton.setVisibility(View.VISIBLE);
- mFolder.mFolderName.setGravity(Gravity.START);
+ mFolder.mFolderName.setGravity(rtlLayout ? Gravity.RIGHT : Gravity.LEFT);
setEnableOverscroll(true);
} else {
mPageIndicator.setVisibility(View.GONE);
@@ -611,7 +621,9 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
/**
* Scrolls the current view by a fraction
*/
- public void showScrollHint(float fraction) {
+ public void showScrollHint(int direction) {
+ float fraction = (direction == DragController.SCROLL_LEFT) ^ rtlLayout
+ ? -SCROLL_HINT_FRACTION : SCROLL_HINT_FRACTION;
int hint = (int) (fraction * getWidth());
int scroll = getScrollForPage(getNextPage()) + hint;
int delta = scroll - mUnboundedScrollX;
@@ -761,7 +773,7 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
}
};
v.animate()
- .translationXBy(direction > 0 ? -v.getWidth() : v.getWidth())
+ .translationXBy((direction > 0 ^ rtlLayout) ? -v.getWidth() : v.getWidth())
.setDuration(REORDER_ANIMATION_DURATION)
.setStartDelay(0)
.withEndAction(endAction);