Skip to content

Commit

Permalink
[MaterialTimePicker] Fix text and cursor alignment on the clock display
Browse files Browse the repository at this point in the history
Resolves #2834
Resolves #2832

GIT_ORIGIN_REV_ID=dbd966e3fbf8161aaea9389b14adc178bbbe7aad
Co-authored-by: paulfthomas
PiperOrigin-RevId: 468005512
  • Loading branch information
pubiqq authored and leticiarossi committed Aug 17, 2022
1 parent 4e323fa commit 16edbb9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<padding
android:bottom="@dimen/material_cursor_inset_bottom"
android:top="@dimen/material_cursor_inset_top" />
android:bottom="@dimen/material_cursor_inset"
android:top="@dimen/material_cursor_inset" />
<size android:width="@dimen/material_cursor_width" />
<solid android:color="?attr/colorPrimary" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<padding
android:bottom="@dimen/material_cursor_inset_bottom"
android:top="@dimen/material_cursor_inset_top" />
android:bottom="@dimen/material_cursor_inset"
android:top="@dimen/material_cursor_inset" />
<size android:width="@dimen/material_cursor_width" />
<solid android:color="@android:color/black" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
-->
<com.google.android.material.chip.Chip
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="96dp"
android:layout_height="80dp"
android:layout_width="@dimen/material_clock_display_width"
android:layout_height="@dimen/material_clock_display_height"
style="?attr/chipStyle" />
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:errorIconDrawable="@null"
app:hintEnabled="false" >
app:hintEnabled="false">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="96dp"
android:textCursorDrawable="@drawable/material_cursor_drawable"
android:layout_height="80dp"
android:paddingBottom="@dimen/material_time_input_padding_bottom" />
android:layout_width="@dimen/material_clock_display_width"
android:layout_height="@dimen/material_clock_display_height"
android:textCursorDrawable="@drawable/material_cursor_drawable" />

<TextView
android:id="@+id/material_label"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
-->

<resources>
<dimen name="material_clock_display_width">96dp</dimen>
<dimen name="material_clock_display_height">80dp</dimen>
<dimen name="material_clock_display_padding">24dp</dimen>
<dimen name="material_clock_period_toggle_height">96dp</dimen>
<dimen name="material_clock_period_toggle_width">52dp</dimen>
Expand All @@ -30,13 +32,10 @@
<dimen name="material_clock_number_text_size">15sp</dimen>

<!-- cursor dimens -->
<dimen name="material_cursor_inset_bottom">-6dp</dimen>
<dimen name="material_cursor_inset_top">-12dp</dimen>
<dimen name="material_cursor_inset">-4dp</dimen>
<dimen name="material_cursor_width">2dp</dimen>

<dimen name="material_clock_size">256dp</dimen>
<!-- TextInputEditText doesn't properly center pre-S, so add padding fix -->
<dimen name="material_time_input_padding_bottom">6dp</dimen>

<dimen name="material_time_picker_minimum_screen_height">560dp</dimen>
<dimen name="material_time_picker_minimum_screen_width">340dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<style name="Widget.MaterialComponents.TimePicker.Display.TextInputEditText" parent="Widget.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="android:textAppearance">?attr/textAppearanceHeadline3</item>
<item name="android:textSize" tools:ignore="SpUsage">56dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:inputType">number</item>
<item name="android:maxLength">2</item>
Expand All @@ -93,6 +93,7 @@
<item name="android:gravity">center</item>
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:includeFontPadding">false</item>
</style>

<style name="Widget.MaterialComponents.TimePicker.Display.HelperText" parent="Widget.MaterialComponents.TextView">
Expand Down Expand Up @@ -177,7 +178,7 @@
<style name="Widget.Material3.MaterialTimePicker.Display.TextInputEditText" parent="Widget.Material3.TextInputEditText.OutlinedBox">
<item name="android:textAppearance">?attr/textAppearanceHeadlineMedium</item>
<item name="android:textSize" tools:ignore="SpUsage">56dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:inputType">number</item>
<item name="android:maxLength">2</item>
Expand All @@ -186,6 +187,7 @@
<item name="android:gravity">center</item>
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:includeFontPadding">false</item>
</style>

<style name="Widget.Material3.MaterialTimePicker.Display.HelperText" parent="Widget.MaterialComponents.TimePicker.Display.HelperText">
Expand Down

0 comments on commit 16edbb9

Please sign in to comment.