當前位置: 首頁>>代碼示例>>Java>>正文


Java InputMethodService類代碼示例

本文整理匯總了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);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:37,代碼來源:LatinIME.java

示例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();
}
 
開發者ID:MohammadAlBanna,項目名稱:Swift-Braille-Soft-keyboard,代碼行數:20,代碼來源:IntentApiTrigger.java

示例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);
	}
	
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:16,代碼來源:ImeSwitcher.java

示例4: onComputeInsets

import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
    super.onComputeInsets(outInsets);
    if (!isFullscreenMode()) {
        outInsets.contentTopInsets = outInsets.visibleTopInsets;
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:8,代碼來源:KP2AKeyboard.java

示例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);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:9,代碼來源:RichInputMethodManager.java

示例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);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:16,代碼來源:RichInputMethodManager.java

示例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();
    }
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:9,代碼來源:ViewOutlineProviderCompatUtilsLXX.java

示例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;
}
 
開發者ID:MohammadAlBanna,項目名稱:Swift-Braille-Soft-keyboard,代碼行數:18,代碼來源:ImeTrigger.java

示例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);
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:9,代碼來源:SubtypeSwitcher.java

示例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);
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:16,代碼來源:SubtypeSwitcher.java

示例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;
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:35,代碼來源:LatinIME.java

示例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;
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:9,代碼來源:Utils.java

示例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);
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:9,代碼來源:AccessibilityUtils.java

示例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);
}
 
開發者ID:slightfoot,項目名稱:android-kioskime,代碼行數:8,代碼來源:AccessibilityEntityProvider.java

示例15: showPicker

import android.inputmethodservice.InputMethodService; //導入依賴的package包/類
private static void showPicker(Context ctx) {
	((InputMethodManager) ctx.getSystemService(InputMethodService.INPUT_METHOD_SERVICE))
		.showInputMethodPicker();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:5,代碼來源:ImeSwitcher.java


注:本文中的android.inputmethodservice.InputMethodService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。