Loading res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,18 @@ shape and theme for the home screen. [CHAR LIMIT=15] --> <string name="app_icons_title">Icons</string> <!-- Description of a section of the customization picker where the user can configure app icon shape and theme, e.g. Circle, themed. [CHAR LIMIT=NONE] --> <string name="app_icons_description"><xliff:g name="shape">%1$s</xliff:g>, <xliff:g name="theme">%2$s</xliff:g></string> <!-- Part of the app icon section description, shown when the user's app icons are not themed. [CHAR LIMIT=15] --> <string name="app_icons_theme_default">default</string> <!-- Part of the app icon section description, shown when the user has themed icons turned on. [CHAR LIMIT=15] --> <string name="app_icons_theme_themed">themed</string> <!-- Label for a button that allows the user to apply the currently selected Theme. [CHAR LIMIT=20] --> <string name="apply_theme_btn">Apply</string> Loading src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt +9 −14 Original line number Diff line number Diff line Loading @@ -320,20 +320,15 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO } launch { val appIconPickerViewModel = optionsViewModel.appIconPickerViewModel combine( appIconPickerViewModel.selectedShape, appIconPickerViewModel.isThemedIconEnabled, ::Pair, ) .collect { (selectedShape, isThemedIconEnabled) -> optionsViewModel.appIconPickerViewModel.summary.collect { description -> // TODO(b/402161932): create and display app icon preview optionAppIcons .requireViewById<View>(R.id.option_entry_icon_container) .visibility = View.INVISIBLE // TODO(b/402161932): show selected shape text when b/406486710 is fixed // TODO(b/402161932): show selected theme text after content is decided optionAppIconsDescription.visibility = View.GONE TextViewBinder.bind( view = optionAppIconsDescription, viewModel = description, ) } } Loading src/com/android/wallpaper/customization/ui/viewmodel/AppIconPickerViewModel.kt +26 −1 Original line number Diff line number Diff line Loading @@ -16,14 +16,17 @@ package com.android.wallpaper.customization.ui.viewmodel import android.content.Context import com.android.customization.model.grid.ShapeOptionModel import com.android.customization.picker.grid.domain.interactor.AppIconInteractor import com.android.customization.picker.grid.ui.viewmodel.ShapeIconViewModel import com.android.themepicker.R import com.android.wallpaper.picker.common.text.ui.viewmodel.Text import com.android.wallpaper.picker.option.ui.viewmodel.OptionItemViewModel2 import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.scopes.ViewModelScoped import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.coroutineScope Loading @@ -41,7 +44,11 @@ import kotlinx.coroutines.launch class AppIconPickerViewModel @AssistedInject constructor(interactor: AppIconInteractor, @Assisted private val viewModelScope: CoroutineScope) { constructor( @ApplicationContext private val applicationContext: Context, interactor: AppIconInteractor, @Assisted private val viewModelScope: CoroutineScope, ) { //// Shape // The currently-set system shape option Loading Loading @@ -92,6 +99,24 @@ constructor(interactor: AppIconInteractor, @Assisted private val viewModelScope: } } val summary: Flow<Text> = combine(selectedShape, isThemedIconEnabled) { selectedShape, isThemedIconEnabled -> val selectedShapeString = selectedShape.text.asString(applicationContext) val appIconThemeString = if (isThemedIconEnabled) { applicationContext.getString(R.string.app_icons_theme_themed) } else { applicationContext.getString(R.string.app_icons_theme_default) } Text.Loaded( applicationContext.getString( R.string.app_icons_description, selectedShapeString, appIconThemeString, ) ) } val onApply: Flow<(suspend () -> Unit)?> = combine( overridingShapeKey, Loading tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/AppIconPickerViewModelTest.kt +1 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ class AppIconPickerViewModelTest { @get:Rule var hiltRule = HiltAndroidRule(this) @Inject lateinit var testScope: TestScope @Inject lateinit var gridOptionsManager: FakeShapeGridManager @Inject lateinit var interactor: AppIconInteractor @Inject @ApplicationContext lateinit var appContext: Context Loading @@ -58,7 +57,7 @@ class AppIconPickerViewModelTest { @Before fun setUp() { hiltRule.inject() underTest = AppIconPickerViewModel(interactor, testScope.backgroundScope) underTest = AppIconPickerViewModel(appContext, interactor, testScope.backgroundScope) } @After Loading Loading
res/values/strings.xml +12 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,18 @@ shape and theme for the home screen. [CHAR LIMIT=15] --> <string name="app_icons_title">Icons</string> <!-- Description of a section of the customization picker where the user can configure app icon shape and theme, e.g. Circle, themed. [CHAR LIMIT=NONE] --> <string name="app_icons_description"><xliff:g name="shape">%1$s</xliff:g>, <xliff:g name="theme">%2$s</xliff:g></string> <!-- Part of the app icon section description, shown when the user's app icons are not themed. [CHAR LIMIT=15] --> <string name="app_icons_theme_default">default</string> <!-- Part of the app icon section description, shown when the user has themed icons turned on. [CHAR LIMIT=15] --> <string name="app_icons_theme_themed">themed</string> <!-- Label for a button that allows the user to apply the currently selected Theme. [CHAR LIMIT=20] --> <string name="apply_theme_btn">Apply</string> Loading
src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt +9 −14 Original line number Diff line number Diff line Loading @@ -320,20 +320,15 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO } launch { val appIconPickerViewModel = optionsViewModel.appIconPickerViewModel combine( appIconPickerViewModel.selectedShape, appIconPickerViewModel.isThemedIconEnabled, ::Pair, ) .collect { (selectedShape, isThemedIconEnabled) -> optionsViewModel.appIconPickerViewModel.summary.collect { description -> // TODO(b/402161932): create and display app icon preview optionAppIcons .requireViewById<View>(R.id.option_entry_icon_container) .visibility = View.INVISIBLE // TODO(b/402161932): show selected shape text when b/406486710 is fixed // TODO(b/402161932): show selected theme text after content is decided optionAppIconsDescription.visibility = View.GONE TextViewBinder.bind( view = optionAppIconsDescription, viewModel = description, ) } } Loading
src/com/android/wallpaper/customization/ui/viewmodel/AppIconPickerViewModel.kt +26 −1 Original line number Diff line number Diff line Loading @@ -16,14 +16,17 @@ package com.android.wallpaper.customization.ui.viewmodel import android.content.Context import com.android.customization.model.grid.ShapeOptionModel import com.android.customization.picker.grid.domain.interactor.AppIconInteractor import com.android.customization.picker.grid.ui.viewmodel.ShapeIconViewModel import com.android.themepicker.R import com.android.wallpaper.picker.common.text.ui.viewmodel.Text import com.android.wallpaper.picker.option.ui.viewmodel.OptionItemViewModel2 import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.scopes.ViewModelScoped import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.coroutineScope Loading @@ -41,7 +44,11 @@ import kotlinx.coroutines.launch class AppIconPickerViewModel @AssistedInject constructor(interactor: AppIconInteractor, @Assisted private val viewModelScope: CoroutineScope) { constructor( @ApplicationContext private val applicationContext: Context, interactor: AppIconInteractor, @Assisted private val viewModelScope: CoroutineScope, ) { //// Shape // The currently-set system shape option Loading Loading @@ -92,6 +99,24 @@ constructor(interactor: AppIconInteractor, @Assisted private val viewModelScope: } } val summary: Flow<Text> = combine(selectedShape, isThemedIconEnabled) { selectedShape, isThemedIconEnabled -> val selectedShapeString = selectedShape.text.asString(applicationContext) val appIconThemeString = if (isThemedIconEnabled) { applicationContext.getString(R.string.app_icons_theme_themed) } else { applicationContext.getString(R.string.app_icons_theme_default) } Text.Loaded( applicationContext.getString( R.string.app_icons_description, selectedShapeString, appIconThemeString, ) ) } val onApply: Flow<(suspend () -> Unit)?> = combine( overridingShapeKey, Loading
tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/AppIconPickerViewModelTest.kt +1 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ class AppIconPickerViewModelTest { @get:Rule var hiltRule = HiltAndroidRule(this) @Inject lateinit var testScope: TestScope @Inject lateinit var gridOptionsManager: FakeShapeGridManager @Inject lateinit var interactor: AppIconInteractor @Inject @ApplicationContext lateinit var appContext: Context Loading @@ -58,7 +57,7 @@ class AppIconPickerViewModelTest { @Before fun setUp() { hiltRule.inject() underTest = AppIconPickerViewModel(interactor, testScope.backgroundScope) underTest = AppIconPickerViewModel(appContext, interactor, testScope.backgroundScope) } @After Loading