mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
Collabora: click on hyperlink opens it in browser, not in webview
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
baff5f2f64
commit
7edd1f22fa
1 changed files with 13 additions and 1 deletions
|
@ -74,6 +74,7 @@ public class RichDocumentsEditorWebView extends EditorWebView {
|
|||
public static final int REQUEST_LOCAL_FILE = 101;
|
||||
private static final int REQUEST_REMOTE_FILE = 100;
|
||||
private static final String URL = "URL";
|
||||
private static final String HYPERLINK = "Url";
|
||||
private static final String TYPE = "Type";
|
||||
private static final String PRINT = "print";
|
||||
private static final String SLIDESHOW = "slideshow";
|
||||
|
@ -287,7 +288,6 @@ public class RichDocumentsEditorWebView extends EditorWebView {
|
|||
}
|
||||
} catch (JSONException e) {
|
||||
Log_OC.e(this, "Failed to parse download json message: " + e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,5 +312,17 @@ public class RichDocumentsEditorWebView extends EditorWebView {
|
|||
webview.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_PASTE));
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void hyperlink(String hyperlink) {
|
||||
try {
|
||||
String url = new JSONObject(hyperlink).getString(HYPERLINK);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
} catch (JSONException e) {
|
||||
Log_OC.e(this, "Failed to parse download json message: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue