diff options
Diffstat (limited to 'src/com/android/launcher3/Folder.java')
-rw-r--r-- | src/com/android/launcher3/Folder.java | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index f2d7a6991..377e8eeff 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.drawable.InsetDrawable; import android.os.Build; import android.text.InputType; import android.text.Selection; @@ -182,6 +183,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList // name is complete, we have something to focus on, thus hiding the cursor and giving // reliable behavior when clicking the text field (since it will always gain focus on click). setFocusableInTouchMode(true); + + if (Utilities.isLmpOrAbove()) { + int padding = getResources().getDimensionPixelSize(R.dimen.folder_shadow_padding); + setBackground(new InsetDrawable( + getResources().getDrawable(R.drawable.apps_list_bg), + padding, padding, padding, padding)); + } else { + setBackgroundResource(R.drawable.quantum_panel); + } } @Override @@ -274,6 +284,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList for (int i = 0; i < mContent.getChildCount(); i++) { mContent.getPageAt(i).enableAccessibleDrag(enable, CellLayout.FOLDER_ACCESSIBILITY_DRAG); } + + mFooter.setImportantForAccessibility(enable ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : + IMPORTANT_FOR_ACCESSIBILITY_AUTO); mLauncher.getWorkspace().setAddNewPageOnDrag(!enable); } @@ -295,13 +308,14 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mFolderName.setHint(sHintText); // Convert to a string here to ensure that no other state associated with the text field // gets saved. - String newTitle = mFolderName.getText().toString(); + CharSequence newTitle = mFolderName.getText(); mInfo.setTitle(newTitle); LauncherModel.updateItemInDatabase(mLauncher, mInfo); if (commit) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, - String.format(getContext().getString(R.string.folder_renamed), newTitle)); + String.format(getContext().getString(R.string.folder_renamed), + newTitle.toString())); } // In order to clear the focus from the text field, we set the focus on ourself. This // ensures that every time the field is clicked, focus is gained, giving reliable behavior. @@ -469,9 +483,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, 0); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, 0); + Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty); + drift.setDuration(mMaterialExpandDuration); + drift.setStartDelay(mMaterialExpandStagger); + drift.setInterpolator(new LogDecelerateInterpolator(100, 0)); + int rx = (int) Math.max(Math.max(width - getPivotX(), 0), getPivotX()); int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY()); float radius = (float) Math.hypot(rx, ry); + AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); Animator reveal = LauncherAnimUtils.createCircularReveal(this, (int) getPivotX(), (int) getPivotY(), 0, radius); @@ -490,10 +510,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList textAlpha.setStartDelay(mMaterialExpandStagger); textAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); - Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty); - drift.setDuration(mMaterialExpandDuration); - drift.setStartDelay(mMaterialExpandStagger); - drift.setInterpolator(new LogDecelerateInterpolator(60, 0)); anim.play(drift); anim.play(iconsAlpha); @@ -503,10 +519,12 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList openFolderAnim = anim; mContentWrapper.setLayerType(LAYER_TYPE_HARDWARE, null); + mFooter.setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { mContentWrapper.setLayerType(LAYER_TYPE_NONE, null); + mContentWrapper.setLayerType(LAYER_TYPE_NONE, null); } }; } @@ -1095,8 +1113,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList // Move the item from the folder to the workspace, in the position of the folder if (getItemCount() == 1) { ShortcutInfo finalItem = mInfo.contents.get(0); - child = mLauncher.createShortcut(R.layout.application, cellLayout, - finalItem); + child = mLauncher.createShortcut(cellLayout, finalItem); LauncherModel.addOrMoveItemInDatabase(mLauncher, finalItem, mInfo.container, mInfo.screenId, mInfo.cellX, mInfo.cellY); } |