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 23
23
import android .view .LayoutInflater ;
24
24
import android .view .View ;
25
25
import android .view .ViewGroup ;
26
+ import android .view .accessibility .AccessibilityManager ;
26
27
import android .widget .AdapterView ;
27
28
import android .widget .EditText ;
28
29
import androidx .annotation .NonNull ;
@@ -154,4 +155,10 @@ static void showKeyboardWithAutoHideBehavior(@NonNull EditText... editTexts) {
154
155
viewToFocus , /* useWindowInsetsController= */ false ),
155
156
100 );
156
157
}
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
+ }
157
164
}
Original file line number Diff line number Diff line change @@ -281,7 +281,10 @@ void onInvalidDate() {
281
281
}
282
282
});
283
283
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
+ }
285
288
286
289
return root ;
287
290
}
Original file line number Diff line number Diff line change @@ -158,7 +158,10 @@ void onInvalidDate() {
158
158
}
159
159
});
160
160
161
- DateSelector .showKeyboardWithAutoHideBehavior (dateEditText );
161
+ // only show keyboard if touch exploration is disabled
162
+ if (!DateSelector .isTouchExplorationEnabled (root .getContext ())) {
163
+ DateSelector .showKeyboardWithAutoHideBehavior (dateEditText );
164
+ }
162
165
163
166
return root ;
164
167
}
You can’t perform that action at this time.
0 commit comments