Skip to content

Commit b92261f

Browse files
ymariandsn5ft
authored andcommitted
[TimePicker] Fix lint issue with edit texts
PiperOrigin-RevId: 322804881
1 parent 111791e commit b92261f

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

lib/java/com/google/android/material/timepicker/TimePickerTextInputPresenter.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828

2929
import android.content.Context;
3030
import android.content.res.Resources;
31-
import android.os.Build.VERSION;
32-
import android.os.Build.VERSION_CODES;
3331
import android.text.Editable;
3432
import android.text.TextUtils;
3533
import android.text.TextWatcher;
@@ -123,12 +121,6 @@ public void onClick(View v) {
123121

124122
hourEditText = hourTextInput.getTextInput().getEditText();
125123
minuteEditText = minuteTextInput.getTextInput().getEditText();
126-
127-
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
128-
minuteLabel.setLabelFor(minuteEditText.getId());
129-
hourLabel.setLabelFor(hourEditText.getId());
130-
}
131-
132124
controller = new TimePickerTextInputKeyController(hourTextInput, minuteTextInput, time);
133125
hourTextInput.setChipDelegate(
134126
new ClickActionDelegate(timePickerView.getContext(), R.string.material_hour_selection));

lib/java/com/google/android/material/timepicker/res/layout/material_time_input.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<com.google.android.material.textfield.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
1919
xmlns:app="http://schemas.android.com/apk/res-auto"
20+
xmlns:tools="http://schemas.android.com/tools"
2021
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
2122
android:layout_width="wrap_content"
2223
android:layout_height="wrap_content"
@@ -26,18 +27,21 @@
2627
app:shapeAppearance="?attr/shapeAppearanceMediumComponent"
2728
app:shapeAppearanceOverlay="@null">
2829

29-
<EditText
30+
<EditText
3031
android:id="@+id/material_timepicker_edit_text"
3132
style="@style/Widget.MaterialComponents.TimePicker.Display.TextInputEditText"
3233
android:paddingStart="16dp"
3334
android:layout_width="96dp"
34-
android:layout_height="80dp" />
35+
android:layout_height="80dp"
36+
tools:ignore="LabelFor" />
3537

3638
<TextView
39+
android:labelFor="@+id/material_timepicker_edit_text"
3740
android:id="@+id/material_label"
3841
android:textAppearance="?attr/textAppearanceCaption"
3942
android:focusable="false"
4043
android:layout_width="wrap_content"
41-
android:layout_height="wrap_content" />
44+
android:layout_height="wrap_content"
45+
tools:ignore="LabelFor" />
4246

4347
</com.google.android.material.textfield.TextInputLayout>

0 commit comments

Comments
 (0)