Merge "Hook picker default clock up to FlexClockView" into main
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 07b2800..5643351 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -101,7 +101,7 @@
<string name="grid_title">App grid</string>
<!-- Title of a section of the customization picker where the user can select app shapes and
- grid layouts for the home screen. [CHAR LIMIT=15] -->
+ grid layouts for the home screen. [CHAR LIMIT=32] -->
<string name="shape_and_grid_title">App shape & layout</string>
<!-- Tab title that switch to app grid customization section, where people can customization
diff --git a/src/com/android/customization/model/color/ColorOption.java b/src/com/android/customization/model/color/ColorOption.java
index d3886a0..18414a4 100644
--- a/src/com/android/customization/model/color/ColorOption.java
+++ b/src/com/android/customization/model/color/ColorOption.java
@@ -19,10 +19,10 @@
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE;
import android.content.Context;
-import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.ColorInt;
import androidx.annotation.VisibleForTesting;
import com.android.customization.model.CustomizationManager;
@@ -59,11 +59,13 @@
private final Style mStyle;
private final int mIndex;
private CharSequence mContentDescription;
+ private final @ColorInt int mSeedColor;
protected ColorOption(String title, Map<String, String> overlayPackages, boolean isDefault,
- Style style, int index) {
+ int seedColor, Style style, int index) {
mTitle = title;
mIsDefault = isDefault;
+ mSeedColor = seedColor;
mStyle = style;
mIndex = index;
mPackagesByCategory = Collections.unmodifiableMap(removeNullValues(overlayPackages));
@@ -102,37 +104,8 @@
}
}
- /**
- * Gets the seed color from the overlay packages in hex string.
- *
- * @return a string representing the seed color, or null if the color option is generated from
- * the default seed.
- */
- public Integer getSeedColor() {
- String seedColor = mPackagesByCategory.get(OVERLAY_CATEGORY_SYSTEM_PALETTE);
- if (TextUtils.isEmpty(seedColor)) {
- return null;
- }
- if (!seedColor.startsWith("#")) {
- seedColor = "#" + seedColor;
- }
- return Color.parseColor(seedColor);
- }
-
- /**
- * Gets the seed color from the overlay packages for logging.
- *
- * @return an int representing the seed color, or NULL_SEED_COLOR
- */
- public int getSeedColorForLogging() {
- String seedColor = mPackagesByCategory.get(OVERLAY_CATEGORY_SYSTEM_PALETTE);
- if (seedColor == null || seedColor.isEmpty()) {
- return ThemesUserEventLogger.NULL_SEED_COLOR;
- }
- if (!seedColor.startsWith("#")) {
- seedColor = "#" + seedColor;
- }
- return Color.parseColor(seedColor);
+ public @ColorInt int getSeedColor() {
+ return mSeedColor;
}
/**
diff --git a/src/com/android/customization/model/color/ColorOptionImpl.kt b/src/com/android/customization/model/color/ColorOptionImpl.kt
index ecef2a7..3b8fbc8 100644
--- a/src/com/android/customization/model/color/ColorOptionImpl.kt
+++ b/src/com/android/customization/model/color/ColorOptionImpl.kt
@@ -33,16 +33,15 @@
overlayPackages: Map<String, String?>,
isDefault: Boolean,
private val source: String?,
+ seedColor: Int,
style: Style,
index: Int,
private val previewInfo: PreviewInfo,
val type: ColorType,
-) : ColorOption(title, overlayPackages, isDefault, style, index) {
+) : ColorOption(title, overlayPackages, isDefault, seedColor, style, index) {
- class PreviewInfo(
- @ColorInt val lightColors: IntArray,
- @ColorInt val darkColors: IntArray,
- ) : ColorOption.PreviewInfo {
+ class PreviewInfo(@ColorInt val lightColors: IntArray, @ColorInt val darkColors: IntArray) :
+ ColorOption.PreviewInfo {
@ColorInt
fun resolveColors(darkTheme: Boolean): IntArray {
return if (darkTheme) darkColors else lightColors
@@ -89,6 +88,7 @@
@ColorSource var source: String? = null
var isDefault = false
+ @ColorInt var seedColor = 0
var style = Style.TONAL_SPOT
var index = 0
var packages: MutableMap<String, String?> = HashMap()
@@ -100,10 +100,11 @@
packages,
isDefault,
source,
+ seedColor,
style,
index,
createPreviewInfo(),
- type
+ type,
)
}
diff --git a/src/com/android/customization/model/color/ColorProvider.kt b/src/com/android/customization/model/color/ColorProvider.kt
index 2d7037e..b883e03 100644
--- a/src/com/android/customization/model/color/ColorProvider.kt
+++ b/src/com/android/customization/model/color/ColorProvider.kt
@@ -100,10 +100,7 @@
this.homeWallpaperColors != homeWallpaperColors ||
this.lockWallpaperColors != lockWallpaperColors
if (wallpaperColorsChanged || reload) {
- loadSeedColors(
- homeWallpaperColors,
- lockWallpaperColors,
- )
+ loadSeedColors(homeWallpaperColors, lockWallpaperColors)
this.homeWallpaperColors = homeWallpaperColors
this.lockWallpaperColors = lockWallpaperColors
}
@@ -166,13 +163,7 @@
bundles,
)
} else {
- buildColorSeeds(
- homeWallpaperColors,
- colorsPerSource,
- COLOR_SOURCE_HOME,
- true,
- bundles,
- )
+ buildColorSeeds(homeWallpaperColors, colorsPerSource, COLOR_SOURCE_HOME, true, bundles)
}
wallpaperColorBundles = bundles
}
@@ -206,9 +197,10 @@
val builder = ColorOptionImpl.Builder()
builder.lightColors = getLightColorPreview(lightColorScheme)
builder.darkColors = getDarkColorPreview(darkColorScheme)
+ builder.seedColor = colorInt
builder.addOverlayPackage(
OVERLAY_CATEGORY_SYSTEM_PALETTE,
- if (isDefault) "" else toColorString(colorInt)
+ if (isDefault) "" else toColorString(colorInt),
)
builder.title =
when (style) {
@@ -312,12 +304,7 @@
Style.RAINBOW -> intArrayOf(colorScheme.accent1.s200, colorScheme.accent1.s200)
else -> intArrayOf(colorScheme.accent1.s100, colorScheme.accent1.s100)
}
- return intArrayOf(
- colors[0],
- colors[1],
- colors[0],
- colors[1],
- )
+ return intArrayOf(colors[0], colors[1], colors[0], colors[1])
}
private suspend fun loadPreset() =
@@ -392,6 +379,7 @@
val darkColor = darkColorScheme.accentColor
var lightColors = intArrayOf(lightColor, lightColor, lightColor, lightColor)
var darkColors = intArrayOf(darkColor, darkColor, darkColor, darkColor)
+ builder.seedColor = colorFromStub
builder.addOverlayPackage(OVERLAY_CATEGORY_COLOR, toColorString(colorFromStub))
builder.addOverlayPackage(OVERLAY_CATEGORY_SYSTEM_PALETTE, toColorString(colorFromStub))
if (style != null) {
@@ -426,7 +414,7 @@
if (wallpaperColors.isNotEmpty()) {
wallpaperColors.add(
1,
- buildPreset(it, -1, Style.MONOCHROMATIC, ColorType.WALLPAPER_COLOR)
+ buildPreset(it, -1, Style.MONOCHROMATIC, ColorType.WALLPAPER_COLOR),
)
}
}
diff --git a/src/com/android/customization/picker/color/data/repository/FakeColorPickerRepository.kt b/src/com/android/customization/picker/color/data/repository/FakeColorPickerRepository.kt
index f35d934..3f120ce 100644
--- a/src/com/android/customization/picker/color/data/repository/FakeColorPickerRepository.kt
+++ b/src/com/android/customization/picker/color/data/repository/FakeColorPickerRepository.kt
@@ -22,6 +22,7 @@
import com.android.customization.model.ResourceConstants
import com.android.customization.model.color.ColorOptionImpl
import com.android.customization.model.color.ColorOptionsProvider
+import com.android.customization.model.color.ColorUtils.toColorString
import com.android.customization.picker.color.shared.model.ColorOptionModel
import com.android.customization.picker.color.shared.model.ColorType
import com.android.systemui.monet.Style
@@ -40,7 +41,7 @@
MutableStateFlow(
mapOf<ColorType, List<ColorOptionModel>>(
ColorType.WALLPAPER_COLOR to listOf(),
- ColorType.PRESET_COLOR to listOf()
+ ColorType.PRESET_COLOR to listOf(),
)
)
override val colorOptions: StateFlow<Map<ColorType, List<ColorOptionModel>>> =
@@ -54,7 +55,7 @@
wallpaperOptions: List<ColorOptionImpl>,
presetOptions: List<ColorOptionImpl>,
selectedColorOptionType: ColorType,
- selectedColorOptionIndex: Int
+ selectedColorOptionIndex: Int,
) {
_colorOptions.value =
mapOf(
@@ -68,7 +69,7 @@
ColorOptionModel(
key = "${ColorType.WALLPAPER_COLOR}::$index",
colorOption = colorOption,
- isSelected = isSelected
+ isSelected = isSelected,
)
if (isSelected) {
selectedColorOption = colorOptionModel
@@ -86,7 +87,7 @@
ColorOptionModel(
key = "${ColorType.PRESET_COLOR}::$index",
colorOption = colorOption,
- isSelected = isSelected
+ isSelected = isSelected,
)
if (isSelected) {
selectedColorOption = colorOptionModel
@@ -101,7 +102,7 @@
numWallpaperOptions: Int,
numPresetOptions: Int,
selectedColorOptionType: ColorType,
- selectedColorOptionIndex: Int
+ selectedColorOptionIndex: Int,
) {
_colorOptions.value =
mapOf(
@@ -140,7 +141,7 @@
}
add(colorOption)
}
- }
+ },
)
}
@@ -160,7 +161,7 @@
return builder.build()
}
- fun buildPresetOption(style: Style, seedColor: String): ColorOptionImpl {
+ fun buildPresetOption(style: Style, seedColor: Int): ColorOptionImpl {
val builder = ColorOptionImpl.Builder()
builder.lightColors =
intArrayOf(Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT)
@@ -170,9 +171,13 @@
builder.source = ColorOptionsProvider.COLOR_SOURCE_PRESET
builder.style = style
builder.title = "Preset"
+ builder.seedColor = seedColor
builder
.addOverlayPackage("TEST_PACKAGE_TYPE", "preset_color")
- .addOverlayPackage(ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE, seedColor)
+ .addOverlayPackage(
+ ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE,
+ toColorString(seedColor),
+ )
return builder.build()
}
@@ -192,7 +197,7 @@
return builder.build()
}
- fun buildWallpaperOption(source: String, style: Style, seedColor: String): ColorOptionImpl {
+ fun buildWallpaperOption(source: String, style: Style, seedColor: Int): ColorOptionImpl {
val builder = ColorOptionImpl.Builder()
builder.lightColors =
intArrayOf(Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT)
@@ -202,9 +207,13 @@
builder.source = source
builder.style = style
builder.title = "Dynamic"
+ builder.seedColor = seedColor
builder
.addOverlayPackage("TEST_PACKAGE_TYPE", "wallpaper_color")
- .addOverlayPackage(ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE, seedColor)
+ .addOverlayPackage(
+ ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE,
+ toColorString(seedColor),
+ )
return builder.build()
}
@@ -237,7 +246,7 @@
_colorOptions.value =
mapOf(
ColorType.WALLPAPER_COLOR to newWallpaperColorOptions,
- ColorType.PRESET_COLOR to newBasicColorOptions
+ ColorType.PRESET_COLOR to newBasicColorOptions,
)
}
diff --git a/src/com/android/customization/picker/color/domain/interactor/ColorPickerInteractor.kt b/src/com/android/customization/picker/color/domain/interactor/ColorPickerInteractor.kt
index aebc6c2..4f779f8 100644
--- a/src/com/android/customization/picker/color/domain/interactor/ColorPickerInteractor.kt
+++ b/src/com/android/customization/picker/color/domain/interactor/ColorPickerInteractor.kt
@@ -60,6 +60,4 @@
_selectingColorOption.value = null
}
}
-
- fun getCurrentColorOption(): ColorOptionModel = repository.getCurrentColorOption()
}
diff --git a/src/com/android/customization/picker/color/ui/viewmodel/ColorPickerViewModel.kt b/src/com/android/customization/picker/color/ui/viewmodel/ColorPickerViewModel.kt
index 61a648f..9dba4bb 100644
--- a/src/com/android/customization/picker/color/ui/viewmodel/ColorPickerViewModel.kt
+++ b/src/com/android/customization/picker/color/ui/viewmodel/ColorPickerViewModel.kt
@@ -49,10 +49,9 @@
/** View-models for each color tab. */
val colorTypeTabs: Flow<Map<ColorType, ColorTypeTabViewModel>> =
- combine(
- interactor.colorOptions,
- selectedColorTypeTabId,
- ) { colorOptions, selectedColorTypeIdOrNull ->
+ combine(interactor.colorOptions, selectedColorTypeTabId) {
+ colorOptions,
+ selectedColorTypeIdOrNull ->
colorOptions.keys
.mapIndexed { index, colorType ->
val isSelected =
@@ -143,8 +142,7 @@
.sourceForLogging,
colorOptionModel.colorOption
.styleForLogging,
- colorOptionModel.colorOption
- .seedColorForLogging,
+ colorOptionModel.colorOption.seedColor,
)
}
}
@@ -180,7 +178,7 @@
min(
max(0, COLOR_SECTION_OPTION_SIZE - wallpaperOptions.size),
presetOptions.size,
- )
+ ),
)
subOptions + additionalSubOptions
}
@@ -192,11 +190,7 @@
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@Suppress("UNCHECKED_CAST")
- return ColorPickerViewModel(
- context = context,
- interactor = interactor,
- logger = logger,
- )
+ return ColorPickerViewModel(context = context, interactor = interactor, logger = logger)
as T
}
}
diff --git a/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
index e2a8cf3..10bedb3 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ColorsFloatingSheetBinder.kt
@@ -92,6 +92,17 @@
}
}
}
+
+ launch {
+ viewModel.previewingColorOption.collect { colorModel ->
+ if (colorModel != null) {
+ colorUpdateViewModel.previewColors(
+ colorModel.colorOption.seedColor,
+ colorModel.colorOption.style,
+ )
+ } else colorUpdateViewModel.resetPreview()
+ }
+ }
}
}
}
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2.kt
index fc78ac7..26e7867 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2.kt
@@ -176,7 +176,7 @@
logger.logThemeColorApplied(
previewingColorOption.colorOption.sourceForLogging,
previewingColorOption.colorOption.styleForLogging,
- previewingColorOption.colorOption.seedColorForLogging,
+ previewingColorOption.colorOption.seedColor,
)
}
}
diff --git a/src/com/android/wallpaper/picker/common/preview/ui/binder/ThemePickerWorkspaceCallbackBinder.kt b/src/com/android/wallpaper/picker/common/preview/ui/binder/ThemePickerWorkspaceCallbackBinder.kt
index fd82710..0dc38e8 100644
--- a/src/com/android/wallpaper/picker/common/preview/ui/binder/ThemePickerWorkspaceCallbackBinder.kt
+++ b/src/com/android/wallpaper/picker/common/preview/ui/binder/ThemePickerWorkspaceCallbackBinder.kt
@@ -24,9 +24,7 @@
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
-import com.android.customization.model.color.ColorOptionsProvider
import com.android.customization.picker.color.data.util.MaterialColorsGenerator
-import com.android.systemui.monet.ColorScheme
import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_END
import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START
import com.android.systemui.shared.quickaffordance.shared.model.KeyguardPreviewConstants.KEY_INITIALLY_SELECTED_SLOT_ID
@@ -153,10 +151,7 @@
workspaceCallback.sendMessage(MESSAGE_ID_UPDATE_COLOR, Bundle())
return@collect
}
- val seedColor =
- it.colorOption.seedColor
- ?: getSeedColorFromSource(it.colorOption.source)
- ?: return@collect
+ val seedColor = it.colorOption.seedColor
val (ids, colors) =
materialColorsGenerator.generate(
seedColor,
@@ -176,16 +171,6 @@
}
}
- private fun getSeedColorFromSource(source: String?): Int? {
- return when (source) {
- ColorOptionsProvider.COLOR_SOURCE_HOME -> WallpaperManager.FLAG_SYSTEM
- ColorOptionsProvider.COLOR_SOURCE_LOCK -> WallpaperManager.FLAG_LOCK
- else -> null
- }
- ?.let { wallpaperManager.getWallpaperColors(it) }
- ?.let { ColorScheme.getSeedColor(it) }
- }
-
companion object {
const val MESSAGE_ID_UPDATE_GRID = 7414
const val KEY_GRID_NAME = "grid_name"
diff --git a/tests/robotests/src/com/android/customization/model/color/ColorCustomizationManagerTest.kt b/tests/robotests/src/com/android/customization/model/color/ColorCustomizationManagerTest.kt
index 0776cc8..98a1973 100644
--- a/tests/robotests/src/com/android/customization/model/color/ColorCustomizationManagerTest.kt
+++ b/tests/robotests/src/com/android/customization/model/color/ColorCustomizationManagerTest.kt
@@ -64,7 +64,7 @@
provider,
application.contentResolver,
mockOM,
- MoreExecutors.newDirectExecutorService()
+ MoreExecutors.newDirectExecutorService(),
)
}
@@ -80,7 +80,7 @@
OVERLAY_CATEGORY_COLOR to someOtherColor,
OVERLAY_COLOR_SOURCE to source,
OVERLAY_THEME_STYLE to style.toString(),
- ColorOption.TIMESTAMP_FIELD to "12345"
+ ColorOption.TIMESTAMP_FIELD to "12345",
)
val json = JSONObject(settings).toString()
@@ -106,14 +106,16 @@
getPresetColorOption(index),
object : CustomizationManager.Callback {
override fun onSuccess() {}
+
override fun onError(throwable: Throwable?) {}
- }
+ },
)
val overlaysJson = JSONObject(manager.storedOverlays)
assertThat(overlaysJson.getString(OVERLAY_COLOR_INDEX)).isEqualTo(value)
}
+
@Test
fun apply_WallpaperColorOption_index() {
testApplyWallpaperColorOption(1, "1")
@@ -127,8 +129,9 @@
getWallpaperColorOption(index),
object : CustomizationManager.Callback {
override fun onSuccess() {}
+
override fun onError(throwable: Throwable?) {}
- }
+ },
)
val overlaysJson = JSONObject(manager.storedOverlays)
@@ -141,10 +144,11 @@
mapOf("fake_package" to "fake_color"),
/* isDefault= */ false,
COLOR_SOURCE_PRESET,
+ 12345,
Style.TONAL_SPOT,
index,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.PRESET_COLOR
+ ColorType.PRESET_COLOR,
)
}
@@ -154,10 +158,11 @@
mapOf("fake_package" to "fake_color"),
/* isDefault= */ false,
COLOR_SOURCE_HOME,
+ 12345,
Style.TONAL_SPOT,
index,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.WALLPAPER_COLOR
+ ColorType.WALLPAPER_COLOR,
)
}
@@ -170,8 +175,9 @@
getWallpaperColorOption(0),
object : CustomizationManager.Callback {
override fun onSuccess() {}
+
override fun onError(throwable: Throwable?) {}
- }
+ },
)
val overlaysJson = JSONObject(manager.storedOverlays)
@@ -188,8 +194,9 @@
getWallpaperColorOption(0),
object : CustomizationManager.Callback {
override fun onSuccess() {}
+
override fun onError(throwable: Throwable?) {}
- }
+ },
)
val overlaysJson = JSONObject(manager.storedOverlays)
diff --git a/tests/robotests/src/com/android/customization/model/color/ColorOptionTest.kt b/tests/robotests/src/com/android/customization/model/color/ColorOptionTest.kt
index b9156d6..ed04d14 100644
--- a/tests/robotests/src/com/android/customization/model/color/ColorOptionTest.kt
+++ b/tests/robotests/src/com/android/customization/model/color/ColorOptionTest.kt
@@ -15,6 +15,7 @@
*/
package com.android.customization.model.color
+import android.graphics.Color
import com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE
import com.android.customization.model.color.ColorOptionsProvider.COLOR_SOURCE_HOME
import com.android.customization.model.color.ColorOptionsProvider.COLOR_SOURCE_LOCK
@@ -54,10 +55,11 @@
mapOf("fake_package" to "fake_color"),
false,
source,
+ 12345,
Style.TONAL_SPOT,
/* index= */ 0,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.WALLPAPER_COLOR
+ ColorType.WALLPAPER_COLOR,
)
assertThat(colorOption.source).isEqualTo(source)
}
@@ -77,10 +79,11 @@
mapOf("fake_package" to "fake_color"),
/* isDefault= */ false,
"fake_source",
+ 12345,
style,
0,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.WALLPAPER_COLOR
+ ColorType.WALLPAPER_COLOR,
)
assertThat(colorOption.style).isEqualTo(style)
}
@@ -100,17 +103,41 @@
mapOf("fake_package" to "fake_color"),
/* isDefault= */ false,
"fake_source",
+ 12345,
Style.TONAL_SPOT,
index,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.WALLPAPER_COLOR
+ ColorType.WALLPAPER_COLOR,
)
assertThat(colorOption.index).isEqualTo(index)
}
+ @Test
+ fun colorOption_seedColor() {
+ testColorOptionSeed(Color.RED)
+ testColorOptionSeed(Color.WHITE)
+ testColorOptionSeed(Color.BLACK)
+ }
+
+ private fun testColorOptionSeed(seedColor: Int) {
+ val colorOption: ColorOption =
+ ColorOptionImpl(
+ "fake color",
+ mapOf("fake_package" to "fake_color"),
+ /* isDefault= */ false,
+ "fake_source",
+ seedColor,
+ Style.TONAL_SPOT,
+ 0,
+ ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
+ ColorType.WALLPAPER_COLOR,
+ )
+ assertThat(colorOption.seedColor).isEqualTo(seedColor)
+ }
+
private fun setUpWallpaperColorOption(
isDefault: Boolean,
- source: String = "some_source"
+ source: String = "some_source",
): ColorOptionImpl {
val overlays =
if (isDefault) {
@@ -124,10 +151,11 @@
overlays,
isDefault,
source,
+ 12345,
Style.TONAL_SPOT,
/* index= */ 0,
ColorOptionImpl.PreviewInfo(intArrayOf(0), intArrayOf(0)),
- ColorType.WALLPAPER_COLOR
+ ColorType.WALLPAPER_COLOR,
)
}
diff --git a/tests/robotests/src/com/android/customization/model/picker/color/ui/viewmodel/ColorPickerViewModelTest.kt b/tests/robotests/src/com/android/customization/model/picker/color/ui/viewmodel/ColorPickerViewModelTest.kt
index f5878a4..50602ad 100644
--- a/tests/robotests/src/com/android/customization/model/picker/color/ui/viewmodel/ColorPickerViewModelTest.kt
+++ b/tests/robotests/src/com/android/customization/model/picker/color/ui/viewmodel/ColorPickerViewModelTest.kt
@@ -17,7 +17,6 @@
package com.android.customization.model.picker.color.ui.viewmodel
import android.content.Context
-import android.graphics.Color
import android.stats.style.StyleEnums
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
@@ -86,7 +85,7 @@
ColorPickerViewModel.Factory(
context = context,
interactor = interactor,
- logger = logger
+ logger = logger,
)
.create(ColorPickerViewModel::class.java)
@@ -105,19 +104,19 @@
assertColorOptionUiState(
colorOptions = colorSectionOptions(),
- selectedColorOptionIndex = 0
+ selectedColorOptionIndex = 0,
)
selectColorOption(colorSectionOptions, 2)
assertColorOptionUiState(
colorOptions = colorSectionOptions(),
- selectedColorOptionIndex = 2
+ selectedColorOptionIndex = 2,
)
selectColorOption(colorSectionOptions, 4)
assertColorOptionUiState(
colorOptions = colorSectionOptions(),
- selectedColorOptionIndex = 4
+ selectedColorOptionIndex = 4,
)
}
@@ -129,12 +128,12 @@
repository.buildWallpaperOption(
ColorOptionsProvider.COLOR_SOURCE_LOCK,
Style.EXPRESSIVE,
- "121212"
+ 121212,
)
),
- listOf(repository.buildPresetOption(Style.FRUIT_SALAD, "#ABCDEF")),
+ listOf(repository.buildPresetOption(Style.FRUIT_SALAD, -54321)),
ColorType.PRESET_COLOR,
- 0
+ 0,
)
val colorTypes = collectLastValue(underTest.colorTypeTabs)
@@ -149,7 +148,7 @@
assertThat(logger.themeColorSource)
.isEqualTo(StyleEnums.COLOR_SOURCE_LOCK_SCREEN_WALLPAPER)
assertThat(logger.themeColorStyle).isEqualTo(Style.EXPRESSIVE.toString().hashCode())
- assertThat(logger.themeSeedColor).isEqualTo(Color.parseColor("#121212"))
+ assertThat(logger.themeSeedColor).isEqualTo(121212)
}
@Test
@@ -160,12 +159,12 @@
repository.buildWallpaperOption(
ColorOptionsProvider.COLOR_SOURCE_LOCK,
Style.EXPRESSIVE,
- "121212"
+ 121212,
)
),
- listOf(repository.buildPresetOption(Style.FRUIT_SALAD, "#ABCDEF")),
+ listOf(repository.buildPresetOption(Style.FRUIT_SALAD, -54321)),
ColorType.WALLPAPER_COLOR,
- 0
+ 0,
)
val colorTypes = collectLastValue(underTest.colorTypeTabs)
@@ -179,7 +178,7 @@
assertThat(logger.themeColorSource).isEqualTo(StyleEnums.COLOR_SOURCE_PRESET_COLOR)
assertThat(logger.themeColorStyle).isEqualTo(Style.FRUIT_SALAD.toString().hashCode())
- assertThat(logger.themeSeedColor).isEqualTo(Color.parseColor("#ABCDEF"))
+ assertThat(logger.themeSeedColor).isEqualTo(-54321)
}
@Test
@@ -193,7 +192,7 @@
colorTypes = colorTypes(),
colorOptions = colorOptions(),
selectedColorTypeText = "Wallpaper colors",
- selectedColorOptionIndex = 0
+ selectedColorOptionIndex = 0,
)
// Select "Basic colors" tab
@@ -202,7 +201,7 @@
colorTypes = colorTypes(),
colorOptions = colorOptions(),
selectedColorTypeText = "Basic colors",
- selectedColorOptionIndex = -1
+ selectedColorOptionIndex = -1,
)
// Select a color option
@@ -214,7 +213,7 @@
colorTypes = colorTypes(),
colorOptions = colorOptions(),
selectedColorTypeText = "Wallpaper colors",
- selectedColorOptionIndex = -1
+ selectedColorOptionIndex = -1,
)
// Check new option is selected
@@ -223,7 +222,7 @@
colorTypes = colorTypes(),
colorOptions = colorOptions(),
selectedColorTypeText = "Basic colors",
- selectedColorOptionIndex = 2
+ selectedColorOptionIndex = 2,
)
}
diff --git a/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2Test.kt b/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2Test.kt
index c153de6..a4d0ba0 100644
--- a/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2Test.kt
+++ b/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ColorPickerViewModel2Test.kt
@@ -17,7 +17,6 @@
package com.android.wallpaper.customization.ui.viewmodel
import android.content.Context
-import android.graphics.Color
import android.stats.style.StyleEnums
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
@@ -104,10 +103,10 @@
repository.buildWallpaperOption(
ColorOptionsProvider.COLOR_SOURCE_LOCK,
Style.EXPRESSIVE,
- "121212",
+ 121212,
)
),
- listOf(repository.buildPresetOption(Style.FRUIT_SALAD, "#ABCDEF")),
+ listOf(repository.buildPresetOption(Style.FRUIT_SALAD, -54321)),
ColorType.PRESET_COLOR,
0,
)
@@ -125,7 +124,7 @@
assertThat(logger.themeColorSource)
.isEqualTo(StyleEnums.COLOR_SOURCE_LOCK_SCREEN_WALLPAPER)
assertThat(logger.themeColorStyle).isEqualTo(Style.EXPRESSIVE.toString().hashCode())
- assertThat(logger.themeSeedColor).isEqualTo(Color.parseColor("#121212"))
+ assertThat(logger.themeSeedColor).isEqualTo(121212)
}
@Test
@@ -136,10 +135,10 @@
repository.buildWallpaperOption(
ColorOptionsProvider.COLOR_SOURCE_LOCK,
Style.EXPRESSIVE,
- "121212",
+ 121212,
)
),
- listOf(repository.buildPresetOption(Style.FRUIT_SALAD, "#ABCDEF")),
+ listOf(repository.buildPresetOption(Style.FRUIT_SALAD, -54321)),
ColorType.WALLPAPER_COLOR,
0,
)
@@ -156,7 +155,7 @@
assertThat(logger.themeColorSource).isEqualTo(StyleEnums.COLOR_SOURCE_PRESET_COLOR)
assertThat(logger.themeColorStyle).isEqualTo(Style.FRUIT_SALAD.toString().hashCode())
- assertThat(logger.themeSeedColor).isEqualTo(Color.parseColor("#ABCDEF"))
+ assertThat(logger.themeSeedColor).isEqualTo(-54321)
}
@Test