diff options
author | Santiago Etchebehere <santie@google.com> | 2021-06-02 01:14:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-06-02 01:14:51 +0000 |
commit | 0d25a47eaefc42847b427cfe223f59d44cc42923 (patch) | |
tree | 47d626c372dd7ed886447da0e513804593b1fe3e /src/com/android | |
parent | 016159011e5a06b2fd66975321f56d5b54c7bdb2 (diff) | |
parent | ecc46e1612cc1d1b621a2b89fb649675a78635e9 (diff) | |
download | ThemePicker-0d25a47eaefc42847b427cfe223f59d44cc42923.tar.gz |
Merge "Request Workspace preview in a background thread" into sc-dev
Diffstat (limited to 'src/com/android')
3 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/customization/model/grid/GridOptionsManager.java b/src/com/android/customization/model/grid/GridOptionsManager.java index 1f67ad6f..c1ec7293 100644 --- a/src/com/android/customization/model/grid/GridOptionsManager.java +++ b/src/com/android/customization/model/grid/GridOptionsManager.java @@ -28,6 +28,7 @@ import com.android.customization.module.CustomizationInjector; import com.android.customization.module.ThemesUserEventLogger; import com.android.wallpaper.R; import com.android.wallpaper.module.InjectorProvider; +import com.android.wallpaper.util.PreviewUtils; import java.util.List; @@ -84,8 +85,9 @@ public class GridOptionsManager implements CustomizationManager<GridOption> { } /** Call through content provider API to render preview */ - public Bundle renderPreview(Bundle bundle, String gridName) { - return mProvider.renderPreview(gridName, bundle); + public void renderPreview(Bundle bundle, String gridName, + PreviewUtils.WorkspacePreviewCallback callback) { + mProvider.renderPreview(gridName, bundle, callback); } private static class FetchTask extends AsyncTask<Void, Void, List<GridOption>> { diff --git a/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java b/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java index 06c4761f..acf91b6c 100644 --- a/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java +++ b/src/com/android/customization/model/grid/LauncherGridOptionsProvider.java @@ -111,10 +111,12 @@ public class LauncherGridOptionsProvider { * @param name the grid option name * @param bundle surface view request bundle generated from * {@link com.android.wallpaper.util.SurfaceViewUtils#createSurfaceViewRequest(SurfaceView)}. + * @param callback To receive the result (will be called on the main thread) */ - Bundle renderPreview(String name, Bundle bundle) { + void renderPreview(String name, Bundle bundle, + PreviewUtils.WorkspacePreviewCallback callback) { bundle.putString("name", name); - return mPreviewUtils.renderPreview(bundle); + mPreviewUtils.renderPreview(bundle, callback); } int applyGrid(String name) { diff --git a/src/com/android/customization/picker/grid/GridOptionPreviewer.java b/src/com/android/customization/picker/grid/GridOptionPreviewer.java index dac3d9b4..8de08cfd 100644 --- a/src/com/android/customization/picker/grid/GridOptionPreviewer.java +++ b/src/com/android/customization/picker/grid/GridOptionPreviewer.java @@ -16,7 +16,6 @@ package com.android.customization.picker.grid; import android.content.Context; -import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.ViewGroup; @@ -24,6 +23,7 @@ import android.view.ViewGroup; import com.android.customization.model.grid.GridOption; import com.android.customization.model.grid.GridOptionsManager; import com.android.wallpaper.picker.WorkspaceSurfaceHolderCallback; +import com.android.wallpaper.util.PreviewUtils; import com.android.wallpaper.util.SurfaceViewUtils; /** A class to load the {@link GridOption} preview to the view. */ @@ -90,10 +90,11 @@ class GridOptionPreviewer { } @Override - protected Bundle requestPreview(SurfaceView workspaceSurface) { - return mGridManager.renderPreview( + protected void requestPreview(SurfaceView workspaceSurface, + PreviewUtils.WorkspacePreviewCallback callback) { + mGridManager.renderPreview( SurfaceViewUtils.createSurfaceViewRequest(workspaceSurface), - mGridOption.name); + mGridOption.name, callback); } } } |