-
Notifications
You must be signed in to change notification settings - Fork 320
Migrate DateViewFactory to compose #2879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
682f16e to
5488bfd
Compare
9eb5df4 to
1c0bb48
Compare
d527337 to
3b05b71
Compare
3f5c7a9 to
708c675
Compare
708c675 to
76c76f5
Compare
Instead of throwing an IllegalArgumentException
76c76f5 to
25bb605
Compare
| import androidx.compose.ui.text.input.TransformedText | ||
| import androidx.compose.ui.text.input.VisualTransformation | ||
|
|
||
| class DateVisualTransformation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add doc
| var transformedText = "" | ||
| trimmedText.forEachIndexed { index, char -> | ||
| transformedText += char | ||
| if (index + 1 == firstDelimiterOffset || index + 2 == secondDelimiterOffset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add documentation
To note; the ExposedDropdownMenuBox is specifically designed for displaying a list of selectable items within a menu, and not for triggering dialogs
3589d01 to
2fc8e63
Compare
To simplify date formatting visualization and synchronization
2fc8e63 to
268a71d
Compare
This reverts commit 268a71d.
48f8fe4 to
5d3fe12
Compare
5d3fe12 to
4fcf123
Compare
|
|
|
| val delimiterFirstIndex: Int = pattern.indexOf(delimiter) | ||
| val delimiterLastIndex: Int = pattern.lastIndexOf(delimiter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just have a function that checks if a certain index is a delimiter?
|
|
||
| val delimiterFirstIndex: Int = pattern.indexOf(delimiter) | ||
| val delimiterLastIndex: Int = pattern.lastIndexOf(delimiter) | ||
| val delimiterExistsInPattern = delimiterFirstIndex != -1 && delimiterLastIndex != -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| val delimiterExistsInPattern = delimiterFirstIndex != -1 && delimiterLastIndex != -1 | |
| val delimiterExistsInPattern = pattern.indexOf(delimiter) != -1 |
| if ( | ||
| this.length > dateInputFormat.delimiterFirstIndex && | ||
| get(dateInputFormat.delimiterFirstIndex) != dateInputFormat.delimiter | ||
| ) { | ||
| insert(dateInputFormat.delimiterFirstIndex, dateInputFormat.delimiter) | ||
| } | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these 2 ifs collapse into 1? there's no difference between the first and last delimiters, just treat them the same way.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2860
Description
Clear and concise code change description.
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
Screenshots (if applicable)
Checklist
./gradlew spotlessApplyand./gradlew spotlessCheckto check my code follows the style guide of this project../gradlew checkand./gradlew connectedCheckto test my changes locally.