Loading src/com/android/customization/module/ThemePickerInjector.kt +3 −1 Original line number Diff line number Diff line Loading @@ -175,7 +175,9 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject getKeyguardQuickAffordancePickerInteractor(context), getUndoInteractor(context), getCurrentWallpaperInfoFactory(context), ) ) { intent -> context.startActivity(intent) } .also { keyguardQuickAffordancePickerViewModelFactory = it } } Loading src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ class KeyguardQuickAffordancePickerRepository( enablementInstructions = enablementInstructions ?: emptyList(), enablementActionText = enablementActionText, enablementActionComponentName = enablementActionComponentName, configureIntent = configureIntent, ) } Loading src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.customization.picker.quickaffordance.shared.model import android.content.Intent import androidx.annotation.DrawableRes /** Models a quick affordance. */ Loading @@ -42,4 +43,6 @@ data class KeyguardQuickAffordancePickerAffordanceModel( * user to a destination where they can re-enable it. */ val enablementActionComponentName: String?, /** Optional [Intent] to use to start an activity to configure this affordance. */ val configureIntent: Intent?, ) src/com/android/customization/picker/quickaffordance/ui/adapter/AffordancesAdapter.kt +9 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ class AffordancesAdapter : RecyclerView.Adapter<AffordancesAdapter.ViewHolder>() null } ) holder.itemView.onLongClickListener = if (item.onLongClicked != null) { View.OnLongClickListener { item.onLongClicked.invoke() true } } else { null } holder.iconContainerView.setBackgroundResource( if (item.isSelected) { R.drawable.keyguard_quick_affordance_icon_container_background_selected Loading src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ private constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, undoInteractor: UndoInteractor, private val wallpaperInfoFactory: CurrentWallpaperInfoFactory, activityStarter: (Intent) -> Unit, ) : ViewModel() { @SuppressLint("StaticFieldLeak") private val applicationContext = context.applicationContext Loading Loading @@ -129,6 +130,7 @@ private constructor( contentDescription = affordanceModel.name, isSelected = true, onClicked = null, onLongClicked = null, isEnabled = affordanceModel.isEnabled, ) }, Loading Loading @@ -201,6 +203,12 @@ private constructor( ) } }, onLongClicked = if (affordance.configureIntent != null) { { activityStarter(affordance.configureIntent) } } else { null }, isEnabled = affordance.isEnabled, ) } Loading Loading @@ -374,6 +382,7 @@ private constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, private val undoInteractor: UndoInteractor, private val wallpaperInfoFactory: CurrentWallpaperInfoFactory, private val activityStarter: (Intent) -> Unit, ) : ViewModelProvider.Factory { override fun <T : ViewModel> create(modelClass: Class<T>): T { @Suppress("UNCHECKED_CAST") Loading @@ -382,6 +391,7 @@ private constructor( quickAffordanceInteractor = quickAffordanceInteractor, undoInteractor = undoInteractor, wallpaperInfoFactory = wallpaperInfoFactory, activityStarter = activityStarter, ) as T } Loading Loading
src/com/android/customization/module/ThemePickerInjector.kt +3 −1 Original line number Diff line number Diff line Loading @@ -175,7 +175,9 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject getKeyguardQuickAffordancePickerInteractor(context), getUndoInteractor(context), getCurrentWallpaperInfoFactory(context), ) ) { intent -> context.startActivity(intent) } .also { keyguardQuickAffordancePickerViewModelFactory = it } } Loading
src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ class KeyguardQuickAffordancePickerRepository( enablementInstructions = enablementInstructions ?: emptyList(), enablementActionText = enablementActionText, enablementActionComponentName = enablementActionComponentName, configureIntent = configureIntent, ) } Loading
src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.customization.picker.quickaffordance.shared.model import android.content.Intent import androidx.annotation.DrawableRes /** Models a quick affordance. */ Loading @@ -42,4 +43,6 @@ data class KeyguardQuickAffordancePickerAffordanceModel( * user to a destination where they can re-enable it. */ val enablementActionComponentName: String?, /** Optional [Intent] to use to start an activity to configure this affordance. */ val configureIntent: Intent?, )
src/com/android/customization/picker/quickaffordance/ui/adapter/AffordancesAdapter.kt +9 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ class AffordancesAdapter : RecyclerView.Adapter<AffordancesAdapter.ViewHolder>() null } ) holder.itemView.onLongClickListener = if (item.onLongClicked != null) { View.OnLongClickListener { item.onLongClicked.invoke() true } } else { null } holder.iconContainerView.setBackgroundResource( if (item.isSelected) { R.drawable.keyguard_quick_affordance_icon_container_background_selected Loading
src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ private constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, undoInteractor: UndoInteractor, private val wallpaperInfoFactory: CurrentWallpaperInfoFactory, activityStarter: (Intent) -> Unit, ) : ViewModel() { @SuppressLint("StaticFieldLeak") private val applicationContext = context.applicationContext Loading Loading @@ -129,6 +130,7 @@ private constructor( contentDescription = affordanceModel.name, isSelected = true, onClicked = null, onLongClicked = null, isEnabled = affordanceModel.isEnabled, ) }, Loading Loading @@ -201,6 +203,12 @@ private constructor( ) } }, onLongClicked = if (affordance.configureIntent != null) { { activityStarter(affordance.configureIntent) } } else { null }, isEnabled = affordance.isEnabled, ) } Loading Loading @@ -374,6 +382,7 @@ private constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, private val undoInteractor: UndoInteractor, private val wallpaperInfoFactory: CurrentWallpaperInfoFactory, private val activityStarter: (Intent) -> Unit, ) : ViewModelProvider.Factory { override fun <T : ViewModel> create(modelClass: Class<T>): T { @Suppress("UNCHECKED_CAST") Loading @@ -382,6 +391,7 @@ private constructor( quickAffordanceInteractor = quickAffordanceInteractor, undoInteractor = undoInteractor, wallpaperInfoFactory = wallpaperInfoFactory, activityStarter = activityStarter, ) as T } Loading