Java Code Examples for android.widget.PopupWindow#INPUT_METHOD_NOT_NEEDED

The following examples show how to use android.widget.PopupWindow#INPUT_METHOD_NOT_NEEDED . 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: IcsListPopupWindow.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
Example 2
Source File: AutocompletePopup.java    From Autocomplete with Apache License 2.0 4 votes vote down vote up
/**
 * @return {@code true} if this popup is configured to assume the user does not need
 * to interact with the IME while it is showing, {@code false} otherwise.
 */
@SuppressWarnings("WeakerAccess")
boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
Example 3
Source File: AutocompletePopup.java    From Autocomplete with Apache License 2.0 4 votes vote down vote up
/**
 * <p>Builds the popup window's content and returns the height the popup
 * should have. Returns -1 when the content already exists.</p>
 *
 * @return the content's wrap content height or -1 if content already exists
 */
private int buildDropDown() {
    int otherHeights = 0;

    // getMaxAvailableHeight() subtracts the padding, so we put it back
    // to get the available height for the whole window.
    final int paddingVert;
    final int paddingHoriz;
    final Drawable background = mPopup.getBackground();
    if (background != null) {
        background.getPadding(mTempRect);
        paddingVert = mTempRect.top + mTempRect.bottom;
        paddingHoriz = mTempRect.left + mTempRect.right;

        // If we don't have an explicit vertical offset, determine one from
        // the window background so that content will line up.
        if (!mVerticalOffsetSet) {
            mVerticalOffset = -mTempRect.top;
        }
    } else {
        mTempRect.setEmpty();
        paddingVert = 0;
        paddingHoriz = 0;
    }

    // Redefine dimensions taking into account maxWidth and maxHeight.
    final boolean ignoreBottomDecorations = mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
    final int maxContentHeight = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ?
            mPopup.getMaxAvailableHeight(getAnchorView(), mVerticalOffset, ignoreBottomDecorations) :
            mPopup.getMaxAvailableHeight(getAnchorView(), mVerticalOffset);
    final int maxContentWidth = mContext.getResources().getDisplayMetrics().widthPixels - paddingHoriz;

    mMaxHeight = Math.min(maxContentHeight + paddingVert, mUserMaxHeight);
    mMaxWidth = Math.min(maxContentWidth + paddingHoriz, mUserMaxWidth);
    // if (mHeight > 0) mHeight = Math.min(mHeight, maxContentHeight);
    // if (mWidth > 0) mWidth = Math.min(mWidth, maxContentWidth);

    if (mAlwaysVisible || mHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
        return mMaxHeight;
    }

    final int childWidthSpec;
    switch (mWidth) {
        case ViewGroup.LayoutParams.WRAP_CONTENT:
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(maxContentWidth, View.MeasureSpec.AT_MOST); break;
        case ViewGroup.LayoutParams.MATCH_PARENT:
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(maxContentWidth, View.MeasureSpec.EXACTLY); break;
        default:
            //noinspection Range
            childWidthSpec = View.MeasureSpec.makeMeasureSpec(mWidth, View.MeasureSpec.EXACTLY); break;
    }

    // Add padding only if the list has items in it, that way we don't show
    // the popup if it is not needed. For this reason, we measure as wrap_content.
    mView.measure(childWidthSpec, View.MeasureSpec.makeMeasureSpec(maxContentHeight, View.MeasureSpec.AT_MOST));
    final int viewHeight = mView.getMeasuredHeight();
    if (viewHeight > 0) {
        otherHeights += paddingVert + mView.getPaddingTop() + mView.getPaddingBottom();
    }

    return Math.min(viewHeight + otherHeights, mMaxHeight);
}
 
Example 4
Source File: IcsListPopupWindow.java    From android-apps with MIT License 4 votes vote down vote up
private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
Example 5
Source File: IcsListPopupWindow.java    From zen4android with MIT License 4 votes vote down vote up
private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
Example 6
Source File: IcsListPopupWindow.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}
 
Example 7
Source File: IcsListPopupWindow.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
private boolean isInputMethodNotNeeded() {
    return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
}