|
|
|
@ -300,6 +300,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|
|
|
|
public boolean onLongClick(View view) {
|
|
|
|
|
try {
|
|
|
|
|
final Context context = view.getContext();
|
|
|
|
|
|
|
|
|
|
WebView.HitTestResult result = ((WebView) view).getHitTestResult();
|
|
|
|
|
int type = result.getType();
|
|
|
|
|
String extra = result.getExtra();
|
|
|
|
@ -312,8 +313,26 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|
|
|
|
type == HitTestResult.GEO_TYPE ||
|
|
|
|
|
type == HitTestResult.EMAIL_TYPE ||
|
|
|
|
|
type == HitTestResult.SRC_ANCHOR_TYPE ||
|
|
|
|
|
type == HitTestResult.EDIT_TEXT_TYPE)
|
|
|
|
|
type == HitTestResult.EDIT_TEXT_TYPE) {
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
boolean confirm_links = prefs.getBoolean("confirm_links", true);
|
|
|
|
|
if (confirm_links) {
|
|
|
|
|
ClipboardManager clipboard = Helper.getSystemService(context, ClipboardManager.class);
|
|
|
|
|
if (clipboard == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
String title = context.getString(R.string.app_name);
|
|
|
|
|
|
|
|
|
|
ClipData clip = ClipData.newPlainText(title, extra);
|
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
|
|
|
|
|
ToastEx.makeText(context, R.string.title_clipboard_copied, Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
return intf.onOpenLink(extra, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == WebView.HitTestResult.IMAGE_TYPE ||
|
|
|
|
|
type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
|
|
|
|