Skip to content

twoiq/Hashtagify-android

Repository files navigation

Hashtagify-Android

Built with ❤︎ by Twoiq

Highlight hashtags in EditText and TextInputEditText as text change.

💻 Installation

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>

❔ Usage

Use CustomEditText instead of normal EditText to highlight hash tags,

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"/>
Use CustomTextInputEditText instead of normal TextInputEditText to highlight hash tags,

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"/>
Use TextView instead of normal TextView to highlight hash tags,

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"/>

🎨 Customization and Attributes

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

Change hash tag color (Kotlin)

// 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))

👨 Developed By

Mufaddal Makda

👍 How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

📃 License

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.