Example usage for android.view Gravity BOTTOM

List of usage examples for android.view Gravity BOTTOM

Introduction

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

Prototype

int BOTTOM

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

Click Source Link

Document

Push object to the bottom of its container, not changing its size.

Usage

From source file:info.hl.mediam.CreateGroupActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case GET_IMAGE_DIALOG:
        mGetImageDialog = new Dialog(CreateGroupActivity.this, R.style.TransparentDialogTheme);
        mGetImageDialog.getWindow().setGravity(Gravity.BOTTOM);
        mGetImageDialog.setContentView(R.layout.dialog_get_image);

        // Grab the window of the dialog, and change the width
        WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
        Window window = mGetImageDialog.getWindow();
        lp.copyFrom(window.getAttributes());
        // This makes the dialog take up the full width
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);/*  w w  w. j av a  2 s .c o m*/

        final Button btnGallery = (Button) mGetImageDialog.findViewById(R.id.btnGallery);
        btnGallery.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnGallery.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent galleryIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class);
                galleryIntent.putExtra("type", "gallery");
                galleryIntent.putExtra("createGroup", true);
                CreateGroupActivity.this.startActivity(galleryIntent);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnCamera = (Button) mGetImageDialog.findViewById(R.id.btnCamera);
        btnCamera.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnCamera.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent cameraIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class);
                cameraIntent.putExtra("type", "camera");
                cameraIntent.putExtra("createGroup", true);
                CreateGroupActivity.this.startActivity(cameraIntent);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnRemovePhoto = (Button) mGetImageDialog.findViewById(R.id.btnRemovePhoto);
        btnRemovePhoto.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnRemovePhoto.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                mGroupAvatarId = "";
                gGroupImage = null;
                Utils.displayImage(mGroupAvatarId, mIvGroupImage, ImageLoader.LARGE,
                        R.drawable.group_stub_large, false);
                mGetImageDialog.dismiss();

            }
        });

        return mGetImageDialog;
    default:
        return null;
    }
}

From source file:com.actionbarsherlock.custom.widget.VerticalDrawerLayout.java

/**
 * Enable or disable interaction with the given drawer.
 *
 * <p>This allows the application to restrict the user's ability to open or close
 * the given drawer. VerticalDrawerLayout will still respond to calls to {@link #openDrawer(int)},
 * {@link #closeDrawer(int)} and friends if a drawer is locked.</p>
 *
 * <p>Locking a drawer open or closed will implicitly open or close
 * that drawer as appropriate.</p>
 *
 * @param lockMode The new lock mode for the given drawer. One of {@link #LOCK_MODE_UNLOCKED},
 *                 {@link #LOCK_MODE_LOCKED_CLOSED} or {@link #LOCK_MODE_LOCKED_OPEN}.
 * @param edgeGravity Gravity.TOP, BOTTOM, START or END.
 *                    Expresses which drawer to change the mode for.
 *
 * @see #LOCK_MODE_UNLOCKED/*from  www . jav a2  s .c om*/
 * @see #LOCK_MODE_LOCKED_CLOSED
 * @see #LOCK_MODE_LOCKED_OPEN
 */
public void setDrawerLockMode(int lockMode, int edgeGravity) {
    final int absGrav = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this));
    if (absGrav == Gravity.TOP) {
        mLockModeTop = lockMode;
    } else if (absGrav == Gravity.BOTTOM) {
        mLockModeBottom = lockMode;
    }
    if (lockMode != LOCK_MODE_UNLOCKED) {
        // Cancel interaction in progress
        final ViewDragHelper helper = absGrav == Gravity.TOP ? mTopDragger : mBottomDragger;
        helper.cancel();
    }
    switch (lockMode) {
    case LOCK_MODE_LOCKED_OPEN:
        final View toOpen = findDrawerWithGravity(absGrav);
        if (toOpen != null) {
            openDrawer(toOpen);
        }
        break;
    case LOCK_MODE_LOCKED_CLOSED:
        final View toClose = findDrawerWithGravity(absGrav);
        if (toClose != null) {
            closeDrawer(toClose);
        }
        break;
    // default: do nothing
    }
}

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

