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

Commit bd205d1e authored by Abdullah Tabassum's avatar Abdullah Tabassum Committed by Android (Google) Code Review
Browse files

Merge "Adjusting minimum touch size for clock color button" into udc-dev

parents 5fd2a7ec 01ba1f32
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
package com.android.customization.picker.preview.ui.section

import android.content.Context
import android.graphics.Rect
import android.os.Bundle
import android.view.TouchDelegate
import android.view.View
import android.view.View.OnAttachStateChangeListener
import android.view.ViewGroup
@@ -98,6 +100,20 @@ class PreviewWithClockCarouselSectionController(
            clockColorAndSizeButton?.setOnClickListener {
                navigationController.navigateTo(ClockSettingsFragment())
            }
            // clockColorAndSizeButton's touch target has to be increased programmatically
            // rather than with padding because this button only appears in the lock screen tab.
            view.post {
                val rect = Rect()
                clockColorAndSizeButton?.getHitRect(rect)
                val padding =
                    context
                        .getResources()
                        .getDimensionPixelSize(R.dimen.screen_preview_section_vertical_space)
                rect.top -= padding
                rect.bottom += padding
                val touchDelegate = TouchDelegate(rect, clockColorAndSizeButton)
                view.setTouchDelegate(touchDelegate)
            }

            val carouselViewStub: ViewStub = view.requireViewById(R.id.clock_carousel_view_stub)
            carouselViewStub.layoutResource = R.layout.clock_carousel_view