Built with ❤︎ by
Twoiq
Highlight hashtags in EditText and TextInputEditText as text change.
Add this in your app's build.gradle file:
dependencies {
implementation 'com.twoiq.hashtagify:hashtagify:1.0.0'
}
Or add hashtagify as a new dependency inside your pom.xml
<dependency>
<groupId>com.twoiq.hashtagify</groupId>
<artifactId>hashtagify</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
You can use all standard attributes of EditText in CustomEditText
<com.twoiq.hashtagify.CustomEditText
android:id="@+id/customEdt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:hint="Enter text with #hashtag"
android:textSize="18sp"
android:inputType="textMultiLine"
android:lines="5"
android:textColor="@color/colorPrimary"
app:tagColor="@color/colorAccent"/>
You can use all standard attributes of TextInputEditText in CustomTextInputEditText, You can also use it with material TextInputLayout
<com.twoiq.hashtagify.CustomTextInputEditText
android:id="@+id/customTiet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter text with #hashtag"
android:textSize="18sp"
android:inputType="textMultiLine"
android:lines="5"
android:textColor="@color/colorPrimary"
app:tagColor="@color/colorAccent"/>
You can use all standard attributes of TextView in CustomTextView
<com.twoiq.hashtagify.CustomTextView
android:id="@+id/tvText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:textSize="18sp"
android:text="Crazy brown #Fox jumps over #Lazy dog"
android:textColor="@color/colorPrimary"
app:tagColor="@color/colorAccent"/>
You can use all standard attributes of EditText, TextInputLayout, TextView
Attribute Name | Default Value | Example Value | Description |
---|---|---|---|
app:tagColor | #1e90ff | @color/colorAccent | Color of highlighted hashtag for EditText, TextInputLayout, TextView |
// EditText
edt.setTagColor(ContextCompat.getColor(this, R.color.colorRed))
// TextInputEditText
tiet.setTagColor(ContextCompat.getColor(this, R.color.colorRed))
// TextView
tv.setTagColor(ContextCompat.getColor(this, R.color.colorRed))
Mufaddal Makda
- Website (https://twoiq.com)
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
Copyright 2020 twoiq
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.