Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4cbd7d9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing predicted apps reset on every onResume" into ub-launcher3-master

parents 8e35dbb2 d0d07033
Loading
Loading
Loading
Loading
+5 −29
Original line number Diff line number Diff line
@@ -867,17 +867,10 @@ public class Launcher extends BaseActivity
        if (mOnResumeState == State.WORKSPACE) {
            showWorkspace(false);
        } else if (mOnResumeState == State.APPS) {
            boolean launchedFromApp = (mWaitingForResume != null);
            // Don't update the predicted apps if the user is returning to launcher in the apps
            // view after launching an app, as they may be depending on the UI to be static to
            // switch to another app, otherwise, if it was
            showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */);
            showAppsView(false /* animated */);
        } else if (mOnResumeState == State.WIDGETS) {
            showWidgetsView(false, false);
        }
        if (mOnResumeState != State.APPS) {
            tryAndUpdatePredictedApps();
        }
        mOnResumeState = State.NONE;

        mPaused = false;
@@ -2107,7 +2100,7 @@ public class Launcher extends BaseActivity
        if (!isAppsViewVisible()) {
            getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
                    ControlType.ALL_APPS_BUTTON);
            showAppsView(true /* animated */, true /* updatePredictedApps */);
            showAppsView(true /* animated */);
        } else {
            showWorkspace(true);
        }
@@ -2672,11 +2665,8 @@ public class Launcher extends BaseActivity
    /**
     * Shows the apps view.
     */
    public void showAppsView(boolean animated, boolean updatePredictedApps) {
    public void showAppsView(boolean animated) {
        markAppsViewShown();
        if (updatePredictedApps) {
            tryAndUpdatePredictedApps();
        }
        showAppsOrWidgets(State.APPS, animated);
    }

@@ -2796,7 +2786,7 @@ public class Launcher extends BaseActivity

    public void exitSpringLoadedDragMode() {
        if (mState == State.APPS_SPRING_LOADED) {
            showAppsView(true /* animated */, false /* updatePredictedApps */);
            showAppsView(true /* animated */);
        } else if (mState == State.WIDGETS_SPRING_LOADED) {
            showWidgetsView(true, false);
        } else if (mState == State.WORKSPACE_SPRING_LOADED) {
@@ -2804,19 +2794,6 @@ public class Launcher extends BaseActivity
        }
    }

    /**
     * Updates the set of predicted apps if it hasn't been updated since the last time Launcher was
     * resumed.
     */
    public void tryAndUpdatePredictedApps() {
        if (mLauncherCallbacks != null) {
            List<ComponentKeyMapper<AppInfo>> apps = mLauncherCallbacks.getPredictedApps();
            if (apps != null) {
                mAppsView.setPredictedApps(apps);
            }
        }
    }

    @Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        final boolean result = super.dispatchPopulateAccessibilityEvent(event);
@@ -3531,7 +3508,6 @@ public class Launcher extends BaseActivity
        // Update AllApps
        if (mAppsView != null) {
            mAppsView.removeApps(appInfos);
            tryAndUpdatePredictedApps();
        }
    }

@@ -3695,7 +3671,7 @@ public class Launcher extends BaseActivity
            switch (keyCode) {
                case KeyEvent.KEYCODE_A:
                    if (mState == State.WORKSPACE) {
                        showAppsView(true, true);
                        showAppsView(true);
                        return true;
                    }
                    break;
+0 −5
Original line number Diff line number Diff line
@@ -19,14 +19,10 @@ package com.android.launcher3;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

import com.android.launcher3.util.ComponentKeyMapper;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
@@ -87,5 +83,4 @@ public interface LauncherCallbacks {
     */
    boolean shouldMoveToDefaultScreenOnHomeIntent();
    boolean hasSettings();
    List<ComponentKeyMapper<AppInfo>> getPredictedApps();
}
+0 −7
Original line number Diff line number Diff line
@@ -114,13 +114,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
        }
    }

    /**
     * Sets the current set of predicted apps.
     */
    public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
        mApps.setPredictedApps(apps);
    }

    /**
     * Sets the current set of apps.
     */
+3 −6
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
                            Action.Direction.UP,
                            containerType);
                }
                mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */);
                mLauncher.showAppsView(true /* animated */);
                if (hasSpringAnimationHandler()) {
                    mSpringAnimationHandler.add(mSearchSpring, true /* setDefaultValues */);
                    // The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.)
@@ -239,7 +239,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
                            Action.Direction.UP,
                            containerType);
                }
                mLauncher.showAppsView(true, /* animated */ false /* updatePredictedApps */);
                mLauncher.showAppsView(true /* animated */);
            }
        }
    }
@@ -256,12 +256,9 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
            // Initialize values that should not change until #onDragEnd
            mStatusBarHeight = mLauncher.getDragLayer().getInsets().top;
            mHotseat.setVisibility(View.VISIBLE);
            if (!mLauncher.isAllAppsVisible()) {
                mLauncher.tryAndUpdatePredictedApps();
            mAppsView.setVisibility(View.VISIBLE);
        }
    }
    }

    private void updateLightStatusBar(float shift) {
        // Use a light system UI (dark icons) if all apps is behind at least half of the status bar.
+0 −9
Original line number Diff line number Diff line
@@ -7,13 +7,10 @@ import android.view.Menu;
import com.android.launcher3.AppInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherCallbacks;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ComponentKeyMapper;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * This class represents a very trivial LauncherExtension. It primarily serves as a simple
@@ -149,12 +146,6 @@ public class LauncherExtension extends Launcher {
            return false;
        }

        @Override
        public List<ComponentKeyMapper<AppInfo>> getPredictedApps() {
            // To debug app predictions, enable AlphabeticalAppsList#DEBUG_PREDICTIONS
            return new ArrayList<>();
        }

        @Override
        public void onAttachedToWindow() {
        }