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

Commit a7f3fd13 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13097162 from 2f6c3c04 to 25Q2-release

Change-Id: I03993f5457615cb416396c7a57dcad2b825d688c
parents b4d6f183 2f6c3c04
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.customization.model.grid

import android.content.ContentValues
import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.util.Log
import androidx.core.content.res.ResourcesCompat
import com.android.wallpaper.R
import com.android.wallpaper.picker.di.modules.BackgroundDispatcher
@@ -156,15 +158,26 @@ constructor(
        )
    }

    override fun getGridOptionDrawble(iconId: Int): Drawable? {
        return ResourcesCompat.getDrawable(
    override fun getGridOptionDrawable(iconId: Int): Drawable? {
        try {
            val drawable =
                ResourcesCompat.getDrawable(
                    context.packageManager.getResourcesForApplication(APP_RESOURCES_PACKAGE_NAME),
                    iconId,
                    /* theme = */ null,
                )
            return drawable
        } catch (exception: Resources.NotFoundException) {
            Log.w(
                TAG,
                "Unable to find drawable resource from package $APP_RESOURCES_PACKAGE_NAME with resource ID $iconId",
            )
            return null
        }
    }

    companion object {
        const val TAG = "DefaultShapeGridManager"
        const val SHAPE_OPTIONS: String = "shape_options"
        const val GRID_OPTIONS: String = "list_options"
        const val SHAPE_GRID: String = "default_grid"
+1 −1
Original line number Diff line number Diff line
@@ -26,5 +26,5 @@ interface ShapeGridManager {

    fun applyShapeGridOption(shapeKey: String, gridKey: String): Int

    fun getGridOptionDrawble(iconId: Int): Drawable?
    fun getGridOptionDrawable(iconId: Int): Drawable?
}
+1 −1
Original line number Diff line number Diff line
@@ -72,6 +72,6 @@ constructor(
        }

    fun getGridOptionDrawable(iconId: Int): Drawable? {
        return manager.getGridOptionDrawble(iconId)
        return manager.getGridOptionDrawable(iconId)
    }
}
+19 −2
Original line number Diff line number Diff line
@@ -17,11 +17,14 @@
package com.android.wallpaper.customization.ui.viewmodel

import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.Drawable
import com.android.customization.model.ResourceConstants
import com.android.customization.model.grid.GridOptionModel
import com.android.customization.model.grid.ShapeOptionModel
import com.android.customization.picker.grid.domain.interactor.ShapeGridInteractor
import com.android.customization.picker.grid.ui.viewmodel.ShapeIconViewModel
import com.android.customization.widget.GridTileDrawable
import com.android.themepicker.R
import com.android.wallpaper.picker.common.icon.ui.viewmodel.Icon
import com.android.wallpaper.picker.common.text.ui.viewmodel.Text
@@ -186,6 +189,21 @@ constructor(
    }

    private fun toGridOptionItemViewModel(option: GridOptionModel): OptionItemViewModel2<Drawable> {
        // Fallback to use GridTileDrawable when no resource found for the icon ID
        val drawable =
            interactor.getGridOptionDrawable(option.iconId)
                ?: GridTileDrawable(
                    option.cols,
                    option.rows,
                    context.resources.getString(
                        Resources.getSystem()
                            .getIdentifier(
                                ResourceConstants.CONFIG_ICON_MASK,
                                "string",
                                ResourceConstants.ANDROID_PACKAGE,
                            )
                    ),
                )
        val isSelected =
            previewingGridKey
                .map { it == option.key }
@@ -194,10 +212,9 @@ constructor(
                    started = SharingStarted.Lazily,
                    initialValue = false,
                )

        return OptionItemViewModel2(
            key = MutableStateFlow(option.key),
            payload = interactor.getGridOptionDrawable(option.iconId),
            payload = drawable,
            text = Text.Loaded(option.title),
            isSelected = isSelected,
            onClicked =
+1 −8
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ class FakeShapeGridManager @Inject constructor() : ShapeGridManager {
        return 0
    }

    override fun getGridOptionDrawble(iconId: Int): Drawable? {
    override fun getGridOptionDrawable(iconId: Int): Drawable? {
        return when (iconId) {
            0 -> gridOptionDrawable0
            1 -> gridOptionDrawable1
@@ -94,13 +94,6 @@ class FakeShapeGridManager @Inject constructor() : ShapeGridManager {
                        "M35.209 4.878C36.326 3.895 36.884 3.404 37.397 3.006 44.82-2.742 55.18-2.742 62.603 3.006 63.116 3.404 63.674 3.895 64.791 4.878 65.164 5.207 65.351 5.371 65.539 5.529 68.167 7.734 71.303 9.248 74.663 9.932 74.902 9.981 75.147 10.025 75.637 10.113 77.1 10.375 77.831 10.506 78.461 10.66 87.573 12.893 94.032 21.011 94.176 30.412 94.186 31.062 94.151 31.805 94.08 33.293 94.057 33.791 94.045 34.04 94.039 34.285 93.958 37.72 94.732 41.121 96.293 44.18 96.404 44.399 96.522 44.618 96.759 45.056 97.467 46.366 97.821 47.021 98.093 47.611 102.032 56.143 99.727 66.266 92.484 72.24 91.983 72.653 91.381 73.089 90.177 73.961 89.774 74.254 89.572 74.4 89.377 74.548 86.647 76.626 84.477 79.353 83.063 82.483 82.962 82.707 82.865 82.936 82.671 83.395 82.091 84.766 81.8 85.451 81.51 86.033 77.31 94.44 67.977 98.945 58.801 96.994 58.166 96.859 57.451 96.659 56.019 96.259 55.54 96.125 55.3 96.058 55.063 95.998 51.74 95.154 48.26 95.154 44.937 95.998 44.699 96.058 44.46 96.125 43.981 96.259 42.549 96.659 41.834 96.859 41.199 96.994 32.023 98.945 22.69 94.44 18.49 86.033 18.2 85.451 17.909 84.766 17.329 83.395 17.135 82.936 17.038 82.707 16.937 82.483 15.523 79.353 13.353 76.626 10.623 74.548 10.428 74.4 10.226 74.254 9.823 73.961 8.619 73.089 8.017 72.653 7.516 72.24.273 66.266-2.032 56.143 1.907 47.611 2.179 47.021 2.533 46.366 3.241 45.056 3.478 44.618 3.596 44.399 3.707 44.18 5.268 41.121 6.042 37.72 5.961 34.285 5.955 34.04 5.943 33.791 5.92 33.293 5.849 31.805 5.814 31.062 5.824 30.412 5.968 21.011 12.427 12.893 21.539 10.66 22.169 10.506 22.9 10.375 24.363 10.113 24.853 10.025 25.098 9.981 25.337 9.932 28.697 9.248 31.833 7.734 34.461 5.529 34.649 5.371 34.836 5.207 35.209 4.878Z",
                    isCurrent = false,
                ),
                ShapeOptionModel(
                    key = "sunny",
                    title = "sunny",
                    path =
                        "M42.846 4.873C46.084-.531 53.916-.531 57.154 4.873L60.796 10.951C62.685 14.103 66.414 15.647 69.978 14.754L76.851 13.032C82.962 11.5 88.5 17.038 86.968 23.149L85.246 30.022C84.353 33.586 85.897 37.315 89.049 39.204L95.127 42.846C100.531 46.084 100.531 53.916 95.127 57.154L89.049 60.796C85.897 62.685 84.353 66.414 85.246 69.978L86.968 76.851C88.5 82.962 82.962 88.5 76.851 86.968L69.978 85.246C66.414 84.353 62.685 85.898 60.796 89.049L57.154 95.127C53.916 100.531 46.084 100.531 42.846 95.127L39.204 89.049C37.315 85.898 33.586 84.353 30.022 85.246L23.149 86.968C17.038 88.5 11.5 82.962 13.032 76.851L14.754 69.978C15.647 66.414 14.103 62.685 10.951 60.796L4.873 57.154C-.531 53.916-.531 46.084 4.873 42.846L10.951 39.204C14.103 37.315 15.647 33.586 14.754 30.022L13.032 23.149C11.5 17.038 17.038 11.5 23.149 13.032L30.022 14.754C33.586 15.647 37.315 14.103 39.204 10.951L42.846 4.873Z",
                    isCurrent = false,
                ),
                ShapeOptionModel(
                    key = "circle",
                    title = "circle",
Loading