Example usage for android.view Gravity NO_GRAVITY

List of usage examples for android.view Gravity NO_GRAVITY

Introduction

In this page you can find the example usage for android.view Gravity NO_GRAVITY.

Prototype

int NO_GRAVITY

To view the source code for android.view Gravity NO_GRAVITY.

Click Source Link

Document

Constant indicating that no gravity has been set

Usage

From source file:android.support.design.widget.CoordinatorLayout.java

/**
 * Dispatch any dependent view changes to the relevant {@link Behavior} instances.
 *
 * Usually run as part of the pre-draw step when at least one child view has a reported
 * dependency on another view. This allows CoordinatorLayout to account for layout
 * changes and animations that occur outside of the normal layout pass.
 *
 * It can also be ran as part of the nested scrolling dispatch to ensure that any offsetting
 * is completed within the correct coordinate window.
 *
 * The offsetting behavior implemented here does not store the computed offset in
 * the LayoutParams; instead it expects that the layout process will always reconstruct
 * the proper positioning./*  w  w w.  j a  v  a  2  s  .c o m*/
 *
 * @param type the type of event which has caused this call
 */
final void onChildViewsChanged(@DispatchChangeEvent final int type) {
    final int layoutDirection = ViewCompat.getLayoutDirection(this);
    final int childCount = mDependencySortedChildren.size();
    final Rect inset = acquireTempRect();
    final Rect drawRect = acquireTempRect();
    final Rect lastDrawRect = acquireTempRect();

    for (int i = 0; i < childCount; i++) {
        final View child = mDependencySortedChildren.get(i);
        final LayoutParams lp = (LayoutParams) child.getLayoutParams();
        if (type == EVENT_PRE_DRAW && child.getVisibility() == View.GONE) {
            // Do not try to update GONE child views in pre draw updates.
            continue;
        }

        // Check child views before for anchor
        for (int j = 0; j < i; j++) {
            final View checkChild = mDependencySortedChildren.get(j);

            if (lp.mAnchorDirectChild == checkChild) {
                offsetChildToAnchor(child, layoutDirection);
            }
        }

        // Get the current draw rect of the view
        getChildRect(child, true, drawRect);

        // Accumulate inset sizes
        if (lp.insetEdge != Gravity.NO_GRAVITY && !drawRect.isEmpty()) {
            final int absInsetEdge = GravityCompat.getAbsoluteGravity(lp.insetEdge, layoutDirection);
            switch (absInsetEdge & Gravity.VERTICAL_GRAVITY_MASK) {
            case Gravity.TOP:
                inset.top = Math.max(inset.top, drawRect.bottom);
                break;
            case Gravity.BOTTOM:
                inset.bottom = Math.max(inset.bottom, getHeight() - drawRect.top);
                break;
            }
            switch (absInsetEdge & Gravity.HORIZONTAL_GRAVITY_MASK) {
            case Gravity.LEFT:
                inset.left = Math.max(inset.left, drawRect.right);
                break;
            case Gravity.RIGHT:
                inset.right = Math.max(inset.right, getWidth() - drawRect.left);
                break;
            }
        }

        // Dodge inset edges if necessary
        if (lp.dodgeInsetEdges != Gravity.NO_GRAVITY && child.getVisibility() == View.VISIBLE) {
            offsetChildByInset(child, inset, layoutDirection);
        }

        if (type != EVENT_VIEW_REMOVED) {
            // Did it change? if not continue
            getLastChildRect(child, lastDrawRect);
            if (lastDrawRect.equals(drawRect)) {
                continue;
            }
            recordLastChildRect(child, drawRect);
        }

        // Update any behavior-dependent views for the change
        for (int j = i + 1; j < childCount; j++) {
            final View checkChild = mDependencySortedChildren.get(j);
            final LayoutParams checkLp = (LayoutParams) checkChild.getLayoutParams();
            final Behavior b = checkLp.getBehavior();

            if (b != null && b.layoutDependsOn(this, checkChild, child)) {
                if (type == EVENT_PRE_DRAW && checkLp.getChangedAfterNestedScroll()) {
                    // If this is from a pre-draw and we have already been changed
                    // from a nested scroll, skip the dispatch and reset the flag
                    checkLp.resetChangedAfterNestedScroll();
                    continue;
                }

                final boolean handled;
                switch (type) {
                case EVENT_VIEW_REMOVED:
                    // EVENT_VIEW_REMOVED means that we need to dispatch
                    // onDependentViewRemoved() instead
                    b.onDependentViewRemoved(this, checkChild, child);
                    handled = true;
                    break;
                default:
                    // Otherwise we dispatch onDependentViewChanged()
                    handled = b.onDependentViewChanged(this, checkChild, child);
                    break;
                }

                if (type == EVENT_NESTED_SCROLL) {
                    // If this is from a nested scroll, set the flag so that we may skip
                    // any resulting onPreDraw dispatch (if needed)
                    checkLp.setChangedAfterNestedScroll(handled);
                }
            }
        }
    }

    releaseTempRect(inset);
    releaseTempRect(drawRect);
    releaseTempRect(lastDrawRect);
}

