本文整理汇总了Java中android.support.v13.view.inputmethod.InputConnectionCompat类的典型用法代码示例。如果您正苦于以下问题:Java InputConnectionCompat类的具体用法?Java InputConnectionCompat怎么用?Java InputConnectionCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputConnectionCompat类属于android.support.v13.view.inputmethod包,在下文中一共展示了InputConnectionCompat类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommitContent
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入依赖的package包/类
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
if (BuildCompat.isAtLeastNMR1() && (flags & InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
try {
inputContentInfo.requestPermission();
} catch (Exception e) {
Log.w(TAG, e);
return false;
}
}
if (inputContentInfo.getDescription().getMimeTypeCount() > 0) {
mediaListener.onMediaSelected(inputContentInfo.getContentUri(),
inputContentInfo.getDescription().getMimeType(0));
return true;
}
return false;
}
示例2: 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;
}
}
示例3: 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);
}
示例4: 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;
}
}
示例5: 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;
}
}
示例6: 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));
}
示例7: 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;
}
}
示例8: 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));
}
示例9: 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;
}
}
});
}
示例10: setMimeTypes
import android.support.v13.view.inputmethod.InputConnectionCompat; //导入依赖的package包/类
public void setMimeTypes(String[] types,
InputConnectionCompat.OnCommitContentListener listener) {
mimeTypes = types;
onCommitContentListener = listener;
}