summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2023-08-09 16:26:31 -0700
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2023-09-11 20:35:53 +0000
commite79bbb968e860b7953f509a8dac629ef9e46df37 (patch)
tree78e9aae771a1a2cbbd2b084af0ee3cf957a9fc2f
parentd2e6c765ff3f43170ddb3dfcad4253b20fb3db3d (diff)
downloadThemePicker-tmp_amf_298295554.tar.gz
Fix kotlin nullable errors in ThemePickertmp_amf_298295554
Fix kotlin nullable errors that were exposed by setting the retention of android.annotation.NonNull and android.annotation.Nullable to class retention. Bug: 294110802 Test: builds (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2d4a9f40c357e1979895fac005934c1185461798) Merged-In: If13ac9b81cfe65730d5ce270e9409bc97cef75ec Change-Id: If13ac9b81cfe65730d5ce270e9409bc97cef75ec
-rw-r--r--src/com/android/customization/picker/clock/ui/binder/CarouselAccessibilityDelegate.kt14
-rw-r--r--src/com/android/customization/picker/color/ui/view/ColorOptionIconView.kt4
-rw-r--r--src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt6
3 files changed, 12 insertions, 12 deletions
diff --git a/src/com/android/customization/picker/clock/ui/binder/CarouselAccessibilityDelegate.kt b/src/com/android/customization/picker/clock/ui/binder/CarouselAccessibilityDelegate.kt
index 5e3c26ee..eb111717 100644
--- a/src/com/android/customization/picker/clock/ui/binder/CarouselAccessibilityDelegate.kt
+++ b/src/com/android/customization/picker/clock/ui/binder/CarouselAccessibilityDelegate.kt
@@ -34,28 +34,28 @@ class CarouselAccessibilityDelegate(
private val ACTION_SCROLL_BACKWARD = R.id.action_scroll_backward
private val ACTION_SCROLL_FORWARD = R.id.action_scroll_forward
- override fun onInitializeAccessibilityNodeInfo(host: View?, info: AccessibilityNodeInfo?) {
+ override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(host, info)
- info?.isScrollable = true
- info?.addAction(
+ info.isScrollable = true
+ info.addAction(
AccessibilityNodeInfo.AccessibilityAction(
ACTION_SCROLL_FORWARD,
context.getString(R.string.scroll_forward_and_select)
)
)
- info?.addAction(
+ info.addAction(
AccessibilityNodeInfo.AccessibilityAction(
ACTION_SCROLL_BACKWARD,
context.getString(R.string.scroll_backward_and_select)
)
)
- info?.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS)
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS)
// We need to specifically set the content description since for some reason the talkback
// service does not go to children of the clock carousel in the view hierarchy
- info?.contentDescription = contentDescriptionOfSelectedClock
+ info.contentDescription = contentDescriptionOfSelectedClock
}
- override fun performAccessibilityAction(host: View?, action: Int, args: Bundle?): Boolean {
+ override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
when (action) {
ACTION_SCROLL_BACKWARD -> {
scrollBackwardCallback.invoke()
diff --git a/src/com/android/customization/picker/color/ui/view/ColorOptionIconView.kt b/src/com/android/customization/picker/color/ui/view/ColorOptionIconView.kt
index 05148430..257bffb2 100644
--- a/src/com/android/customization/picker/color/ui/view/ColorOptionIconView.kt
+++ b/src/com/android/customization/picker/color/ui/view/ColorOptionIconView.kt
@@ -69,7 +69,7 @@ class ColorOptionIconView(
super.onSizeChanged(w, h, oldw, oldh)
}
- override fun onDraw(canvas: Canvas?) {
+ override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
// The w and h need to be an even number to avoid tiny pixel-level gaps between the pies
w = w.roundDownToEven()
@@ -79,7 +79,7 @@ class ColorOptionIconView(
val height = h.toFloat()
oval.set(0f, 0f, width, height)
- canvas?.apply {
+ canvas.apply {
paint.color = color3
drawArc(
oval,
diff --git a/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt b/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt
index 8e917987..a828f837 100644
--- a/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt
+++ b/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt
@@ -102,7 +102,7 @@ class PreviewWithClockCarouselSectionController(
val view = super.createView(context)
if (screen == CustomizationSections.Screen.LOCK_SCREEN) {
val screenPreviewClickView: ScreenPreviewClickView =
- view.findViewById(R.id.screen_preview_click_view)
+ view.requireViewById(R.id.screen_preview_click_view)
val clockColorAndSizeButtonStub: ViewStub =
view.requireViewById(R.id.clock_color_and_size_button)
clockColorAndSizeButtonStub.layoutResource = R.layout.clock_color_and_size_button
@@ -161,7 +161,7 @@ class PreviewWithClockCarouselSectionController(
var bindJob: Job? = null
onAttachStateChangeListener =
object : OnAttachStateChangeListener {
- override fun onViewAttachedToWindow(view: View?) {
+ override fun onViewAttachedToWindow(view: View) {
bindJob =
lifecycleOwner.lifecycleScope.launch {
ClockCarouselViewBinder.bind(
@@ -182,7 +182,7 @@ class PreviewWithClockCarouselSectionController(
}
}
- override fun onViewDetachedFromWindow(view: View?) {
+ override fun onViewDetachedFromWindow(view: View) {
bindJob?.cancel()
}
}