From 2715b33125a0c6d5dce7ef45c9d4e53519ca06a0 Mon Sep 17 00:00:00 2001 From: Catherine Liang Date: Thu, 31 Aug 2023 18:45:44 +0000 Subject: Pre-revamped UI cleanup color file rename (1/2) As part of the revamped UI flag removal process, rename files to replace original. Bug: 262780002 Test: manually verified functionalities still work throughout the wallpaper picker app Change-Id: If3cb1f8be19a541e9726a38d20091c09f83365af --- .../picker/color/ui/binder/ColorPickerBinder.kt | 2 +- .../color/ui/section/ColorSectionController.kt | 67 ++++++++++++++++++++++ .../color/ui/section/ColorSectionController2.kt | 67 ---------------------- .../picker/color/ui/view/ColorSectionView.kt | 26 +++++++++ .../picker/color/ui/view/ColorSectionView2.kt | 26 --------- 5 files changed, 94 insertions(+), 94 deletions(-) create mode 100644 src/com/android/customization/picker/color/ui/section/ColorSectionController.kt delete mode 100644 src/com/android/customization/picker/color/ui/section/ColorSectionController2.kt create mode 100644 src/com/android/customization/picker/color/ui/view/ColorSectionView.kt delete mode 100644 src/com/android/customization/picker/color/ui/view/ColorSectionView2.kt (limited to 'src/com/android/customization/picker') diff --git a/src/com/android/customization/picker/color/ui/binder/ColorPickerBinder.kt b/src/com/android/customization/picker/color/ui/binder/ColorPickerBinder.kt index cd9dd540..bd203b15 100644 --- a/src/com/android/customization/picker/color/ui/binder/ColorPickerBinder.kt +++ b/src/com/android/customization/picker/color/ui/binder/ColorPickerBinder.kt @@ -62,7 +62,7 @@ object ColorPickerBinder { colorTypeTabView.addItemDecoration(ItemSpacing(ItemSpacing.TAB_ITEM_SPACING_DP)) val colorOptionAdapter = OptionItemAdapter( - layoutResourceId = R.layout.color_option_2, + layoutResourceId = R.layout.color_option, lifecycleOwner = lifecycleOwner, bindIcon = { foregroundView: View, colorIcon: ColorOptionIconViewModel -> val colorOptionIconView = foregroundView as? ColorOptionIconView diff --git a/src/com/android/customization/picker/color/ui/section/ColorSectionController.kt b/src/com/android/customization/picker/color/ui/section/ColorSectionController.kt new file mode 100644 index 00000000..a36fd80a --- /dev/null +++ b/src/com/android/customization/picker/color/ui/section/ColorSectionController.kt @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.android.customization.picker.color.ui.section + +import android.content.Context +import android.view.LayoutInflater +import androidx.lifecycle.LifecycleOwner +import com.android.customization.picker.color.ui.binder.ColorSectionViewBinder +import com.android.customization.picker.color.ui.fragment.ColorPickerFragment +import com.android.customization.picker.color.ui.view.ColorSectionView +import com.android.customization.picker.color.ui.viewmodel.ColorPickerViewModel +import com.android.wallpaper.R +import com.android.wallpaper.model.CustomizationSectionController +import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController as NavigationController + +class ColorSectionController( + private val navigationController: NavigationController, + private val viewModel: ColorPickerViewModel, + private val lifecycleOwner: LifecycleOwner +) : CustomizationSectionController { + + override fun isAvailable(context: Context): Boolean { + return true + } + + override fun createView(context: Context): ColorSectionView { + return createView(context, CustomizationSectionController.ViewCreationParams()) + } + + override fun createView( + context: Context, + params: CustomizationSectionController.ViewCreationParams + ): ColorSectionView { + @SuppressWarnings("It is fine to inflate with null parent for our need.") + val view = + LayoutInflater.from(context) + .inflate( + R.layout.color_section_view, + null, + ) as ColorSectionView + ColorSectionViewBinder.bind( + view = view, + viewModel = viewModel, + lifecycleOwner = lifecycleOwner, + navigationOnClick = { + navigationController.navigateTo(ColorPickerFragment.newInstance()) + }, + isConnectedHorizontallyToOtherSections = params.isConnectedHorizontallyToOtherSections, + ) + return view + } +} diff --git a/src/com/android/customization/picker/color/ui/section/ColorSectionController2.kt b/src/com/android/customization/picker/color/ui/section/ColorSectionController2.kt deleted file mode 100644 index f1c982b4..00000000 --- a/src/com/android/customization/picker/color/ui/section/ColorSectionController2.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.android.customization.picker.color.ui.section - -import android.content.Context -import android.view.LayoutInflater -import androidx.lifecycle.LifecycleOwner -import com.android.customization.picker.color.ui.binder.ColorSectionViewBinder -import com.android.customization.picker.color.ui.fragment.ColorPickerFragment -import com.android.customization.picker.color.ui.view.ColorSectionView2 -import com.android.customization.picker.color.ui.viewmodel.ColorPickerViewModel -import com.android.wallpaper.R -import com.android.wallpaper.model.CustomizationSectionController -import com.android.wallpaper.model.CustomizationSectionController.CustomizationSectionNavigationController as NavigationController - -class ColorSectionController2( - private val navigationController: NavigationController, - private val viewModel: ColorPickerViewModel, - private val lifecycleOwner: LifecycleOwner -) : CustomizationSectionController { - - override fun isAvailable(context: Context): Boolean { - return true - } - - override fun createView(context: Context): ColorSectionView2 { - return createView(context, CustomizationSectionController.ViewCreationParams()) - } - - override fun createView( - context: Context, - params: CustomizationSectionController.ViewCreationParams - ): ColorSectionView2 { - @SuppressWarnings("It is fine to inflate with null parent for our need.") - val view = - LayoutInflater.from(context) - .inflate( - R.layout.color_section_view2, - null, - ) as ColorSectionView2 - ColorSectionViewBinder.bind( - view = view, - viewModel = viewModel, - lifecycleOwner = lifecycleOwner, - navigationOnClick = { - navigationController.navigateTo(ColorPickerFragment.newInstance()) - }, - isConnectedHorizontallyToOtherSections = params.isConnectedHorizontallyToOtherSections, - ) - return view - } -} diff --git a/src/com/android/customization/picker/color/ui/view/ColorSectionView.kt b/src/com/android/customization/picker/color/ui/view/ColorSectionView.kt new file mode 100644 index 00000000..a89292d8 --- /dev/null +++ b/src/com/android/customization/picker/color/ui/view/ColorSectionView.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.customization.picker.color.ui.view + +import android.content.Context +import android.util.AttributeSet +import com.android.wallpaper.picker.SectionView + +/** + * The class inherits from {@link SectionView} as the view representing the color section of the + * customization picker. It displays a list of color options and an overflow option. + */ +class ColorSectionView(context: Context, attrs: AttributeSet?) : SectionView(context, attrs) diff --git a/src/com/android/customization/picker/color/ui/view/ColorSectionView2.kt b/src/com/android/customization/picker/color/ui/view/ColorSectionView2.kt deleted file mode 100644 index 7a8f21af..00000000 --- a/src/com/android/customization/picker/color/ui/view/ColorSectionView2.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.customization.picker.color.ui.view - -import android.content.Context -import android.util.AttributeSet -import com.android.wallpaper.picker.SectionView - -/** - * The class inherits from {@link SectionView} as the view representing the color section of the - * customization picker. It displays a list of color options and an overflow option. - */ -class ColorSectionView2(context: Context, attrs: AttributeSet?) : SectionView(context, attrs) -- cgit v1.2.3