From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    final SavedState ss = (SavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.openDrawerGravity != Gravity.NO_GRAVITY) {
        final View toOpen = findDrawerWithGravity(ss.openDrawerGravity);
        if (toOpen != null) {
            openDrawer(toOpen);/*from   www .  j av  a2 s  . c om*/
        }
    }

    setDrawerLockMode(ss.lockModeLeft, Gravity.LEFT);
    setDrawerLockMode(ss.lockModeRight, Gravity.RIGHT);
}

From source file:org.medcare.Dicom.DicomActivity.java

void drawInfoWindow() {
    ImageController curentImageController = dicomView.getCurrentImageController();
    if (curentImageController == null)
        return;/*from www  .  j av a 2 s .  c  o m*/

    if (curentImageController != null) {
        // GeoPoint geoPoint = DicomActivity.this.selectedSearchPoint
        // .getPoint();
        ImageDicom id = curentImageController._imageDicom;

        // initialisation de la liste a partir de la Hashtable
        Hashtable h = id.getListGroupDicom();
        Enumeration en = h.elements();
        en = h.keys();
        Log.e("DicomActivity", "getStringInfoDicom " + curentImageController._imageName);
        String page = "<html><body><font size=-2><p>" + curentImageController._imageName + "</p>";
        while (en.hasMoreElements()) {
            int groupId = ((Integer) en.nextElement()).intValue();
            page = page + "<p>" + groupId + "</p>" + "<p>" + id.getStringInfoDicom(groupId) + "</p>";
        }
        page = page + "</font></body></html>";
        mPopupWebView.loadData(page, "text/html", "utf-8");
        Bitmap img = curentImageController.getDrawable().getBitmap();
        int bitmapWidth = img.getWidth();
        int bitmapHeight = img.getHeight();
        Log.e("DicomActivity", "BitMap width = " + bitmapWidth + " height " + bitmapHeight);
        showPopup(DicomActivity.this.dicomView, Gravity.NO_GRAVITY,
                (int) (curentImageController.getCenterX() - bitmapWidth / 2),
                (int) (curentImageController.getCenterY() - bitmapHeight / 2), bitmapWidth, bitmapHeight);
    }
}

From source file:org.zywx.wbpalmstar.engine.EBrowserWindow.java

