Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logcat errors on cell selection in CalendarPickerView inside AlertDialog #103

Open
nathanielwolf opened this issue Jan 22, 2014 · 5 comments
Labels

Comments

@nathanielwolf
Copy link

The AlertDialog is created with:

    calendarPickerView = new CalendarPickerView(context,null);

    calendarPickerView.init(new Date(System.currentTimeMillis()),
        new Date(System.currentTimeMillis() + DateUtils.YEAR_IN_MILLIS))
        .inMode(CalendarPickerView.SelectionMode.RANGE);

    builder.setView(calendarPickerView);
    builder.show();

Note: Inflating xml containing a CalendarPickerView results in the same situation):

The logcat shows the following whenever a cell is selected/deselected:

01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420dcd88 V..D..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42123f30 V..D..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421aa1d8 V..D..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4212b930 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421b0220 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42268df8 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42278438 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42124d50 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42262e40 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42193c78 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.912  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4219bf30 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421abc28 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421e80d0 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4225b298 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420e1dc0 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420c6548 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42100110 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42191080 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420e17a8 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420fc390 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42104828 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42165540 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421f0250 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4226be78 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421eec68 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420fa2d8 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421ad2a0 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42273e90 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420fd908 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42104428 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421a3d38 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421a4b28 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420ff978 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421636b0 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42191c50 V..D..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4230e778 V..D..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42310010 V..D..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42310868 V..D..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{423110c0 V..D..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42311918 V..D..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42312170 V..D..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{423129c8 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42313ac0 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42315358 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42315bb0 V.ED..C. ..S...ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42316408 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42316c60 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{423174b8 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42317d10 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42318e08 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.922  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231a6a0 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231aef8 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231b750 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231bfa8 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231c800 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231d058 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231e150 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4231f9e8 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42320240 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42320a98 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{423212f0 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42321b48 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{423223a0 V.ED..C. ......ID 570,0-665,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{42323498 V.ED..C. ......ID 0,0-95,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421089e8 V.ED..C. ......ID 95,0-190,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421aab28 V.ED..C. ......ID 190,0-285,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{420c6970 V.ED..C. ......ID 285,0-380,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421abfa8 V.ED..C. ......ID 380,0-475,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{4219ddd8 V.ED..C. ......ID 475,0-570,95} during layout: running second layout pass
01-22 14:38:46.932  25390-25390/com.test.mobile.debug W/View﹕ requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{421a4358 V..D..C. ......ID 570,0-665,95} during layout: running second layout pass
@rspenc29
Copy link

This links to #107 and #107 links back to here. Both are closed with no resolution. Any update on this?

@edenman
Copy link
Collaborator

edenman commented Mar 24, 2014

No update, haven't had a chance to look at it. PRs welcome!

@JakeWharton
Copy link
Collaborator

Both are closed with no resolution.

This issue is open.

@miraclebg
Copy link

I've been digging this issue because performance of the calendar when the layout is being refreshed several times is horrible...

This has to do (at least that is what i've found) with setText() of the text view used as the cell. Once you remove it - all problems are gone!

So - instead of using the textview's text property i am simply drawing it myself - and this solved it all!

Can't commit the changes right now as my code is highly customized but it comes down to modifying this in CalendarCellView:

  • Define vars:

    private String mCellText;
    private int mCellTextXPadding = 0;
    private int mCellTextYPadding = 5;

  • Create a base paint for the text:

public CalendarCellView(Context context, AttributeSet attrs) {
super(context, attrs);

    this.context = context;

    mTextPaint = new Paint();
    mTextPaint.setTextAlign(Align.CENTER);
    mTextPaint.setTextScaleX(this.getTextScaleX());
}
  • Copy props from the text view itself upon inflating:

protected void onFinishInflate() {
super.onFinishInflate();

    mTextPaint.setColor(getTextColors().getDefaultColor());
    mTextPaint.setTextSize(getTextSize());
    mTextPaint.setTypeface(getTypeface());
}
  • Create a setter to set the text:

public void setCellText(String text) {
if (mCellText != text) {
mCellText = text;
invalidate();
}
}

  • In OnDraw of the cell draw the text:

// draw the text
canvas.drawText((mCellText == null ? "" : mCellText),
(this.getWidth() / 2) + mCellTextXPadding,
(this.getHeight() / 2) + mCellTextYPadding, mTextPaint);

That's pretty much it.

Sorry for the unformatted text - i am not using gitHub that much :-)

Hope it helps out!

@RushiMThakker
Copy link

This is again a cyclic reference. Please provide a proper solution. My code is at production level. @JakeWharton @edenman Please look at this. How to reopen this cyclic referenced issues. This is a lot of pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants