diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-06-29 22:34:45 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-06-29 22:34:45 +0200 |
commit | 70477c9fc9c6c6df45d2b921d920ec4070535bb4 (patch) | |
tree | 9e53c29f86894cb46a7e79c523b26f839192153b /src/main/java/de/pixart/messenger/ui/text | |
parent | dda1f862f0d96571e1353e4deefe10bb57a7d269 (diff) |
linkify subject + open xmpp directly w/o going through start conv activity
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/text')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java index 87299b8e1..353887054 100644 --- a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java +++ b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java @@ -42,6 +42,7 @@ import android.view.View; import android.widget.Toast; import de.pixart.messenger.R; +import de.pixart.messenger.ui.ConversationsActivity; @SuppressLint("ParcelCreator") public class FixedURLSpan extends URLSpan { @@ -63,6 +64,12 @@ public class FixedURLSpan extends URLSpan { public void onClick(View widget) { final Uri uri = Uri.parse(getURL()); final Context context = widget.getContext(); + if (uri.getScheme().equals("xmpp") && context instanceof ConversationsActivity) { + if (((ConversationsActivity) context).onXmppUriClicked(uri)) { + widget.playSoundEffect(0); + return; + } + } final Intent intent = new Intent(Intent.ACTION_VIEW, uri); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); @@ -70,6 +77,7 @@ public class FixedURLSpan extends URLSpan { //intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); try { context.startActivity(intent); + widget.playSoundEffect(0); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); } |