This adds custom delimiter support which fixes #23. The delimiter can be set through XML or programmatically.
Example for setting a comma as the delimiter:
<com.tylersuehr.chips.ChipsInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Start typing for chips..."
app:delimiter=","/>
or programmatically:
chipInputLayout.setDelimiter(",");
When the user types a comma anywhere in the edit text, the entire string will be split into tokens and the respective chips will be created in order. This also works for copy/paste.
The delimiter doesn't have to just be a single character. It can be a whole word or even a regex string. Here's an example with regex:
<com.tylersuehr.chips.ChipsInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Start typing for chips..."
app:delimiter="[0-9]+"
app:delimiterRegex="true"/>
or programmatically:
chipInputLayout.setDelimiter("[0-9]+", true);
This will tokenize the input using any number as the delimiter.
Upkeep
I've updated and tested the target and build SDKs and the support libraries. This will resolve the warnings in #33.
Multiple Gradle keywords deprecated also and being removed at the end of 2018 and I've updated those accordingly in order to get rid of build warnings.
I intended to put these 2 commits in a separate branch and make a different pull request but I messed that up and don't know how to fix it, but I will figure it out if you need that 😄
Custom delimiters
This adds custom delimiter support which fixes #23. The delimiter can be set through XML or programmatically.
Example for setting a comma as the delimiter:
or programmatically:
When the user types a comma anywhere in the edit text, the entire string will be split into tokens and the respective chips will be created in order. This also works for copy/paste.
The delimiter doesn't have to just be a single character. It can be a whole word or even a regex string. Here's an example with regex:
or programmatically:
This will tokenize the input using any number as the delimiter.
Upkeep
I've updated and tested the target and build SDKs and the support libraries. This will resolve the warnings in #33.
Multiple Gradle keywords deprecated also and being removed at the end of 2018 and I've updated those accordingly in order to get rid of build warnings.
I intended to put these 2 commits in a separate branch and make a different pull request but I messed that up and don't know how to fix it, but I will figure it out if you need that 😄