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

Support Enums #12

Closed
Jawnnypoo opened this issue Nov 7, 2016 · 3 comments
Closed

Support Enums #12

Jawnnypoo opened this issue Nov 7, 2016 · 3 comments

Comments

@Jawnnypoo
Copy link

When I try to generate a parcelable class which contains an enum, it generates something like:

enum class SortOrder {
    AlphaAscending ,
    AlphaDescending,
    Date
}
constructor(source: Parcel) : this(source.readSortOrder())

override fun writeToParcel(dest: Parcel?, flags: Int) {
        dest?.writeSortOrder(sortOrder)
    }

and cannot resolve those read or write methods. Not sure if this has something to do with my code, or this plugin.

@Jawnnypoo
Copy link
Author

It should be something more like

out.writeInt(myEnum.ordinal());

and

constructor(source: Parcel) : this(MyEnum.values()[source.readInt()])

nekocode added a commit that referenced this issue Nov 9, 2016
@nekocode
Copy link
Owner

nekocode commented Nov 9, 2016

@nekocode nekocode closed this as completed Nov 9, 2016
@Jawnnypoo
Copy link
Author

Great news, thanks!

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

No branches or pull requests

2 participants