mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Merge pull request #1914 from Hafizzle/Fiz/handle-external-application-linkclick
Attempt to open webpage or application versus query for external packages
This commit is contained in:
commit
71665a000f
2 changed files with 4 additions and 2 deletions
|
|
@ -139,7 +139,6 @@ abstract class ChecklistedViewHolder(
|
|||
val parsedText = MarkdownParser.parseMarkdown(item.text ?: "")
|
||||
withContext(Dispatchers.Main) {
|
||||
textView?.setParsedMarkdown(parsedText)
|
||||
textView?.movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.habitrpg.common.habitica.helpers
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
|
|
@ -170,7 +171,9 @@ private fun handleUrlClicks(context: Context, url: String) {
|
|||
}
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_VIEW, webpage)
|
||||
if (intent.resolveActivity(context.packageManager) != null) {
|
||||
try {
|
||||
context.startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
// No application can handle the link
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue