Fix alignment issue with suggested apps in all apps
-> New RecyclerView handles wrap_content differently
-> Add mock set of suggested apps to the LauncherExtension
issue: 27581978
Change-Id: Id080e212e0425515fa66e821d116b95284bb3526
diff --git a/res/layout/all_apps_prediction_bar_icon.xml b/res/layout/all_apps_prediction_bar_icon.xml
index 341d8ef..f15aeaf 100644
--- a/res/layout/all_apps_prediction_bar_icon.xml
+++ b/res/layout/all_apps_prediction_bar_icon.xml
@@ -18,7 +18,7 @@
xmlns:launcher="http://schemas.android.com/apk/res-auto"
style="@style/Icon.AllApps"
android:id="@+id/icon"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="@dimen/all_apps_prediction_icon_top_padding"
diff --git a/src/com/android/launcher3/testing/LauncherExtension.java b/src/com/android/launcher3/testing/LauncherExtension.java
index d5a340d..6f1acfe 100644
--- a/src/com/android/launcher3/testing/LauncherExtension.java
+++ b/src/com/android/launcher3/testing/LauncherExtension.java
@@ -1,5 +1,6 @@
package com.android.launcher3.testing;
+import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Rect;
@@ -11,6 +12,7 @@
import com.android.launcher3.AppInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherCallbacks;
+import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.logging.UserEventLogger;
import com.android.launcher3.allapps.AllAppsSearchBarController;
import com.android.launcher3.util.ComponentKey;
@@ -280,7 +282,15 @@
@Override
public List<ComponentKey> getPredictedApps() {
- return new ArrayList<>();
+ // Return a mock set of predicted apps for UI testing
+ ArrayList<ComponentKey> ar = new ArrayList<>();
+ for (int i = 0; i < 6; i++) {
+ ComponentKey ck = new ComponentKey(new ComponentName("com.android.settings",
+ "com.android.settings.Settings"), UserHandleCompat.myUserHandle());
+ ar.add(ck);
+ }
+ return ar;
+
}
@Override