本文整理汇总了Java中android.support.v13.view.inputmethod.InputConnectionCompat.createWrapper方法的典型用法代码示例。如果您正苦于以下问题:Java InputConnectionCompat.createWrapper方法的具体用法?Java InputConnectionCompat.createWrapper怎么用?Java InputConnectionCompat.createWrapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v13.view.inputmethod.InputConnectionCompat
的用法示例。
在下文中一共展示了InputConnectionCompat.createWrapper方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
final InputConnection ic = super.onCreateInputConnection(editorInfo);
if (mimeTypes != null && mCommitContentListener != null) {
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
return InputConnectionCompat.createWrapper(ic, editorInfo, new InputConnectionCompat.OnCommitContentListener() {
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
}
});
}
else {
return ic;
}
}
示例2: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(final EditorInfo info) {
final InputConnection ic = super.onCreateInputConnection(info);
EditorInfoCompat.setContentMimeTypes(info, new String[]{"image/gif"});
final InputConnectionCompat.OnCommitContentListener callback = (info1, flags, opts) -> {
if (BuildVersionUtil.isAtLeastNMR1() && (flags & InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
try {
info1.requestPermission();
} catch (Exception e) {
return false;
}
}
if (commitListener != null) {
commitListener.onCommitContent(info1);
}
return true;
};
return InputConnectionCompat.createWrapper(ic, info, callback);
}
示例3: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
@Nullable
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
final InputConnection ic = super.onCreateInputConnection(editorInfo);
if (mimeTypes != null && mCommitContentListener != null) {
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
return InputConnectionCompat.createWrapper(ic, editorInfo, new InputConnectionCompat.OnCommitContentListener() {
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
}
});
} else {
return ic;
}
}
示例4: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
final InputConnection ic = super.onCreateInputConnection(editorInfo);
if (mimeTypes != null && mCommitContentListener != null) {
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
return InputConnectionCompat.createWrapper(ic, editorInfo, new InputConnectionCompat.OnCommitContentListener() {
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
}
});
} else {
return ic;
}
}
示例5: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection inputConnection = super.onCreateInputConnection(editorInfo);
if(TextSecurePreferences.isEnterSendsEnabled(getContext())) {
editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
}
if (Build.VERSION.SDK_INT < 21) return inputConnection;
if (mediaListener == null) return inputConnection;
if (inputConnection == null) return null;
EditorInfoCompat.setContentMimeTypes(editorInfo, new String[] {"image/jpeg", "image/png", "image/gif"});
return InputConnectionCompat.createWrapper(inputConnection, editorInfo, new CommitContentListener(mediaListener));
}
示例6: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection connection = super.onCreateInputConnection(editorInfo);
if (onCommitContentListener != null) {
Assert.expect(mimeTypes != null);
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
return InputConnectionCompat.createWrapper(connection, editorInfo,
onCommitContentListener);
} else {
return connection;
}
}
示例7: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection inputConnection = super.onCreateInputConnection(editorInfo);
if (SilencePreferences.getEnterKeyType(getContext()).equals("send")) {
editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
}
if (Build.VERSION.SDK_INT <= 13) return inputConnection;
if (mediaListener == null) return inputConnection;
EditorInfoCompat.setContentMimeTypes(editorInfo, new String[] {"image/jpeg", "image/png", "image/gif"});
return InputConnectionCompat.createWrapper(inputConnection, editorInfo, new CommitContentListener(mediaListener));
}
示例8: onCreateInputConnection
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入方法依赖的package包/类
@Override
public InputConnection onCreateInputConnection(EditorInfo attrs) {
InputConnection con = super.onCreateInputConnection(attrs);
EditorInfoCompat.setContentMimeTypes(attrs, new String[] { "image/gif", "image/png" });
return InputConnectionCompat.createWrapper(con, attrs, new InputConnectionCompat.OnCommitContentListener() {
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
if (callback != null) {
if (BuildCompat.isAtLeastNMR1() &&
(flags & InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
try {
inputContentInfo.requestPermission();
} catch (Exception e) {
return false;
}
}
callback.onImageSelected(
inputContentInfo.getContentUri(),
inputContentInfo.getDescription().getMimeType(0)
);
return true;
} else {
return false;
}
}
});
}