private void hPopOverOpen(EBrwViewEntry entity) {
    if (checkPop(entity)) {
        return;/*from  w  w  w  . j a v  a  2  s  .com*/
    }
    EBrowserView eView = new EBrowserView(mContext, entity.mType, this);
    //      eView.setVisibility(INVISIBLE);
    eView.setName(entity.mViewName);
    eView.setRelativeUrl(entity.mRelativeUrl);
    eView.setDateType(entity.mDataType);
    LayoutParams newParm = new LayoutParams(entity.mWidth, entity.mHeight);
    newParm.gravity = Gravity.NO_GRAVITY;
    newParm.leftMargin = entity.mX;
    newParm.topMargin = entity.mY;
    newParm.bottomMargin = entity.mBottom;
    EBounceView bounceView = new EBounceView(mContext);
    EUtil.viewBaseSetting(bounceView);
    bounceView.setLayoutParams(newParm);
    bounceView.addView(eView);
    addView(bounceView);
    eView.setHWEnable(entity.mHardware);
    if (entity.checkFlag(EBrwViewEntry.F_FLAG_SHOULD_OP_SYS)) {
        eView.setShouldOpenInSystem(true);
    }
    if (!entity.hasExtraInfo) {
        if (entity.checkFlag(EBrwViewEntry.F_FLAG_OPAQUE)) {
            eView.setOpaque(true);
        } else {
            eView.setOpaque(false);
        }
    }
    if (entity.hasExtraInfo) {
        /** wanglei del 20151124*/
        //            eView.setBrwViewBackground(entity.mOpaque, entity.mBgColor, "");
        /** wanglei add 20151124*/
        bounceView.setBounceViewBackground(entity.mOpaque, entity.mBgColor, "", eView);
    }
    /** wanglei add 20151124*/
    eView.setBackgroundColor(Color.TRANSPARENT);
    if (entity.checkFlag(EBrwViewEntry.F_FLAG_OAUTH)) {
        eView.setOAuth(true);
    }
    if (entity.checkFlag(EBrwViewEntry.F_FLAG_WEBAPP)) {
        eView.setWebApp(true);
    }
    eView.setQuery(entity.mQuery);
    eView.init();
    if (entity.checkFlag(EBrwViewEntry.F_FLAG_GESTURE)) {
        eView.setSupportZoom();
    }
    if (entity.mFontSize > 0) {
        eView.setDefaultFontSize(entity.mFontSize);
    }
    mPopTable.put(entity.mViewName, eView);
    if (checkFlag(EBrowserWindow.F_WINDOW_FLAG_OPPOP)) {
        mPreQueue.add(entity.mViewName);
    }
    switch (entity.mDataType) {
    case EBrwViewEntry.WINDOW_DATA_TYPE_URL:
        //         if (entity.checkFlag(EBrwViewEntry.F_FLAG_OBFUSCATION)) {
        if ((getWidget().m_obfuscation == 1) && !entity.checkFlag(EBrwViewEntry.F_FLAG_WEBAPP)) {
            eView.needToEncrypt(eView, entity.mUrl, 0);
        } else {
            eView.newLoadUrl(entity.mUrl);
        }
        break;
    case EBrwViewEntry.WINDOW_DATA_TYPE_DATA:
        eView.newLoadData(entity.mData);
        break;
    case EBrwViewEntry.WINDOW_DATA_TYPE_DATA_URL:
        String date1 = ACEDes.decrypt(entity.mUrl, mContext, false, entity.mData);
        eView.loadDataWithBaseURL(entity.mUrl, date1, EBrowserView.CONTENT_MIMETYPE_HTML,
                EBrowserView.CONTENT_DEFAULT_CODE, entity.mUrl);
        break;
    }
}

From source file:org.zywx.wbpalmstar.engine.EBrowserWindow.java

private void hSetPopOverFrame(EBrwViewEntry entity) {
    EBrowserView pop = mPopTable.get(entity.mViewName);
    if (pop == null) {
        return;//from  www. j a  va 2  s  .c o  m
    }
    View vParent = (View) pop.getParent();
    LayoutParams lParam = new LayoutParams(entity.mWidth, entity.mHeight);
    lParam.gravity = Gravity.NO_GRAVITY;
    lParam.leftMargin = entity.mX;
    lParam.topMargin = entity.mY;
    vParent.setLayoutParams(lParam);
}

