fix some lint warnings and Kotlin style issues (#1390)
This commit is contained in:
parent
a46922bfde
commit
83f9638aaf
9 changed files with 10 additions and 42 deletions
|
@ -159,7 +159,7 @@ class ListStatusAccessibilityDelegate(
|
|||
val textLinks = links.map { item -> item.link }
|
||||
AlertDialog.Builder(host.context)
|
||||
.setTitle(R.string.title_links_dialog)
|
||||
.setAdapter(ArrayAdapter<String>(
|
||||
.setAdapter(ArrayAdapter(
|
||||
host.context,
|
||||
android.R.layout.simple_list_item_1,
|
||||
textLinks)
|
||||
|
@ -188,7 +188,7 @@ class ListStatusAccessibilityDelegate(
|
|||
val tags = getHashtags(status).map { it.subSequence(1, it.length) }.toList()
|
||||
AlertDialog.Builder(host.context)
|
||||
.setTitle(R.string.title_hashtags_dialog)
|
||||
.setAdapter(ArrayAdapter<CharSequence>(host.context,
|
||||
.setAdapter(ArrayAdapter(host.context,
|
||||
android.R.layout.simple_list_item_1, tags)
|
||||
) { _, which ->
|
||||
statusActionListener.onViewTag(tags[which].toString())
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.text.style.CharacterStyle
|
|||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.URLSpan
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* @see <a href="https://github.com/tootsuite/mastodon/blob/master/app/models/tag.rb">
|
||||
|
@ -68,7 +69,7 @@ private fun findPattern(string: String, fromIndex: Int): FindCharsResult {
|
|||
&& ((i - fromIndex) < finder.searchPrefixWidth ||
|
||||
Character.isWhitespace(string.codePointAt(i - finder.searchPrefixWidth)))) {
|
||||
result.matchType = matchType
|
||||
result.start = Math.max(0, i - finder.searchPrefixWidth)
|
||||
result.start = max(0, i - finder.searchPrefixWidth)
|
||||
findEndOfPattern(string, result, finder.pattern)
|
||||
if (result.start + finder.searchPrefixWidth <= i + 1 && // The found result is actually triggered by the correct search character
|
||||
result.end >= result.start) { // ...and we actually found a valid result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue