Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e79bbb96 authored by Colin Cross's avatar Colin Cross Committed by Cherrypicker Worker
Browse files

Fix kotlin nullable errors in ThemePicker

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
parent d2e6c765
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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()
+2 −2
Original line number Diff line number Diff line
@@ -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,
+3 −3
Original line number Diff line number Diff line
@@ -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()
                    }
                }