Loading src/com/android/launcher3/graphics/GridCustomizationsProvider.java +13 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ public class GridCustomizationsProvider extends ContentProvider { private static final String KEY_SURFACE_PACKAGE = "surface_package"; private static final String KEY_CALLBACK = "callback"; public static final String KEY_HIDE_BOTTOM_ROW = "hide_bottom_row"; private static final int MESSAGE_ID_UPDATE_PREVIEW = 1337; private final ArrayMap<IBinder, PreviewLifecycleObserver> mActivePreviews = new ArrayMap<>(); Loading Loading @@ -224,7 +227,14 @@ public class GridCustomizationsProvider extends ContentProvider { @Override public boolean handleMessage(Message message) { if (destroyed) { return true; } if (message.what == MESSAGE_ID_UPDATE_PREVIEW) { renderer.hideBottomRow(message.getData().getBoolean(KEY_HIDE_BOTTOM_ROW)); } else { destroyObserver(this); } return true; } Loading src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +19 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,25 @@ public class LauncherPreviewRenderer extends ContextWrapper return mHotseat; } /** * Hides the components in the bottom row. * * @param hide True to hide and false to show. */ public void hideBottomRow(boolean hide) { mUiHandler.post(() -> { if (mDp.isTaskbarPresent) { // hotseat icons on bottom mHotseat.setIconsAlpha(hide ? 0 : 1); if (mDp.isQsbInline) { mHotseat.setQsbAlpha(hide ? 0 : 1); } } else { mHotseat.setQsbAlpha(hide ? 0 : 1); } }); } @Override public CellLayout getScreenWithId(int screenId) { return mWorkspaceScreens.get(screenId); Loading src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +20 −4 Original line number Diff line number Diff line Loading @@ -87,6 +87,8 @@ public class PreviewSurfaceRenderer { private final SurfaceControlViewHost mSurfaceControlViewHost; private boolean mDestroyed = false; private LauncherPreviewRenderer mRenderer; private boolean mHideQsb; public PreviewSurfaceRenderer(Context context, Bundle bundle) throws Exception { mContext = context; Loading @@ -97,6 +99,7 @@ public class PreviewSurfaceRenderer { gridName = InvariantDeviceProfile.getCurrentGridName(context); } mWallpaperColors = bundle.getParcelable(KEY_COLORS); mHideQsb = bundle.getBoolean(GridCustomizationsProvider.KEY_HIDE_BOTTOM_ROW); mIdp = new InvariantDeviceProfile(context, gridName); mHostToken = bundle.getBinder(KEY_HOST_TOKEN); Loading Loading @@ -174,6 +177,17 @@ public class PreviewSurfaceRenderer { MODEL_EXECUTOR.execute(this::loadModelData); } /** * Hides the components in the bottom row. * * @param hide True to hide and false to show. */ public void hideBottomRow(boolean hide) { if (mRenderer != null) { mRenderer.hideBottomRow(hide); } } @WorkerThread private void loadModelData() { final boolean migrated = doGridMigrationIfNecessary(); Loading Loading @@ -254,8 +268,10 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors, launcherWidgetSpanInfo).getRenderedView(dataModel, widgetProviderInfoMap); mRenderer = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors, launcherWidgetSpanInfo); mRenderer.hideBottomRow(mHideQsb); View view = mRenderer.getRenderedView(dataModel, widgetProviderInfoMap); // This aspect scales the view to fit in the surface and centers it final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), mHeight / (float) view.getMeasuredHeight()); Loading Loading
src/com/android/launcher3/graphics/GridCustomizationsProvider.java +13 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ public class GridCustomizationsProvider extends ContentProvider { private static final String KEY_SURFACE_PACKAGE = "surface_package"; private static final String KEY_CALLBACK = "callback"; public static final String KEY_HIDE_BOTTOM_ROW = "hide_bottom_row"; private static final int MESSAGE_ID_UPDATE_PREVIEW = 1337; private final ArrayMap<IBinder, PreviewLifecycleObserver> mActivePreviews = new ArrayMap<>(); Loading Loading @@ -224,7 +227,14 @@ public class GridCustomizationsProvider extends ContentProvider { @Override public boolean handleMessage(Message message) { if (destroyed) { return true; } if (message.what == MESSAGE_ID_UPDATE_PREVIEW) { renderer.hideBottomRow(message.getData().getBoolean(KEY_HIDE_BOTTOM_ROW)); } else { destroyObserver(this); } return true; } Loading
src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +19 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,25 @@ public class LauncherPreviewRenderer extends ContextWrapper return mHotseat; } /** * Hides the components in the bottom row. * * @param hide True to hide and false to show. */ public void hideBottomRow(boolean hide) { mUiHandler.post(() -> { if (mDp.isTaskbarPresent) { // hotseat icons on bottom mHotseat.setIconsAlpha(hide ? 0 : 1); if (mDp.isQsbInline) { mHotseat.setQsbAlpha(hide ? 0 : 1); } } else { mHotseat.setQsbAlpha(hide ? 0 : 1); } }); } @Override public CellLayout getScreenWithId(int screenId) { return mWorkspaceScreens.get(screenId); Loading
src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +20 −4 Original line number Diff line number Diff line Loading @@ -87,6 +87,8 @@ public class PreviewSurfaceRenderer { private final SurfaceControlViewHost mSurfaceControlViewHost; private boolean mDestroyed = false; private LauncherPreviewRenderer mRenderer; private boolean mHideQsb; public PreviewSurfaceRenderer(Context context, Bundle bundle) throws Exception { mContext = context; Loading @@ -97,6 +99,7 @@ public class PreviewSurfaceRenderer { gridName = InvariantDeviceProfile.getCurrentGridName(context); } mWallpaperColors = bundle.getParcelable(KEY_COLORS); mHideQsb = bundle.getBoolean(GridCustomizationsProvider.KEY_HIDE_BOTTOM_ROW); mIdp = new InvariantDeviceProfile(context, gridName); mHostToken = bundle.getBinder(KEY_HOST_TOKEN); Loading Loading @@ -174,6 +177,17 @@ public class PreviewSurfaceRenderer { MODEL_EXECUTOR.execute(this::loadModelData); } /** * Hides the components in the bottom row. * * @param hide True to hide and false to show. */ public void hideBottomRow(boolean hide) { if (mRenderer != null) { mRenderer.hideBottomRow(hide); } } @WorkerThread private void loadModelData() { final boolean migrated = doGridMigrationIfNecessary(); Loading Loading @@ -254,8 +268,10 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors, launcherWidgetSpanInfo).getRenderedView(dataModel, widgetProviderInfoMap); mRenderer = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors, launcherWidgetSpanInfo); mRenderer.hideBottomRow(mHideQsb); View view = mRenderer.getRenderedView(dataModel, widgetProviderInfoMap); // This aspect scales the view to fit in the surface and centers it final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), mHeight / (float) view.getMeasuredHeight()); Loading