Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8aa5c8dd authored by Adam Shih's avatar Adam Shih
Browse files

Revert "[2/n] Let picker refresh preview when user selects a dif..."

Revert submission 24343660-picker-apply-button

Reason for revert: Build break on git_main branch on several targets

Reverted changes: /q/submissionid:24343660-picker-apply-button

Change-Id: I5ea19f6f42a784f3a3b4b2a6ca538bbc443f5a48
Merged-In: I5ea19f6f42a784f3a3b4b2a6ca538bbc443f5a48
parent ced0d679
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -72,9 +72,6 @@ public interface CustomizationManager<T extends CustomizationOption> {
     */
    void apply(T option, Callback callback);

    /** Preview the given option without committing the change. */
    default void preview(T option) {}

    /**
     * Loads the available options for the type of Customization managed by this class, calling the
     * given callback when done.
+0 −5
Original line number Diff line number Diff line
@@ -98,11 +98,6 @@ public class GridOptionsManager implements CustomizationManager<GridOption> {
        }
    }

    @Override
    public void preview(GridOption option) {
        mProvider.updateView();
    }

    @Override
    public void fetchOptions(OptionsFetchedListener<GridOption> callback, boolean reload) {
        sExecutorService.submit(() -> {
+0 −4
Original line number Diff line number Diff line
@@ -117,10 +117,6 @@ public class LauncherGridOptionsProvider {
        mPreviewUtils.renderPreview(bundle, callback);
    }

    void updateView() {
        mLiveData.postValue(new Object());
    }

    int applyGrid(String name) {
        ContentValues values = new ContentValues();
        values.put("name", name);
+11 −18
Original line number Diff line number Diff line
@@ -17,14 +17,12 @@

package com.android.customization.model.grid.data.repository

import android.content.Context
import androidx.lifecycle.asFlow
import com.android.customization.model.CustomizationManager
import com.android.customization.model.grid.GridOption
import com.android.customization.model.grid.GridOptionsManager
import com.android.customization.model.grid.shared.model.GridOptionItemModel
import com.android.customization.model.grid.shared.model.GridOptionItemsModel
import com.android.wallpaper.config.BaseFlags
import kotlin.coroutines.resume
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
@@ -43,7 +41,6 @@ interface GridRepository {
}

class GridRepositoryImpl(
    private val context: Context,
    private val applicationScope: CoroutineScope,
    private val manager: GridOptionsManager,
    private val backgroundDispatcher: CoroutineDispatcher,
@@ -108,9 +105,6 @@ class GridRepositoryImpl(
    private suspend fun onSelected(option: GridOption) {
        withContext(backgroundDispatcher) {
            suspendCancellableCoroutine { continuation ->
                if (BaseFlags.get().isGridApplyButtonEnabled(context)) {
                    manager.preview(option)
                } else {
                manager.apply(
                    option,
                    object : CustomizationManager.Callback {
@@ -126,7 +120,6 @@ class GridRepositoryImpl(
            }
        }
    }
    }

    private fun GridOption?.key(): String? {
        return if (this != null) "${cols}x${rows}" else null
+0 −1
Original line number Diff line number Diff line
@@ -580,7 +580,6 @@ internal constructor(
                    applicationScope = getApplicationCoroutineScope(),
                    repository =
                        GridRepositoryImpl(
                            context = appContext,
                            applicationScope = getApplicationCoroutineScope(),
                            manager = GridOptionsManager.getInstance(context),
                            backgroundDispatcher = bgDispatcher,