Adjusting minimum touch size for clock color button
This CL adjusts the height of the clock color and size button to a minimum of 48dp.
This height is dictated by accessibility requirements found in the attached bug.
Bug: 278641340
Test: manual
Change-Id: I2594563ec965d2e39d88efa783416988bbc57c03
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 5941e3d..4bd5f1c 100644
--- a/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt
+++ b/src/com/android/customization/picker/preview/ui/section/PreviewWithClockCarouselSectionController.kt
@@ -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 @@
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