Skip to content

Commit e3882a7

Browse files
committed
添加首次进入桌面绑定完成后是否滑动到最后一页
1 parent de0afcb commit e3882a7

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ Launcher3-master.iml
99

1010
effectivecard/effectivecard.iml
1111
launcherclient/launcherclient.iml
12+
libs/
13+
src/main/res/

src/com/android/launcher3/Launcher.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,12 @@ private void bindAddScreens(ArrayList<Long> orderedScreenIds) {
19461946
@Override
19471947
public void bindAppsAdded(ArrayList<Long> newScreens, ArrayList<ItemInfo> addNotAnimated,
19481948
ArrayList<ItemInfo> addAnimated) {
1949-
XLog.e(XLog.getTag(), XLog.TAG_GU + addNotAnimated.size() + " " + addAnimated.size());
1949+
if (addNotAnimated != null) {
1950+
XLog.e(XLog.getTag(), XLog.TAG_GU + addNotAnimated.size());
1951+
}
1952+
if (addAnimated != null) {
1953+
XLog.e(XLog.getTag(), XLog.TAG_GU + addAnimated.size());
1954+
}
19501955
// Add the new screens
19511956
if (newScreens != null) {
19521957
bindAddScreens(newScreens);
@@ -1976,7 +1981,10 @@ public void bindItems(final List<ItemInfo> items, final boolean forceAnimateIcon
19761981
// Get the list of added items and intersect them with the set of items here
19771982
final AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
19781983
final Collection<Animator> bounceAnims = new ArrayList<>();
1979-
final boolean animateIcons = forceAnimateIcons && canRunNewAppsAnimation();
1984+
// modify by codemx.cn ---- 20200710 ---- start
1985+
final boolean animateIcons = FeatureFlags.SCROLL_TO_LAST_PAGE_WHEN_BIND_FINISH
1986+
&& forceAnimateIcons && canRunNewAppsAnimation();
1987+
// modify by codemx.cn ---- 20200710 ---- start
19801988
Workspace workspace = mWorkspace;
19811989
long newItemsScreenId = -1;
19821990
int end = items.size();
@@ -2060,15 +2068,13 @@ public void run() {
20602068
if (newItemsScreenId != currentScreenId) {
20612069
// We post the animation slightly delayed to prevent slowdowns
20622070
// when we are loading right after we return to launcher.
2063-
mWorkspace.postDelayed(new Runnable() {
2064-
public void run() {
2065-
if (mWorkspace != null) {
2066-
AbstractFloatingView.closeAllOpenViews(Launcher.this, false);
2067-
2068-
mWorkspace.snapToPage(newScreenIndex);
2069-
mWorkspace.postDelayed(startBounceAnimRunnable,
2070-
NEW_APPS_ANIMATION_DELAY);
2071-
}
2071+
mWorkspace.postDelayed(() -> {
2072+
if (mWorkspace != null) {
2073+
AbstractFloatingView.closeAllOpenViews(Launcher.this, false);
2074+
2075+
mWorkspace.snapToPage(newScreenIndex);
2076+
mWorkspace.postDelayed(startBounceAnimRunnable,
2077+
NEW_APPS_ANIMATION_DELAY);
20722078
}
20732079
}, NEW_APPS_PAGE_MOVE_DELAY);
20742080
} else {
@@ -2205,7 +2211,7 @@ private View inflateAppWidget(LauncherAppWidgetInfo item) {
22052211
*/
22062212
private LauncherAppWidgetInfo completeRestoreAppWidget(int appWidgetId, int finalRestoreFlag) {
22072213
LauncherAppWidgetHostView view = mWorkspace.getWidgetForAppWidgetId(appWidgetId);
2208-
if ((view == null) || !(view instanceof PendingAppWidgetHostView)) {
2214+
if (!(view instanceof PendingAppWidgetHostView)) {
22092215
Log.e(TAG, "Widget update called, when the widget no longer exists.");
22102216
return null;
22112217
}

src/com/android/launcher3/config/BaseFlags.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ abstract class BaseFlags {
6161

6262
// 是否开启负一屏,当LAUNCHER_OVERLAY_ENABLED = false才起作用
6363
public static final boolean CUSTOM_CONTENT_ENABLED = false;
64+
6465
// 是否开启跨进程的负一屏,如果开启,则不会开启CustomContent负一屏
6566
public static final boolean LAUNCHER_OVERLAY_ENABLED = false;
6667

68+
// add by codemx.cn ---- 20200710 ---- start
69+
// 绑定完成后是否滑动到最后一页
70+
public static final boolean SCROLL_TO_LAST_PAGE_WHEN_BIND_FINISH = false;
71+
// add by codemx.cn ---- 20200710 ---- start
72+
6773
}

0 commit comments

Comments
 (0)