Skip to content

Added support multiple custom mode #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/java/io/github/armcha/RecyclerViewActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ class RecyclerViewActivity : AppCompatActivity() {
val autoLinkTextView = holder.itemView.autoLinkTextView
val context = holder.itemView.context
val custom = MODE_CUSTOM("\\sAndroid\\b")
val custom1 = MODE_CUSTOM("\\sapp\\b")
val custom2 = MODE_CUSTOM("\\sbased\\b")
autoLinkTextView.addAutoLinkMode(
MODE_HASHTAG,
MODE_URL,
MODE_PHONE,
MODE_EMAIL,

custom1,
custom2,
custom,
MODE_MENTION)

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">AutoLinkTextView</string>
<string name="android_text">Android is a mobile operating system developed by https://google.com.
<string name="android_text">https://www.android.com/gms Android is a mobile operating system developed by https://google.com.
It is based on a modified version of the @Linux kernel and other open source software,
and is designed @primarily for touchscreen mobile devices such as smartphones and #tablets.
In addition, https://github.com/armcha/AutoLinkTextViewV2 has developed Android TV for televisions, Android Auto for cars
Expand All @@ -16,7 +16,7 @@
which use 801-691-7894 their own equivalents to Google Mobile Services.
</string>

<string name="android_text_short">Android is a mobile operating system developed by https://google.com.
<string name="android_text_short">https://www.android.com/gms Android is a mobile operating system developed by https://google.com.
It is based on a modified version of the @Linux kernel and other open source software,
and is designed @primarily for touchscreen mobile devices such as smartphones and #tablets.
\n\n In addition, https://google.com has developed Android TV for televisions, Android Auto for cars
Expand Down
21 changes: 20 additions & 1 deletion autolinklibrary/src/main/java/io/github/armcha/autolink/Mode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,26 @@ object MODE_MENTION : Mode("Mention")
object MODE_URL : Mode("Url")
object MODE_PHONE : Mode("Phone")
object MODE_EMAIL : Mode("Email")
class MODE_CUSTOM(val regex: String) : Mode("Custom")
class MODE_CUSTOM(val regex: String) : Mode("Custom"){
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
if (!super.equals(other)) return false

other as MODE_CUSTOM

if (regex != other.regex) return false

return true
}

override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + regex.hashCode()
return result
}

}



2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0-alpha12'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "guru.stefma.bintrayrelease:bintrayrelease:1.1.1"
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 16 11:20:20 AMT 2019
#Wed Jul 03 13:17:29 PKT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip