1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-25 12:28:02 +01:00

Added option to copy images to clipboard. Also caught mysterious classcastexception in settings.

This commit is contained in:
vanitasvitae 2016-12-30 22:02:32 +01:00
parent 98bf2d6a93
commit 5428113706
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 10 additions and 1 deletions

View file

@ -285,7 +285,12 @@ public class AppSettings {
* @return whether proxy is enabled or not
*/
public boolean isProxyHttpEnabled() {
return getBoolean(prefApp, R.string.pref_key__http_proxy_enabled, false);
try {
return getBoolean(prefApp, R.string.pref_key__http_proxy_enabled, false);
} catch (ClassCastException e) {
setProxyHttpEnabled(false);
return false;
}
}
public boolean wasProxyEnabled() {

View file

@ -52,6 +52,7 @@ public class ContextMenuWebView extends NestedWebView {
public static final int ID_SAVE_IMAGE = 10;
public static final int ID_IMAGE_EXTERNAL_BROWSER = 11;
public static final int ID_COPY_IMAGE_LINK = 15;
public static final int ID_COPY_LINK = 12;
public static final int ID_SHARE_LINK = 13;
public static final int ID_SHARE_IMAGE = 14;
@ -177,6 +178,7 @@ public class ContextMenuWebView extends NestedWebView {
break;
//Copy url to clipboard
case ID_COPY_IMAGE_LINK:
case ID_COPY_LINK:
if (url != null) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
@ -209,6 +211,7 @@ public class ContextMenuWebView extends NestedWebView {
menu.add(0, ID_SAVE_IMAGE, 0, context.getString(R.string.context_menu_save_image)).setOnMenuItemClickListener(handler);
menu.add(0, ID_IMAGE_EXTERNAL_BROWSER, 0, context.getString(R.string.context_menu_open_external_browser)).setOnMenuItemClickListener(handler);
menu.add(0, ID_SHARE_IMAGE, 0, context.getString(R.string.context_menu_share_image)).setOnMenuItemClickListener(handler);
menu.add(0, ID_COPY_IMAGE_LINK, 0, context.getString(R.string.context_menu_copy_image_link)).setOnMenuItemClickListener(handler);
} else if (result.getType() == HitTestResult.ANCHOR_TYPE ||
result.getType() == HitTestResult.SRC_ANCHOR_TYPE) {
// Menu options for a hyperlink.

View file

@ -90,6 +90,7 @@
<string name="context_menu_share_image">Share image</string>
<string name="context_menu_open_external_browser">Open in external browser…</string>
<string name="context_menu_copy_link">Copy link address to clipboard</string>
<string name="context_menu_copy_image_link">Copy image address to clipboard</string>
<!-- More from MainActivity -->