From source file:maximsblog.blogspot.com.formuladict.DrawerLayout.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    final SavedState ss = (SavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.openDrawerGravity != Gravity.NO_GRAVITY) {
        final View toOpen = findDrawerWithGravity(ss.openDrawerGravity);
        if (toOpen != null) {
            openDrawer(toOpen);/*from w w w. jav a  2s  . com*/
        }
    }

    if (ss.lockModeLeft != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeLeft, Gravity.LEFT);
    }
    if (ss.lockModeRight != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeRight, Gravity.RIGHT);
    }
    if (ss.lockModeStart != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeStart, GravityCompat.START);
    }
    if (ss.lockModeEnd != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeEnd, GravityCompat.END);
    }
}

From source file:com.huangj.huangjlibrary.widget.drawerlayout.DrawerLayout.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (!(state instanceof SavedState)) {
        super.onRestoreInstanceState(state);
        return;// w  ww  . ja  v a  2s.c  om
    }

    final SavedState ss = (SavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.openDrawerGravity != Gravity.NO_GRAVITY) {
        final View toOpen = findDrawerWithGravity(ss.openDrawerGravity);
        if (toOpen != null) {
            openDrawer(toOpen);
        }
    }

    if (ss.lockModeLeft != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeLeft, Gravity.LEFT);
    }
    if (ss.lockModeRight != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeRight, Gravity.RIGHT);
    }
    if (ss.lockModeStart != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeStart, GravityCompat.START);
    }
    if (ss.lockModeEnd != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeEnd, GravityCompat.END);
    }
}

From source file:com.zyk.drawerlayout.widget.DrawerLayout.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    final SavedState ss = (SavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    if (ss.openDrawerGravity != Gravity.NO_GRAVITY) {
        final View toOpen = findDrawerWithGravity(ss.openDrawerGravity);
        if (toOpen != null) {
            openDrawer(toOpen);//from w ww  .j a va  2s.c o m
        }
    }

    if (ss.lockModeLeft != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeLeft, Gravity.LEFT);
    }
    if (ss.lockModeTop != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeTop, Gravity.TOP);
    }
    if (ss.lockModeRight != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeRight, Gravity.RIGHT);
    }
    if (ss.lockModeBottom != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeBottom, Gravity.BOTTOM);
    }
    if (ss.lockModeStart != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeStart, GravityCompat.START);
    }
    if (ss.lockModeEnd != LOCK_MODE_UNDEFINED) {
        setDrawerLockMode(ss.lockModeEnd, GravityCompat.END);
    }
}

From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java

