chore: Cleanup, and hidden feature logged
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
5180c3d4c4
commit
11f7abcb66
1818 files changed
+104945
-147848
No files matched your search
@@ -28,8 +28,6 @@ import static com.android.launcher3.folder.FolderGridOrganizer.createFolderGridO
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_LABEL_UPDATED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED;
|
||||
import static com.android.launcher3.model.data.FolderInfo.willAcceptItemType;
|
||||
import static com.android.launcher3.pageindicators.PaginationArrow.DISABLED_ARROW_OPACITY;
|
||||
import static com.android.launcher3.pageindicators.PaginationArrow.FULLY_OPAQUE;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.FOLDER_OPENED_MESSAGE;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
@@ -44,10 +42,8 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.os.Looper;
|
||||
import android.text.InputType;
|
||||
import android.text.Selection;
|
||||
@@ -57,8 +53,6 @@ import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.TypedValue;
|
||||
import android.view.FocusFinder;
|
||||
import android.view.Gravity;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -68,14 +62,12 @@ import android.view.WindowInsets;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
@@ -86,7 +78,6 @@ import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DragSource;
|
||||
import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.ExtendedEditText;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.OnAlarmListener;
|
||||
import com.android.launcher3.R;
|
||||
@@ -97,11 +88,9 @@ import com.android.launcher3.accessibility.FolderAccessibilityHelper;
|
||||
import com.android.launcher3.anim.KeyboardInsetAnimationCallback;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.graphics.ShapeDelegate;
|
||||
import com.android.launcher3.graphics.ThemeManager;
|
||||
import com.android.launcher3.logger.LauncherAtom.FromState;
|
||||
import com.android.launcher3.logger.LauncherAtom.ToState;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
@@ -111,7 +100,6 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemFactory;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.pageindicators.PageIndicatorDots;
|
||||
import com.android.launcher3.pageindicators.PaginationArrow;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.Themes;
|
||||
@@ -145,9 +133,9 @@ import app.lawnchair.util.LawnchairUtilsKt;
|
||||
* Represents a set of icons chosen by the user or generated by the system.
|
||||
*/
|
||||
public class Folder extends AbstractFloatingView implements ClipPathView, DragSource,
|
||||
View.OnLongClickListener, DropTarget, TextView.OnEditorActionListener,
|
||||
View.OnFocusChangeListener, DragListener, ExtendedEditText.OnBackKeyListener,
|
||||
LauncherBindableItemsContainer {
|
||||
View.OnLongClickListener, DropTarget, TextView.OnEditorActionListener,
|
||||
View.OnFocusChangeListener, DragListener, ExtendedEditText.OnBackKeyListener,
|
||||
LauncherBindableItemsContainer {
|
||||
private static final String TAG = "Launcher.Folder";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
@@ -218,6 +206,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
protected LauncherDelegate mLauncherDelegate;
|
||||
protected final ActivityContext mActivityContext;
|
||||
|
||||
protected DragController mDragController;
|
||||
public FolderInfo mInfo;
|
||||
private CharSequence mFromTitle;
|
||||
private FromState mFromLabelState;
|
||||
@@ -229,10 +218,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
FolderPagedView mContent;
|
||||
FolderNameEditText mFolderName;
|
||||
private PageIndicatorDots mPageIndicator;
|
||||
private PaginationArrow mLeftArrow;
|
||||
private PaginationArrow mRightArrow;
|
||||
|
||||
protected LinearLayout mFooter;
|
||||
protected View mFooter;
|
||||
private int mFooterHeight;
|
||||
|
||||
// Cell ranks used for drag and drop
|
||||
@@ -242,14 +229,14 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
private Path mClipPath;
|
||||
|
||||
@ViewDebug.ExportedProperty(category = "launcher",
|
||||
mapping = {
|
||||
@ViewDebug.IntToString(from = STATE_CLOSED, to = "STATE_CLOSED"),
|
||||
@ViewDebug.IntToString(from = STATE_ANIMATING, to = "STATE_ANIMATING"),
|
||||
@ViewDebug.IntToString(from = STATE_OPEN, to = "STATE_OPEN"),
|
||||
})
|
||||
mapping = {
|
||||
@ViewDebug.IntToString(from = STATE_CLOSED, to = "STATE_CLOSED"),
|
||||
@ViewDebug.IntToString(from = STATE_ANIMATING, to = "STATE_ANIMATING"),
|
||||
@ViewDebug.IntToString(from = STATE_OPEN, to = "STATE_OPEN"),
|
||||
})
|
||||
private int mState = STATE_CLOSED;
|
||||
private final List<OnFolderStateChangedListener> mOnFolderStateChangedListeners =
|
||||
new ArrayList<>();
|
||||
new ArrayList<>();
|
||||
private OnFolderStateChangedListener mPriorityOnFolderStateChangedListener;
|
||||
@ViewDebug.ExportedProperty(category = "launcher")
|
||||
private boolean mRearrangeOnClose = false;
|
||||
@@ -306,8 +293,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
setFocusableInTouchMode(true);
|
||||
|
||||
mBackground = (GradientDrawable) Objects.requireNonNull(
|
||||
ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.round_rect_folder, getContext().getTheme()));
|
||||
ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.round_rect_folder, getContext().getTheme()));
|
||||
mBackground.setCallback(this);
|
||||
preferenceManager2 = PreferenceManager2.INSTANCE.get(context);
|
||||
}
|
||||
@@ -324,7 +311,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
final int paddingLeftRight = dp.folderContentPaddingLeftRight;
|
||||
|
||||
mBackground = DrawableTokens.RoundRectFolder.resolve(getContext());
|
||||
// pE-TODO: this is interesting, we can customise this.
|
||||
// TODO-Myself: this is interesting, we can customise this.
|
||||
var alpha = LawnchairUtilsKt.getFolderBackgroundAlpha(getContext());
|
||||
mBackground.setAlpha(alpha);
|
||||
|
||||
@@ -333,20 +320,24 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mContent.setFolder(this);
|
||||
|
||||
mPageIndicator = findViewById(R.id.folder_page_indicator);
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
MarginLayoutParams params = ((MarginLayoutParams) mPageIndicator.getLayoutParams());
|
||||
int horizontalMargin = getContext().getResources()
|
||||
.getDimensionPixelSize(R.dimen.folder_footer_horiz_padding);
|
||||
params.setMarginStart(horizontalMargin);
|
||||
params.setMarginEnd(horizontalMargin);
|
||||
}
|
||||
mFooter = findViewById(R.id.folder_footer);
|
||||
mFooterHeight = dp.folderFooterHeightPx;
|
||||
mFolderName = findViewById(R.id.folder_name);
|
||||
if (Flags.enableLauncherVisualRefresh()) {
|
||||
mFolderName.setTypeface(Typeface.create("google-sans-flex", Typeface.NORMAL));
|
||||
}
|
||||
mFolderName.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp.folderLabelTextSizePx);
|
||||
mFolderName.setOnBackKeyListener(this);
|
||||
mFolderName.setOnEditorActionListener(this);
|
||||
mFolderName.setSelectAllOnFocus(true);
|
||||
mFolderName.setInputType(mFolderName.getInputType()
|
||||
& ~InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|
||||
| InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||
| InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
& ~InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|
||||
| InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||
| InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
mFolderName.forceDisableSuggestions(true);
|
||||
|
||||
@ColorInt
|
||||
@@ -362,76 +353,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
|
||||
}
|
||||
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
// pE-TODO(QPR1): Investigate
|
||||
// mLeftArrow = findViewById(R.id.left_indicator_arrow);
|
||||
// mRightArrow = findViewById(R.id.right_indicator_arrow);
|
||||
// mRightArrow.setOnClickListener(v -> mContent.snapToPage(
|
||||
// mContent.getCurrentPage() + 1));
|
||||
// mLeftArrow.setOnClickListener(v -> mContent.snapToPage(
|
||||
// mContent.getCurrentPage() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If indicator is visible, set margin between folder title and indicator. Also properly show
|
||||
* arrows if pointer is enabled and indicator is visible.
|
||||
*/
|
||||
public void onIndicatorVisibilityChanged() {
|
||||
if (mPageIndicator.getVisibility() == View.VISIBLE) {
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginEnd(
|
||||
getResources().getDimensionPixelSize(R.dimen.folder_footer_horiz_padding));
|
||||
Context ctx = getContext(); // done here to avoid getting context on bg thread
|
||||
Executors.UI_HELPER_EXECUTOR.execute(() -> {
|
||||
// Only show arrows if a mouse or touchpad is connected to the device
|
||||
int arrowVisibility = isPointerEnabled(ctx) ? View.VISIBLE : View.GONE;
|
||||
mLeftArrow.setVisibility(arrowVisibility);
|
||||
mRightArrow.setVisibility(arrowVisibility);
|
||||
|
||||
// If the arrows are visible, then their touch box will slightly overlap with the
|
||||
// footer's padding by 8dp. Update it for proper alignment. PaddingEnd was always
|
||||
// equal to paddingRight in both LTR & RTL mode, so isRtl is manually accounted for
|
||||
int endPadding = getResources().getDimensionPixelSize(
|
||||
arrowVisibility == View.VISIBLE
|
||||
? R.dimen.folder_footer_horiz_padding_minus_arrow_overlap
|
||||
: R.dimen.folder_footer_horiz_padding);
|
||||
boolean isRtl = Utilities.isRtl(getResources());
|
||||
mFooter.setPadding(
|
||||
isRtl ? endPadding : mFooter.getPaddingLeft(),
|
||||
mFooter.getPaddingTop(),
|
||||
isRtl ? mFooter.getPaddingRight() : endPadding,
|
||||
mFooter.getPaddingBottom()
|
||||
);
|
||||
});
|
||||
} else {
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginEnd(0);
|
||||
mLeftArrow.setVisibility(View.GONE);
|
||||
mRightArrow.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private boolean isPointerEnabled(Context context) {
|
||||
InputManager im = context.getSystemService(InputManager.class);
|
||||
return Arrays.stream(im.getInputDeviceIds())
|
||||
.mapToObj(im::getInputDevice)
|
||||
.anyMatch(device -> device.isEnabled()
|
||||
&& (device.supportsSource(InputDevice.SOURCE_MOUSE)
|
||||
|| device.supportsSource(InputDevice.SOURCE_TOUCHPAD)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the page is switched. Sets arrow UX to a disabled appearance if the page is at
|
||||
* one end or the other.
|
||||
*/
|
||||
public void updateArrowAlphas() {
|
||||
if (enableLauncherVisualRefresh()) {
|
||||
mLeftArrow.setAlpha(
|
||||
0 == mContent.getCurrentPage() ? DISABLED_ARROW_OPACITY : FULLY_OPAQUE);
|
||||
mRightArrow.setAlpha(mContent.getPageCount() == mContent.getCurrentPage() + 1
|
||||
? DISABLED_ARROW_OPACITY : FULLY_OPAQUE);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
@@ -467,19 +388,19 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
|
||||
void addDragListener(DragOptions options) {
|
||||
mActivityContext.getDragController().addDragListener(this);
|
||||
getDragController().addDragListener(this);
|
||||
if (!options.isAccessibleDrag) {
|
||||
return;
|
||||
}
|
||||
mActivityContext.getDragController().addDragListener(new AccessibleDragListenerAdapter(
|
||||
mContent, FolderAccessibilityHelper::new) {
|
||||
getDragController().addDragListener(new AccessibleDragListenerAdapter(
|
||||
mContent, FolderAccessibilityHelper::new) {
|
||||
@Override
|
||||
protected void enableAccessibleDrag(boolean enable,
|
||||
@Nullable DragObject dragObject) {
|
||||
@Nullable DragObject dragObject) {
|
||||
super.enableAccessibleDrag(enable, dragObject);
|
||||
mFooter.setImportantForAccessibility(enable
|
||||
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -516,7 +437,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
completeDragExit();
|
||||
}
|
||||
mIsDragInProgress = false;
|
||||
mActivityContext.getDragController().removeDragListener(this);
|
||||
getDragController().removeDragListener(this);
|
||||
}
|
||||
|
||||
public void startEditingFolderName() {
|
||||
@@ -533,7 +454,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onBackKey newTitle=" + newTitle);
|
||||
}
|
||||
mInfo.setTitle(newTitle, mActivityContext.getModelWriter());
|
||||
mInfo.setTitle(newTitle, mLauncherDelegate.getModelWriter());
|
||||
mFolderIcon.onTitleChanged(newTitle);
|
||||
|
||||
if (TextUtils.isEmpty(mInfo.title)) {
|
||||
@@ -544,8 +465,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
|
||||
sendCustomAccessibilityEvent(
|
||||
this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
|
||||
getContext().getString(R.string.folder_renamed, newTitle));
|
||||
this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
|
||||
getContext().getString(R.string.folder_renamed, newTitle));
|
||||
|
||||
// This ensures that focus is gained every time the field is clicked, which selects all
|
||||
// the text and brings up the soft keyboard if necessary.
|
||||
@@ -559,7 +480,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onEditorAction actionId=" + actionId + " key="
|
||||
+ (event != null ? event.getKeyCode() : "null event"));
|
||||
+ (event != null ? event.getKeyCode() : "null event"));
|
||||
}
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
mFolderName.dispatchBackKey();
|
||||
@@ -571,8 +492,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
||||
this.setTranslationY(0);
|
||||
|
||||
// Lawnchair-TODO: Keyboard too close to Folder name edit?
|
||||
|
||||
try {
|
||||
if (windowInsets.isVisible(WindowInsets.Type.ime())) {
|
||||
@@ -607,8 +526,17 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
return mFolderIcon;
|
||||
}
|
||||
|
||||
DragController getDragController() {
|
||||
return mDragController;
|
||||
}
|
||||
|
||||
void setDragController(DragController dragController) {
|
||||
mDragController = dragController;
|
||||
}
|
||||
|
||||
public void setFolderIcon(FolderIcon icon) {
|
||||
mFolderIcon = icon;
|
||||
mLauncherDelegate.init(this, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -698,12 +626,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
mFolderName.showKeyboard();
|
||||
mFolderName.displayCompletions(
|
||||
Stream.of(mInfo.suggestedFolderNames.getLabels())
|
||||
.filter(Objects::nonNull)
|
||||
.map(Object::toString)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.filter(s -> !s.equalsIgnoreCase(mFolderName.getText().toString()))
|
||||
.collect(Collectors.toList()));
|
||||
Stream.of(mInfo.suggestedFolderNames.getLabels())
|
||||
.filter(Objects::nonNull)
|
||||
.map(Object::toString)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.filter(s -> !s.equalsIgnoreCase(mFolderName.getText().toString()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,12 +645,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
@SuppressLint("InflateParams")
|
||||
static <T extends Context & ActivityContext> Folder fromXml(T activityContext) {
|
||||
return (Folder) LayoutInflater.from(activityContext).cloneInContext(activityContext)
|
||||
.inflate(R.layout.user_folder_icon_normalized, null);
|
||||
.inflate(R.layout.user_folder_icon_normalized, null);
|
||||
}
|
||||
|
||||
private void addAnimationStartListeners(AnimatorSet a) {
|
||||
mLauncherDelegate.forEachVisibleWorkspacePage(
|
||||
visiblePage -> addAnimatorListenerForPage(a, (CellLayout) visiblePage));
|
||||
visiblePage -> addAnimatorListenerForPage(a, (CellLayout) visiblePage));
|
||||
|
||||
a.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
@@ -781,7 +709,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
// Since this folder opened by another controller, it might not get onDrop or
|
||||
// onDropComplete. Perform cleanup once drag-n-drop ends.
|
||||
mActivityContext.getDragController().addDragListener(this);
|
||||
getDragController().addDragListener(this);
|
||||
|
||||
ArrayList<ItemInfo> items = new ArrayList<>(mInfo.getContents());
|
||||
mEmptyCellRank = items.size();
|
||||
@@ -824,22 +752,22 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// There was a one-off crash where the folder had a parent already.
|
||||
if (getParent() == null) {
|
||||
dragLayer.addView(this);
|
||||
mActivityContext.getDragController().addDropTarget(this);
|
||||
getDragController().addDropTarget(this);
|
||||
} else {
|
||||
if (FeatureFlags.IS_STUDIO_BUILD) {
|
||||
Log.e(TAG, "Opening folder (" + this + ") which already has a parent:"
|
||||
+ getParent());
|
||||
+ getParent());
|
||||
}
|
||||
}
|
||||
|
||||
Log.d("b/383526431", "animateOpen: content child count before: "
|
||||
+ mContent.getTotalChildCount());
|
||||
+ mContent.getTotalChildCount());
|
||||
|
||||
mContent.completePendingPageChanges();
|
||||
mContent.setCurrentPage(pageNo);
|
||||
|
||||
Log.d("b/383526431", "animateOpen: content child count after pending page"
|
||||
+ " changes: " + mContent.getTotalChildCount());
|
||||
+ " changes: " + mContent.getTotalChildCount());
|
||||
|
||||
// This is set to true in close(), but isn't reset to false until onDropCompleted(). This
|
||||
// leads to an inconsistent state if you drag out of the folder and drag back in without
|
||||
@@ -848,12 +776,10 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
cancelRunningAnimations();
|
||||
Log.d("b/383526431", "animateOpen: content child count after cancelling"
|
||||
+ " animation: " + mContent.getTotalChildCount());
|
||||
|
||||
AnimatorSet animatorSet = getFolderAnimationManager()
|
||||
.createAnimatorSet(/* isOpening */ true);
|
||||
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
+ " animation: " + mContent.getTotalChildCount());
|
||||
FolderAnimationManager fam = new FolderAnimationManager(this, true /* isOpening */);
|
||||
AnimatorSet anim = fam.getAnimator();
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mFolderIcon.setIconVisible(false);
|
||||
@@ -865,7 +791,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
setState(STATE_OPEN);
|
||||
announceAccessibilityChanges();
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
|
||||
FOLDER_OPENED_MESSAGE);
|
||||
FOLDER_OPENED_MESSAGE);
|
||||
|
||||
mContent.setFocusOnFirstChild();
|
||||
}
|
||||
@@ -874,7 +800,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// Footer animation
|
||||
if (mContent.getPageCount() > 1 && !mInfo.hasOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION)) {
|
||||
int footerWidth = mContent.getDesiredWidth()
|
||||
- mFooter.getPaddingLeft() - mFooter.getPaddingRight();
|
||||
- mFooter.getPaddingLeft() - mFooter.getPaddingRight();
|
||||
|
||||
float textWidth = mFolderName.getPaint().measureText(mFolderName.getText().toString());
|
||||
float translation = (footerWidth - textWidth) / 2;
|
||||
@@ -884,20 +810,20 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// Do not update the flag if we are in drag mode. The flag will be updated, when we
|
||||
// actually drop the icon.
|
||||
final boolean updateAnimationFlag = !mIsDragInProgress;
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mFolderName.animate().setDuration(FOLDER_NAME_ANIMATION_DURATION)
|
||||
.translationX(0)
|
||||
.setInterpolator(AnimationUtils.loadInterpolator(
|
||||
getContext(), android.R.interpolator.fast_out_slow_in));
|
||||
.translationX(0)
|
||||
.setInterpolator(AnimationUtils.loadInterpolator(
|
||||
getContext(), android.R.interpolator.fast_out_slow_in));
|
||||
mPageIndicator.playEntryAnimation();
|
||||
|
||||
if (updateAnimationFlag) {
|
||||
mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true,
|
||||
mActivityContext.getModelWriter());
|
||||
mLauncherDelegate.getModelWriter());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -910,18 +836,16 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// b/282158620 because setCurrentPlayTime() below will start animator, we need to register
|
||||
// {@link AnimatorListener} before it so that {@link AnimatorListener#onAnimationStart} can
|
||||
// be called to register mCurrentAnimator, which will be used to cancel animator
|
||||
addAnimationStartListeners(animatorSet);
|
||||
addAnimationStartListeners(anim);
|
||||
// Because t=0 has the folder match the folder icon, we can skip the
|
||||
// first frame and have the same movement one frame earlier.
|
||||
Log.d("b/311077782", "Folder.animateOpen");
|
||||
animatorSet.setCurrentPlayTime(Math.min(
|
||||
getSingleFrameMs(getContext()), animatorSet.getTotalDuration()));
|
||||
animatorSet.start();
|
||||
|
||||
anim.setCurrentPlayTime(Math.min(getSingleFrameMs(getContext()), anim.getTotalDuration()));
|
||||
anim.start();
|
||||
|
||||
// Make sure the folder picks up the last drag move even if the finger doesn't move.
|
||||
if (mActivityContext.getDragController().isDragging()) {
|
||||
mActivityContext.getDragController().forceTouchMove();
|
||||
if (getDragController().isDragging()) {
|
||||
getDragController().forceTouchMove();
|
||||
}
|
||||
mContent.verifyVisibleHighResIcons(mContent.getNextPage());
|
||||
}
|
||||
@@ -937,20 +861,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
return true;
|
||||
}
|
||||
|
||||
private FolderAnimationCreator getFolderAnimationManager() {
|
||||
boolean shouldUseSpringMotion = Flags.enableLauncherIconShapes()
|
||||
&& Flags.enableExpressiveFolderExpansion();
|
||||
if (shouldUseSpringMotion) {
|
||||
ShapeDelegate shapeDelegate =
|
||||
ThemeManager.INSTANCE.get(mActivityContext.asContext()).getFolderShape();
|
||||
return new FolderAnimationSpringBuilderManager(
|
||||
this, shapeDelegate, mLauncherDelegate
|
||||
);
|
||||
} else {
|
||||
return new FolderAnimationManager(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If there's a folder already open, we want to close it before opening another one.
|
||||
*/
|
||||
@@ -996,7 +906,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// Notify the accessibility manager that this folder "window" has disappeared and no
|
||||
// longer occludes the workspace items
|
||||
mActivityContext.getDragLayer().sendAccessibilityEvent(
|
||||
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
}
|
||||
|
||||
private void cancelRunningAnimations() {
|
||||
@@ -1022,10 +932,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mContent.snapToPageImmediately(mContent.getDestinationPage());
|
||||
|
||||
cancelRunningAnimations();
|
||||
AnimatorSet animatorSet = getFolderAnimationManager()
|
||||
.createAnimatorSet(/* isOpening */ false);
|
||||
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
AnimatorSet a = new FolderAnimationManager(this, false /* isOpening */).getAnimator();
|
||||
a.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
@@ -1046,14 +954,14 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mIsAnimatingClosed = false;
|
||||
}
|
||||
});
|
||||
addAnimationStartListeners(animatorSet);
|
||||
animatorSet.start();
|
||||
addAnimationStartListeners(a);
|
||||
a.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Pair<View, String> getAccessibilityTarget() {
|
||||
return Pair.create(mContent, mIsOpen ? mContent.getAccessibilityDescription()
|
||||
: getContext().getString(R.string.folder_closed));
|
||||
: getContext().getString(R.string.folder_closed));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1068,7 +976,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
if (parent != null) {
|
||||
parent.removeView(this);
|
||||
}
|
||||
mActivityContext.getDragController().removeDropTarget(this);
|
||||
getDragController().removeDropTarget(this);
|
||||
clearFocus();
|
||||
if (mFolderIcon != null) {
|
||||
mFolderIcon.setVisibility(View.VISIBLE);
|
||||
@@ -1130,7 +1038,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
private int getTargetRank(DragObject d, float[] recycle) {
|
||||
recycle = d.getVisualCenter(recycle);
|
||||
return mContent.findNearestArea(
|
||||
(int) recycle[0] - getPaddingLeft(), (int) recycle[1] - getPaddingTop());
|
||||
(int) recycle[0] - getPaddingLeft(), (int) recycle[1] - getPaddingTop());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1149,7 +1057,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
if (d.stateAnnouncer != null) {
|
||||
d.stateAnnouncer.announce(getContext().getString(R.string.move_to_position,
|
||||
mTargetRank + 1));
|
||||
mTargetRank + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,14 +1065,14 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
int currentPage = mContent.getNextPage();
|
||||
|
||||
float cellOverlap = mContent.getCurrentCellLayout().getCellWidth()
|
||||
* ICON_OVERSCROLL_WIDTH_FACTOR;
|
||||
* ICON_OVERSCROLL_WIDTH_FACTOR;
|
||||
boolean isOutsideLeftEdge = x < cellOverlap;
|
||||
boolean isOutsideRightEdge = x > (getWidth() - cellOverlap);
|
||||
|
||||
if (currentPage > 0 && (mContent.mIsRtl ? isOutsideRightEdge : isOutsideLeftEdge)) {
|
||||
showScrollHint(SCROLL_LEFT, d);
|
||||
} else if (currentPage < (mContent.getPageCount() - 1)
|
||||
&& (mContent.mIsRtl ? isOutsideLeftEdge : isOutsideRightEdge)) {
|
||||
&& (mContent.mIsRtl ? isOutsideLeftEdge : isOutsideRightEdge)) {
|
||||
showScrollHint(SCROLL_RIGHT, d);
|
||||
} else {
|
||||
mOnScrollHintAlarm.cancelAlarm();
|
||||
@@ -1253,20 +1161,20 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
@Override
|
||||
public void onDropCompleted(final View target, final DragObject d,
|
||||
final boolean success) {
|
||||
final boolean success) {
|
||||
if (success) {
|
||||
if (getItemCount() <= 1) {
|
||||
mDeleteFolderOnDropCompleted = true;
|
||||
}
|
||||
if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon
|
||||
&& target != this) {
|
||||
&& target != this) {
|
||||
replaceFolderWithFinalItem();
|
||||
}
|
||||
} else {
|
||||
// The drag failed, we need to return the item to the folder
|
||||
ItemInfo info = d.dragInfo;
|
||||
View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info)
|
||||
? mCurrentDragView : mContent.createNewView(info);
|
||||
? mCurrentDragView : mContent.createNewView(info);
|
||||
ArrayList<View> views = getIconsInReadingOrder();
|
||||
if (!views.contains(icon)) {
|
||||
info.rank = Utilities.boundToRange(info.rank, 0, views.size());
|
||||
@@ -1275,7 +1183,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mItemsInvalidated = true;
|
||||
|
||||
executeWithContentUpdateSuppressed(
|
||||
() -> mFolderIcon.onDrop(d, true /* itemReturnedOnFailedDrop */));
|
||||
() -> mFolderIcon.onDrop(d, true /* itemReturnedOnFailedDrop */));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1303,14 +1211,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
if (getItemCount() <= mContent.itemsPerPage()) {
|
||||
// Show the animation, next time something is added to the folder.
|
||||
mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, false,
|
||||
mActivityContext.getModelWriter());
|
||||
mLauncherDelegate.getModelWriter());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItemLocationsInDatabaseBatch(boolean isBind) {
|
||||
FolderGridOrganizer verifier = createFolderGridOrganizer(
|
||||
mActivityContext.getDeviceProfile()
|
||||
).setFolderInfo(mInfo);
|
||||
mActivityContext.getDeviceProfile()).setFolderInfo(mInfo);
|
||||
|
||||
ArrayList<ItemInfo> items = new ArrayList<>();
|
||||
int total = mInfo.getContents().size();
|
||||
@@ -1322,12 +1229,15 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
mActivityContext.getModelWriter().moveItemsInDatabase(items, mInfo.id, 0);
|
||||
mLauncherDelegate.getModelWriter().moveItemsInDatabase(items, mInfo.id, 0);
|
||||
}
|
||||
if (!isBind && total > 1 /* no need to update if there's one icon */) {
|
||||
LauncherComponentProvider.get(getContext()).getFolderNameSuggestionLoader()
|
||||
.getSuggestedFolderName(mInfo.getAppContents(),
|
||||
folderNameInfos -> mInfo.suggestedFolderNames = folderNameInfos);
|
||||
Executors.MODEL_EXECUTOR.post(() -> {
|
||||
FolderNameInfos nameInfos = new FolderNameInfos();
|
||||
FolderNameProvider fnp = FolderNameProvider.newInstance(getContext());
|
||||
fnp.getSuggestedFolderName(getContext(), mInfo.getAppContents(), nameInfos);
|
||||
mInfo.suggestedFolderNames = nameInfos;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1376,15 +1286,15 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
protected int getContentAreaHeight() {
|
||||
int height = Math.min(getMaxContentAreaHeight(),
|
||||
mContent.getDesiredHeight());
|
||||
mContent.getDesiredHeight());
|
||||
return Math.max(height, MIN_CONTENT_DIMEN);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
int getMaxContentAreaHeight() {
|
||||
DeviceProfile grid = mActivityContext.getDeviceProfile();
|
||||
return grid.getDeviceProperties().getAvailableHeightPx() - grid.getTotalWorkspacePadding().y
|
||||
- getFooterHeight();
|
||||
return grid.availableHeightPx - grid.getTotalWorkspacePadding().y
|
||||
- getFooterHeight();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -1423,7 +1333,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mContent.measure(contentAreaWidthSpec, contentAreaHeightSpec);
|
||||
|
||||
mFooter.measure(contentAreaWidthSpec,
|
||||
MeasureSpec.makeMeasureSpec(mFooterHeight, MeasureSpec.EXACTLY));
|
||||
MeasureSpec.makeMeasureSpec(mFooterHeight, MeasureSpec.EXACTLY));
|
||||
|
||||
int folderWidth = getPaddingLeft() + getPaddingRight() + contentWidth;
|
||||
int folderHeight = getFolderHeight(contentHeight);
|
||||
@@ -1443,10 +1353,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
int minTitleWidth = getResources().getDimensionPixelSize(R.dimen.folder_title_min_width);
|
||||
if (enableLauncherVisualRefresh() && mFolderName.getMeasuredWidth() < minTitleWidth) {
|
||||
((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginEnd(0);
|
||||
// The post is necessary for margins to be recalculated. RTL UI is shifted otherwise.
|
||||
mFolderName.post(() -> mFolderName.setVisibility(View.GONE));
|
||||
mFooter.setGravity(Gravity.END);
|
||||
mFolderName.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,7 +1404,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
boolean isShiftPlusTab = keyCode == KeyEvent.KEYCODE_TAB &&
|
||||
event.hasModifiers(KeyEvent.META_SHIFT_ON);
|
||||
event.hasModifiers(KeyEvent.META_SHIFT_ON);
|
||||
if (isShiftPlusTab && Folder.this.isFocused()) {
|
||||
return lastChild.requestFocus();
|
||||
}
|
||||
@@ -1530,16 +1437,16 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
|
||||
PendingAddShortcutInfo pasi = d.dragInfo instanceof PendingAddShortcutInfo
|
||||
? (PendingAddShortcutInfo) d.dragInfo : null;
|
||||
? (PendingAddShortcutInfo) d.dragInfo : null;
|
||||
WorkspaceItemInfo pasiSi =
|
||||
pasi != null ? pasi.getActivityInfo(launcher).createWorkspaceItemInfo() : null;
|
||||
pasi != null ? pasi.getActivityInfo(launcher).createWorkspaceItemInfo() : null;
|
||||
if (pasi != null && pasiSi == null) {
|
||||
// There is no WorkspaceItemInfo, so we have to go through a configuration activity.
|
||||
pasi.container = mInfo.id;
|
||||
pasi.rank = mEmptyCellRank;
|
||||
|
||||
launcher.addPendingItem(pasi, pasi.container, pasi.screenId, null, pasi.spanX,
|
||||
pasi.spanY);
|
||||
pasi.spanY);
|
||||
d.deferDragViewCleanupPostAnimation = false;
|
||||
mRearrangeOnClose = true;
|
||||
} else {
|
||||
@@ -1560,8 +1467,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
// Actually move the item in the database if it was an external drag. Call this
|
||||
// before creating the view, so that the ItemInfo is updated appropriately.
|
||||
mActivityContext.getModelWriter().addOrMoveItemInDatabase(
|
||||
si, mInfo.id, 0, si.cellX, si.cellY);
|
||||
mLauncherDelegate.getModelWriter().addOrMoveItemInDatabase(
|
||||
si, mInfo.id, 0, si.cellX, si.cellY);
|
||||
mIsExternalDrag = false;
|
||||
} else {
|
||||
currentDragView = mCurrentDragView;
|
||||
@@ -1602,7 +1509,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
if (mContent.getPageCount() > 1) {
|
||||
// The animation has already been shown while opening the folder.
|
||||
mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true,
|
||||
mActivityContext.getModelWriter());
|
||||
mLauncherDelegate.getModelWriter());
|
||||
}
|
||||
|
||||
if (!launcher.isInState(EDIT_MODE)) {
|
||||
@@ -1613,7 +1520,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
d.stateAnnouncer.completeAction(R.string.item_moved);
|
||||
}
|
||||
mStatsLogManager.logger().withItemInfo(d.dragInfo).withInstanceId(d.logInstanceId)
|
||||
.log(LAUNCHER_ITEM_DROP_COMPLETED);
|
||||
.log(LAUNCHER_ITEM_DROP_COMPLETED);
|
||||
}
|
||||
|
||||
// This is used so the item doesn't immediately appear in the folder when added. In one case
|
||||
@@ -1649,11 +1556,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
|
||||
if (!mSuppressContentUpdate) {
|
||||
FolderGridOrganizer verifier = createFolderGridOrganizer(
|
||||
mActivityContext.getDeviceProfile()).setFolderInfo(mInfo);
|
||||
mActivityContext.getDeviceProfile()).setFolderInfo(mInfo);
|
||||
verifier.updateRankAndPos(item, rank);
|
||||
mActivityContext.getModelWriter().addOrMoveItemInDatabase(item, mInfo.id, 0,
|
||||
item.cellX,
|
||||
item.cellY);
|
||||
mLauncherDelegate.getModelWriter().addOrMoveItemInDatabase(item, mInfo.id, 0,
|
||||
item.cellX,
|
||||
item.cellY);
|
||||
updateItemLocationsInDatabaseBatch(false);
|
||||
|
||||
if (mContent.areViewsBound()) {
|
||||
@@ -1663,7 +1570,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
updateTextViewFocus();
|
||||
}
|
||||
|
||||
mActivityContext.getModelWriter().notifyItemModified(mInfo);
|
||||
mLauncherDelegate.getModelWriter().notifyItemModified(mInfo);
|
||||
mFolderIcon.onItemsChanged(animate);
|
||||
}
|
||||
|
||||
@@ -1671,7 +1578,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
public void removeFolderContent(boolean animate, ItemInfo... items) {
|
||||
List<ItemInfo> itemArray = Arrays.asList(items);
|
||||
if (mInfo.getContents().removeAll(itemArray)) {
|
||||
mActivityContext.getModelWriter().notifyItemModified(mInfo);
|
||||
mLauncherDelegate.getModelWriter().notifyItemModified(mInfo);
|
||||
}
|
||||
|
||||
if (!mSuppressContentUpdate) {
|
||||
@@ -1700,11 +1607,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
return mContent.iterateOverItems((info, view) -> info == item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isContainerSupported(int container) {
|
||||
return container == mInfo.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility methods to iterate over items of the view
|
||||
*/
|
||||
@@ -1732,8 +1634,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
int totalItemsInFolder = allItems.size();
|
||||
int itemsPerPage = mContent.itemsPerPage();
|
||||
int numItemsOnCurrentPage = page == lastPage
|
||||
? totalItemsInFolder - (itemsPerPage * page)
|
||||
: itemsPerPage;
|
||||
? totalItemsInFolder - (itemsPerPage * page)
|
||||
: itemsPerPage;
|
||||
|
||||
int startIndex = page * itemsPerPage;
|
||||
int endIndex = Math.min(startIndex + numItemsOnCurrentPage, allItems.size());
|
||||
@@ -1754,8 +1656,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
post(this::startEditingFolderName);
|
||||
} else {
|
||||
StatsLogger statsLogger = mStatsLogManager.logger()
|
||||
.withItemInfo(mInfo)
|
||||
.withFromState(mFromLabelState);
|
||||
.withItemInfo(mInfo)
|
||||
.withFromState(mFromLabelState);
|
||||
|
||||
// If the folder label is suggested, it is logged to improve prediction model.
|
||||
// When both old and new labels are logged together delimiter is used.
|
||||
@@ -1820,7 +1722,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
// Pause drag event until the scrolling is finished
|
||||
mScrollPauseAlarm.setOnAlarmListener(new OnScrollFinishedListener(mDragObject));
|
||||
int rescrollDelay = getResources().getInteger(
|
||||
R.integer.config_pageSnapAnimationDuration) + RESCROLL_EXTRA_DELAY;
|
||||
R.integer.config_pageSnapAnimationDuration) + RESCROLL_EXTRA_DELAY;
|
||||
mScrollPauseAlarm.setAlarm(rescrollDelay);
|
||||
}
|
||||
}
|
||||
@@ -1899,7 +1801,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
return false;
|
||||
} else if (!dl.isEventOverView(this, ev)
|
||||
&& mLauncherDelegate.interceptOutsideTouch(ev, dl, this)) {
|
||||
&& mLauncherDelegate.interceptOutsideTouch(ev, dl, this)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2003,6 +1905,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mFolderName = value;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
FolderNameEditText getFolderName() {
|
||||
return mFolderName;
|
||||
}
|
||||
@@ -2031,7 +1934,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
private int getHeightFromBottom() {
|
||||
BaseDragLayer.LayoutParams layoutParams = (BaseDragLayer.LayoutParams) getLayoutParams();
|
||||
int folderBottomPx = layoutParams.y + layoutParams.height;
|
||||
int windowBottomPx = mActivityContext.getDeviceProfile().getDeviceProperties().getHeightPx();
|
||||
int windowBottomPx = mActivityContext.getDeviceProfile().heightPx;
|
||||
|
||||
return windowBottomPx - folderBottomPx;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user