Skip to content

Commit d66e8c5

Browse files
committed
bug fixed
1 parent 05df0e4 commit d66e8c5

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

socialtextview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
implementation fileTree(dir: 'libs', include: ['*.jar'])
3030

3131
implementation 'androidx.appcompat:appcompat:1.0.2'
32-
compile "androidx.core:core-ktx:+"
32+
implementation "androidx.core:core-ktx:1.0.2"
3333
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3434

3535
}

socialtextview/src/main/java/com/hasankucuk/socialtextview/SocialTextView.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ class SocialTextView(context: Context, attrs: AttributeSet? = null, def: Int = 0
132132
val items = HashSet<LinkItem>()
133133
var linkedText: String = text
134134

135+
136+
if (linkedType == HASHTAG) {
137+
linkedText = collectLinkItems(HASHTAG.value, items, hashtagPattern.matcher(linkedText), text)
138+
}
139+
if (linkedType == MENTION) {
140+
linkedText = collectLinkItems(MENTION.value, items, mentionPattern!!.matcher(linkedText), text)
141+
}
142+
if (linkedType == URL) {
143+
linkedText = collectLinkItems(URL.value, items, linkPattern!!.matcher(linkedText), text)
144+
}
145+
if (linkedType == EMAIL) {
146+
linkedText = collectLinkItems(EMAIL.value, items, Patterns.EMAIL_ADDRESS.matcher(linkedText), text)
147+
}
148+
if (linkedType == PHONE) {
149+
linkedText = collectLinkItems(PHONE.value, items, Patterns.PHONE.matcher(linkedText), text)
150+
}
151+
152+
collectLinkItems(TEXT.value, items, standartText!!.matcher(linkedText), text)
153+
154+
/*
135155
when (linkedType) {
136156
137157
HASHTAG -> {
@@ -162,6 +182,7 @@ class SocialTextView(context: Context, attrs: AttributeSet? = null, def: Int = 0
162182
}
163183
}
164184
185+
*/
165186
return items
166187
}
167188

0 commit comments

Comments
 (0)