summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-03-14 11:28:36 -0700
committerKevin <kevhan@google.com>2019-03-15 15:09:38 -0700
commit5163b58d525333c4f979c7a1c3fb129a64019c96 (patch)
treed4e025b0399d56291a235986480db255d18ca898 /go
parentaaffa2385f2bdb9a04236e95532fca5054c5ca3c (diff)
downloadandroid_packages_apps_Trebuchet-5163b58d525333c4f979c7a1c3fb129a64019c96.tar.gz
android_packages_apps_Trebuchet-5163b58d525333c4f979c7a1c3fb129a64019c96.tar.bz2
android_packages_apps_Trebuchet-5163b58d525333c4f979c7a1c3fb129a64019c96.zip
Add activity interface to Recents Go view
Add an interface for recents to activity logic that can be set on the Go recents view. This CL includes a method for the logic that should occur when leaving recents due to having no tasks remaining. As the view has no knowledge of the containing activity (could be Launcher or could be a separate activity), this interface must be set externally. Bug: 114136250 Test: Remove all tasks, see that it goes to home when l3goIconRecents is the default launcher Change-Id: I110abab49c22e245b98a1f9b91b0b0f052886098
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/src/com/android/launcher3/LauncherRecentsToActivityHelper.java38
-rw-r--r--go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java3
-rw-r--r--go/quickstep/src/com/android/quickstep/FallbackRecentsToActivityHelper.java34
-rw-r--r--go/quickstep/src/com/android/quickstep/RecentsActivity.java1
-rw-r--r--go/quickstep/src/com/android/quickstep/RecentsToActivityHelper.java29
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java14
6 files changed, 118 insertions, 1 deletions
diff --git a/go/quickstep/src/com/android/launcher3/LauncherRecentsToActivityHelper.java b/go/quickstep/src/com/android/launcher3/LauncherRecentsToActivityHelper.java
new file mode 100644
index 000000000..c12da946f
--- /dev/null
+++ b/go/quickstep/src/com/android/launcher3/LauncherRecentsToActivityHelper.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3;
+
+import static com.android.launcher3.LauncherState.NORMAL;
+
+import com.android.quickstep.RecentsToActivityHelper;
+
+/**
+ * {@link RecentsToActivityHelper} for when the recents implementation is contained in
+ * {@link Launcher}.
+ */
+public final class LauncherRecentsToActivityHelper implements RecentsToActivityHelper {
+
+ private final Launcher mLauncher;
+
+ public LauncherRecentsToActivityHelper(Launcher launcher) {
+ mLauncher = launcher;
+ }
+
+ @Override
+ public void leaveRecents() {
+ mLauncher.getStateManager().goToState(NORMAL);
+ }
+}
diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index f1cb75b9d..784af7d11 100644
--- a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -23,6 +23,7 @@ import android.util.FloatProperty;
import androidx.annotation.NonNull;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherRecentsToActivityHelper;
import com.android.quickstep.views.IconRecentsView;
/**
@@ -33,6 +34,8 @@ public final class RecentsViewStateController extends
public RecentsViewStateController(@NonNull Launcher launcher) {
super(launcher);
+ launcher.<IconRecentsView>getOverviewPanel().setRecentsToActivityHelper(
+ new LauncherRecentsToActivityHelper(launcher));
}
@Override
diff --git a/go/quickstep/src/com/android/quickstep/FallbackRecentsToActivityHelper.java b/go/quickstep/src/com/android/quickstep/FallbackRecentsToActivityHelper.java
new file mode 100644
index 000000000..a845f93a9
--- /dev/null
+++ b/go/quickstep/src/com/android/quickstep/FallbackRecentsToActivityHelper.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep;
+
+/**
+ * {@link RecentsToActivityHelper} for when we are using the fallback recents in
+ * {@link BaseRecentsActivity}.
+ */
+public final class FallbackRecentsToActivityHelper implements RecentsToActivityHelper {
+
+ BaseRecentsActivity mActivity;
+
+ public FallbackRecentsToActivityHelper(BaseRecentsActivity activity) {
+ mActivity = activity;
+ }
+
+ @Override
+ public void leaveRecents() {
+ mActivity.startHome();
+ }
+}
diff --git a/go/quickstep/src/com/android/quickstep/RecentsActivity.java b/go/quickstep/src/com/android/quickstep/RecentsActivity.java
index a186aaa83..c814a71f0 100644
--- a/go/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/go/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -36,6 +36,7 @@ public final class RecentsActivity extends BaseRecentsActivity {
setContentView(R.layout.fallback_recents_activity);
mRecentsRootView = findViewById(R.id.drag_layer);
mIconRecentsView = findViewById(R.id.overview_panel);
+ mIconRecentsView.setRecentsToActivityHelper(new FallbackRecentsToActivityHelper(this));
}
@Override
diff --git a/go/quickstep/src/com/android/quickstep/RecentsToActivityHelper.java b/go/quickstep/src/com/android/quickstep/RecentsToActivityHelper.java
new file mode 100644
index 000000000..8f3b707fe
--- /dev/null
+++ b/go/quickstep/src/com/android/quickstep/RecentsToActivityHelper.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep;
+
+/**
+ * Generic interface providing methods to the recents implementation that allow it to callback to
+ * the containing activity.
+ */
+public interface RecentsToActivityHelper {
+
+ /**
+ * The default action to take when leaving/closing recents. In general, this should be used to
+ * go to the appropriate home state.
+ */
+ void leaveRecents();
+}
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 8c7177bab..e294282c3 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -26,12 +26,14 @@ import android.view.View;
import android.view.ViewDebug;
import android.widget.FrameLayout;
+import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
import com.android.launcher3.R;
+import com.android.quickstep.RecentsToActivityHelper;
import com.android.quickstep.TaskAdapter;
import com.android.quickstep.TaskInputController;
import com.android.quickstep.TaskListLoader;
@@ -87,6 +89,7 @@ public final class IconRecentsView extends FrameLayout {
private final TaskAdapter mTaskAdapter;
private final TaskInputController mTaskInputController;
+ private RecentsToActivityHelper mActivityHelper;
private float mTranslationYFactor;
private RecyclerView mTaskRecyclerView;
private View mEmptyView;
@@ -128,6 +131,15 @@ public final class IconRecentsView extends FrameLayout {
}
/**
+ * Set activity helper for the view to callback to.
+ *
+ * @param helper the activity helper
+ */
+ public void setRecentsToActivityHelper(@NonNull RecentsToActivityHelper helper) {
+ mActivityHelper = helper;
+ }
+
+ /**
* Logic for when we know we are going to overview/recents and will be putting up the recents
* view. This should be used to prepare recents (e.g. load any task data, etc.) before it
* becomes visible.
@@ -160,7 +172,7 @@ public final class IconRecentsView extends FrameLayout {
int taskListSize = mTaskLoader.getCurrentTaskList().size();
if (mEmptyView.getVisibility() != VISIBLE && taskListSize == 0) {
crossfadeViews(mEmptyView, mTaskRecyclerView);
- // TODO: Go to home.
+ mActivityHelper.leaveRecents();
}
if (mTaskRecyclerView.getVisibility() != VISIBLE && taskListSize > 0) {
crossfadeViews(mTaskRecyclerView, mEmptyView);