summaryrefslogtreecommitdiffstats
path: root/quickstep/recents_ui_overrides
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-09-13 14:29:31 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-09-13 14:29:31 -0700
commit3ff100063264d4240b91145e1cd4eacdc9384db5 (patch)
tree6509905fa88336269cf74e0e04e1f9417a17a3cd /quickstep/recents_ui_overrides
parentb548b3c7b06dbf9c2bd6c47c5fbdbd844f06ae8a (diff)
parentfc520edbc65fc39820cfd942f2da7aa4f792194e (diff)
downloadandroid_packages_apps_Trebuchet-3ff100063264d4240b91145e1cd4eacdc9384db5.tar.gz
android_packages_apps_Trebuchet-3ff100063264d4240b91145e1cd4eacdc9384db5.tar.bz2
android_packages_apps_Trebuchet-3ff100063264d4240b91145e1cd4eacdc9384db5.zip
Merge "Replace OnGlobalLayoutListener with StateListener to update predictions" into ub-launcher3-qt-qpr1-dev
am: fc520edbc6 Change-Id: I8e5b43a582bd243e21f02b5a83b931f4f277eb95
Diffstat (limited to 'quickstep/recents_ui_overrides')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
index 085bbc4a5..1a59770a0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
@@ -24,7 +24,6 @@ import android.app.prediction.AppPredictor;
import android.app.prediction.AppTarget;
import android.content.ComponentName;
import android.content.Context;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import com.android.launcher3.AppInfo;
import com.android.launcher3.InvariantDeviceProfile;
@@ -32,6 +31,8 @@ import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager.StateListener;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsStore.OnUpdateListener;
@@ -58,7 +59,7 @@ import java.util.List;
* 4) Maintains the current active client id (for the predictions) and all updates are performed on
* that client id.
*/
-public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInfoUpdateReceiver,
+public class PredictionUiStateManager implements StateListener, ItemInfoUpdateReceiver,
OnIDPChangeListener, OnUpdateListener {
public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state";
@@ -153,7 +154,10 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
public void reapplyItemInfo(ItemInfoWithIcon info) { }
@Override
- public void onGlobalLayout() {
+ public void onStateTransitionStart(LauncherState toState) { }
+
+ @Override
+ public void onStateTransitionComplete(LauncherState state) {
if (mAppsView == null) {
return;
}
@@ -162,7 +166,8 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
mPendingState = null;
}
if (mPendingState == null) {
- mAppsView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ Launcher.getLauncher(mAppsView.getContext()).getStateManager()
+ .removeStateListener(this);
}
}
@@ -170,9 +175,8 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
boolean registerListener = mPendingState == null;
mPendingState = state;
if (registerListener) {
- // OnGlobalLayoutListener is called whenever a view in the view tree changes
- // visibility. Add a listener and wait until appsView is invisible again.
- mAppsView.getViewTreeObserver().addOnGlobalLayoutListener(this);
+ // Add a listener and wait until appsView is invisible again.
+ Launcher.getLauncher(mAppsView.getContext()).getStateManager().addStateListener(this);
}
}