New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-23993] Android: Expose disableContextMenu in TiWebView #8494
Conversation
…ems properties in app.js
Relates to #8488 |
import android.webkit.WebSettings; | ||
import android.webkit.WebView; | ||
|
||
@SuppressWarnings("deprecation") | ||
public class TiUIWebView extends TiUIView | ||
@SuppressWarnings("deprecation") public class TiUIWebView extends TiUIView |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting still looks off from our standard. annotations should be on the preceding line, not inline as they appear to be throughout your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reformatted code using https://github.com/appcelerator/appc-standards/blob/master/languages/java/eclipse-format-android.xml. It put the annotations in the same line @sgtcoolguy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you've imported it and used it properly then. The settings include these:
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. The file I imported have those two lines. As for how I imported them: Preferences->Editor->Code Style->Java then import eclipse xml and select. For reformatting, cmd + a then code -> reformat code. Still same result.
@@ -37,7 +37,8 @@ | |||
TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR, | |||
TiC.PROPERTY_OVER_SCROLL_MODE, | |||
TiC.PROPERTY_CACHE_MODE, | |||
TiC.PROPERTY_LIGHT_TOUCH_ENABLED | |||
TiC.PROPERTY_LIGHT_TOUCH_ENABLED, | |||
TiC.PROPERTY_CONTEXT_MENU_ITEMS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this ticket is just about addressing the ability to disable the context menu on text selection. So we shouldn't need a new contextMenuItems property. But we should need a new disableContextMenu property.
@@ -69,35 +74,128 @@ | |||
public static final int PLUGIN_STATE_ON = 1; | |||
public static final int PLUGIN_STATE_ON_DEMAND = 2; | |||
|
|||
private static enum reloadTypes { | |||
private boolean disableTextSelection = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @hansemannn has just done disableContextMenu in iOS (and not disableTextSelection). May want to limit it to the single property like he did.
} | ||
|
||
public ActionMode nullifiedActionMode() { | ||
return new ActionMode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract out a class NullActionMode?
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) | ||
{ | ||
mode.getMenuInflater().inflate(R.menu.ti_custom_menu, menu); | ||
// try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out and unused code.
setUrl((String) reloadData); | ||
} else { | ||
Log.d(TAG, "reloadMethod points to url but reloadData is null or of wrong type. Calling default", Log.DEBUG_MODE); | ||
case DATA: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retain existing formatting if you're not changing anything here to avoid confusion on reviews, please.
@@ -1119,6 +1119,11 @@ | |||
/** | |||
* @module.api | |||
*/ | |||
public static final String PROPERTY_CONTEXT_MENU_ITEMS = "contextMenuItems"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -0,0 +1,14 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want all this (the android icon, etc)? We just want to disable the normal context items, so don't need placeholder contents here, but likely just an empty menu or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove the files then
/** | ||
* @module.api | ||
*/ | ||
public static final String PROPERTY_DISABLE_TEXT_SELECTION = "disableTextSelection"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limit to disableContextMenu to match Hans' iOS implementation.
@@ -1598,6 +1613,11 @@ | |||
/** | |||
* @module.api | |||
*/ | |||
public static final String PROPERTY_IDENTIFIER = "identifier"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @hansemannn sample code, I think it was to identify the menu item using user's given id for said item in app.js. Normally an Android developer would have to change the menu xml file but since the user will be using JS, I was going to do it for them programmatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok I found where this came from in the sample. In any case, it was related to the contextMenuItems stuff that we're pushing off to later.
Does this replace PR #8468? |
Yes I believe so @sgtcoolguy |
@@ -1259,11 +1254,6 @@ | |||
/** | |||
* @module.api | |||
*/ | |||
public static final String PROPERTY_DISABLE_CONTEXT_MENU = "disableContextMenu"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you swapped what we wanted to keep versus cut in your PR. This PR is about implementing disableContextMenu, not disableTextSelection.
644f534
to
02905b9
Compare
fc5363e
to
01a9497
Compare
JIRA: https://jira.appcelerator.org/browse/timob-23993
cloned off: https://jira.appcelerator.org/browse/TIMOB-16369. Disable context menu.