Commit Graph

19 Commits

Author SHA1 Message Date
Goooler ca29ee2b0b
Use more orEmpty extensions (#3399)
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/or-empty.html
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/or-empty.html
2023-03-01 21:06:55 +01:00
Nik Clayton 10f983c953
Ignore clicks outside the start/end of a line (#3380)
* Ignore clicks outside the start/end of a line

`LinkMovementMethod` has a bug in its calculation of the clickable width of a span on a line. If the span is the last thing on the line the clickable area extends to the end of the view. So the user can tap what appears to be whitespace and open a link.

Previous code tried to fix this by adding a zero-width space after the link so that `LinkMovementMethod` wouldn't consider it empty. However the ZWS was selected by copy/paste operations, resulting in junk results if users tried to copy the link.

Fix this by subclassing `LinkMovementMethod` and fixing the click detection code to ignore clicks that are outside the bounds of the line that was clicked on.

Remove the code that adds the ZWS.

Fixes https://github.com/tuskyapp/Tusky/issues/1567

* Assume arguments are all non-null

* Use `object` for singleton

* getInstance as a one-liner
2023-02-27 08:54:51 +01:00
Goooler 3592318dc1
Modernize a bit (#3171)
* Remove redundant ignore file

* Add .gitattributes

* Generate new wrapper

* Apply plugins in `plugins`

* Adopt new dsl

* Enable stable config cache

* Ignore all build folders

* Enable build scan

* Disable buildFeatures flags by default

* Migrate to nonTransitive R class

* Tweak flags

* Bump AGP to 7.4.0

* Bump deps

* Run `ktlintFormat`

* Add an icon for IDEA to display

* Revert "Bump deps"

This reverts commit bc0d5b69d5.

* Revert "Enable build scan"

This reverts commit 1568e5e84f.

* Remove com.android.library

* Enable Gradle cache

* Enable room incremental build

* Cleanups

* Cleanups

* Add .editorconfig

* Defer clean task

* Migrate `flavorDimensions`

* Merge instance-build.gradle into app's build.gradle

* Declare compileOptions & kotlinOptions

* Bump jvmTarget to 17

* Fix conflicts

* Xmx4g

* Rename output apks

* Revert "Bump jvmTarget to 17"

This reverts commit e4d1543bda.
2023-02-04 19:58:53 +01:00
Levi Bard 412a28e9a9
Reinstate optional login via custom browser tab (#3165)
* Reinstate optional login via custom browser tab

* Clarify the buttons for the different login options

* Add informative labels for the different login options

* Move "Login with Browser" to the options menu
2023-01-25 19:26:29 +01:00
Levi Bard 8ca92d9fde
Add new mastodon status url format to looksLikeMastodonUrl. (#3136)
Fixes #3092
2023-01-09 21:07:22 +01:00
Nik Clayton 22834431ca
Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046)
* Fix off-by-one error in HttpHeaderLink

Link headers with multiple URLs with multiple parameters were being parsed
incorrectly.

Detected by adding unit tests ahead of converting to Kotlin.

* Convert util/HttpHeaderLink from Java to Kotlin

* Convert util/ThemeUtils from Java to Kotlin

* Convert util/TimestampUtils from Java to Kotlin

* Add tests for PairedList

* Convert util/PairedList from Java to Kotlin

* Implement feedback from PR

* Relicense as GPL
2022-12-31 13:01:35 +01:00
Levi Bard 9e52f7acf1
Load goto social and microblog.pub urls in the app (#2945)
* Move looksLikeMastodonUrl to LinkHelper

* Add support for goto social and microblog.pub urls.
Closes #2893
2022-12-03 12:16:17 +01:00
kyori19 d1482324cc
Make URLSpans with trailing URL not marked up (#2813) 2022-11-16 18:28:00 +01:00
kyori19 a3d13b2743
Fix `markupHiddenUrls` destructs original CharSequence (#2814) 2022-11-15 19:02:35 +01:00
Levi Bard 21b3b53f93
Make bare domain detection more robust in link markup logic (#2792) 2022-11-15 18:05:26 +01:00
Josh Soref 98092e6ff7
Spelling (#2771)
* spelling: activity

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: animation

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: detailed

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: memory

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: notification

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: opened

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: preferable

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: repetitive

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: spoiler

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: thumbnail

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: visibility

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: whitespace

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-09 19:32:39 +01:00
Levi Bard 58e8f75287
Don't markup urls where the display text is exactly the domain (#2732)
* Don't markup urls where the display text is exactly the domain (or www.thedomain)

* Remove unused arguments
2022-11-01 16:41:55 +01:00
Levi Bard 5d09a67b52
Fix the tag span generation for tags with nonascii characters (#2700)
* Update mention and tag regexes from mastodon

* Normalize nonascii tag names the same way that mastodon does
2022-09-17 19:06:45 +02:00
Levi Bard 687cffd540
Show target domains for non-mention/non-hashtag links where the target domain is not provided or differs from the domain in the text (#2698)
* Show target domains for non-mention/non-hashtag links where the target domain is not provided or differs from the domain in the text.
Addresses #2694

* Add link signifier to the marked-up domain

* Back down on validating hashtags and mentions, don't markup _any_ urls where the text starts with #/@
2022-09-17 19:06:07 +02:00
Levi Bard ad001d044d
Revert unintentional behavior change for mention spans to use remote usernames (#2408) 2022-03-30 19:33:31 +02:00
Levi Bard cdefcc441f
Fix relinkifying tags in posts from remote servers (#2359)
* Fix relinkifying tags in posts from remote servers

* Completely ignore urls, and (case-insensitively) match tag names instead
2022-02-28 16:54:25 +01:00
Levi Bard addce87eb6
Use tags from status when adding handlers to hashtag spans in status content (#2344)
* Migrate LinkHelper to kotlin

* Support tags field on statuses

* Use embedded tags list in status instead of text scraping to embed tag click handler.
Fixes #2283

* Make mentions and tags lists nonnullable

* Make LinkHelper.openLink a Context extension method

* Use builtin extension for uri conversion

* More cleanup in LinkHelper

* Add tests for LinkHelper.getDomain

* Unbreak tags in places that don't have a tag list (e.g. profiles)

* Fixup javadoc
2022-02-25 18:56:21 +01:00
Conny Duck eeaadea905 Revert "Generalize url scheme parsing/highlighting (#1008)"
This reverts commit 85610a8311.
2019-02-11 14:43:57 +01:00
Levi Bard 85610a8311 Generalize url scheme parsing/highlighting (#1008)
* Add support for highlighting dat, ssb, ipfs url schemes. #847

* Generalize scheme parsing for url highlighting. #847

* Migrate LinkHelper to kotlin
2019-02-05 19:55:28 +01:00