material-components / material-components/material-components-android

[MaterialDatePicker] Disabling input mods switch change and setting input text

Open
#3,624 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Widget: DatePicker
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

1st point - I've been looking for options to switch off text input mode, block input variants changing or just remove the inputmode toggle(attached image1). I've saw a previous discussions about such issue, such as https://github.com/material-components/material-components-android/issues/1380 , but none of the suggested methods works now. Setting attributes visibility/clickable through styles causes error:
causes exception, that reffers to 31st line of mtrl_picker_dialog and method builder.setToggleInputModeEnable(false) doesn't exist anymore.

2nd point - is there any kind of way to set text watcher for text input field, or any other way that allow to apply mask like "##.##.####" to inputting symbol. Such as auto-adding . to number input like 21.02.1993, and not allow to input any further. Simple date formats, that could be set with setTextInputFormat() doesn't provide such functionality, not preventing further year input for formats like "dd.MM.yyyy"

Attached image1
![screen_1](https://github.com/material-components/material-components-android/assets/61781754/6bf36c86-e624-447f-af71-e913936a7034)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the current MaterialDatePicker behavior and inspect mtrl_picker_dialog around line 31, along with the available input-mode APIs. The issue is complete when disabling or locking the input-mode switch and constraining or masking text input are supported with documented behavior, including the requested date format cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.