Closed Pimsch closed 7 years ago
Will take a look. Thanks for your support.
I am not using FragmentPager. I wonder why the property is added to the bundle. Anyway, i am implementing SaveState.
@Pimsch i am sorry for the delay. I have been busy. I will solve this soon. Thanks.
@Pimsch you may also may check my Google Analytics plugin for Xamarin https://github.com/alexrainman/GAXamarin
@alexrainman Thank you for your updates. I will look into your Google Analytics plugin too and present it to my bosses.
Also i have a stackoverflow link i found while testing that might help you. http://stackoverflow.com/questions/26085425/xamarin-android-unfortunately-app-has-stopped This seems to be a similiar issue and the CirclePageIndicator from Xamarin are mentioned as problematic in the comments.
I applied the fix to CirclePageIndicator but, i also need to apply a fix to PageAdapter. I have a really cool functionality on my roadmap: SwipeLeftToLoadMore and SwipeRightToRefresh :)
I believe i fixed the problem. Can i send you a NuGet package so you can test?
Sorry for the late reply i was pretty buisy the last few days. It would be great if you can send me that NuGet package so i can test your fix. What kind of information do you need for that?
I will leave you a NuGet package link. Install from a local folder https://developer.xamarin.com/guides/cross-platform/xamarin-studio/nuget_walkthrough/#Adding_Package_Sources and let me know how testing goes. Some small changes in this release. I am deprecating all custom controls except CVLabel as im providing the default HeightRequest per-platform, and im also deprecating PageIndicatorBackgroundColor as i believe is not useful and it helps me to clean up the code.
Download from here: https://drive.google.com/file/d/0B6hZDQudMRBUUXE5QVNneVZTbUE/view?usp=sharing
@Pimsch did you have any chances to test?
@alexrainman Sorry again for the late reply, I just had the chance to test your new package and sadly it did not resolve my issue. Hopefully i can provide you with more information tomorrow when i have a chance to look into this a bit more.
@Pimsch it seems u have busy. I will do my own test from my side. Thanks
@Pimsch after some testing, what i did for saving state of ViewPager and PageIndicators works but, RestoreState on both of them is not called unless you call RestoreSate in the activity itself.
The solution is to call to onSaveInstanceState and onRestoreInstanceState from the root Activity containing the ViewPager and store the custom view's state programatically as well.
Inside your root Activity implement the following:
Save the state of your custom view
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putParcelable("STATE_COLLECTION", collectionFrameLayout.onSaveInstanceState());
super.onSaveInstanceState(outState);
}
And inside the onCreate() restore it after you create your custom views.
if (savedInstanceState != null) {
Parcelable state = savedInstanceState.getParcelable("STATE_COLLECTION");
if (state != null) {
collectionFrameLayout.onRestoreInstanceState(state);
}
}
Now, there's a problem, XForms activity doesn't allow you to implement onSaveInstanceState :(
If my work is helping you, please help me back: https://xamarinhq.wufoo.com/forms/nominate-a-xamarin-mvp/
This is what i have done that is community visible:
First of all thank you for providing this great control. It looks really good.
The problem: The App (Android) crashes when OnRestoreInstanceState is called in the Android Activity with the following error : "Java.Lang.RuntimeException: Parcel android.os.Parcel@XXXXXXX: Unmarshalling unknown type code XXXXXXX at offset XXX"
After some testing i found out that two properties are added to the Bundle that is supposed to be restored in the method call when using the CarouselView:
FragmentPager.SavedState CirclePageIndicator_SavedState
These might be a good start to look.
Thank you for looking into this issue.