splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 384 forks source link

Add direct support for saving Parcelable objects in view state #311

Closed mgod closed 7 years ago

mgod commented 7 years ago

Close #17. Close #62.

This change uses reflection to determine if we can use Parcelable instead of Serializable when saving and restoring view state. It will check if the generic type T conforms to the Parcelable interface and use that to save and restore the objects instead of the Serializable implementation. Falls back on the Serializable code if type T is not Parcelable.

As we are adding reflection and usually expect to have a small number of objects, this is probably not a performance improvement, but it will allow developers who are currently using Parcelable objects to not need to do anything special to get reasonable save/restore behavior.

mgod commented 7 years ago

Thanks @wardellbagby. It may be a little bit before I wrap this all up in a release. I'm working on a few other breaking changes before I make a 3.0 version. You can always use gradlew jar to get an in-progress jar you can add to your project if you need this right now.

wardellbagby commented 7 years ago

I'm a bit off from a release myself, but I'll go ahead and do that while I wait for your release. I really appreciate your prompt response and solution! I know you didn't have to do that, so thank you!