Skip to content

Commit b1c4f53

Browse files
committed
Made LG devices exceptions for using date type of keyboard for date picker text input.
Resolves #901 - Check if the device is LG, and change the keyboard type if yes. - Remove the exception for Samsung devices, they updated their date type keyboard with "." and "/". PiperOrigin-RevId: 290753487
1 parent 9f48006 commit b1c4f53

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/java/com/google/android/material/datepicker/RangeDateSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ public View onCreateTextInputView(
180180
final TextInputLayout endTextInput = root.findViewById(R.id.mtrl_picker_text_input_range_end);
181181
EditText startEditText = startTextInput.getEditText();
182182
EditText endEditText = endTextInput.getEditText();
183-
// The date inputType for Samsung does not include any separator characters
184-
if (ManufacturerUtils.isSamsungDevice()) {
183+
// The date inputType for LG does not include any separator characters
184+
if (ManufacturerUtils.isLGDevice()) {
185185
// Using the URI variation places the '/' and '.' in more prominent positions
186186
startEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
187187
endEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);

lib/java/com/google/android/material/datepicker/SingleDateSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public View onCreateTextInputView(
102102

103103
TextInputLayout dateTextInput = root.findViewById(R.id.mtrl_picker_text_input_date);
104104
EditText dateEditText = dateTextInput.getEditText();
105-
// The date inputType for Samsung does not include any separator characters
106-
if (ManufacturerUtils.isSamsungDevice()) {
105+
// The date inputType for LG does not include any separator characters
106+
if (ManufacturerUtils.isLGDevice()) {
107107
// Using the URI variation places the '/' and '.' in more prominent positions
108108
dateEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
109109
}

lib/java/com/google/android/material/internal/ManufacturerUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public class ManufacturerUtils {
2727

2828
private ManufacturerUtils() {}
2929

30-
/** Returns true if the device manufacturer is Samsung. */
31-
public static boolean isSamsungDevice() {
32-
return Build.MANUFACTURER.equalsIgnoreCase("samsung");
33-
}
34-
3530
/** Returns true if the device manufacturer is Meizu. */
3631
public static boolean isMeizuDevice() {
3732
return Build.MANUFACTURER.equalsIgnoreCase("meizu");
3833
}
34+
35+
/** Returns true if the device manufacturer is LG. */
36+
public static boolean isLGDevice() {
37+
return Build.MANUFACTURER.equalsIgnoreCase("lg");
38+
}
3939
}

0 commit comments

Comments
 (0)