private void calculateBaseOffsets() {
    final float currentTextSize = mCurrentTextSize;

    // We then calculate the collapsed text size, using the same logic
    calculateUsingTextSize(mCollapsedTextSize);
    float width = mTextToDraw != null ? mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()) : 0;
    final int collapsedAbsGravity = GravityCompat.getAbsoluteGravity(mCollapsedTextGravity,
            mIsRtl ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR);
    switch (collapsedAbsGravity & Gravity.VERTICAL_GRAVITY_MASK) {
    case Gravity.BOTTOM:
        mCollapsedDrawY = mCollapsedBounds.bottom;
        break;/*from w ww  . j  a  v  a 2 s  .  c om*/
    case Gravity.TOP:
        mCollapsedDrawY = mCollapsedBounds.top - mTextPaint.ascent();
        break;
    case Gravity.CENTER_VERTICAL:
    default:
        float textHeight = mTextPaint.descent() - mTextPaint.ascent();
        float textOffset = (textHeight / 2) - mTextPaint.descent();
        mCollapsedDrawY = mCollapsedBounds.centerY() + textOffset;
        break;
    }
    switch (collapsedAbsGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
    case Gravity.CENTER_HORIZONTAL:
        mCollapsedDrawX = mCollapsedBounds.centerX() - (width / 2);
        break;
    case Gravity.RIGHT:
        mCollapsedDrawX = mCollapsedBounds.right - width;
        break;
    case Gravity.LEFT:
    default:
        mCollapsedDrawX = mCollapsedBounds.left;
        break;
    }

    calculateUsingTextSize(mExpandedTextSize);
    width = mTextToDraw != null ? mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()) : 0;
    final int expandedAbsGravity = GravityCompat.getAbsoluteGravity(mExpandedTextGravity,
            mIsRtl ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR);
    switch (expandedAbsGravity & Gravity.VERTICAL_GRAVITY_MASK) {
    case Gravity.BOTTOM:
        mExpandedDrawY = mExpandedBounds.bottom;
        break;
    case Gravity.TOP:
        mExpandedDrawY = mExpandedBounds.top - mTextPaint.ascent();
        break;
    case Gravity.CENTER_VERTICAL:
    default:
        float textHeight = mTextPaint.descent() - mTextPaint.ascent();
        float textOffset = (textHeight / 2) - mTextPaint.descent();
        mExpandedDrawY = mExpandedBounds.centerY() + textOffset;
        break;
    }
    switch (expandedAbsGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
    case Gravity.CENTER_HORIZONTAL:
        mExpandedDrawX = mExpandedBounds.centerX() - (width / 2);
        break;
    case Gravity.RIGHT:
        mExpandedDrawX = mExpandedBounds.right - width;
        break;
    case Gravity.LEFT:
    default:
        mExpandedDrawX = mExpandedBounds.left;
        break;
    }

    // The bounds have changed so we need to clear the texture
    clearTexture();
    // Now reset the text size back to the original
    setInterpolatedTextSize(currentTextSize);
}

From source file:com.lambdasoup.quickfit.ui.WorkoutListActivity.java

private void showSchedulesPane(long workoutId) {
    if (!isTwoPane) {
        Timber.wtf("showSchedulesPane called despite not in two-pane layout mode");
        return;//from  w  w w  .jav a2  s . c o m
    }

    CoordinatorLayout.LayoutParams fabLayoutParams = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
    fabLayoutParams.setAnchorId(R.id.list_pane);
    fabLayoutParams.anchorGravity = Gravity.BOTTOM | Gravity.END;
    fabLayoutParams.gravity = Gravity.CENTER_HORIZONTAL;
    fab.setLayoutParams(fabLayoutParams);

    fab.setOnClickListener(view -> showMiniFabs());

    masterDetailView.requestShowDetail();

    SchedulesFragment newFragment = SchedulesFragment.create(workoutId);
    getSupportFragmentManager().beginTransaction().add(R.id.schedules_container, newFragment).commit();
}

From source file:com.aries.ui.view.title.util.CollapsingTextHelper.java

