mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Removing some folder customization options
The old folder preview and animation relied on creating bitmaps for transition. As we move to hardware bitmaps, creating custom bitmaps which rely on icon bitmaps would be costly (hardware bitmaps are immutable and cannot be drawn on a software canvas). Bug: 35428783 Change-Id: I39869ed44feb6a886985ad15775bc1ab55565727
This commit is contained in:
@@ -22,6 +22,7 @@ import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
@@ -44,6 +45,8 @@ import com.android.launcher3.util.Themes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
|
||||
|
||||
/**
|
||||
* Manages the opening and closing animations for a {@link Folder}.
|
||||
*
|
||||
@@ -101,8 +104,9 @@ public class FolderAnimationManager {
|
||||
|
||||
mIsOpening = isOpening;
|
||||
|
||||
mDuration = mFolder.mMaterialExpandDuration;
|
||||
mDelay = mContext.getResources().getInteger(R.integer.config_folderDelay);
|
||||
Resources res = mContent.getResources();
|
||||
mDuration = res.getInteger(R.integer.config_materialFolderExpandDuration);
|
||||
mDelay = res.getInteger(R.integer.config_folderDelay);
|
||||
|
||||
mFolderInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||
R.interpolator.folder_interpolator);
|
||||
@@ -118,7 +122,7 @@ public class FolderAnimationManager {
|
||||
*/
|
||||
public AnimatorSet getAnimator() {
|
||||
final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) mFolder.getLayoutParams();
|
||||
FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule();
|
||||
ClippedFolderIconLayoutRule rule = mFolderIcon.getLayoutRule();
|
||||
final List<BubbleTextView> itemsInPreview = mFolderIcon.getPreviewItems();
|
||||
|
||||
// Match position of the FolderIcon
|
||||
@@ -129,7 +133,7 @@ public class FolderAnimationManager {
|
||||
float initialSize = (scaledRadius * 2) * scaleRelativeToDragLayer;
|
||||
|
||||
// Match size/scale of icons in the preview
|
||||
float previewScale = rule.scaleForItem(0, itemsInPreview.size());
|
||||
float previewScale = rule.scaleForItem(itemsInPreview.size());
|
||||
float previewSize = rule.getIconSize() * previewScale;
|
||||
float initialScale = previewSize / itemsInPreview.get(0).getIconSize()
|
||||
* scaleRelativeToDragLayer;
|
||||
@@ -242,15 +246,14 @@ public class FolderAnimationManager {
|
||||
*/
|
||||
private void addPreviewItemAnimators(AnimatorSet animatorSet, final float folderScale,
|
||||
int previewItemOffsetX, int previewItemOffsetY) {
|
||||
FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule();
|
||||
ClippedFolderIconLayoutRule rule = mFolderIcon.getLayoutRule();
|
||||
boolean isOnFirstPage = mFolder.mContent.getCurrentPage() == 0;
|
||||
final List<BubbleTextView> itemsInPreview = isOnFirstPage
|
||||
? mFolderIcon.getPreviewItems()
|
||||
: mFolderIcon.getPreviewItemsOnPage(mFolder.mContent.getCurrentPage());
|
||||
final int numItemsInPreview = itemsInPreview.size();
|
||||
final int numItemsInFirstPagePreview = isOnFirstPage
|
||||
? numItemsInPreview
|
||||
: FolderIcon.NUM_ITEMS_IN_PREVIEW;
|
||||
? numItemsInPreview : MAX_NUM_ITEMS_IN_PREVIEW;
|
||||
|
||||
TimeInterpolator previewItemInterpolator = getPreviewItemInterpolator();
|
||||
|
||||
@@ -264,7 +267,7 @@ public class FolderAnimationManager {
|
||||
cwc.setupLp(btv);
|
||||
|
||||
// Match scale of icons in the preview of the items on the first page.
|
||||
float previewScale = rule.scaleForItem(i, numItemsInFirstPagePreview);
|
||||
float previewScale = rule.scaleForItem(numItemsInFirstPagePreview);
|
||||
float previewSize = rule.getIconSize() * previewScale;
|
||||
float iconScale = previewSize / itemsInPreview.get(i).getIconSize();
|
||||
|
||||
@@ -299,7 +302,7 @@ public class FolderAnimationManager {
|
||||
scaleAnimator.setInterpolator(previewItemInterpolator);
|
||||
play(animatorSet, scaleAnimator);
|
||||
|
||||
if (mFolder.getItemCount() > FolderIcon.NUM_ITEMS_IN_PREVIEW) {
|
||||
if (mFolder.getItemCount() > MAX_NUM_ITEMS_IN_PREVIEW) {
|
||||
// These delays allows the preview items to move as part of the Folder's motion,
|
||||
// and its only necessary for large folders because of differing interpolators.
|
||||
int delay = mIsOpening ? mDelay : mDelay * 2;
|
||||
@@ -349,7 +352,7 @@ public class FolderAnimationManager {
|
||||
}
|
||||
|
||||
private TimeInterpolator getPreviewItemInterpolator() {
|
||||
if (mFolder.getItemCount() > FolderIcon.NUM_ITEMS_IN_PREVIEW) {
|
||||
if (mFolder.getItemCount() > MAX_NUM_ITEMS_IN_PREVIEW) {
|
||||
// With larger folders, we want the preview items to reach their final positions faster
|
||||
// (when opening) and later (when closing) so that they appear aligned with the rest of
|
||||
// the folder items when they are both visible.
|
||||
|
||||
Reference in New Issue
Block a user