Merge "Fix issue that expanded widgets appear before next item moved down" into main
This commit is contained in:
commit
88a905879a
1 file changed
+27
-1
@@ -21,6 +21,7 @@ import static com.android.launcher3.LauncherPrefs.WIDGETS_EDUCATION_DIALOG_SEEN;
|
||||
import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_SEARCHED;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
|
||||
import static com.android.launcher3.widget.picker.WidgetsListAdapter.VIEW_TYPE_WIDGETS_LIST;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.content.Context;
|
||||
@@ -1094,10 +1095,35 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mWidgetsListItemAnimator = new DefaultItemAnimator();
|
||||
mWidgetsListItemAnimator = new DefaultItemAnimator() {
|
||||
@Override
|
||||
public boolean animateChange(RecyclerView.ViewHolder oldHolder,
|
||||
RecyclerView.ViewHolder newHolder, int fromLeft, int fromTop, int toLeft,
|
||||
int toTop) {
|
||||
// As we expand an item, the content / widgets list that appears (with add
|
||||
// event) also gets change events as its previews load asynchronously. The
|
||||
// super implementation of animateChange cancels the animations on it - breaking
|
||||
// the "add animation". Instead, here, we skip "change" animation for content
|
||||
// list - because we want it to either appear or disappear. And, the previews
|
||||
// themselves have their own animation when loaded, so, we don't need change
|
||||
// animations for them anyway. Below, we do-nothing.
|
||||
if (oldHolder.getItemViewType() == VIEW_TYPE_WIDGETS_LIST) {
|
||||
dispatchChangeStarting(oldHolder, true);
|
||||
dispatchChangeFinished(oldHolder, true);
|
||||
return true;
|
||||
}
|
||||
return super.animateChange(oldHolder, newHolder, fromLeft, fromTop, toLeft,
|
||||
toTop);
|
||||
}
|
||||
};
|
||||
// Disable change animations because it disrupts the item focus upon adapter item
|
||||
// change.
|
||||
mWidgetsListItemAnimator.setSupportsChangeAnimations(false);
|
||||
// Make the moves a bit faster, so that the amount of time for which user sees the
|
||||
// bottom-sheet background before "add" animation starts is less making it smoother.
|
||||
mWidgetsListItemAnimator.setChangeDuration(90);
|
||||
mWidgetsListItemAnimator.setMoveDuration(90);
|
||||
mWidgetsListItemAnimator.setAddDuration(300);
|
||||
}
|
||||
|
||||
private int getEmptySpaceHeight() {
|
||||
|
||||
Reference in new issue
Block a user