summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHayden Schoen <hayden@cyngn.com>2015-07-09 19:58:56 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-07-14 09:52:47 -0700
commit2ee7ccecc8705f48d05104e0dcba9f118195af56 (patch)
treefac1caad6a6701e812d99e2e059e819eeb76896e
parent9711ba2542f4a15ed5dce442886a6a86d3ac0fa6 (diff)
downloadandroid_packages_apps_Trebuchet-2ee7ccecc8705f48d05104e0dcba9f118195af56.tar.gz
android_packages_apps_Trebuchet-2ee7ccecc8705f48d05104e0dcba9f118195af56.tar.bz2
android_packages_apps_Trebuchet-2ee7ccecc8705f48d05104e0dcba9f118195af56.zip
Folder Layout Revision
Updated the folder layout to reflect design revisions based on community feedback Change-Id: Ica1bb796dfccf779a954cf0903a1ae94a010ea1a
-rw-r--r--[-rwxr-xr-x]res/drawable-hdpi/folder_bg.9.pngbin197 -> 823 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-hdpi/folder_fill_highlight.9.pngbin429 -> 14914 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-mdpi/folder_bg.9.pngbin149 -> 510 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-mdpi/folder_fill_highlight.9.pngbin324 -> 14764 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-xhdpi/folder_bg.9.pngbin246 -> 1023 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-xhdpi/folder_fill_highlight.9.pngbin594 -> 15075 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-xxhdpi/folder_bg.9.pngbin320 -> 1678 bytes
-rw-r--r--[-rwxr-xr-x]res/drawable-xxhdpi/folder_fill_highlight.9.pngbin811 -> 15836 bytes
-rw-r--r--res/layout-land/launcher.xml13
-rw-r--r--res/layout-port/launcher.xml13
-rw-r--r--res/layout-sw720dp/launcher.xml13
-rw-r--r--res/layout/user_folder.xml76
-rw-r--r--res/values/dimens.xml6
-rw-r--r--src/com/android/launcher3/Folder.java263
-rw-r--r--src/com/android/launcher3/FolderIcon.java47
-rw-r--r--src/com/android/launcher3/Launcher.java13
16 files changed, 119 insertions, 325 deletions
diff --git a/res/drawable-hdpi/folder_bg.9.png b/res/drawable-hdpi/folder_bg.9.png
index 4b2108053..ee0090c09 100755..100644
--- a/res/drawable-hdpi/folder_bg.9.png
+++ b/res/drawable-hdpi/folder_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/folder_fill_highlight.9.png b/res/drawable-hdpi/folder_fill_highlight.9.png
index c7dde8930..b82302ba6 100755..100644
--- a/res/drawable-hdpi/folder_fill_highlight.9.png
+++ b/res/drawable-hdpi/folder_fill_highlight.9.png
Binary files differ
diff --git a/res/drawable-mdpi/folder_bg.9.png b/res/drawable-mdpi/folder_bg.9.png
index 36154e2fb..4039da560 100755..100644
--- a/res/drawable-mdpi/folder_bg.9.png
+++ b/res/drawable-mdpi/folder_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/folder_fill_highlight.9.png b/res/drawable-mdpi/folder_fill_highlight.9.png
index 418048471..7c6a0d456 100755..100644
--- a/res/drawable-mdpi/folder_fill_highlight.9.png
+++ b/res/drawable-mdpi/folder_fill_highlight.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/folder_bg.9.png b/res/drawable-xhdpi/folder_bg.9.png
index c3a30837a..1fbe1d80f 100755..100644
--- a/res/drawable-xhdpi/folder_bg.9.png
+++ b/res/drawable-xhdpi/folder_bg.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/folder_fill_highlight.9.png b/res/drawable-xhdpi/folder_fill_highlight.9.png
index c1a4f702f..f5f0bd08d 100755..100644
--- a/res/drawable-xhdpi/folder_fill_highlight.9.png
+++ b/res/drawable-xhdpi/folder_fill_highlight.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/folder_bg.9.png b/res/drawable-xxhdpi/folder_bg.9.png
index d698a0750..3b2bc4253 100755..100644
--- a/res/drawable-xxhdpi/folder_bg.9.png
+++ b/res/drawable-xxhdpi/folder_bg.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/folder_fill_highlight.9.png b/res/drawable-xxhdpi/folder_fill_highlight.9.png
index c80ead243..4dc29f46c 100755..100644
--- a/res/drawable-xxhdpi/folder_fill_highlight.9.png
+++ b/res/drawable-xxhdpi/folder_fill_highlight.9.png
Binary files differ
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 4242b065d..a865bc6ca 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -29,19 +29,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
- android:alpha=".5"
+ android:alpha="1.0"
android:clipToPadding="false">
- <View
- android:id="@+id/reveal_fake_page"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/folder_background"/>
-
- <View
- android:id="@+id/reveal_fake_folder_outline"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/folder_bg_opaque"/>
<ImageView
android:id="@+id/reveal_fake_folder_icon"
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 9ff292824..09da8fcd7 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -29,19 +29,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
- android:alpha=".5"
+ android:alpha="1.0"
android:clipToPadding="false">
- <View
- android:id="@+id/reveal_fake_page"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/folder_background"/>
-
- <View
- android:id="@+id/reveal_fake_folder_outline"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/folder_bg_opaque"/>
<ImageView
android:id="@+id/reveal_fake_folder_icon"
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index abf06ae25..3a7f8c05e 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -29,19 +29,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
- android:alpha=".5"
+ android:alpha="1.0"
android:clipToPadding="false">
- <View
- android:id="@+id/reveal_fake_page"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/folder_background"/>
-
- <View
- android:id="@+id/reveal_fake_folder_outline"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/folder_bg_opaque"/>
<ImageView
android:id="@+id/reveal_fake_folder_icon"
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index 2339e7a93..aae5e4bd9 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -15,30 +15,20 @@
-->
<com.android.launcher3.Folder
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
+ android:paddingTop="16dp"
android:paddingStart="@dimen/folder_preview_padding"
android:paddingEnd="@dimen/folder_preview_padding"
- android:layout_gravity="center">
-
- <ImageView
- android:id="@+id/folder_lock"
- android:layout_width="@dimen/folder_lock_icon"
- android:layout_height="@dimen/folder_lock_icon"
- android:paddingBottom="@dimen/folder_name_padding"
- android:paddingTop="@dimen/folder_name_padding"
- android:paddingLeft="@dimen/folder_name_padding"
- android:paddingRight="@dimen/folder_name_padding"
- android:layout_gravity="center_horizontal"
- android:layout_marginBottom="@dimen/folder_lock_margin"
- android:src="@drawable/folder_unlocked" />
+ android:paddingBottom="@dimen/folder_preview_padding"
+ android:layout_gravity="center"
+ android:background="@drawable/folder_bg">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<com.android.launcher3.CellLayout
android:id="@+id/folder_content"
@@ -48,24 +38,42 @@
android:hapticFeedbackEnabled="false" />
</ScrollView>
- <com.android.launcher3.FolderEditText
- android:id="@+id/folder_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:background="#00000000"
- android:fontFamily="sans-serif-condensed"
- android:gravity="center_horizontal"
- android:layout_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:singleLine="true"
- android:textColor="@color/workspace_icon_text_color"
- android:textColorHighlight="#ffCCCCCC"
- android:textColorHint="#78ffffff"
- android:textCursorDrawable="@null"
- android:textSize="20sp" />
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/folder_name_lock_container">
+
+ <ImageView
+ android:id="@+id/folder_lock"
+ android:layout_width="@dimen/folder_lock_icon"
+ android:layout_height="@dimen/folder_lock_icon"
+ android:padding="@dimen/folder_name_padding"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentBottom="true"
+ android:src="@drawable/folder_unlocked" />
+
+ <com.android.launcher3.FolderEditText
+ android:id="@+id/folder_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@android:color/transparent"
+ android:fontFamily="sans-serif-condensed"
+ android:hint="@string/folder_hint_text"
+ android:imeOptions="flagNoExtractUi"
+ android:paddingBottom="@dimen/folder_name_padding"
+ android:paddingTop="@dimen/folder_name_padding"
+ android:layout_marginStart="@dimen/folder_name_padding"
+ android:gravity="center_vertical"
+ android:singleLine="true"
+ android:textColor="@color/workspace_icon_text_color"
+ android:textColorHighlight="#ffCCCCCC"
+ android:textColorHint="#78ffffff"
+ android:textCursorDrawable="@null"
+ android:textSize="18sp"
+ android:layout_toStartOf="@id/folder_lock"
+ android:layout_alignTop="@id/folder_lock"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentBottom="true"/>
+ </RelativeLayout>
</com.android.launcher3.Folder>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b915a2876..97a12abdc 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -103,14 +103,14 @@
<!-- Folders -->
<!-- The amount that the preview contents are inset from the preview background -->
- <dimen name="folder_preview_padding">4dp</dimen>
+ <dimen name="folder_preview_padding">10dp</dimen>
<dimen name="folder_lock_margin">6dp</dimen>
<dimen name="folder_name_padding">10dp</dimen>
- <dimen name="folder_lock_icon">50dp</dimen>
+ <dimen name="folder_lock_icon">48dp</dimen>
<!-- Folder icon dimens -->
<dimen name="folder_icon">64dp</dimen>
- <dimen name="folder_icon_app_preview">26dp</dimen>
+ <dimen name="folder_icon_app_preview">22dp</dimen>
<!-- Sizes for managed profile badges -->
<dimen name="profile_badge_size">24dp</dimen>
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 614e1cd20..d10be4efc 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -39,6 +39,7 @@ import android.text.Selection;
import android.text.Spannable;
import android.text.TextUtils;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
import android.view.ActionMode;
@@ -48,7 +49,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewAnimationUtils;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateInterpolator;
@@ -94,6 +94,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private static final int CLOSE_FOLDER_DELAY_MS = 150;
+ private static final int ALPHA_DELAY_MULT = 15;
+
private final PowerManager mPowerManager;
private int mExpandDuration;
@@ -130,8 +132,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private boolean mDeleteFolderOnDropCompleted = false;
private boolean mSuppressFolderDeletion = false;
private boolean mItemAddedBackToSelfViaIcon = false;
+ View mFolderNameLockContainer;
FolderEditText mFolderName;
ImageView mFolderLock;
+ private int mScreenWidth;
private float mFolderIconPivotX;
private float mFolderIconPivotY;
private boolean mHideLabels;
@@ -228,6 +232,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mContent.setGridSize(0, 0);
mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
mContent.setInvertIfRtl(true);
+ mFolderNameLockContainer = findViewById(R.id.folder_name_lock_container);
mFolderName = (FolderEditText) findViewById(R.id.folder_name);
mFolderName.setFolder(this);
mFolderName.setOnFocusChangeListener(this);
@@ -256,6 +261,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderLock.measure(measureSpec, measureSpec);
mFolderLock.setOnClickListener(this);
mFolderLockHeight = mFolderLock.getMeasuredHeight();
+
+ DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();
+ mScreenWidth = displayMetrics.widthPixels;
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@@ -552,29 +560,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
View reveal = mLauncher.findViewById(R.id.reveal_fake_page_container);
reveal.setVisibility(View.VISIBLE);
- View revealPage = mLauncher.findViewById(R.id.reveal_fake_page);
- revealPage.setVisibility(View.VISIBLE);
- View revealOutline = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
- revealOutline.setVisibility(View.INVISIBLE);
View revealFolderIcon = mLauncher.findViewById(R.id.reveal_fake_folder_icon);
revealFolderIcon.setVisibility(View.INVISIBLE);
}
- private void prepareOutline() {
- View outline = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) outline.getLayoutParams();
- int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
- int height = getFolderHeight();
-
- lp.width = width;
- lp.height = height;
- outline.setLayoutParams(lp);
-
- outline.setX(mLeft);
- outline.setY(mTop);
- outline.setVisibility(View.INVISIBLE);
- }
-
private void prepareFakeFolderIcon() {
mFolderIcon.buildDrawingCache(true);
@@ -620,7 +609,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return animator;
}
- public void animateOpen(Workspace workspace) {
+ public void animateOpen(Workspace workspace, int[] folderTouch) {
if (!(getParent() instanceof DragLayer)) return;
Animator openFolderAnim = null;
@@ -660,14 +649,41 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
- View[] alphaViewSet = new View[] { mFolderLock, mContent, mFolderName };
- for (View view : alphaViewSet) {
- Animator alphaAnimator = setupAlphaAnimator(view, 0f, 1f,
- mMaterialExpandDuration, mMaterialExpandStagger);
+ int[] folderLocation = new int[2];
+ getLocationOnScreen(folderLocation);
+
+ int circX = folderTouch[0] - folderLocation[0];
+ int circY = folderTouch[1] - folderLocation[1];
+
+ Animator circReveal = LauncherAnimUtils.createCircularReveal(this,
+ circX, circY, 0, mScreenWidth);
- anim.play(alphaAnimator);
+ final View[] alphaViewSet = new View[] { mFolderNameLockContainer,
+ mContent, mFolderName, mFolderLock };
+ for (View view : alphaViewSet) {
+ view.setAlpha(0f);
}
+ circReveal.setDuration(150);
+ circReveal.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+
+ int i = 0;
+ for (View view : alphaViewSet) {
+ view.setVisibility(VISIBLE);
+ Animator alphaAnimator = setupAlphaAnimator(view, 0f, 1f,
+ mMaterialExpandDuration, mMaterialExpandStagger);
+ alphaAnimator.setStartDelay(ALPHA_DELAY_MULT * i);
+ alphaAnimator.start();
+ i++;
+ }
+ }
+ });
+
+ circReveal.start();
+
Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty);
drift.setDuration(mMaterialExpandDuration);
drift.setStartDelay(mMaterialExpandStagger);
@@ -705,7 +721,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
fakeFolderIcon.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
- mFolderIcon.setPreviewBackground(-1);
mFolderIcon.setAlpha(0);
fakeFolderIconView.setVisibility(View.VISIBLE);
}
@@ -718,27 +733,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Animator revealAnim = null;
prepareReveal();
- if (!mIsExternalDrag) {
- revealAnim = getFolderIconRevealAnimator(false);
- } else {
- prepareOutline();
- View revealFakeView = mLauncher.findViewById(R.id.reveal_fake_page);
- revealFakeView.setVisibility(View.INVISIBLE);
- View outlineView = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
- outlineView.setAlpha(0f);
- outlineView.setVisibility(View.VISIBLE);
-
- float baseOutlineTranslationY = outlineView.getTranslationY();
- PropertyValuesHolder outlineTransY = PropertyValuesHolder.ofFloat("translationY",
- baseOutlineTranslationY + transY, baseOutlineTranslationY);
-
- PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f);
- revealAnim = LauncherAnimUtils.ofPropertyValuesHolder(outlineView, alpha,
- outlineTransY);
- revealAnim.setDuration(mMaterialExpandDuration);
- revealAnim.setStartDelay(mMaterialExpandStagger);
- revealAnim.setInterpolator(new LogDecelerateInterpolator(60, 0));
- }
if (revealAnim != null) {
anim.play(revealAnim);
@@ -786,44 +780,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
}
- private Animator getFolderIconRevealAnimator(boolean reverse) {
- DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
- float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
-
- int centerX = (int) (mTempRect.left + mTempRect.width() * scale / 2);
- int centerY = (int) (mTempRect.top + mTempRect.height() * scale / 2);
-
- float targetRadius = 0;
- return getRevealAnimator(reverse, centerX, centerY, targetRadius);
- }
-
- private Animator getFolderRevealAnimator(boolean reverse) {
- DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
- float scale = parent.getDescendantRectRelativeToSelf(this, mTempRect);
-
- int centerX = (int) (mTempRect.left + mTempRect.width() * scale / 2);
- int centerY = (int) (mTempRect.top + mTempRect.height() * scale / 2);
-
- float targetRadius = 0;
- return getRevealAnimator(reverse, centerX, centerY, targetRadius);
- }
-
- private Animator getRevealAnimator(boolean reverse, int centerX, int centerY,
- float targetRadius) {
- View reveal = mLauncher.findViewById(R.id.reveal_fake_page);
- int height = reveal.getMeasuredHeight();
-
- float startRadius = targetRadius;
- float endRadius = height;
-
- if (reverse) {
- endRadius = startRadius;
- startRadius = height;
- }
- return ViewAnimationUtils.createCircularReveal(reveal, centerX,
- centerY, startRadius, endRadius);
- }
-
public void beginExternalDrag(ShortcutInfo item) {
setupContentForNumItems(getItemCount() + 1);
findAndSetEmptyCells(item);
@@ -881,14 +837,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, translationY);
}
- oa.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- if (animate && !mDragController.isDragging()) {
- hideFolderOutline(false);
- }
- }
- });
oa.setDuration(mMaterialExpandDuration);
oa.setInterpolator(new LogDecelerateInterpolator(60, 0));
anim.play(oa);
@@ -899,42 +847,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Animator fakeFolderIconAnim = null;
if (animate) {
- if (!mDragInProgress) {
- reverseRevealAnim = getFolderIconRevealAnimator(true);
- reverseRevealAnim.setInterpolator(new DecelerateInterpolator(2f));
- reverseRevealAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- View revealView = mLauncher.findViewById(R.id.reveal_fake_page_container);
- revealView.setVisibility(View.INVISIBLE);
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- View outline = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
- outline.setVisibility(View.INVISIBLE);
- }
- });
- } else {
- prepareOutline();
- View revealFakeView = mLauncher.findViewById(R.id.reveal_fake_page);
- revealFakeView.setVisibility(View.INVISIBLE);
- View outlineView = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
- outlineView.setAlpha(1f);
- outlineView.setVisibility(View.VISIBLE);
-
- float baseOutlineTranslationY = outlineView.getTranslationY();
- PropertyValuesHolder outlineTransY = PropertyValuesHolder.ofFloat("translationY",
- baseOutlineTranslationY, baseOutlineTranslationY + transY);
-
- PropertyValuesHolder outlineAlpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f);
- reverseRevealAnim = LauncherAnimUtils.ofPropertyValuesHolder(outlineView,
- outlineAlpha, outlineTransY);
-
- reverseRevealAnim.setDuration(mMaterialExpandDuration);
- reverseRevealAnim.setStartDelay(mMaterialExpandStagger);
- reverseRevealAnim.setInterpolator(new DecelerateInterpolator(2f));
- }
prepareFakeFolderIcon();
float iconTransY = getResources().getInteger(R.integer.folder_icon_translate_y_dist);
@@ -952,7 +864,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
fakeFolderIconAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
- mFolderIcon.setPreviewBackground(-1);
mFolderIcon.setAlpha(0);
fakeFolderIconView.setVisibility(View.VISIBLE);
}
@@ -961,7 +872,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onAnimationEnd(Animator animation) {
fakeFolderIconView.setVisibility(View.INVISIBLE);
mFolderIcon.setAlpha(1);
- mFolderIcon.setPreviewBackground(R.drawable.folder_bg);
View revealView = mLauncher.findViewById(R.id.reveal_fake_page_container);
revealView.setVisibility(View.INVISIBLE);
@@ -971,7 +881,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
View revealView = mLauncher.findViewById(R.id.reveal_fake_page_container);
revealView.setVisibility(View.INVISIBLE);
mFolderIcon.setAlpha(1);
- mFolderIcon.setPreviewBackground(R.drawable.folder_bg);
}
if (workspaceAnim != null) {
@@ -1058,10 +967,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mPreviousTargetCell[0] = -1;
mPreviousTargetCell[1] = -1;
mOnExitAlarm.cancelAlarm();
-
- if (mState != STATE_ANIMATING && !mIsExternalDrag) {
- showFolderOutline(true);
- }
}
OnAlarmListener mReorderAlarmListener = new OnAlarmListener() {
@@ -1215,10 +1120,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mOnExitAlarm.setAlarm(ON_EXIT_CLOSE_DELAY);
}
mReorderAlarm.cancelAlarm();
-
- if (!mDragController.isDragging()) {
- hideFolderOutline(true);
- }
}
public void onDropCompleted(final View target, final DragObject d,
@@ -1266,7 +1167,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mSuppressOnAdd = false;
if (mState == STATE_OPEN) {
- hideFolderOutline(true);
mLauncher.hideSearch();
} else if (mState == STATE_SMALL) {
mLauncher.showSearch();
@@ -1480,7 +1380,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
private int getFolderHeight() {
- int height = getPaddingTop() + getPaddingBottom() + mFolderNameHeight + mFolderLockHeight
+ int height = getPaddingTop() + getPaddingBottom() + mFolderNameHeight
+ getContentAreaHeight();
return height;
}
@@ -1505,6 +1405,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderName.measure(contentAreaWidthSpec, MeasureSpec.makeMeasureSpec(
mFolderNameHeight, MeasureSpec.EXACTLY));
}
+ mFolderNameLockContainer.measure(contentAreaWidthSpec,
+ MeasureSpec.makeMeasureSpec(mFolderNameHeight,MeasureSpec.EXACTLY));
setMeasuredDimension(width, height);
}
@@ -1821,81 +1723,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// handle the special cancel cases (when the user quickly picks up and drops an in the folder)
private boolean mCancelAnim = false;
- private void showFolderOutline(boolean animate) {
- final View revealView = mLauncher.findViewById(R.id.reveal_fake_page);
- final View outline = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
-
- if (mHideOutlinesAnimator != null && mHideOutlinesAnimator.isRunning()) {
- mHideOutlinesAnimator.cancel();
- }
- prepareOutline();
-
- if (!animate) {
- revealView.setVisibility(View.INVISIBLE);
- outline.setVisibility(View.VISIBLE);
- return;
- }
-
- mRevealOutlinesAnimator = getFolderRevealAnimator(true);
- mRevealOutlinesAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (mCancelAnim) {
- mCancelAnim = false;
- } else {
- revealView.setVisibility(View.INVISIBLE);
- }
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- outline.setAlpha(1f);
- outline.setVisibility(View.VISIBLE);
- }
- });
-
- mRevealOutlinesAnimator.start();
- }
-
- private void hideFolderOutline(boolean animate) {
- final View revealView = mLauncher.findViewById(R.id.reveal_fake_page);
- final View outline = mLauncher.findViewById(R.id.reveal_fake_folder_outline);
-
- if (revealView.getVisibility() == View.VISIBLE) {
- // Nothing to do here
- return;
- }
-
- if (mRevealOutlinesAnimator != null && mRevealOutlinesAnimator.isRunning()) {
- mCancelAnim = true;
- mRevealOutlinesAnimator.cancel();
- }
-
- if (!animate) {
- revealView.setVisibility(View.VISIBLE);
- outline.setVisibility(View.INVISIBLE);
- return;
- }
-
- mHideOutlinesAnimator = getFolderRevealAnimator(false);
- mHideOutlinesAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- revealView.setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (mCancelAnim) {
- mCancelAnim = false;
- } else {
- outline.setVisibility(View.INVISIBLE);
- }
- }
- });
-
- mHideOutlinesAnimator.start();
- }
@Override
public void getHitRectRelativeToDragLayer(Rect outRect) {
diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java
index 03bb1e34a..214ec3241 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -69,7 +69,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
private static final float INNER_RING_GROWTH_FACTOR = 0.0f;
// The degree to which the outer ring is scaled in its natural state
- private static final float OUTER_RING_GROWTH_FACTOR = 0.15f;
+ private static final float OUTER_RING_GROWTH_FACTOR = 0.1f;
// The amount of vertical spread between items in the stack [0...1]
private static final float PERSPECTIVE_SHIFT_FACTOR = 0.18f;
@@ -183,11 +183,13 @@ public class FolderIcon extends FrameLayout implements FolderListener {
icon.setDrawingCacheEnabled(true);
// get dimen for the icon size
- // ratio: iconsize = 3*padding + 2*small_icon_size
- // padding*6.5 = small_icon_size
- // so padding = folderIconSize / 16
- int padding = grid.iconSizePx / 16;
- int smallIconSize = (int) (padding * 6.5);
+ // padding is equal to 1/8 of icon size
+ // padding gets used at start and end accounting for 2/8
+ // small icons are separated by 1/2 padding
+ // Total padding equals 2.5/8 leaving 5.5/8 for icons
+ // 5.5/8 remaining, divided by 2 equals 2.75 for each small icon
+ int padding = grid.iconSizePx / 8;
+ int smallIconSize = (int) (padding * 2.75);
for (int i = NUM_ITEMS_IN_PREVIEW; i >= 0; i--) {
ImageView appIcon = null;
@@ -288,9 +290,6 @@ public class FolderIcon extends FrameLayout implements FolderListener {
mAcceptAnimator.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
float percent = (Float) animation.getAnimatedValue();
- if (mFolderIcon != null) {
- percent = 1f;
- }
mOuterRingSize = (1 + percent * OUTER_RING_GROWTH_FACTOR) * previewSize;
mInnerRingSize = (1 + percent * INNER_RING_GROWTH_FACTOR) * previewSize;
if (mCellLayout != null) {
@@ -298,14 +297,6 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
}
});
- mAcceptAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- if (mFolderIcon != null) {
- mFolderIcon.mPreviewBackground.setBackground(null);
- }
- }
- });
mAcceptAnimator.start();
}
@@ -320,9 +311,6 @@ public class FolderIcon extends FrameLayout implements FolderListener {
mNeutralAnimator.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
float percent = (Float) animation.getAnimatedValue();
- if (mFolderIcon != null) {
- percent = 0f;
- }
mOuterRingSize = (1 + (1 - percent) * OUTER_RING_GROWTH_FACTOR) * previewSize;
mInnerRingSize = (1 + (1 - percent) * INNER_RING_GROWTH_FACTOR) * previewSize;
if (mCellLayout != null) {
@@ -337,7 +325,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
mCellLayout.hideFolderAccept(FolderRingAnimator.this);
}
if (mFolderIcon != null) {
- mFolderIcon.mPreviewBackground.setBackgroundResource(R.drawable.folder_bg);
+ mFolderIcon.mPreviewBackground.setVisibility(View.VISIBLE);
}
}
});
@@ -410,14 +398,6 @@ public class FolderIcon extends FrameLayout implements FolderListener {
mInfo.add(item);
}
- public void setPreviewBackground(int res) {
- if (res < 0) {
- mPreviewBackground.setBackground(null);
- } else {
- mPreviewBackground.setBackgroundResource(res);
- }
- }
-
public void onDragEnter(Object dragInfo) {
if (mFolder.isDestroyed() || !willAcceptItem((ItemInfo) dragInfo)) return;
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
@@ -456,7 +436,14 @@ public class FolderIcon extends FrameLayout implements FolderListener {
item = (ShortcutInfo) mDragInfo;
}
mFolder.beginExternalDrag(item);
- mLauncher.openFolder(FolderIcon.this);
+ mFolderRingAnimator.mCellLayout.hideFolderAccept(mFolderRingAnimator);
+
+ int[] folderTouchXY = new int[2];
+ mFolder.getLocationOnScreen(folderTouchXY);
+ int[] folderTouchXYOffset = {folderTouchXY[0] + mFolder.getWidth() / 2,
+ folderTouchXY[1] + mFolder.getHeight() / 2};
+
+ mLauncher.openFolder(FolderIcon.this, folderTouchXYOffset);
}
};
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a9ea9c75f..c2debec43 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3134,6 +3134,11 @@ public class Launcher extends Activity
final FolderInfo info = folderIcon.getFolderInfo();
Folder openFolder = mWorkspace.getFolderForTag(info);
+ int[] folderTouchXY = new int[2];
+ v.getLocationOnScreen(folderTouchXY);
+ int[] folderTouchXYOffset = {folderTouchXY[0] + v.getWidth() / 2,
+ folderTouchXY[1] + v.getHeight() / 2};
+
// If the folder info reports that the associated folder is open, then verify that
// it is actually opened. There have been a few instances where this gets out of sync.
if (info.opened && openFolder == null) {
@@ -3146,7 +3151,7 @@ public class Launcher extends Activity
// Close any open folder
closeFolder();
// Open the requested folder
- openFolder(folderIcon);
+ openFolder(folderIcon, folderTouchXYOffset);
} else {
// Find the open folder...
int folderScreen;
@@ -3158,7 +3163,7 @@ public class Launcher extends Activity
// Close any folder open on the current screen
closeFolder();
// Pull the folder onto this screen
- openFolder(folderIcon);
+ openFolder(folderIcon, folderTouchXYOffset);
}
}
}
@@ -3447,7 +3452,7 @@ public class Launcher extends Activity
*
* @param folderInfo The FolderInfo describing the folder to open.
*/
- public void openFolder(FolderIcon folderIcon) {
+ public void openFolder(FolderIcon folderIcon, int[] folderTouch) {
Folder folder = folderIcon.getFolder();
FolderInfo info = folder.mInfo;
@@ -3471,7 +3476,7 @@ public class Launcher extends Activity
Log.w(TAG, "Opening folder (" + folder + ") which already has a parent (" +
folder.getParent() + ").");
}
- folder.animateOpen(getWorkspace());
+ folder.animateOpen(getWorkspace(), folderTouch);
// Notify the accessibility manager that this folder "window" has appeared and occluded
// the workspace items