Bug 1062112: Part 1.5: Move GeckoEditable interfaces to satisfy JDK 8. r=nalexander

This commit is contained in:
Chris Kitching 2014-09-08 12:48:08 -07:00
parent 6e6bc9110e
commit b4dbd63148
4 changed files with 58 additions and 37 deletions

View File

@ -5,6 +5,7 @@
package org.mozilla.gecko;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@ -37,39 +38,6 @@ import android.util.Log;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
// interface for the IC thread
interface GeckoEditableClient {
void sendEvent(GeckoEvent event);
Editable getEditable();
void setUpdateGecko(boolean update);
void setSuppressKeyUp(boolean suppress);
Handler getInputConnectionHandler();
boolean setInputConnectionHandler(Handler handler);
}
/* interface for the Editable to listen to the Gecko thread
and also for the IC thread to listen to the Editable */
interface GeckoEditableListener {
// IME notification type for notifyIME(), corresponding to NotificationToIME enum in Gecko
final int NOTIFY_IME_OPEN_VKB = -2;
final int NOTIFY_IME_REPLY_EVENT = -1;
final int NOTIFY_IME_OF_FOCUS = 1;
final int NOTIFY_IME_OF_BLUR = 2;
final int NOTIFY_IME_TO_COMMIT_COMPOSITION = 8;
final int NOTIFY_IME_TO_CANCEL_COMPOSITION = 9;
// IME enabled state for notifyIMEContext()
final int IME_STATE_DISABLED = 0;
final int IME_STATE_ENABLED = 1;
final int IME_STATE_PASSWORD = 2;
final int IME_STATE_PLUGIN = 3;
void notifyIME(int type);
void notifyIMEContext(int state, String typeHint,
String modeHint, String actionHint);
void onSelectionChange(int start, int end);
void onTextChange(CharSequence text, int start, int oldEnd, int newEnd);
}
/*
GeckoEditable implements only some functions of Editable
The field mText contains the actual underlying
@ -1004,12 +972,12 @@ final class GeckoEditable
} else if (Proxy.isProxyClass(obj.getClass())) {
debugAppend(sb, Proxy.getInvocationHandler(obj));
} else if (obj instanceof CharSequence) {
sb.append("\"").append(obj.toString().replace('\n', '\u21b2')).append("\"");
sb.append('"').append(obj.toString().replace('\n', '\u21b2')).append('"');
} else if (obj.getClass().isArray()) {
sb.append(obj.getClass().getComponentType().getSimpleName()).append("[")
.append(java.lang.reflect.Array.getLength(obj)).append("]");
sb.append(obj.getClass().getComponentType().getSimpleName()).append('[')
.append(Array.getLength(obj)).append(']');
} else {
sb.append(obj.toString());
sb.append(obj);
}
return sb;
}

View File

@ -0,0 +1,21 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import android.os.Handler;
import android.text.Editable;
/**
* Interface for the IC thread.
*/
interface GeckoEditableClient {
void sendEvent(GeckoEvent event);
Editable getEditable();
void setUpdateGecko(boolean update);
void setSuppressKeyUp(boolean suppress);
Handler getInputConnectionHandler();
boolean setInputConnectionHandler(Handler handler);
}

View File

@ -0,0 +1,30 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
/**
* Interface for the Editable to listen on the Gecko thread, as well as for the IC thread to listen
* to the Editable.
*/
interface GeckoEditableListener {
// IME notification type for notifyIME(), corresponding to NotificationToIME enum in Gecko
int NOTIFY_IME_OPEN_VKB = -2;
int NOTIFY_IME_REPLY_EVENT = -1;
int NOTIFY_IME_OF_FOCUS = 1;
int NOTIFY_IME_OF_BLUR = 2;
int NOTIFY_IME_TO_COMMIT_COMPOSITION = 8;
int NOTIFY_IME_TO_CANCEL_COMPOSITION = 9;
// IME enabled state for notifyIMEContext()
int IME_STATE_DISABLED = 0;
int IME_STATE_ENABLED = 1;
int IME_STATE_PASSWORD = 2;
int IME_STATE_PLUGIN = 3;
void notifyIME(int type);
void notifyIMEContext(int state, String typeHint, String modeHint, String actionHint);
void onSelectionChange(int start, int end);
void onTextChange(CharSequence text, int start, int oldEnd, int newEnd);
}

View File

@ -194,6 +194,8 @@ gbjar.sources += [
'GeckoBatteryManager.java',
'GeckoConnectivityReceiver.java',
'GeckoEditable.java',
'GeckoEditableClient.java',
'GeckoEditableListener.java',
'GeckoEvent.java',
'GeckoHalDefines.java',
'GeckoInputConnection.java',