File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
lib/java/com/google/android/material/datepicker Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 2323import android .view .LayoutInflater ;
2424import android .view .View ;
2525import android .view .ViewGroup ;
26+ import android .view .accessibility .AccessibilityManager ;
2627import android .widget .AdapterView ;
2728import android .widget .EditText ;
2829import androidx .annotation .NonNull ;
@@ -154,4 +155,10 @@ static void showKeyboardWithAutoHideBehavior(@NonNull EditText... editTexts) {
154155 viewToFocus , /* useWindowInsetsController= */ false ),
155156 100 );
156157 }
158+
159+ static boolean isTouchExplorationEnabled (@ NonNull Context context ) {
160+ AccessibilityManager accessibilityManager =
161+ (AccessibilityManager ) context .getSystemService (Context .ACCESSIBILITY_SERVICE );
162+ return accessibilityManager != null && accessibilityManager .isTouchExplorationEnabled ();
163+ }
157164}
Original file line number Diff line number Diff line change @@ -281,7 +281,10 @@ void onInvalidDate() {
281281 }
282282 });
283283
284- DateSelector .showKeyboardWithAutoHideBehavior (startEditText , endEditText );
284+ // only show keyboard if touch exploration is disabled
285+ if (!DateSelector .isTouchExplorationEnabled (root .getContext ())) {
286+ DateSelector .showKeyboardWithAutoHideBehavior (startEditText , endEditText );
287+ }
285288
286289 return root ;
287290 }
Original file line number Diff line number Diff line change @@ -158,7 +158,10 @@ void onInvalidDate() {
158158 }
159159 });
160160
161- DateSelector .showKeyboardWithAutoHideBehavior (dateEditText );
161+ // only show keyboard if touch exploration is disabled
162+ if (!DateSelector .isTouchExplorationEnabled (root .getContext ())) {
163+ DateSelector .showKeyboardWithAutoHideBehavior (dateEditText );
164+ }
162165
163166 return root ;
164167 }
You can’t perform that action at this time.
0 commit comments