-
Notifications
You must be signed in to change notification settings - Fork 817
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
[Review] Minor performance tweaks #74
Conversation
Looks good, I will test it a bit and keep you posted. |
[Review] Minor performance tweaks
Thanks for merging! |
@@ -66,8 +67,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { | |||
mData = People.DATA; | |||
mUseSystemDefault = false; | |||
} else { | |||
Object[] o = (Object[]) getArguments().getSerializable("emojicons"); | |||
mData = Arrays.asList(o).toArray(new Emojicon[o.length]); | |||
mData = (Emojicon[]) getArguments().getParcelableArray(EMOJICONS_KEY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this throws an exception
Caused by: java.lang.ClassCastException: android.os.Parcelable[] cannot be cast to com.rockerhieu.emojicon.emoji.Emojicon[]
it can be fixed as described here: http://stackoverflow.com/questions/3647432/how-to-pass-an-array-of-address-objects-to-an-other-acitvity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uwemaurer Interesting. It worked fine when I tested it. Does it crash your app or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we see this exception in our exception reporting. (reported on Android 4.1.2 and 4.4.2 so far)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uwemaurer Maybe I am missing something but I can't reproduce this on emulators API 19 and 23. Anyway, I've sent a pull request (#79). Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can reproduce it on my phone when I enable 'Don't keep activities' in the developer options. I can confirm that your pull request fixes it.
I got this stacktrace (maybe it has to do with the support library):
E/AndroidRuntime(26523): Caused by: java.lang.ClassCastException: android.os.Parcelable[] cannot be cast to com.rockerhieu.emojicon.emoji.Emojicon[]
E/AndroidRuntime(26523): at com.rockerhieu.emojicon.EmojiconGridFragment.onViewCreated(EmojiconGridFragment.java:70)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1197)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1179)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1991)
E/AndroidRuntime(26523): at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1976)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1041)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1197)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1179)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1991)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:165)
E/AndroidRuntime(26523): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:507)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uwemaurer Ok Thanks. It's good to learn something new every day!
Hi guys,
First of all, thanks for this awesome work.
I'd like to propose to use Parcelable instead of Serializable in Emojicon class.
Hopefully, this might improve performance (as mention at http://www.developerphil.com/parcelable-vs-serializable/) and seems to align with Android best practices.
Also, I updated ViewHolder to be static based on Favor static member classes over nonstatic
Changes:
Thanks!