tbaggett / xfgloss

New styling properties for standard Xamarin.Forms controls
Other
160 stars 25 forks source link

Does initialize XFGloss in Android project is needed? #23

Closed asafgo closed 6 years ago

asafgo commented 7 years ago

Hi,

Adding the following code to my Android project: // IMPORTANT: Initialize XFGloss AFTER calling LoadApplication on the Android platform XFGloss.Droid.Library.Init(this, savedInstanceState); results with error "The name 'savedInstanceState' does not exist in the current context". When deleting this above code XFGloss works on Android project so I wander why the above line of code needed for Android project?

Thanks, AG

Hasanajouz commented 7 years ago

If you are just using the gradient effect for the form's background i think it is not necessary to use this line. It started showing the error you mentioned after updating xamarin forms to 2.4.0 I hope they update this plugin soon it's been along time since it's been updated

software770-2 commented 6 years ago

By me it does not work without it and I have the same error when I put it... Latest version of xf and XFGloss... Its juste does not do anything when I don,t put this line.

EmilAlipiev commented 6 years ago

I wonder if initialization increases start up time like any other xamarin themes. last time I used light theme, profiling showed me that it increased my start up time 2-3 secs on Android. Does it have similar effects? any experience?

tbaggett commented 6 years ago

The new 1.1.0 version now supports NetStandard 2.0 and Xamarin.Forms 2.5. It should also resolve issues involving crashing on the Android platform during initialization. Please try the new version and let me know if it resolves your issue. Thanks!

VirtualNomad00 commented 6 years ago

The issue still exists with Xamarin.Forms 2.5 and NetStandard 2.0

tbaggett commented 6 years ago

Thanks for trying it, @VirtualNomad00. I will test further and try to reproduce the issue.

tbaggett commented 6 years ago

@EmilAlipiev , regarding initialization increasing start up time, all it does is basically insure that the Xamarin linker recognizes the lib is being used so it will include it in release builds.

tbaggett commented 6 years ago

@VirtualNomad00, and everyone else experiencing this issue, I reviewed the MainActivity class in the XFGlossSample.Droid project included in the repo. The savedInstanceState variable is passed as a parameter to the OnCreate method where you were supposed to add the Init statement. I've copied relevant portions of it below.

    public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Xamarin.Forms.Forms.Init(this, savedInstanceState);

            var app = new App();
            LoadApplication(app);

            XFGloss.Droid.Library.Init(this, savedInstanceState);
        }
    }

Can you compare this to your implementations of your Android project's MainActivity class? Please let me know how they differ. The feedback you provide may help me resolve this issue. Thanks!

tbaggett commented 6 years ago

I've released the new v1.1.1.83 to address issue #19. Please update to it before testing this issue again, just in case they are related. Thanks!

VirtualNomad00 commented 6 years ago

@tbaggett this one is resolved. Though a suggestion you might want to make changes in the README.md file of either changing savedInstanceState to bundle or vice-versa as that was the main issue but it was the mistake of overlooking and blindly copying the code on our part too. I realized that just after commenting on the issue but forgot to update, apologies for that. However am still facing issue #21 for both Android and iOS. I have pasted my code over there

tbaggett commented 6 years ago

@VirtualNomad00, thanks for the confirmation. I will close this issue. And thanks for pointing out the discrepancy in the README.md file. I will fix that as well. I will look into issue #21 tonight after work.