private void calculateBaseOffsets() {
    final float currentTextSize = mCurrentTextSize;

    // We then calculate the collapsed text size, using the same logic
    calculateUsingTextSize(mCollapsedTextSize);
    float width = mTextToDraw != null ? mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()) : 0;
    final int collapsedAbsGravity = GravityCompat.getAbsoluteGravity(mCollapsedTextGravity,
            mIsRtl ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR);
    switch (collapsedAbsGravity & Gravity.VERTICAL_GRAVITY_MASK) {
    case Gravity.BOTTOM:
        mCollapsedDrawY = mCollapsedBounds.bottom - mTextPaint.descent();
        break;// w w w .j av a2s .c o  m
    case Gravity.TOP:
        mCollapsedDrawY = mCollapsedBounds.top - mTextPaint.ascent();
        break;
    case Gravity.CENTER_VERTICAL:
    default:
        float textHeight = mTextPaint.descent() - mTextPaint.ascent();
        float textOffset = (textHeight / 2) - mTextPaint.descent();
        mCollapsedDrawY = mCollapsedBounds.centerY() + textOffset;
        break;
    }
    switch (collapsedAbsGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
    case Gravity.CENTER_HORIZONTAL:
        mCollapsedDrawX = mCollapsedBounds.centerX() - (width / 2);
        break;
    case Gravity.RIGHT:
        mCollapsedDrawX = mCollapsedBounds.right - width;
        break;
    case Gravity.LEFT:
    default:
        mCollapsedDrawX = mCollapsedBounds.left;
        break;
    }

    calculateUsingTextSize(mExpandedTextSize);
    width = mTextToDraw != null ? mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()) : 0;
    final int expandedAbsGravity = GravityCompat.getAbsoluteGravity(mExpandedTextGravity,
            mIsRtl ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR);
    switch (expandedAbsGravity & Gravity.VERTICAL_GRAVITY_MASK) {
    case Gravity.BOTTOM:
        mExpandedDrawY = mExpandedBounds.bottom - mTextPaint.descent();
        break;
    case Gravity.TOP:
        mExpandedDrawY = mExpandedBounds.top - mTextPaint.ascent();
        break;
    case Gravity.CENTER_VERTICAL:
    default:
        float textHeight = mTextPaint.descent() - mTextPaint.ascent();
        float textOffset = (textHeight / 2) - mTextPaint.descent();
        mExpandedDrawY = mExpandedBounds.centerY() + textOffset;
        break;
    }
    switch (expandedAbsGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
    case Gravity.CENTER_HORIZONTAL:
        mExpandedDrawX = mExpandedBounds.centerX() - (width / 2);
        break;
    case Gravity.RIGHT:
        mExpandedDrawX = mExpandedBounds.right - width;
        break;
    case Gravity.LEFT:
    default:
        mExpandedDrawX = mExpandedBounds.left;
        break;
    }

    // The bounds have changed so we need to clear the texture
    clearTexture();
    // Now reset the text size back to the original
    setInterpolatedTextSize(currentTextSize);
}

From source file:com.boha.malengagolf.library.util.PagerTitleStrip22.java

void updateTextPositions(int position, float positionOffset, boolean force) {
    if (position != mLastKnownCurrentPage) {
        updateText(position, mPager.getAdapter());
    } else if (!force && positionOffset == mLastKnownPositionOffset) {
        return;/*from w ww . j a v  a 2s . c  o m*/
    }

    mUpdatingPositions = true;

    final int prevWidth = mPrevText.getMeasuredWidth();
    final int currWidth = mCurrText.getMeasuredWidth();
    final int nextWidth = mNextText.getMeasuredWidth();
    final int halfCurrWidth = currWidth / 2;

    final int stripWidth = getWidth();
    final int stripHeight = getHeight();
    final int paddingLeft = getPaddingLeft();
    final int paddingRight = getPaddingRight();
    final int paddingTop = getPaddingTop();
    final int paddingBottom = getPaddingBottom();
    final int textPaddedLeft = paddingLeft + halfCurrWidth;
    final int textPaddedRight = paddingRight + halfCurrWidth;
    final int contentWidth = stripWidth - textPaddedLeft - textPaddedRight;

    float currOffset = positionOffset + 0.5f;
    if (currOffset > 1.f) {
        currOffset -= 1.f;
    }
    final int currCenter = stripWidth - textPaddedRight - (int) (contentWidth * currOffset);
    final int currLeft = currCenter - currWidth / 2;
    final int currRight = currLeft + currWidth;

    final int prevBaseline = mPrevText.getBaseline();
    final int currBaseline = mCurrText.getBaseline();
    final int nextBaseline = mNextText.getBaseline();
    final int maxBaseline = Math.max(Math.max(prevBaseline, currBaseline), nextBaseline);
    final int prevTopOffset = maxBaseline - prevBaseline;
    final int currTopOffset = maxBaseline - currBaseline;
    final int nextTopOffset = maxBaseline - nextBaseline;
    final int alignedPrevHeight = prevTopOffset + mPrevText.getMeasuredHeight();
    final int alignedCurrHeight = currTopOffset + mCurrText.getMeasuredHeight();
    final int alignedNextHeight = nextTopOffset + mNextText.getMeasuredHeight();
    final int maxTextHeight = Math.max(Math.max(alignedPrevHeight, alignedCurrHeight), alignedNextHeight);

    final int vgrav = mGravity & Gravity.VERTICAL_GRAVITY_MASK;

    int prevTop;
    int currTop;
    int nextTop;
    switch (vgrav) {
    default:
    case Gravity.TOP:
        prevTop = paddingTop + prevTopOffset;
        currTop = paddingTop + currTopOffset;
        nextTop = paddingTop + nextTopOffset;
        break;
    case Gravity.CENTER_VERTICAL:
        final int paddedHeight = stripHeight - paddingTop - paddingBottom;
        final int centeredTop = (paddedHeight - maxTextHeight) / 2;
        prevTop = centeredTop + prevTopOffset;
        currTop = centeredTop + currTopOffset;
        nextTop = centeredTop + nextTopOffset;
        break;
    case Gravity.BOTTOM:
        final int bottomGravTop = stripHeight - paddingBottom - maxTextHeight;
        prevTop = bottomGravTop + prevTopOffset;
        currTop = bottomGravTop + currTopOffset;
        nextTop = bottomGravTop + nextTopOffset;
        break;
    }

    mCurrText.layout(currLeft, currTop, currRight, currTop + mCurrText.getMeasuredHeight());

    final int prevLeft = Math.min(paddingLeft, currLeft - mScaledTextSpacing - prevWidth);
    mPrevText.layout(prevLeft, prevTop, prevLeft + prevWidth, prevTop + mPrevText.getMeasuredHeight());

    final int nextLeft = Math.max(stripWidth - paddingRight - nextWidth, currRight + mScaledTextSpacing);
    mNextText.layout(nextLeft, nextTop, nextLeft + nextWidth, nextTop + mNextText.getMeasuredHeight());

    mLastKnownPositionOffset = positionOffset;
    mUpdatingPositions = false;
}

