Example usage for android.widget SimpleMonthView getCellWidth

List of usage examples for android.widget SimpleMonthView getCellWidth

Introduction

In this page you can find the example usage for android.widget SimpleMonthView getCellWidth.

Prototype

public int getCellWidth() 

Source Link

Usage

From source file:connect.app.com.connect.calendar.DayPickerView.java

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final ImageButton leftButton;
    final ImageButton rightButton;
    //        if (isLayoutRtl()) {
    //            leftButton = mNextButton;
    //            rightButton = mPrevButton;
    //        } else {
    //            leftButton = mPrevButton;
    //            rightButton = mNextButton;
    //        }/*  w w  w. j a  va2s. c o m*/
    leftButton = mPrevButton;
    rightButton = mNextButton;
    final int width = right - left;
    final int height = bottom - top;
    mViewPager.layout(0, 0, width, height);

    final SimpleMonthView monthView = (SimpleMonthView) mViewPager.getChildAt(0);
    final int monthHeight = monthView.getMonthHeight();
    final int cellWidth = monthView.getCellWidth();

    // Vertically center the previous/next buttons within the month
    // header, horizontally center within the day cell.
    final int leftDW = leftButton.getMeasuredWidth();
    final int leftDH = leftButton.getMeasuredHeight();
    final int leftIconTop = monthView.getPaddingTop() + (monthHeight - leftDH) / 2;
    final int leftIconLeft = monthView.getPaddingLeft() + (cellWidth - leftDW) / 2;
    leftButton.layout(leftIconLeft, leftIconTop, leftIconLeft + leftDW, leftIconTop + leftDH);

    final int rightDW = rightButton.getMeasuredWidth();
    final int rightDH = rightButton.getMeasuredHeight();
    final int rightIconTop = monthView.getPaddingTop() + (monthHeight - rightDH) / 2;
    final int rightIconRight = width - monthView.getPaddingRight() - (cellWidth - rightDW) / 2;
    rightButton.layout(rightIconRight - rightDW, rightIconTop, rightIconRight, rightIconTop + rightDH);
}

From source file:com.tr4android.support.extension.picker.date.DayPickerView.java

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final ImageButton leftButton;
    final ImageButton rightButton;
    if (ViewCompatUtils.isLayoutRtl(this)) {
        leftButton = mNextButton;/*from   w w  w .ja v  a 2 s. c  o m*/
        rightButton = mPrevButton;
    } else {
        leftButton = mPrevButton;
        rightButton = mNextButton;
    }
    PickerThemeUtils.setNavButtonDrawable(getContext(), leftButton, rightButton,
            mAdapter.getMonthTextAppearance());

    final int width = right - left;
    final int height = bottom - top;
    mViewPager.layout(0, 0, width, height);

    final SimpleMonthView monthView = (SimpleMonthView) mViewPager.getChildAt(0);
    final int monthHeight = monthView.getMonthHeight();
    final int cellWidth = monthView.getCellWidth();

    // Vertically center the previous/next buttons within the month
    // header, horizontally center within the day cell.
    final int leftDW = leftButton.getMeasuredWidth();
    final int leftDH = leftButton.getMeasuredHeight();
    final int leftIconTop = monthView.getPaddingTop() + (monthHeight - leftDH) / 2;
    final int leftIconLeft = monthView.getPaddingLeft() + (cellWidth - leftDW) / 2;
    leftButton.layout(leftIconLeft, leftIconTop, leftIconLeft + leftDW, leftIconTop + leftDH);

    final int rightDW = rightButton.getMeasuredWidth();
    final int rightDH = rightButton.getMeasuredHeight();
    final int rightIconTop = monthView.getPaddingTop() + (monthHeight - rightDH) / 2;
    final int rightIconRight = width - monthView.getPaddingRight() - (cellWidth - rightDW) / 2;
    rightButton.layout(rightIconRight - rightDW, rightIconTop, rightIconRight, rightIconTop + rightDH);
}

