Search in sources :

Example 1 with HandlerRunnable

use of com.android.launcher3.icons.cache.HandlerRunnable in project android_packages_apps_404Launcher by P-404.

the class DatabaseWidgetPreviewLoader method loadPreview.

/**
 * Generates the widget preview on {@link AsyncTask#THREAD_POOL_EXECUTOR}. Must be
 * called on UI thread.
 *
 * @return a request id which can be used to cancel the request.
 */
@NonNull
public HandlerRunnable loadPreview(@NonNull WidgetItem item, @NonNull Size previewSize, @NonNull Consumer<Bitmap> callback) {
    Handler handler = Executors.UI_HELPER_EXECUTOR.getHandler();
    HandlerRunnable<Bitmap> request = new HandlerRunnable<>(handler, () -> generatePreview(item, previewSize.getWidth(), previewSize.getHeight()), MAIN_EXECUTOR, callback);
    Utilities.postAsyncCallback(handler, request);
    return request;
}
Also used : Bitmap(android.graphics.Bitmap) Handler(android.os.Handler) HandlerRunnable(com.android.launcher3.icons.cache.HandlerRunnable) NonNull(androidx.annotation.NonNull)

Example 2 with HandlerRunnable

use of com.android.launcher3.icons.cache.HandlerRunnable in project android_packages_apps_Launcher3 by ArrowOS.

the class DatabaseWidgetPreviewLoader method loadPreview.

/**
 * Generates the widget preview on {@link AsyncTask#THREAD_POOL_EXECUTOR}. Must be
 * called on UI thread.
 *
 * @return a request id which can be used to cancel the request.
 */
@NonNull
public HandlerRunnable loadPreview(@NonNull WidgetItem item, @NonNull Size previewSize, @NonNull Consumer<Bitmap> callback) {
    Handler handler = Executors.UI_HELPER_EXECUTOR.getHandler();
    HandlerRunnable<Bitmap> request = new HandlerRunnable<>(handler, () -> generatePreview(item, previewSize.getWidth(), previewSize.getHeight()), MAIN_EXECUTOR, callback);
    Utilities.postAsyncCallback(handler, request);
    return request;
}
Also used : Bitmap(android.graphics.Bitmap) Handler(android.os.Handler) HandlerRunnable(com.android.launcher3.icons.cache.HandlerRunnable) NonNull(androidx.annotation.NonNull)

Example 3 with HandlerRunnable

use of com.android.launcher3.icons.cache.HandlerRunnable in project android_packages_apps_Launcher3 by ProtonAOSP.

the class DatabaseWidgetPreviewLoader method loadPreview.

/**
 * Generates the widget preview on {@link AsyncTask#THREAD_POOL_EXECUTOR}. Must be
 * called on UI thread.
 *
 * @return a request id which can be used to cancel the request.
 */
@NonNull
public HandlerRunnable loadPreview(@NonNull WidgetItem item, @NonNull Size previewSize, @NonNull Consumer<Bitmap> callback) {
    Handler handler = Executors.UI_HELPER_EXECUTOR.getHandler();
    HandlerRunnable<Bitmap> request = new HandlerRunnable<>(handler, () -> generatePreview(item, previewSize.getWidth(), previewSize.getHeight()), MAIN_EXECUTOR, callback);
    Utilities.postAsyncCallback(handler, request);
    return request;
}
Also used : Bitmap(android.graphics.Bitmap) Handler(android.os.Handler) HandlerRunnable(com.android.launcher3.icons.cache.HandlerRunnable) NonNull(androidx.annotation.NonNull)

Example 4 with HandlerRunnable

use of com.android.launcher3.icons.cache.HandlerRunnable in project android_packages_apps_Launcher3 by AOSPA.

the class DatabaseWidgetPreviewLoader method loadPreview.

/**
 * Generates the widget preview on {@link AsyncTask#THREAD_POOL_EXECUTOR}. Must be
 * called on UI thread.
 *
 * @return a request id which can be used to cancel the request.
 */
@NonNull
public HandlerRunnable loadPreview(@NonNull WidgetItem item, @NonNull Size previewSize, @NonNull Consumer<Bitmap> callback) {
    Handler handler = Executors.UI_HELPER_EXECUTOR.getHandler();
    HandlerRunnable<Bitmap> request = new HandlerRunnable<>(handler, () -> generatePreview(item, previewSize.getWidth(), previewSize.getHeight()), MAIN_EXECUTOR, callback);
    Utilities.postAsyncCallback(handler, request);
    return request;
}
Also used : Bitmap(android.graphics.Bitmap) Handler(android.os.Handler) HandlerRunnable(com.android.launcher3.icons.cache.HandlerRunnable) NonNull(androidx.annotation.NonNull)

Aggregations

Bitmap (android.graphics.Bitmap)4 Handler (android.os.Handler)4 NonNull (androidx.annotation.NonNull)4 HandlerRunnable (com.android.launcher3.icons.cache.HandlerRunnable)4