richeditor-android
richeditor-android copied to clipboard
autoLink in XML?
Hi, so is there any equivalent to android:autoLink in RichEditor? or anyone know how to open new webview when a link is clicked? Thankyou
Were you able to resolve this issue ?
no i didn't. i just set the text to be copyable in android so that the user can copy the link by themself...
` @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
String decode;
try {
**url = view.getHitTestResult().getExtra();**
decode = URLDecoder.decode(url, AppConstants.ENCRYPTION_CHAR_FORMAT_UTF8);
} catch (UnsupportedEncodingException e) {
// No handling
return false;
}
if (TextUtils.indexOf(url, CALLBACK_SCHEME) == 0) {
callback(decode);
return true;
} else if (TextUtils.indexOf(url, STATE_SCHEME) == 0) {
stateCheck(decode);
return true;
}
if (url.startsWith("http://") || url.startsWith("https://")) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
context.startActivity(i);
return true;
}
if (url.startsWith("file:///android_asset/")) {
String newUrl = url.substring("file:///android_asset/".length());
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://" + newUrl));
context.startActivity(i);
return true;
}
return super.shouldOverrideUrlLoading(view, url);
}
}`
using this i was able to click the url and open it in webview
thankyou for the info, i will try it soon i have the time 😄
Where to write this code ? do I need to add this library as a module and change its override method ?
I have implemented above tings but it didn't work!
@nikitrivedii I am also facing the same issue. Please could you tell where to write this code?
always trigger shouldOverrideUrlLoading(WebView view, WebResourceRequest request) not shouldOverrideUrlLoading(WebView view, String url), so i can not get url
the request.url always return ://re-state