From source file:android.support.wear.widget.drawer.WearableDrawerLayout.java

/**
 * Closes drawer after {@code delayMs} milliseconds.
 *///from   w  w  w. j  a  v  a  2  s  . com
private void closeDrawerDelayed(final int gravity, long delayMs) {
    switch (gravity) {
    case Gravity.TOP:
        mMainThreadHandler.removeCallbacks(mCloseTopPeekRunnable);
        mMainThreadHandler.postDelayed(mCloseTopPeekRunnable, delayMs);
        break;
    case Gravity.BOTTOM:
        mMainThreadHandler.removeCallbacks(mCloseBottomPeekRunnable);
        mMainThreadHandler.postDelayed(mCloseBottomPeekRunnable, delayMs);
        break;
    default:
        Log.w(TAG, "Invoked a delayed drawer close with an invalid gravity: " + gravity);
    }
}

From source file:com.sonvp.tooltip.Tooltip.java

@Override
public boolean onPreDraw() {
    container.getViewTreeObserver().removeOnPreDrawListener(this);

    Context context = container.getContext();
    if (!(context instanceof Activity)) {
        return false;
    }//from w  w  w . ja  v a 2s. c o m
    DisplayMetrics displayMetrics = new DisplayMetrics();
    ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    int displayWidth = displayMetrics.widthPixels;
    int displayHeight = displayMetrics.heightPixels;
    int displayTop = getStatusBarHeight();

    int anchorTop = rectAnchorView.top;
    int anchorLeft = rectAnchorView.left;
    int anchorWidth = anchorView.getWidth();
    int anchorHeight = anchorView.getHeight();

    int textWidth = viewTooltip.getWidth();
    //default height 1 line
    int textHeight = viewTooltip.getHeight();
    int arrowWidth = arrow.getWidth();
    int arrowHeight = arrow.getHeight();

    int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(displayWidth, View.MeasureSpec.AT_MOST);
    int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);

    if (gravity == Gravity.TOP || gravity == Gravity.BOTTOM) {
        int width = Math.max(textWidth, arrowWidth);
        int height = textHeight + arrowHeight;

        int leftPadding;
        int topPadding;

        if (gravity == Gravity.TOP) {
            topPadding = anchorTop - height;
        } else {
            // gravity == Gravity.BOTTOM
            topPadding = anchorTop + anchorHeight;
        }

        int anchorHorizontalCenter = anchorLeft + anchorWidth / 2;
        int left = anchorHorizontalCenter - width / 2;
        int right = left + width;
        leftPadding = Math.max(0, right > displayWidth ? displayWidth - width : left);

        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) arrow.getLayoutParams();
        layoutParams.leftMargin = anchorHorizontalCenter - leftPadding - arrowWidth / 2;
        arrow.setLayoutParams(layoutParams);
        popupWindow.update(leftPadding, topPadding, container.getWidth(), container.getHeight());

        pivotX = width / 2;
        pivotY = gravity == Gravity.TOP ? height : 0;
    } else {
        // gravity == Gravity.LEFT || gravity == Gravity.RIGHT

        int width = textWidth + arrowWidth;

        int leftPadding;
        int topPadding;
        int rightPadding = 0;

        if (gravity == Gravity.LEFT) {
            leftPadding = Math.max(0, anchorLeft - width);
            leftPadding += (int) builder.toolTipMargin;
            rightPadding = displayWidth - anchorLeft;
        } else {
            // gravity == Gravity.RIGHT
            leftPadding = anchorLeft + anchorWidth;
            rightPadding = (int) builder.toolTipMargin;
        }

        if (viewTooltip instanceof TextView) {
            TextView text = (TextView) viewTooltip;
            text.setMaxWidth(displayWidth - rightPadding - leftPadding - arrowWidth);
            viewTooltip.measure(widthMeasureSpec, heightMeasureSpec);
            textHeight = viewTooltip.getMeasuredHeight(); // height multi line
        }

        int height = Math.max(textHeight, arrowHeight);

        int anchorVerticalCenter = anchorTop + anchorHeight / 2;
        int top = anchorVerticalCenter - height / 2;
        int bottom = top + height;

        if (builder.arrowGravity == Gravity.TOP) {
            top = anchorTop;
            bottom = anchorTop + height;
        } else if (builder.arrowGravity == Gravity.BOTTOM) {
            top = anchorTop + anchorHeight - height;
        }

        topPadding = Math.max(0,
                bottom > displayHeight ? displayHeight - height - (int) builder.toolTipMargin : top);
        topPadding = Math.max(0,
                topPadding < displayTop ? displayTop + (int) builder.toolTipMargin : topPadding);

        container.measure(widthMeasureSpec, heightMeasureSpec);
        int popupWidth = container.getMeasuredWidth();
        int popupHeight = container.getMeasuredHeight();
        popupWindow.update(leftPadding, topPadding, popupWidth, popupHeight);

        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) arrow.getLayoutParams();
        layoutParams.topMargin = anchorVerticalCenter - topPadding - arrowHeight / 2;
        arrow.setLayoutParams(layoutParams);

        pivotX = gravity == Gravity.LEFT ? popupWidth : 0;
        pivotY = anchorVerticalCenter - topPadding;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        container.setAlpha(0.0F);
        container.setPivotX(pivotX);
        container.setPivotY(pivotY);
        container.setScaleX(0.0F);
        container.setScaleY(0.0F);
        container.animate().setDuration(ANIMATION_DURATION).scaleX(1.0F).scaleY(1.0F).alpha(1.0F);
    } else {
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(ANIMATION_DURATION);
        animationSet.addAnimation(new AlphaAnimation(0.0F, 1.0F));
        animationSet.addAnimation(new ScaleAnimation(0.0F, 1.0F, 0.0F, 1.0F, pivotX, pivotY));
        container.startAnimation(animationSet);
    }

    return false;
}

