Launcher3: Fix launcher preview rendering

Launcher preview rendering fails on AOSP Launcher3 because the search
bar (AppsSearchContainerLayout) tries to find BaseDraggingActivity
during inflation, which doesn't exist in the preview hierarchy.

Remove the search bar from the launcher preview layout entirely to fix
the issue. This is actually more consistent with our real launcher
appearance because it doesn't have a search bar to begin with.

Change-Id: Ic549fd9d592bc702e0c12285fb016b908e49d514
This commit is contained in:
Danny Lin
2020-11-04 01:23:14 -08:00
committed by Patryk Michalik
parent ee42bb76b4
commit c6f8d713bd
2 changed files with 1 additions and 14 deletions
+1 -7
View File
@@ -39,12 +39,6 @@
<com.android.launcher3.InsettableFrameLayout
android:id="@+id/apps_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include
android:id="@id/search_container_all_apps"
layout="@layout/search_container_all_apps"/>
</com.android.launcher3.InsettableFrameLayout>
android:layout_height="match_parent" />
</com.android.launcher3.InsettableFrameLayout>
@@ -63,7 +63,6 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.R;
import com.android.launcher3.WorkspaceLayoutManager;
import com.android.launcher3.allapps.SearchUiManager;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.icons.BaseIconFactory;
@@ -511,12 +510,6 @@ public class LauncherPreviewRenderer {
mWorkspace.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);
}
// Setup search view
SearchUiManager searchUiManager =
mRootView.findViewById(R.id.search_container_all_apps);
mRootView.findViewById(R.id.apps_view).setTranslationY(
mDp.heightPx - searchUiManager.getScrollRangeDelta(mInsets));
measureView(mRootView, mDp.widthPx, mDp.heightPx);
dispatchVisibilityAggregated(mRootView, true);
measureView(mRootView, mDp.widthPx, mDp.heightPx);