From source file:com.appeaser.sublimepickerlibrary.datepicker.DayPickerView.java

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final ImageButton leftButton;
    final ImageButton rightButton;
    if (SUtils.isLayoutRtlCompat(this)) {
        leftButton = mNextButton;//w  ww.  ja v  a 2 s. c om
        rightButton = mPrevButton;
    } else {
        leftButton = mPrevButton;
        rightButton = mNextButton;
    }

    final int width = right - left;
    final int height = bottom - top;
    mViewPager.layout(0, 0, width, height);

    final SimpleMonthView monthView = (SimpleMonthView) mViewPager.getChildAt(0).findViewById(R.id.month_view);
    final int monthHeight = monthView.getMonthHeight();
    final int cellWidth = monthView.getCellWidth();

    // Vertically center the previous/next buttons within the month
    // header, horizontally center within the day cell.
    final int leftDW = leftButton.getMeasuredWidth();
    final int leftDH = leftButton.getMeasuredHeight();
    final int leftIconTop = monthView.getPaddingTop() + (monthHeight - leftDH) / 2;
    final int leftIconLeft = monthView.getPaddingLeft() + (cellWidth - leftDW) / 2;
    leftButton.layout(leftIconLeft, leftIconTop, leftIconLeft + leftDW, leftIconTop + leftDH);

    final int rightDW = rightButton.getMeasuredWidth();
    final int rightDH = rightButton.getMeasuredHeight();
    final int rightIconTop = monthView.getPaddingTop() + (monthHeight - rightDH) / 2;
    final int rightIconRight = width - monthView.getPaddingRight() - (cellWidth - rightDW) / 2;
    rightButton.layout(rightIconRight - rightDW, rightIconTop, rightIconRight, rightIconTop + rightDH);
}

From source file:com.miuhouse.yourcompany.student.view.widget.date.datepicker.DayPickerView.java

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final TextView leftButton;
    final TextView rightButton;
    if (SUtils.isLayoutRtlCompat(this)) {
        leftButton = mNextButton;//from   w  w w.ja va 2 s  . c  om
        rightButton = mPrevButton;
    } else {
        leftButton = mPrevButton;
        rightButton = mNextButton;
    }

    final int width = right - left;
    final int height = bottom - top;
    mViewPager.layout(0, 0, width, height);

    final SimpleMonthView monthView = (SimpleMonthView) mViewPager.getChildAt(0).findViewById(R.id.month_view);
    final int monthHeight = monthView.getMonthHeight();
    //        final int monthHeight = 0;
    final int cellWidth = monthView.getCellWidth();

    // Vertically center the previous/next buttons within the month
    // header, horizontally center within the day cell.
    final int leftDW = leftButton.getMeasuredWidth();
    final int leftDH = leftButton.getMeasuredHeight();
    final int leftIconTop = monthView.getPaddingTop() + (monthHeight - leftDH) / 2;
    final int leftIconLeft = monthView.getPaddingLeft() + (cellWidth - leftDW) / 2;
    leftButton.layout(leftIconLeft, leftIconTop, leftIconLeft + leftDW, leftIconTop + leftDH);

    final int rightDW = rightButton.getMeasuredWidth();
    final int tvResetDW = tvReset.getMeasuredWidth();
    final int rightDH = rightButton.getMeasuredHeight();
    final int tvResetDH = tvReset.getMeasuredHeight();
    final int rightIconTop = monthView.getPaddingTop() + (monthHeight - rightDH) / 2;
    final int tvResetIconTop = monthView.getPaddingTop() + (monthHeight - tvResetDH) / 2;
    final int rightIconRight1 = width - monthView.getPaddingRight() - (cellWidth - rightDW) / 2 - 60;
    final int rightIconRight = leftIconLeft + 180;

    rightButton.layout(rightIconRight, rightIconTop, rightIconRight + rightDW, rightIconTop + rightDH);

    tvReset.layout(rightIconRight1 - tvResetDW, tvResetIconTop, rightIconRight1, tvResetIconTop + tvResetDH);
}