Folder UI fixes
> Fixing top padding (b/21304523)
> Alinging the label and page indicators to the icons
> Fixing folder label alingment in RTL (b/21445821)
> Updating footer animation (b/21336853)
Bug: 21304523, 21445821, 21336853
Change-Id: I2cf3a48c76653b19437b31252d6ee559ce798094
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index ec4ea04..a5b7a60 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -29,10 +29,12 @@
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Build;
+import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
import android.util.AttributeSet;
+import android.util.LayoutDirection;
import android.util.Log;
import android.view.ActionMode;
import android.view.KeyEvent;
@@ -89,7 +91,7 @@
*/
private static final float ICON_OVERSCROLL_WIDTH_FACTOR = 0.45f;
- public static final int FOOTER_ANIMATION_DURATION = 200;
+ private static final int FOLDER_NAME_ANIMATION_DURATION = 633;
private static final int REORDER_DELAY = 250;
private static final int ON_EXIT_CLOSE_DELAY = 400;
@@ -502,7 +504,6 @@
textAlpha.setStartDelay(mMaterialExpandStagger);
textAlpha.setInterpolator(new AccelerateInterpolator(1.5f));
-
anim.play(drift);
anim.play(iconsAlpha);
anim.play(textAlpha);
@@ -545,7 +546,8 @@
- mFooter.getPaddingLeft() - mFooter.getPaddingRight();
float textWidth = mFolderName.getPaint().measureText(mFolderName.getText().toString());
- mFolderName.setTranslationX((footerWidth - textWidth) / 2);
+ float translation = (footerWidth - textWidth) / 2;
+ mFolderName.setTranslationX(mContent.mIsRtl ? -translation : translation);
mContent.setMarkerScale(0);
// Do not update the flag if we are in drag mode. The flag will be updated, when we
@@ -555,7 +557,9 @@
@Override
public void onAnimationEnd(Animator animation) {
- mFolderName.animate().setDuration(FOOTER_ANIMATION_DURATION).translationX(0);
+ mFolderName.animate().setDuration(FOLDER_NAME_ANIMATION_DURATION)
+ .translationX(0)
+ .setInterpolator(new FastOutSlowInInterpolator());
mContent.animateMarkers();
if (updateAnimationFlag) {
@@ -1032,6 +1036,15 @@
mContent.setFixedSize(contentWidth, contentHeight);
mContentWrapper.measure(contentAreaWidthSpec, contentAreaHeightSpec);
+
+ if (mContent.getChildCount() > 0) {
+ int cellIconGap = (mContent.getPageAt(0).getCellWidth()
+ - mLauncher.getDeviceProfile().iconSizePx) / 2;
+ mFooter.setPadding(mContent.getPaddingLeft() + cellIconGap,
+ mFooter.getPaddingTop(),
+ mContent.getPaddingRight() + cellIconGap,
+ mFooter.getPaddingBottom());
+ }
mFooter.measure(contentAreaWidthSpec,
MeasureSpec.makeMeasureSpec(mFooterHeight, MeasureSpec.EXACTLY));