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
This commit is contained in:
parent
761e820ae2
commit
a07c2f5c80
|
@ -40,7 +40,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingTop="8dp"
|
||||
launcher:pageIndicator="@+id/folder_page_indicator" />
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
|||
android:id="@+id/folder_footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp" >
|
||||
|
@ -63,8 +64,8 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:hint="@string/folder_hint_text"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:paddingBottom="@dimen/folder_name_padding"
|
||||
android:paddingTop="@dimen/folder_name_padding"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="4dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff777777"
|
||||
android:textColorHighlight="#ffCCCCCC"
|
||||
|
@ -78,6 +79,7 @@
|
|||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
layout="@layout/page_indicator" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.launcher3.Folder>
|
|
@ -114,7 +114,6 @@
|
|||
<!-- Folders -->
|
||||
<!-- The amount that the preview contents are inset from the preview background -->
|
||||
<dimen name="folder_preview_padding">4dp</dimen>
|
||||
<dimen name="folder_name_padding">10dp</dimen>
|
||||
|
||||
<!-- Sizes for managed profile badges -->
|
||||
<dimen name="profile_badge_size">24dp</dimen>
|
||||
|
|
|
@ -29,10 +29,12 @@ import android.graphics.Point;
|
|||
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 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
*/
|
||||
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 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
textAlpha.setStartDelay(mMaterialExpandStagger);
|
||||
textAlpha.setInterpolator(new AccelerateInterpolator(1.5f));
|
||||
|
||||
|
||||
anim.play(drift);
|
||||
anim.play(iconsAlpha);
|
||||
anim.play(textAlpha);
|
||||
|
@ -545,7 +546,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
- 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 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
|
||||
@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 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
|
||||
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));
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.view.Gravity;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
|
||||
import com.android.launcher3.FocusHelper.PagedFolderKeyEventListener;
|
||||
|
@ -46,7 +47,12 @@ public class FolderPagedView extends PagedView {
|
|||
private static final int START_VIEW_REORDER_DELAY = 30;
|
||||
private static final float VIEW_REORDER_DELAY_FACTOR = 0.9f;
|
||||
|
||||
private static final int PAGE_INDICATOR_ANIMATION_DELAY = 150;
|
||||
private static final int PAGE_INDICATOR_ANIMATION_START_DELAY = 300;
|
||||
private static final int PAGE_INDICATOR_ANIMATION_STAGGERED_DELAY = 150;
|
||||
private static final int PAGE_INDICATOR_ANIMATION_DURATION = 400;
|
||||
|
||||
// This value approximately overshoots to 1.5 times the original size.
|
||||
private static final float PAGE_INDICATOR_OVERSHOOT_TENSION = 4.9f;
|
||||
|
||||
/**
|
||||
* Fraction of the width to scroll when showing the next page hint.
|
||||
|
@ -274,6 +280,7 @@ public class FolderPagedView extends PagedView {
|
|||
arrangeChildren(list, itemCount, true);
|
||||
}
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
private void arrangeChildren(ArrayList<View> list, int itemCount, boolean saveChanges) {
|
||||
ArrayList<CellLayout> pages = new ArrayList<CellLayout>();
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
|
@ -340,7 +347,9 @@ public class FolderPagedView extends PagedView {
|
|||
|
||||
// Update footer
|
||||
mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
|
||||
mFolder.mFolderName.setGravity(getPageCount() > 1 ? Gravity.START : Gravity.CENTER_HORIZONTAL);
|
||||
// Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
|
||||
mFolder.mFolderName.setGravity(getPageCount() > 1 ?
|
||||
(mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
|
||||
}
|
||||
|
||||
public int getDesiredWidth() {
|
||||
|
@ -645,12 +654,13 @@ public class FolderPagedView extends PagedView {
|
|||
|
||||
public void animateMarkers() {
|
||||
int count = mPageIndicator.getChildCount();
|
||||
OvershootInterpolator interpolator = new OvershootInterpolator(4);
|
||||
Interpolator interpolator = new OvershootInterpolator(PAGE_INDICATOR_OVERSHOOT_TENSION);
|
||||
for (int i = 0; i < count; i++) {
|
||||
mPageIndicator.getChildAt(i).animate().scaleX(1).scaleY(1)
|
||||
.setInterpolator(interpolator)
|
||||
.setDuration(Folder.FOOTER_ANIMATION_DURATION)
|
||||
.setStartDelay(PAGE_INDICATOR_ANIMATION_DELAY * i);
|
||||
.setDuration(PAGE_INDICATOR_ANIMATION_DURATION)
|
||||
.setStartDelay(PAGE_INDICATOR_ANIMATION_STAGGERED_DELAY * i
|
||||
+ PAGE_INDICATOR_ANIMATION_START_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue