Merge "Remove Beta tag from themed icon toggle" into main
diff --git a/res/drawable/ic_clock_filled_24px.xml b/res/drawable/ic_clock_filled_24px.xml
new file mode 100644
index 0000000..0d587d7
--- /dev/null
+++ b/res/drawable/ic_clock_filled_24px.xml
@@ -0,0 +1,18 @@
+<!--
+ Copyright (C) 2024 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal">
+ <path android:fillColor="@android:color/white" android:pathData="M612,668L668,612L520,464L520,280L440,280L440,496L612,668ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880Z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_style_filled_24px.xml b/res/drawable/ic_style_filled_24px.xml
deleted file mode 100644
index 0b9ec32..0000000
--- a/res/drawable/ic_style_filled_24px.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2024 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.
- ~
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal">
- <path android:fillColor="@android:color/white" android:pathData="M159,792L125,778Q94,765 83.5,733Q73,701 87,670L159,514L159,792ZM319,880Q286,880 262.5,856.5Q239,833 239,800L239,560L345,854Q348,861 351,867.5Q354,874 359,880L319,880ZM525,876Q493,888 463,873Q433,858 421,826L243,338Q231,306 245,275.5Q259,245 291,234L593,124Q625,112 655,127Q685,142 697,174L875,662Q887,694 873,724.5Q859,755 827,766L525,876ZM439,400Q456,400 467.5,388.5Q479,377 479,360Q479,343 467.5,331.5Q456,320 439,320Q422,320 410.5,331.5Q399,343 399,360Q399,377 410.5,388.5Q422,400 439,400Z"/>
-</vector>
\ No newline at end of file
diff --git a/res/layout/clock_style_option.xml b/res/layout/clock_style_option.xml
index 27fe597..e251c4a 100644
--- a/res/layout/clock_style_option.xml
+++ b/res/layout/clock_style_option.xml
@@ -14,47 +14,43 @@
limitations under the License.
-->
<!-- Content description is set programmatically on the parent FrameLayout -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/floating_sheet_clock_style_option_size"
- android:layout_height="@dimen/floating_sheet_clock_style_option_size"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="@dimen/floating_sheet_clock_style_option_width"
+ android:layout_height="@dimen/floating_sheet_clock_style_option_height"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:clipToPadding="false"
android:clipChildren="false">
- <ImageView
- android:id="@id/selection_border"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/option_item_border"
- android:alpha="0"
- android:importantForAccessibility="no" />
-
- <ImageView
+ <com.android.wallpaper.picker.option.ui.view.OptionItemBackground
android:id="@id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/option_item_background"
- android:importantForAccessibility="no" />
+ android:layout_width="@dimen/floating_sheet_clock_style_option_background_size"
+ android:layout_height="@dimen/floating_sheet_clock_style_option_background_size"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ android:importantForAccessibility="no"
+ android:layout_gravity="bottom" />
- <FrameLayout
+
+ <ImageView
android:id="@+id/foreground"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_width="@dimen/floating_sheet_clock_style_option_thumbnail_size"
+ android:layout_height="@dimen/floating_sheet_clock_style_option_thumbnail_size"
+ android:layout_marginBottom="@dimen/floating_sheet_clock_style_thumbnail_margin_bottom"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ android:src="@drawable/ic_clock_24px" />
- <ImageView
- android:id="@+id/clock_icon"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_margin="@dimen/floating_sheet_clock_style_thumbnail_margin"
- android:src="@drawable/ic_clock_24px" />
-
- <ImageView
- android:id="@+id/edit_icon"
- android:layout_width="@dimen/floating_sheet_clock_edit_icon_size"
- android:layout_height="@dimen/floating_sheet_clock_edit_icon_size"
- android:layout_marginTop="-16dp"
- android:layout_marginLeft="50dp"
- android:src="@drawable/edit_icon"/>
-
- </FrameLayout>
-</FrameLayout>
+ <ImageView
+ android:id="@+id/edit_icon"
+ android:layout_width="@dimen/floating_sheet_clock_edit_icon_size"
+ android:layout_height="@dimen/floating_sheet_clock_edit_icon_size"
+ android:layout_marginTop="@dimen/floating_sheet_clock_edit_icon_margin"
+ android:layout_marginEnd="@dimen/floating_sheet_clock_edit_icon_margin"
+ android:src="@drawable/edit_icon"
+ app:layout_constraintEnd_toEndOf="@+id/background"
+ app:layout_constraintTop_toTopOf="@+id/background"
+ android:importantForAccessibility="no" />
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/clock_style_option2.xml b/res/layout/clock_style_option2.xml
deleted file mode 100644
index 8bb60d1..0000000
--- a/res/layout/clock_style_option2.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- Copyright (C) 2024 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.
--->
-<!-- Content description is set programmatically on the parent FrameLayout -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="80dp"
- android:layout_height="80dp"
- android:clipToPadding="false"
- android:clipChildren="false">
-
- <com.android.wallpaper.picker.option.ui.view.OptionItemBackground
- android:id="@id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no" />
-
- <ImageView
- android:id="@+id/foreground"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_margin="@dimen/floating_sheet_clock_style_thumbnail_margin"
- android:src="@drawable/ic_clock_24px" />
-
- <ImageView
- android:id="@+id/edit_icon"
- android:layout_width="@dimen/floating_sheet_clock_edit_icon_size"
- android:layout_height="@dimen/floating_sheet_clock_edit_icon_size"
- android:layout_marginTop="-16dp"
- android:layout_marginStart="50dp"
- android:src="@drawable/edit_icon"
- android:importantForAccessibility="no" />
-</FrameLayout>
-
diff --git a/res/layout/customization_option_entry_clock.xml b/res/layout/customization_option_entry_clock.xml
index c302965..f677a1e 100644
--- a/res/layout/customization_option_entry_clock.xml
+++ b/res/layout/customization_option_entry_clock.xml
@@ -30,18 +30,24 @@
android:text="@string/clock_title"
android:layout_marginEnd="@dimen/customization_option_entry_text_margin_end"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/option_entry_clock_icon"
+ app:layout_constraintEnd_toStartOf="@+id/option_entry_clock_icon_container"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<FrameLayout
- android:id="@+id/option_entry_clock_icon"
+ android:id="@+id/option_entry_clock_icon_container"
android:layout_width="@dimen/customization_option_entry_icon_size"
android:layout_height="@dimen/customization_option_entry_icon_size"
- android:orientation="horizontal"
android:background="@drawable/customization_option_entry_icon_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintBottom_toBottomOf="parent" />
+ app:layout_constraintBottom_toBottomOf="parent">
+
+ <ImageView
+ android:id="@+id/option_entry_clock_icon"
+ android:layout_width="@dimen/customization_option_entry_clock_icon_size"
+ android:layout_height="@dimen/customization_option_entry_clock_icon_size"
+ android:layout_gravity="center"/>
+ </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/floating_sheet_clock.xml b/res/layout/floating_sheet_clock.xml
index 338cbf2..93cf24b 100644
--- a/res/layout/floating_sheet_clock.xml
+++ b/res/layout/floating_sheet_clock.xml
@@ -24,7 +24,6 @@
android:id="@+id/clock_floating_sheet_content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingVertical="@dimen/floating_sheet_content_vertical_padding"
android:background="@drawable/floating_sheet_content_background"
android:clipToPadding="false"
android:clipChildren="false">
diff --git a/res/layout/floating_sheet_clock_color_content.xml b/res/layout/floating_sheet_clock_color_content.xml
index 3f1ec8c..fd218c6 100644
--- a/res/layout/floating_sheet_clock_color_content.xml
+++ b/res/layout/floating_sheet_clock_color_content.xml
@@ -18,6 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingVertical="@dimen/floating_sheet_content_vertical_padding"
android:orientation="vertical"
android:clipToPadding="false"
android:clipChildren="false">
diff --git a/res/layout/floating_sheet_clock_font_content.xml b/res/layout/floating_sheet_clock_font_content.xml
index 9c223a5..3ce65e4 100644
--- a/res/layout/floating_sheet_clock_font_content.xml
+++ b/res/layout/floating_sheet_clock_font_content.xml
@@ -20,9 +20,10 @@
android:id="@+id/clock_floating_sheet_font_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingVertical="@dimen/floating_sheet_content_vertical_padding"
+ android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding"
android:clipChildren="false"
- android:clipToPadding="false"
- android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding">
+ android:clipToPadding="false">
<TextView
android:id="@+id/clock_axis_slider_name1"
diff --git a/res/layout/floating_sheet_clock_style_content.xml b/res/layout/floating_sheet_clock_style_content.xml
index 9054ec3..5b39776 100644
--- a/res/layout/floating_sheet_clock_style_content.xml
+++ b/res/layout/floating_sheet_clock_style_content.xml
@@ -19,6 +19,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingTop="@dimen/floating_sheet_clock_style_content_top_padding"
+ android:paddingBottom="@dimen/floating_sheet_clock_style_content_bottom_padding"
android:clipToPadding="false"
android:clipChildren="false">
@@ -45,19 +47,14 @@
-->
<include
layout="@layout/clock_style_option"
- android:layout_width="@dimen/floating_sheet_clock_style_option_size"
- android:layout_height="@dimen/floating_sheet_clock_style_option_size"
+ android:layout_width="@dimen/floating_sheet_clock_style_option_width"
+ android:layout_height="@dimen/floating_sheet_clock_style_option_height"
android:visibility="invisible" />
- <!--
- TODO (b/377528523): We intentionally disable over scroll mode since it will clip the
- edit icon when in over scroll.
- -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/clock_style_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:overScrollMode="never"
android:clipChildren="false"
android:clipToPadding="false"/>
</FrameLayout>
diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml
index ac4e52d..a42f932 100644
--- a/res/values-iw/strings.xml
+++ b/res/values-iw/strings.xml
@@ -43,7 +43,7 @@
<string name="clock_size_large" msgid="3143248715744138979">"גדול"</string>
<string name="clock_size_small" msgid="2280449912094164133">"קטן"</string>
<string name="clock_size_small_description" msgid="4089511196955732480">"שעון קטן מופיע בפינת המסך"</string>
- <string name="clock_font_editor_apply" msgid="5965611025879105293">"החלה של שינויי הגופן בשעון"</string>
+ <string name="clock_font_editor_apply" msgid="5965611025879105293">"אישור של שינויי הגופן בשעון"</string>
<string name="clock_font_editor_revert" msgid="5307491447405753061">"ביטול של שינויי הגופן בשעון"</string>
<string name="grid_title" msgid="1688173478777254123">"תצוגת האפליקציות"</string>
<string name="shape_and_grid_title" msgid="9092477491363761054">"הצורה והפריסה של האפליקציה"</string>
diff --git a/res/values-w800dp/dimens.xml b/res/values-w800dp/dimens.xml
index d5032b6..5673be4 100644
--- a/res/values-w800dp/dimens.xml
+++ b/res/values-w800dp/dimens.xml
@@ -23,4 +23,5 @@
<dimen name="clock_carousel_item_card_width">114dp</dimen>
<dimen name="clock_carousel_item_card_height">124dp</dimen>
<dimen name="clock_carousel_guideline_margin">320dp</dimen>
+ <item name="clock_carousel_scale" format="float" type="dimen">0.35</item>
</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 229815e..0c36753 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -166,6 +166,7 @@
<dimen name="clock_carousel_item_card_width">100dp</dimen>
<dimen name="clock_carousel_item_card_height">108dp</dimen>
<dimen name="clock_carousel_guideline_margin_for_2_pane_small_width">122dp</dimen>
+ <item name="clock_carousel_scale" format="float" type="dimen">0.5</item>
<!-- Clock color and size button -->
<dimen name="clock_color_size_button_min_height">32dp</dimen>
@@ -181,6 +182,8 @@
<!-- Floating sheet dimensions -->
<dimen name="floating_sheet_content_vertical_padding">20dp</dimen>
<dimen name="floating_sheet_content_horizontal_padding">20dp</dimen>
+ <dimen name="floating_sheet_clock_style_content_top_padding">2dp</dimen>
+ <dimen name="floating_sheet_clock_style_content_bottom_padding">20dp</dimen>
<dimen name="floating_sheet_horizontal_padding">16dp</dimen>
<dimen name="floating_sheet_tab_toolbar_vertical_margin">8dp</dimen>
<dimen name="floating_sheet_tab_clock_font_toolbar_top_margin">16dp</dimen>
@@ -188,14 +191,19 @@
<dimen name="floating_sheet_list_item_horizontal_space">4dp</dimen>
<dimen name="floating_sheet_list_item_vertical_space">4dp</dimen>
<dimen name="floating_sheet_clock_style_option_list_margin_bottom">8dp</dimen>
- <dimen name="floating_sheet_clock_style_option_size">82dp</dimen>
+ <dimen name="floating_sheet_clock_style_option_width">80dp</dimen>
+ <dimen name="floating_sheet_clock_style_option_height">98dp</dimen>
+ <dimen name="floating_sheet_clock_style_option_background_size">80dp</dimen>
+ <dimen name="floating_sheet_clock_style_option_thumbnail_size">56dp</dimen>
<dimen name="floating_sheet_clock_edit_icon_size">48dp</dimen>
- <dimen name="floating_sheet_clock_style_thumbnail_margin">12dp</dimen>
+ <dimen name="floating_sheet_clock_edit_icon_margin">-18dp</dimen>
+ <dimen name="floating_sheet_clock_style_thumbnail_margin_bottom">12dp</dimen>
<dimen name="floating_sheet_clock_style_clock_size_text_margin_end">16dp</dimen>
<dimen name="floating_sheet_clock_color_option_list_bottom_margin">12dp</dimen>
<dimen name="floating_sheet_color_option_size">54dp</dimen>
<dimen name="floating_sheet_color_option_stroke_width">3dp</dimen>
<dimen name="customization_option_entry_shortcut_icon_size">20dp</dimen>
+ <dimen name="customization_option_entry_clock_icon_size">44dp</dimen>
<!-- Clock font control dimensions -->
<dimen name="clock_font_axis_name_width">64dp</dimen>
diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt
index a022d00..ae412ed 100644
--- a/src/com/android/customization/module/ThemePickerInjector.kt
+++ b/src/com/android/customization/module/ThemePickerInjector.kt
@@ -66,6 +66,7 @@
import com.android.wallpaper.module.CustomizationSections
import com.android.wallpaper.module.FragmentFactory
import com.android.wallpaper.module.NetworkStatusNotifier
+import com.android.wallpaper.module.PackageStatusNotifier
import com.android.wallpaper.module.PartnerProvider
import com.android.wallpaper.module.WallpaperPicker2Injector
import com.android.wallpaper.module.WallpaperPreferences
@@ -118,6 +119,7 @@
prefs: Lazy<WallpaperPreferences>,
wallpaperColorsRepository: Lazy<WallpaperColorsRepository>,
defaultWallpaperCategoryWrapper: Lazy<WallpaperCategoryWrapper>,
+ packageNotifier: Lazy<PackageStatusNotifier>,
) :
WallpaperPicker2Injector(
mainScope,
@@ -132,6 +134,7 @@
prefs,
wallpaperColorsRepository,
defaultWallpaperCategoryWrapper,
+ packageNotifier,
),
CustomizationInjector {
private var customizationSections: CustomizationSections? = null
diff --git a/src/com/android/customization/picker/clock/ui/view/ClockCarouselView.kt b/src/com/android/customization/picker/clock/ui/view/ClockCarouselView.kt
index 1fbdede..0ed0362 100644
--- a/src/com/android/customization/picker/clock/ui/view/ClockCarouselView.kt
+++ b/src/com/android/customization/picker/clock/ui/view/ClockCarouselView.kt
@@ -19,6 +19,7 @@
import android.content.res.ColorStateList
import android.content.res.Resources
import android.util.AttributeSet
+import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -40,6 +41,7 @@
val carousel: Carousel
private val motionLayout: MotionLayout
+ private val clockViewScale: Float
private lateinit var adapter: ClockCarouselAdapter
private lateinit var clockViewFactory: ClockViewFactory
private var toCenterClockController: ClockController? = null
@@ -56,6 +58,11 @@
carousel = clockCarousel.requireViewById(R.id.carousel)
motionLayout = clockCarousel.requireViewById(R.id.motion_container)
motionLayout.contentDescription = context.getString(R.string.custom_clocks_label)
+ clockViewScale =
+ TypedValue().let {
+ resources.getValue(R.dimen.clock_carousel_scale, it, true)
+ it.float
+ }
}
/**
@@ -130,7 +137,14 @@
overrideScreenPreviewWidth()
}
- adapter = ClockCarouselAdapter(clockSize, clocks, clockViewFactory, onClockSelected)
+ adapter =
+ ClockCarouselAdapter(
+ clockViewScale,
+ clockSize,
+ clocks,
+ clockViewFactory,
+ onClockSelected,
+ )
carousel.isInfinite = clocks.size >= MIN_CLOCKS_TO_ENABLE_INFINITE_CAROUSEL
carousel.setAdapter(adapter)
val indexOfSelectedClock =
@@ -222,8 +236,8 @@
?.largeClock
?.animations
?.onPickerCarouselSwiping(progress)
- val scalingDownScale = getScalingDownScale(progress)
- val scalingUpScale = getScalingUpScale(progress)
+ val scalingDownScale = getScalingDownScale(progress, clockViewScale)
+ val scalingUpScale = getScalingUpScale(progress, clockViewScale)
offCenterClockScaleView?.scaleX = scalingDownScale
offCenterClockScaleView?.scaleY = scalingDownScale
toCenterClockScaleView?.scaleX = scalingUpScale
@@ -369,6 +383,7 @@
}
private class ClockCarouselAdapter(
+ val clockViewScale: Float,
val clockSize: ClockSize,
val clocks: List<ClockCarouselItemViewModel>,
private val clockViewFactory: ClockViewFactory,
@@ -450,8 +465,8 @@
clockScaleView.scaleY = 1f
controller.largeClock.animations.onPickerCarouselSwiping(1F)
} else {
- clockScaleView.scaleX = CLOCK_CAROUSEL_VIEW_SCALE
- clockScaleView.scaleY = CLOCK_CAROUSEL_VIEW_SCALE
+ clockScaleView.scaleX = clockViewScale
+ clockScaleView.scaleY = clockViewScale
controller.largeClock.animations.onPickerCarouselSwiping(0F)
}
}
@@ -501,7 +516,6 @@
companion object {
// The carousel needs to have at least 5 different clock faces to be infinite
const val MIN_CLOCKS_TO_ENABLE_INFINITE_CAROUSEL = 5
- const val CLOCK_CAROUSEL_VIEW_SCALE = 0.5f
const val TRANSITION_DURATION = 250
val itemViewIds =
@@ -513,10 +527,11 @@
R.id.item_view_4,
)
- fun getScalingUpScale(progress: Float) =
- CLOCK_CAROUSEL_VIEW_SCALE + progress * (1f - CLOCK_CAROUSEL_VIEW_SCALE)
+ fun getScalingUpScale(progress: Float, clockViewScale: Float) =
+ clockViewScale + progress * (1f - clockViewScale)
- fun getScalingDownScale(progress: Float) = 1f - progress * (1f - CLOCK_CAROUSEL_VIEW_SCALE)
+ fun getScalingDownScale(progress: Float, clockViewScale: Float) =
+ 1f - progress * (1f - clockViewScale)
// This makes the card only starts to reveal in the last quarter of the trip so
// the card won't overlap the preview.
diff --git a/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
index e2b6217..86b2d78 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
@@ -214,10 +214,7 @@
Tab.STYLE -> clockStyleContentHeight
Tab.COLOR -> clockColorContentHeight
Tab.FONT -> clockFontContentHeight
- } +
- view.resources.getDimensionPixelSize(
- R.dimen.floating_sheet_content_vertical_padding
- ) * 2
+ }
// Start to animate the content height
ValueAnimator.ofInt(fromHeight, toHeight)
.apply {
@@ -402,7 +399,7 @@
lifecycleOwner: LifecycleOwner
): OptionItemAdapter2<ClockStyleModel> =
OptionItemAdapter2(
- layoutResourceId = R.layout.clock_style_option2,
+ layoutResourceId = R.layout.clock_style_option,
lifecycleOwner = lifecycleOwner,
bindPayload = { view: View, styleModel: ClockStyleModel ->
view
diff --git a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
index c3d1b83..2936b1c 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ThemePickerCustomizationOptionBinder.kt
@@ -85,6 +85,7 @@
lockScreenCustomizationOptionEntries
.find { it.first == ThemePickerLockCustomizationOption.CLOCK }
?.second
+ val optionClockIcon = optionClock?.findViewById<ImageView>(R.id.option_entry_clock_icon)
val optionShortcut =
lockScreenCustomizationOptionEntries
@@ -128,6 +129,12 @@
}
launch {
+ optionsViewModel.clockPickerViewModel.selectedClock.collect {
+ optionClockIcon?.setImageDrawable(it.thumbnail)
+ }
+ }
+
+ launch {
optionsViewModel.onCustomizeShortcutClicked.collect {
optionShortcut?.setOnClickListener { _ -> it?.invoke() }
}
diff --git a/src/com/android/wallpaper/customization/ui/binder/ThemePickerToolbarBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ThemePickerToolbarBinder.kt
index 357f131..5ea757e 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ThemePickerToolbarBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ThemePickerToolbarBinder.kt
@@ -21,11 +21,13 @@
import android.widget.Button
import android.widget.FrameLayout
import android.widget.Toolbar
+import androidx.core.graphics.ColorUtils
import androidx.core.view.isInvisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
+import com.android.wallpaper.R
import com.android.wallpaper.customization.ui.viewmodel.ThemePickerCustomizationOptionsViewModel
import com.android.wallpaper.customization.ui.viewmodel.ToolbarHeightsViewModel
import com.android.wallpaper.picker.customization.ui.binder.DefaultToolbarBinder
@@ -109,6 +111,14 @@
}
)
+ val applyButtonTextColorEnabled =
+ applyButton.resources.getColor(R.color.system_on_primary, null)
+ val applyButtonTextColorDisabled =
+ ColorUtils.setAlphaComponent(
+ applyButton.resources.getColor(R.color.system_on_surface, null),
+ 97,
+ ) // 97 for 38% transparent
+
lifecycleOwner.lifecycleScope.launch {
lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
launch {
@@ -117,9 +127,18 @@
}
}
- launch { viewModel.isOnApplyVisible.collect { applyButton.isInvisible = !it } }
+ launch { viewModel.isApplyButtonVisible.collect { applyButton.isInvisible = !it } }
- launch { viewModel.isOnApplyEnabled.collect { applyButton.isEnabled = it } }
+ launch {
+ viewModel.isApplyButtonEnabled.collect {
+ applyButton.isEnabled = it
+ applyButton.background.alpha =
+ if (it) 255 else 31 // 255 for 100%, 31 for 12% transparent,
+ applyButton.setTextColor(
+ if (it) applyButtonTextColorEnabled else applyButtonTextColorDisabled
+ )
+ }
+ }
launch {
combine(toolbarHeights, viewModel.isToolbarCollapsed, ::Pair).collect {
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
index f415fa8..6ca773b 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
@@ -88,7 +88,7 @@
listOf(
FloatingToolbarTabViewModel(
Icon.Resource(
- res = R.drawable.ic_style_filled_24px,
+ res = R.drawable.ic_clock_filled_24px,
contentDescription = Text.Resource(R.string.clock_style),
),
context.getString(R.string.clock_style),
@@ -117,10 +117,9 @@
selectedClock ->
overridingClock != null && overridingClock.clockId != selectedClock.clockId
}
+ val selectedClock = clockPickerInteractor.selectedClock
val previewingClock =
- combine(overridingClock, clockPickerInteractor.selectedClock) {
- overridingClock,
- selectedClock ->
+ combine(overridingClock, selectedClock) { overridingClock, selectedClock ->
overridingClock ?: selectedClock
}
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt
index 0937315..62a96fe 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt
@@ -178,9 +178,9 @@
}
.stateIn(viewModelScope, SharingStarted.Eagerly, null)
- val isOnApplyEnabled: Flow<Boolean> = onApplyButtonClicked.map { it != null }
+ val isApplyButtonEnabled: Flow<Boolean> = onApplyButtonClicked.map { it != null }
- val isOnApplyVisible: Flow<Boolean> = selectedOption.map { it != null }
+ val isApplyButtonVisible: Flow<Boolean> = selectedOption.map { it != null }
val isToolbarCollapsed: Flow<Boolean> =
combine(selectedOption, clockPickerViewModel.selectedTab) { selectedOption, selectedTab ->
diff --git a/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt b/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
index a550119..a474212 100644
--- a/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
+++ b/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
@@ -24,6 +24,7 @@
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor
import com.android.wallpaper.testing.FakeWallpaperClient
import com.android.wallpaper.testing.TestInjector
+import com.android.wallpaper.testing.TestPackageStatusNotifier
import com.android.wallpaper.util.DisplayUtils
import javax.inject.Inject
import javax.inject.Singleton
@@ -42,6 +43,7 @@
injectedWallpaperInteractor: WallpaperInteractor,
prefs: WallpaperPreferences,
private val fakeWallpaperCategoryWrapper: WallpaperCategoryWrapper,
+ private val testStatusNotifier: TestPackageStatusNotifier,
) :
TestInjector(
themesUserEventLogger,
@@ -53,6 +55,7 @@
injectedWallpaperInteractor,
prefs,
fakeWallpaperCategoryWrapper,
+ testStatusNotifier,
),
CustomizationInjector {
/////////////////
diff --git a/tests/module/src/com/android/wallpaper/ThemePickerTestModule.kt b/tests/module/src/com/android/wallpaper/ThemePickerTestModule.kt
index 94af717..bc03f12 100644
--- a/tests/module/src/com/android/wallpaper/ThemePickerTestModule.kt
+++ b/tests/module/src/com/android/wallpaper/ThemePickerTestModule.kt
@@ -45,7 +45,10 @@
import com.android.wallpaper.module.logging.UserEventLogger
import com.android.wallpaper.modules.ThemePickerAppModule
import com.android.wallpaper.network.Requester
+import com.android.wallpaper.picker.category.domain.interactor.CategoryInteractor
import com.android.wallpaper.picker.category.domain.interactor.ThirdPartyCategoryInteractor
+import com.android.wallpaper.picker.category.ui.view.providers.IndividualPickerFactory
+import com.android.wallpaper.picker.category.ui.view.providers.implementation.DefaultIndividualPickerFactory
import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
import com.android.wallpaper.picker.common.preview.ui.binder.ThemePickerWorkspaceCallbackBinder
import com.android.wallpaper.picker.common.preview.ui.binder.WorkspaceCallbackBinder
@@ -56,6 +59,7 @@
import com.android.wallpaper.picker.di.modules.MainDispatcher
import com.android.wallpaper.picker.preview.ui.util.DefaultImageEffectDialogUtil
import com.android.wallpaper.picker.preview.ui.util.ImageEffectDialogUtil
+import com.android.wallpaper.testing.FakeCategoryInteractor
import com.android.wallpaper.testing.FakeDefaultRequester
import com.android.wallpaper.testing.FakeThirdPartyCategoryInteractor
import com.android.wallpaper.testing.FakeWallpaperCategoryWrapper
@@ -116,6 +120,16 @@
impl: DefaultImageEffectDialogUtil
): ImageEffectDialogUtil
+ @Binds
+ @Singleton
+ abstract fun bindIndividualPickerFactoryFragment(
+ impl: DefaultIndividualPickerFactory
+ ): IndividualPickerFactory
+
+ @Binds
+ @Singleton
+ abstract fun bindCategoryInteractor(impl: FakeCategoryInteractor): CategoryInteractor
+
@Binds @Singleton abstract fun bindInjector(impl: TestCustomizationInjector): Injector
@Binds
diff --git a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
index 63c27ed..36a723c 100644
--- a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
+++ b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
@@ -46,6 +46,7 @@
import com.android.wallpaper.testing.FakeWallpaperClient
import com.android.wallpaper.testing.TestCurrentWallpaperInfoFactory
import com.android.wallpaper.testing.TestInjector
+import com.android.wallpaper.testing.TestPackageStatusNotifier
import com.android.wallpaper.testing.TestWallpaperPreferences
import com.android.wallpaper.testing.collectLastValue
import com.android.wallpaper.util.DisplayUtils
@@ -80,6 +81,7 @@
private lateinit var client: FakeCustomizationProviderClient
private lateinit var quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor
private lateinit var wallpaperInteractor: WallpaperInteractor
+ private lateinit var testPackageStatusNotifier: TestPackageStatusNotifier
@Before
fun setUp() {
@@ -109,6 +111,7 @@
backgroundDispatcher = testDispatcher,
)
)
+ testPackageStatusNotifier = TestPackageStatusNotifier()
InjectorProvider.setInjector(
TestInjector(
logger,
@@ -120,6 +123,7 @@
wallpaperInteractor,
mock(WallpaperPreferences::class.java),
mock(WallpaperCategoryWrapper::class.java),
+ testPackageStatusNotifier,
)
)
underTest =