Make TextSelection implementations not depend on GeckoApp. Instead, make
them use GeckoView's EventDispatcher directly for communicating with
Gecko.
MozReview-Commit-ID: EygAt3D9HMI
To create new interface ActionModePresenter, a presenter could to
operate action-mode.
For pre-marshmallow Android version, we use ActionBar to provide UI
action for text-selection. Therefore BrowserApp will implement this
presenter for text-selection.
MozReview-Commit-ID: GdLB3ke2pYe
We want to reuse ActionBarTextSelection in more activities, so remove
custom classes from it, to make it easier to interactive with general
Andorid classes.
To achieve that
* Let ActionModeCompat to be a subclass of ActionMode
* Get rid of GeckoMenu
BrowserApp is the only one consumer for ActionModeCompat, and it do
understand the class type. We could move animateIn to it safely. After
doing this, TextSelectionActionModeCallback could become a general
ActionMode.Callback.
MozReview-Commit-ID: 7FTwDTe1JYG
JSONObject.optString defaults to empty string ("") if the key doesn't
exist, whereas GeckoBundle.getString defaults to null if the key doesn't
exist. So the correct conversion for `json.optString("foo")` should be
`bundle.getString("foo", "")`. This patch fixes the wrong conversions
from before. In case we did default to null, this patch gets rid of the
redundant null second argument to GeckoBundle.getString.
Convert observers in ActionBarHandler.js to events that go through
WindowEventDispatcher. "TextSelection:Get" now replies through the
callback interface rather than a "TextSelection:Data" event. The patch
also adds new lazy-loading events in browser.js to replace the
lazy-loading observers that ActionBarHandler relied on.
Convert the "TextSelection:*" events to use BundleEventListener /
GeckoBundle, in both ActionBarTextSelection.java and
FloatingToolbarTextSelection.java. UI events are used because the
listeners require the UI thread. The "TextSelection:Update" listeners
are removed because the event is no longer sent by ActionBarHandler.
In order to use VectorDrawable's in this code we need to use AppCompatDrawableManager, which
is in the v7 appcompat support library. GeckoView cannot access that library, hence
we should move getDrawable() into the main Fennec jar in order to let us use
VectorDrawable's.
Similarly we need to move DrawableUtil for the same reasons.
(This commit only takes care of moving the code, the following code adds VectorDrawable support.)
MozReview-Commit-ID: CE2yTMLgBlJ
in create(), only register listener if anchorHandle exits.
in opposite side, only unregister listener in same condition.
MozReview-Commit-ID: HHN23YcmwS