本文整理匯總了Java中android.inputmethodservice.InputMethodService類的典型用法代碼示例。如果您正苦於以下問題:Java InputMethodService類的具體用法?Java InputMethodService怎麽用?Java InputMethodService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InputMethodService類屬於android.inputmethodservice包,在下文中一共展示了InputMethodService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onComputeInsets
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
@Override
public void onComputeInsets(final InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
// This method may be called before {@link #setInputView(View)}.
if (mInputView == null) {
return;
}
final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
if (visibleKeyboardView == null) {
return;
}
final int inputHeight = mInputView.getHeight();
if (isImeSuppressedByHardwareKeyboard() && !visibleKeyboardView.isShown()) {
// If there is a hardware keyboard and a visible software keyboard view has been hidden,
// no visual element will be shown on the screen.
outInsets.contentTopInsets = inputHeight;
outInsets.visibleTopInsets = inputHeight;
mInsetsUpdater.setInsets(outInsets);
return;
}
final int visibleTopY = inputHeight - visibleKeyboardView.getHeight();
// Need to set expanded touchable region only if a keyboard view is being shown.
if (visibleKeyboardView.isShown()) {
final int touchLeft = 0;
final int touchTop = mKeyboardSwitcher.isShowingMoreKeysPanel() ? 0 : visibleTopY;
final int touchRight = visibleKeyboardView.getWidth();
final int touchBottom = inputHeight
// Extend touchable region below the keyboard.
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
outInsets.touchableRegion.set(touchLeft, touchTop, touchRight, touchBottom);
}
outInsets.contentTopInsets = visibleTopY;
outInsets.visibleTopInsets = visibleTopY;
mInsetsUpdater.setInsets(outInsets);
}
示例2: IntentApiTrigger
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public IntentApiTrigger(InputMethodService inputMethodService) {
mInputMethodService = inputMethodService;
mServiceBridge = new ServiceBridge(new Callback() {
@Override
public void onRecognitionResult(String recognitionResult) {
postResult(recognitionResult);
}
});
mUpperCaseChars = new HashSet<Character>();
mUpperCaseChars.add('.');
mUpperCaseChars.add('!');
mUpperCaseChars.add('?');
mUpperCaseChars.add('\n');
mHandler = new Handler();
}
示例3: switchToPreviousKeyboard
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public static void switchToPreviousKeyboard(InputMethodService ims, boolean silent)
{
try {
InputMethodManager imm = (InputMethodManager) ims.getSystemService(Context.INPUT_METHOD_SERVICE);
final IBinder token = ims.getWindow().getWindow().getAttributes().token;
//imm.setInputMethod(token, LATIN);
imm.switchToLastInputMethod(token);
} catch (Throwable t) { // java.lang.NoSuchMethodError if API_level<11
Log.e("KP2A","cannot set the previous input method:");
t.printStackTrace();
SharedPreferences prefs = ims.getSharedPreferences(KP2A_SWITCHER, Context.MODE_PRIVATE);
switchToKeyboard(ims, prefs.getString(PREVIOUS_KEYBOARD, null), silent);
}
}
示例4: onComputeInsets
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
if (!isFullscreenMode()) {
outInsets.contentTopInsets = outInsets.visibleTopInsets;
}
}
示例5: switchToShortcutIme
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public void switchToShortcutIme(final InputMethodService context) {
if (mShortcutInputMethodInfo == null) {
return;
}
final String imiId = mShortcutInputMethodInfo.getId();
switchToTargetIME(imiId, mShortcutSubtype, context);
}
示例6: switchToTargetIME
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
private void switchToTargetIME(final String imiId, final InputMethodSubtype subtype,
final InputMethodService context) {
final IBinder token = context.getWindow().getWindow().getAttributes().token;
if (token == null) {
return;
}
final InputMethodManager imm = getInputMethodManager();
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
imm.setInputMethodAndSubtype(token, imiId, subtype);
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例7: setInsets
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
@Override
public void setInsets(final InputMethodService.Insets insets) {
final int visibleTopInsets = insets.visibleTopInsets;
if (mLastVisibleTopInsets != visibleTopInsets) {
mLastVisibleTopInsets = visibleTopInsets;
mView.invalidateOutline();
}
}
示例8: isInstalled
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
/**
* Returns true if an implementation of Voice IME is installed.
*/
public static boolean isInstalled(InputMethodService inputMethodService) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return false;
}
InputMethodInfo inputMethodInfo = getVoiceImeInputMethodInfo(
getInputMethodManager(inputMethodService));
if (inputMethodInfo == null) {
return false;
}
return inputMethodInfo.getSubtypeCount() > 0;
}
示例9: switchToShortcutIME
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public void switchToShortcutIME(final InputMethodService context) {
if (mShortcutInputMethodInfo == null) {
return;
}
final String imiId = mShortcutInputMethodInfo.getId();
switchToTargetIME(imiId, mShortcutSubtype, context);
}
示例10: switchToTargetIME
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
private void switchToTargetIME(final String imiId, final InputMethodSubtype subtype,
final InputMethodService context) {
final IBinder token = context.getWindow().getWindow().getAttributes().token;
if (token == null) {
return;
}
final InputMethodManager imm = mRichImm.getInputMethodManager();
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
imm.setInputMethodAndSubtype(token, imiId, subtype);
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例11: onComputeInsets
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
@Override
public void onComputeInsets(final InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
if (mainKeyboardView == null || mSuggestionsContainer == null) {
return;
}
final int adjustedBackingHeight = getAdjustedBackingViewHeight();
final boolean backingGone = (mKeyPreviewBackingView.getVisibility() == View.GONE);
final int backingHeight = backingGone ? 0 : adjustedBackingHeight;
// In fullscreen mode, the height of the extract area managed by InputMethodService should
// be considered.
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
: mSuggestionsContainer.getHeight();
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
int visibleTopY = extraHeight;
// Need to set touchable region only if input view is being shown
if (mainKeyboardView.isShown()) {
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
visibleTopY -= suggestionsHeight;
}
final int touchY = mainKeyboardView.isShowingMoreKeysPanel() ? 0 : visibleTopY;
final int touchWidth = mainKeyboardView.getWidth();
final int touchHeight = mainKeyboardView.getHeight() + extraHeight
// Extend touchable region below the keyboard.
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
outInsets.touchableRegion.set(0, touchY, touchWidth, touchHeight);
}
outInsets.contentTopInsets = visibleTopY;
outInsets.visibleTopInsets = visibleTopY;
}
示例12: init
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public static RingCharBuffer init(InputMethodService context, boolean enabled,
boolean usabilityStudy) {
if (!(enabled || usabilityStudy)) return null;
sRingCharBuffer.mContext = context;
sRingCharBuffer.mEnabled = true;
UsabilityStudyLogUtils.getInstance().init(context);
return sRingCharBuffer;
}
示例13: init
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public static void init(final InputMethodService inputMethod) {
if (!ENABLE_ACCESSIBILITY) return;
// These only need to be initialized if the kill switch is off.
sInstance.initInternal(inputMethod);
KeyCodeDescriptionMapper.init();
AccessibleKeyboardViewProxy.init(inputMethod);
}
示例14: AccessibilityEntityProvider
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
public AccessibilityEntityProvider(final KeyboardView keyboardView,
final InputMethodService inputMethod) {
mInputMethodService = inputMethod;
mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance();
mAccessibilityUtils = AccessibilityUtils.getInstance();
setView(keyboardView);
}
示例15: showPicker
import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
private static void showPicker(Context ctx) {
((InputMethodManager) ctx.getSystemService(InputMethodService.INPUT_METHOD_SERVICE))
.showInputMethodPicker();
}