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

Commit 01ba1f32 authored by abdullahirum's avatar abdullahirum
Browse files

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
parent cad5ab38
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