diff options
author | Siqi Liu <me@siqi.fr> | 2015-03-06 13:35:34 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-09 10:16:17 +0100 |
commit | 619f033d3939839c0b3312e4d6bc1d3944b4ae3d (patch) | |
tree | 2270b2c56f4f658c1035518dcfa60a64f98358c9 /android | |
parent | 5aa19be38f9a176f82733643d47285e2c937cf00 (diff) |
tdf#89705: provides callback for url handling on android.
Change-Id: Ie28cd768519fbdc305f98e1d764d05bd209951ca
Diffstat (limited to 'android')
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/Document.java | 2 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 8c20f7086829..56d92b0a3067 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -40,6 +40,8 @@ public class Document { public static final int CALLBACK_TEXT_SELECTION_START = 3; public static final int CALLBACK_TEXT_SELECTION_END = 4; public static final int CALLBACK_CURSOR_VISIBLE = 5; + // LOK_CALLBACK_GRAPHIC_SELECTION = 6 + public static final int CALLBACK_HYPERLINK_CLICKED = 7; /** * Text selection types diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 0ef12c629251..179c6fffe1f1 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -5,6 +5,8 @@ import android.graphics.PointF; import android.graphics.RectF; import android.util.Log; import android.view.KeyEvent; +import android.net.Uri; +import android.content.Intent; import org.libreoffice.kit.DirectBufferAllocator; import org.libreoffice.kit.Document; @@ -411,10 +413,24 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback */ @Override public void messageRetrieved(int messageID, String payload) { + /** + * Handles messages that do not require entering editing mode. + */ + switch (messageID) { + case Document.CALLBACK_HYPERLINK_CLICKED: + if (!payload.startsWith("http://") && + !payload.startsWith("https://")) + payload = "http://" + payload; + + Intent url_intent = new Intent(Intent.ACTION_VIEW); + url_intent.setData(Uri.parse(payload)); + LibreOfficeMainActivity.mAppContext.startActivity(url_intent); + return; + } + if (!LOKitShell.isEditingEnabled()) { return; } - mInvalidationHandler.processMessage(messageID, payload); } } |