private void showKey(final int keyIndex, PointerTracker tracker) {
    Key key = tracker.getKey(keyIndex);
    if (key == null || !mShowPreview)
        return;//from   ww w . j a v  a  2  s. c o m

    int popupWidth = 0;
    int popupHeight = 0;
    // Should not draw hint icon in key preview
    Drawable iconToDraw = getIconToDrawForKey(key, true);
    if (iconToDraw != null) {
        // Here's an annoying bug for you (explanation at the end of the
        // hack)
        mPreviewIcon.setImageState(iconToDraw.getState(), false);
        // end of hack. You see, the drawable comes with a state, this state
        // is overridden by the ImageView. No more.
        mPreviewIcon.setImageDrawable(iconToDraw);
        mPreviewIcon.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        popupWidth = Math.max(mPreviewIcon.getMeasuredWidth(), key.width);
        popupHeight = Math.max(mPreviewIcon.getMeasuredHeight(), key.height);
        mPreviewText.setText(null);
    } else {
        CharSequence label = tracker.getPreviewText(key, mKeyboard.isShifted());
        if (TextUtils.isEmpty(label)) {
            label = guessLabelForKey(key.codes[0]);
        }
        mPreviewIcon.setImageDrawable(null);
        mPreviewText.setTextColor(mPreviewKeyTextColor);
        setKeyPreviewText(key, label);
        popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width);
        popupHeight = Math.max(mPreviewText.getMeasuredHeight(), key.height);
    }

    if (mPreviewPaddingHeight < 0) {
        mPreviewPaddingWidth = mPreviewLayut.getPaddingLeft() + mPreviewLayut.getPaddingRight();
        mPreviewPaddingHeight = mPreviewLayut.getPaddingTop() + mPreviewLayut.getPaddingBottom();

        if (mPreviewKeyBackground != null) {
            Rect padding = new Rect();
            mPreviewKeyBackground.getPadding(padding);
            mPreviewPaddingWidth += (padding.left + padding.right);
            mPreviewPaddingHeight += (padding.top + padding.bottom);
        }
    }
    popupWidth += mPreviewPaddingWidth;
    popupHeight += mPreviewPaddingHeight;

    // and checking that the width and height are big enough for the
    // background.
    if (mPreviewKeyBackground != null) {
        popupWidth = Math.max(mPreviewKeyBackground.getMinimumWidth(), popupWidth);
        popupHeight = Math.max(mPreviewKeyBackground.getMinimumHeight(), popupHeight);
    }

    final boolean showPopupAboveKey = AnyApplication.getConfig().showKeyPreviewAboveKey();
    int popupPreviewX = showPopupAboveKey ? key.x - ((popupWidth - key.width) / 2)
            : (getWidth() - popupWidth) / 2;
    int popupPreviewY = (showPopupAboveKey ? key.y : 0) - popupHeight - mPreviewOffset;

    mHandler.cancelDismissPreview();
    if (mOffsetInWindow == null) {
        mOffsetInWindow = new int[] { 0, 0 };
        getLocationInWindow(mOffsetInWindow);
        Log.d(TAG, "mOffsetInWindow " + mOffsetInWindow[0] + ", " + mOffsetInWindow[1]);
        mOffsetInWindow[0] += mPopupPreviewOffsetX; // Offset may be zero
        mOffsetInWindow[1] += mPopupPreviewOffsetY; // Offset may be zero
        int[] windowLocation = new int[2];
        getLocationOnScreen(windowLocation);
        mWindowY = windowLocation[1];
    }
    popupPreviewX += mOffsetInWindow[0];
    popupPreviewY += mOffsetInWindow[1];

    // If the popup cannot be shown above the key, put it on the side
    if (popupPreviewY + mWindowY < 0) {
        // If the key you're pressing is on the left side of the keyboard,
        // show the popup on
        // the right, offset by enough to see at least one key to the
        // left/right.
        if (key.x + key.width <= getWidth() / 2) {
            popupPreviewX += (int) (key.width * 2.5);
        } else {
            popupPreviewX -= (int) (key.width * 2.5);
        }
        popupPreviewY += popupHeight;
    }

    if (mPreviewPopup.isShowing()) {
        mPreviewPopup.update(popupPreviewX, popupPreviewY, popupWidth, popupHeight);
    } else {
        mPreviewPopup.setWidth(popupWidth);
        mPreviewPopup.setHeight(popupHeight);
        try {
            // https://github.com/AnySoftKeyboard/AnySoftKeyboard/issues/6
            // I don't understand why this should happen, and only with MIUI
            // ROMs.
            // anyhow, it easy to hide :)
            mPreviewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY, popupPreviewX, popupPreviewY);
        } catch (RuntimeException e) {
            // nothing to do here. I think.
        }

    }
    // Record pop-up preview position to display mini-keyboard later at the
    // same position
    mPopupPreviewDisplayedY = popupPreviewY + (showPopupAboveKey ? 0 : key.y);// the popup keyboard should
    // be
    // placed at the right
    // position.
    // So I'm fixing
    mPreviewLayut.setVisibility(VISIBLE);

    // Set the preview background state
    if (mPreviewKeyBackground != null) {
        mPreviewKeyBackground.setState(key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
    }

    // LayoutParams lp = mPreviewLayut.getLayoutParams();
    // lp.width = popupWidth;
    mPreviewLayut.requestLayout();
    mPreviewLayut.invalidate();
}

From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java

