Java Code Examples for android.inputmethodservice.InputMethodService#Insets

The following examples show how to use android.inputmethodservice.InputMethodService#Insets . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewOutlineProviderCompatUtilsLXX.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {
    final int visibleTopInsets = insets.visibleTopInsets;
    if (mLastVisibleTopInsets != visibleTopInsets) {
        mLastVisibleTopInsets = visibleTopInsets;
        mView.invalidateOutline();
    }
}
 
Example 2
Source File: ViewOutlineProviderCompatUtilsLXX.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {
    final int visibleTopInsets = insets.visibleTopInsets;
    if (mLastVisibleTopInsets != visibleTopInsets) {
        mLastVisibleTopInsets = visibleTopInsets;
        mView.invalidateOutline();
    }
}
 
Example 3
Source File: LatinIME.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@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 SettingsValues settingsValues = mSettings.getCurrent();
    final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
    if (visibleKeyboardView == null || !hasSuggestionStripView()) {
        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 suggestionsHeight = (!mKeyboardSwitcher.isShowingEmojiPalettes()
            && mSuggestionStripView.getVisibility() == View.VISIBLE)
            ? mSuggestionStripView.getHeight() : 0;
    final int visibleTopY = inputHeight - visibleKeyboardView.getHeight() - suggestionsHeight;
    mSuggestionStripView.setMoreSuggestionsHeight(visibleTopY);
    // 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;
        outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
        outInsets.touchableRegion.set(touchLeft, touchTop, touchRight, touchBottom);
    }
    outInsets.contentTopInsets = visibleTopY;
    outInsets.visibleTopInsets = visibleTopY;
    mInsetsUpdater.setInsets(outInsets);
}
 
Example 4
Source File: ChimeeInputMethodService.java    From Chimee with MIT License 5 votes vote down vote up
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
    super.onComputeInsets(outInsets);

    // This gives an invisible padding at the top so that key popups will show in API 28+
    // Touch events on this padding are passed on to whatever views are below it.
    outInsets.visibleTopInsets = imeContainer.getVisibleTop();
    outInsets.contentTopInsets = imeContainer.getVisibleTop();
}
 
Example 5
Source File: LatinIME.java    From hackerskeyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
    super.onComputeInsets(outInsets);
    if (!isFullscreenMode()) {
        outInsets.contentTopInsets = outInsets.visibleTopInsets;
    }
}
 
Example 6
Source File: ViewOutlineProviderCompatUtilsLXX.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {
    final int visibleTopInsets = insets.visibleTopInsets;
    if (mLastVisibleTopInsets != visibleTopInsets) {
        mLastVisibleTopInsets = visibleTopInsets;
        mView.invalidateOutline();
    }
}
 
Example 7
Source File: LatinIME.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@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 SettingsValues settingsValues = mSettings.getCurrent();
    final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
    if (visibleKeyboardView == null || !hasSuggestionStripView()) {
        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 suggestionsHeight = (!mKeyboardSwitcher.isShowingEmojiPalettes()
            && mSuggestionStripView.getVisibility() == View.VISIBLE)
            ? mSuggestionStripView.getHeight() : 0;
    final int visibleTopY = inputHeight - visibleKeyboardView.getHeight() - suggestionsHeight;
    mSuggestionStripView.setMoreSuggestionsHeight(visibleTopY);
    // 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;
        outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
        outInsets.touchableRegion.set(touchLeft, touchTop, touchRight, touchBottom);
    }
    outInsets.contentTopInsets = visibleTopY;
    outInsets.visibleTopInsets = visibleTopY;
    mInsetsUpdater.setInsets(outInsets);
}
 
Example 8
Source File: LatinIME.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 9
Source File: ImeContainerInputMethodService.java    From mongol-library with MIT License 5 votes vote down vote up
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
    super.onComputeInsets(outInsets);

    // This gives an invisible padding at the top so that key popups will show in API 28+
    // Touch events on this padding are passed on to whatever views are below it.
    outInsets.visibleTopInsets = ime.getVisibleTop();
    outInsets.contentTopInsets = ime.getVisibleTop();
}
 
Example 10
Source File: ViewOutlineProviderCompatUtilsLXX.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {
    final int visibleTopInsets = insets.visibleTopInsets;
    if (mLastVisibleTopInsets != visibleTopInsets) {
        mLastVisibleTopInsets = visibleTopInsets;
        mView.invalidateOutline();
    }
}
 
Example 11
Source File: LatinIME.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 12
Source File: BaseKeyboardWidgetManager.java    From Android-Keyboard with Apache License 2.0 5 votes vote down vote up
public void onComputeInsets(final InputMethodService.Insets outInsets) {
    List<KeyboardWidget> widgets = get();
    for (int i = 0; i < widgets.size(); i++) {
        KeyboardWidget widget = widgets.get(i);
        Rect childViewRect = widget.getViewTouchableRect();
        outInsets.touchableRegion.op(childViewRect.left, childViewRect.top, childViewRect.right, childViewRect.bottom, Region.Op.UNION);
    }
}
 
Example 13
Source File: ViewOutlineProviderCompatUtils.java    From simple-keyboard with Apache License 2.0 4 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {}
 
Example 14
Source File: ViewOutlineProviderCompatUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {}
 
Example 15
Source File: ViewOutlineProviderCompatUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 4 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {}
 
Example 16
Source File: ViewOutlineProviderCompatUtils.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
@Override
public void setInsets(final InputMethodService.Insets insets) {}
 
Example 17
Source File: ViewOutlineProviderCompatUtils.java    From simple-keyboard with Apache License 2.0 votes vote down vote up
void setInsets(final InputMethodService.Insets insets); 
Example 18
Source File: ViewOutlineProviderCompatUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 votes vote down vote up
public void setInsets(final InputMethodService.Insets insets); 
Example 19
Source File: ViewOutlineProviderCompatUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 votes vote down vote up
void setInsets(final InputMethodService.Insets insets); 
Example 20
Source File: ViewOutlineProviderCompatUtils.java    From Indic-Keyboard with Apache License 2.0 votes vote down vote up
public void setInsets(final InputMethodService.Insets insets);