Merge \\"API Rename: IC#inputContent to IC#commitContent.\\" into nyc-mr1-dev am: 01e7c10d37
am: 0d7dcf7bc3
Change-Id: I5c4209a79e7426192da082100ac2a7517de36b81
This commit is contained in:
@@ -855,5 +855,5 @@ public class BaseInputConnection implements InputConnection {
|
||||
/**
|
||||
* The default implementation does nothing.
|
||||
*/
|
||||
public boolean insertContent(InputContentInfo inputContentInfo, Bundle opts) { return false; }
|
||||
public boolean commitContent(InputContentInfo inputContentInfo, Bundle opts) { return false; }
|
||||
}
|
||||
|
||||
@@ -368,10 +368,10 @@ public class EditorInfo implements InputType, Parcelable {
|
||||
|
||||
/**
|
||||
* List of acceptable MIME types for
|
||||
* {@link InputConnection#insertContent(InputContentInfo, Bundle)}.
|
||||
* {@link InputConnection#commitContent(InputContentInfo, Bundle)}.
|
||||
*
|
||||
* <p>{@code null} or an empty array means that
|
||||
* {@link InputConnection#insertContent(InputContentInfo, Bundle)} is not supported in this
|
||||
* {@link InputConnection#commitContent(InputContentInfo, Bundle)} is not supported in this
|
||||
* editor.</p>
|
||||
*/
|
||||
@Nullable
|
||||
|
||||
@@ -840,7 +840,7 @@ public interface InputConnection {
|
||||
public void closeConnection();
|
||||
|
||||
/**
|
||||
* Called by the input method to insert a content such as PNG image to the editor.
|
||||
* Called by the input method to commit a content such as PNG image to the editor.
|
||||
*
|
||||
* <p>In order to avoid variety of compatibility issues, this focuses on a simple use case,
|
||||
* where we expect editors and IMEs work cooperatively as follows:</p>
|
||||
@@ -866,5 +866,5 @@ public interface InputConnection {
|
||||
* @return {@code true} if this request is accepted by the application, no matter if the request
|
||||
* is already handled or still being handled in background.
|
||||
*/
|
||||
public boolean insertContent(@NonNull InputContentInfo inputContentInfo, @Nullable Bundle opts);
|
||||
public boolean commitContent(@NonNull InputContentInfo inputContentInfo, @Nullable Bundle opts);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class InputConnectionInspector {
|
||||
MissingMethodFlags.DELETE_SURROUNDING_TEXT_IN_CODE_POINTS,
|
||||
MissingMethodFlags.GET_HANDLER,
|
||||
MissingMethodFlags.CLOSE_CONNECTION,
|
||||
MissingMethodFlags.INSERT_CONTENT,
|
||||
MissingMethodFlags.COMMIT_CONTENT,
|
||||
})
|
||||
public @interface MissingMethodFlags {
|
||||
/**
|
||||
@@ -82,10 +82,10 @@ public final class InputConnectionInspector {
|
||||
*/
|
||||
int CLOSE_CONNECTION = 1 << 6;
|
||||
/**
|
||||
* {@link InputConnection#insertContent(InputContentInfo, Bundle)} is available in
|
||||
* {@link InputConnection#commitContent(InputContentInfo, Bundle)} is available in
|
||||
* {@link android.os.Build.VERSION_CODES#N} MR-1 and later.
|
||||
*/
|
||||
int INSERT_CONTENT = 1 << 7;
|
||||
int COMMIT_CONTENT = 1 << 7;
|
||||
}
|
||||
|
||||
private static final Map<Class, Integer> sMissingMethodsMap = Collections.synchronizedMap(
|
||||
@@ -135,8 +135,8 @@ public final class InputConnectionInspector {
|
||||
if (!hasCloseConnection(clazz)) {
|
||||
flags |= MissingMethodFlags.CLOSE_CONNECTION;
|
||||
}
|
||||
if (!hasInsertContent(clazz)) {
|
||||
flags |= MissingMethodFlags.INSERT_CONTENT;
|
||||
if (!hasCommitContent(clazz)) {
|
||||
flags |= MissingMethodFlags.COMMIT_CONTENT;
|
||||
}
|
||||
sMissingMethodsMap.put(clazz, flags);
|
||||
return flags;
|
||||
@@ -206,9 +206,9 @@ public final class InputConnectionInspector {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasInsertContent(@NonNull final Class clazz) {
|
||||
private static boolean hasCommitContent(@NonNull final Class clazz) {
|
||||
try {
|
||||
final Method method = clazz.getMethod("insertContent", InputContentInfo.class,
|
||||
final Method method = clazz.getMethod("commitContent", InputContentInfo.class,
|
||||
Bundle.class);
|
||||
return !Modifier.isAbstract(method.getModifiers());
|
||||
} catch (NoSuchMethodException e) {
|
||||
@@ -263,11 +263,11 @@ public final class InputConnectionInspector {
|
||||
}
|
||||
sb.append("closeConnection()");
|
||||
}
|
||||
if ((flags & MissingMethodFlags.INSERT_CONTENT) != 0) {
|
||||
if ((flags & MissingMethodFlags.COMMIT_CONTENT) != 0) {
|
||||
if (!isEmpty) {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("InsertContent(InputContentInfo, Bundle)");
|
||||
sb.append("commitContent(InputContentInfo, Bundle)");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public class InputConnectionWrapper implements InputConnection {
|
||||
* {@inheritDoc}
|
||||
* @throws NullPointerException if the target is {@code null}.
|
||||
*/
|
||||
public boolean insertContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
return mTarget.insertContent(inputContentInfo, opts);
|
||||
public boolean commitContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
return mTarget.commitContent(inputContentInfo, opts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package android.widget;
|
||||
import android.annotation.ColorInt;
|
||||
import android.annotation.DrawableRes;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -5986,8 +5985,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
return getTarget().insertContent(inputContentInfo, opts);
|
||||
public boolean commitContent(InputContentInfo inputContentInfo, Bundle opts) {
|
||||
return getTarget().commitContent(inputContentInfo, opts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user