From source file:com.aidy.bottomdrawerlayout.BottomDrawerLayout.java

/**
 * Check the lock mode of the drawer with the given gravity.
 * //from   ww w.j ava  2 s.co  m
 * @param edgeGravity
 *            Gravity of the drawer to check
 * @return one of {@link #LOCK_MODE_UNLOCKED},
 *         {@link #LOCK_MODE_LOCKED_CLOSED} or
 *         {@link #LOCK_MODE_LOCKED_OPEN}.
 */
public int getDrawerLockMode(int edgeGravity) {
    final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this));
    if (absGravity == Gravity.BOTTOM) {
        return mLockModeBottom;
    }
    return LOCK_MODE_UNLOCKED;
}

From source file:com.hxqc.mall.drivingexam.ui.doexam.ExamActivity.java

@Override
public void onClick(View v) {
    int id = v.getId();
    //tab/* w w w  .j a v  a 2 s.c  o m*/
    if (id == R.id.tab) {
        examPopuwin = new SubjectAmountPopuwin(ExamActivity.this,
                DbHelper.query(ExamRecord.class, ExamRecord_Table.num, true), mNowPage, max, rightCount,
                wrongCount, examMode, myWrongMode);
        examPopuwin.showAtLocation(mToolBar, Gravity.BOTTOM, 0, 0);
    }
    //??
    else if (id == R.id.submit_exam) {
        if (mSubmitTv.getText().toString().equals("?"))
            submitExamDialog();
        else if (mSubmitTv.getText().toString().equals("")) {
            deleteWrongSub();
        }
    }
}