/**
 * Called when a key is long pressed. By default this will open any popup
 * keyboard associated with this key through the attributes popupLayout and
 * popupCharacters.//from   w ww  .  ja  va  2s .c om
 *
 * @param popupKey the key that was long pressed
 * @return true if the long press is handled, false otherwise. Subclasses
 *         should call the method on the base class if the subclass doesn't
 *         wish to handle the call.
 */
protected boolean onLongPress(Context packageContext, Key popupKey, boolean isSticky,
        boolean requireSlideInto) {
    if (popupKey.popupResId == 0)
        return false;

    if (mMiniKeyboard == null) {
        createMiniKeyboard();
    }
    AnyPopupKeyboard popupKeyboard = setupMiniKeyboardContainer(packageContext, popupKey, isSticky);
    mMiniKeyboardVisible = true;
    if (mWindowOffset == null) {
        mWindowOffset = new int[2];
        getLocationInWindow(mWindowOffset);
    }

    int popupX = popupKey.x + mWindowOffset[0];
    popupX -= mMiniKeyboard.getPaddingLeft();
    int popupY = popupKey.y + mWindowOffset[1];
    popupY += getPaddingTop();
    popupY -= mMiniKeyboard.getMeasuredHeight();
    popupY -= mMiniKeyboard.getPaddingBottom();
    final int x = popupX;
    final int y = mShowPreview && mOldPreviewKeyIndex != NOT_A_KEY
            && isOneRowKeys(mMiniKeyboard.getKeyboard().getKeys()) ? mPopupPreviewDisplayedY : popupY;

    int adjustedX = x;
    boolean shouldMirrorKeys = false;
    //now we need to see the the popup is positioned correctly:
    //1) if the right edge is off the screen, then we'll try to put the right edge over the popup key
    if (adjustedX > (getMeasuredWidth() - mMiniKeyboard.getMeasuredWidth())) {
        adjustedX = popupKey.x + mWindowOffset[0] - mMiniKeyboard.getMeasuredWidth();
        //adding the width of the key - now the right most popup key is above the finger
        adjustedX += popupKey.width;
        adjustedX += mMiniKeyboard.getPaddingRight();
        shouldMirrorKeys = true;
    }
    //2) if it is still negative, then let's put it at the beginning (shouldn't happen)
    if (adjustedX < 0) {
        adjustedX = 0;
        shouldMirrorKeys = false;
    }
    if (shouldMirrorKeys)
        popupKeyboard.mirrorKeys();

    mMiniKeyboardOriginX = adjustedX + mMiniKeyboard.getPaddingLeft() - mWindowOffset[0];
    mMiniKeyboardOriginY = y + mMiniKeyboard.getPaddingTop() - mWindowOffset[1];

    //I'm not sure I need to do this, but in any case - this is to sync the popup window
    //to align to the mini-keyboard position
    mMiniKeyboard.setPopupOffset(adjustedX, y);
    // NOTE:I'm checking the main keyboard shift state directly!
    // Not anything else.
    mMiniKeyboard.setShifted(mKeyboard != null && mKeyboard.isShifted());
    // Mini keyboard needs no pop-up key preview displayed.
    mMiniKeyboard.setPreviewEnabled(false);
    // animation switching required?
    mMiniKeyboardPopup.setContentView(mMiniKeyboard);
    mMiniKeyboardPopup.setWidth(mMiniKeyboard.getMeasuredWidth());
    mMiniKeyboardPopup.setHeight(mMiniKeyboard.getMeasuredHeight());
    mMiniKeyboardPopup.showAtLocation(this, Gravity.NO_GRAVITY, adjustedX, y);

    if (requireSlideInto) {
        // Inject down event on the key to mini keyboard.
        long eventTime = SystemClock.uptimeMillis();
        mMiniKeyboardPopupTime = eventTime;
        MotionEvent downEvent = generateMiniKeyboardMotionEvent(MotionEvent.ACTION_DOWN,
                popupKey.x + popupKey.width / 2, popupKey.y + popupKey.height / 2, eventTime);
        mMiniKeyboard.onTouchEvent(downEvent);
        downEvent.recycle();
    }

    invalidateAllKeys();
    return true;
}