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

Add isInEditMode checks for preview rendering. #176

Open
cs-victor-nascimento opened this issue Jan 28, 2015 · 11 comments
Open

Add isInEditMode checks for preview rendering. #176

cs-victor-nascimento opened this issue Jan 28, 2015 · 11 comments

Comments

@cs-victor-nascimento
Copy link

Hey people!

I am trying to use TimesSquare but am getting a NullPointerException in a simple preview from Android Studio like:

npe_timessquare
Looking through the code it seems a bit strange that it should be working...

This code seems like will always throw a null pointer exception but I may be mistaken...

The layout file I am trying to preview is:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.squareup.timessquare.CalendarPickerView
        android:id="@+id/calendar_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

When I run it the app crashes just the same.

Am I missing something? Thanks in advance

@edenman
Copy link
Collaborator

edenman commented Jan 28, 2015

Are you initializing the calendar? See the README for an example of calling init

@edenman edenman closed this as completed Jan 28, 2015
@cs-victor-nascimento
Copy link
Author

Yeah... I missed it... Sorry for the inconvenience!
But that means it won't be able to preview in Studio right?

@JakeWharton
Copy link
Member

We can add some isInEdit checks for reasonable preview rendering.
On Jan 28, 2015 10:30 AM, "Victor Oliveira Nascimento" <
notifications@github.com> wrote:

Yeah... I missed it... Sorry for the inconvenience!
But that means it won't be able to preview in Studio right?


Reply to this email directly or view it on GitHub
#176 (comment)
.

@cs-victor-nascimento
Copy link
Author

That would help 👍

@JakeWharton JakeWharton changed the title NullPointerException in MonthView Add isInEditMode checks for preview rendering. Jan 28, 2015
@JakeWharton JakeWharton reopened this Jan 28, 2015
@JakeWharton
Copy link
Member

Re-purposed the issue for that task.

@glebsts
Copy link

glebsts commented Aug 30, 2015

Hi :) So, any progress with that? I have problems with previewing layout in AS (did not check eclipse), if there is CalendarPickerView dropped onto layout.

@glebsts
Copy link

glebsts commented Nov 16, 2015

Hello again. Few months ago I just threw away this component. Now took that again, and still problems with rendering. AS, API17 rendered, gradle imported 1.6.4 version.
java.lang.IllegalArgumentException: Illegal pattern character 'L'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:845)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:659)
at java.text.SimpleDateFormat.(SimpleDateFormat.java:585)
at com.squareup.timessquare.CalendarPickerView.(CalendarPickerView.java:140)
......

Found that in google: https://code.google.com/p/android/issues/detail?id=75940

So how are you guys using this component?

@edenman
Copy link
Collaborator

edenman commented Nov 16, 2015

@glebsts you're just talking about issues with previewing a CalendarPickerView in Android Studio, right?

@glebsts
Copy link

glebsts commented Nov 16, 2015

I am just trying to figure out if something was fixed or is going to be fixed :) Yes, issue with preview in AS.

@edenman
Copy link
Collaborator

edenman commented Nov 16, 2015

No changes have been made on this issue. PRs welcome if you really need AS preview (most of us at Square don't use it).

@glebsts
Copy link

glebsts commented Nov 16, 2015

Well, I thought idea is to provide a component that works in any conditions :) You could at least make a note in readme if you put it into public.... or at least make some statements here in github discussions :) Your component is considered the best across the internets, I was hoping you might be interested in keeping perfect reputation :)
So far I work-arounded that by hiding component and setting visibility in run-time, but you know, sometimes it is nice to see how your layout will look like :D
Thank you for your answer anyway!
Are you using Eclipse?

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

No branches or pull requests

4 participants