UXDivers / Gorilla-Player-Support

This is the public Gorilla Player support website
http://gorillaplayer.com
115 stars 17 forks source link

Iconize Support? #245

Open gsaldana opened 7 years ago

gsaldana commented 7 years ago

Hi @LeoHere , I want to ask you if has gorilla player support to preview images using Iconize Plugin?

When I debug the app everything works fine, but when try to preview an icon on Gorilla player the app crash suddenly.

readying the logs files I found this message (text is too long but I think this is the important part):

Caused by: android.runtime.JavaProxyThrowable: System.MethodAccessException: Method Plugin.Iconize.IconImageRenderer:.ctor ()' is inaccessible from methodXamarin.Forms.Platform.Android.FastRenderers.ImageRenderer:.ctor ()'

P.S. If I comment the line where Iconize:IconImage is defined, the app is previewed on Gorilla.

ShiroYacha commented 7 years ago

Hi @nazgul87 , I have got Iconize to work. You will need to add in MainActivity.cs before the LoadApplication (same goes for AppDelegate.

            Iconize.Init();
            Iconize
                .With(new MaterialModule());

then add in App.cs

            Iconize.With(new MaterialModule());

Note that I have used the packages Xam.Plugin.Iconize & Xam.Plugin.Iconize.Material in the v2.0.0.29-beta prerelease for both PCL and Android/iOS. I could not get it to work in the 1.5 versions...

Hope this helps

gsaldana commented 7 years ago

Hi @ShiroYacha , thanks for your comments. I did exactly what you said and I can't make it work.

I'm using the same NuGet packages (Xam.Plugin.Iconize & Xam.Plugin.Iconize.Material v2.0.0.29-beta).

This is my MainActivity.cs:

protected override void OnCreate(Bundle bundle)
{
    TabLayoutResource = Resource.Layout.tabs;
    ToolbarResource = Resource.Layout.toolbar;

    base.OnCreate(bundle);

    SupportActionBar.Hide();

    global::Xamarin.Forms.Forms.Init(this, bundle);

    Plugin.Iconize.Iconize.Init();
    Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.MaterialModule());

#if GORILLA_PLAYER
    LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication(this,
                                new UXDivers.Gorilla.Config()
                                    .RegisterAssembly(typeof(LoginModule.LoginModule).Assembly)
                                    .RegisterAssembly(typeof(Prism.Mvvm.ViewModelLocationProvider).Assembly)
                                    .RegisterAssembly(typeof(Plugin.Iconize.Iconize).Assembly)
                                    .RegisterAssembly(typeof(Plugin.Iconize.Fonts.MaterialModule).Assembly)));
#else
    LoadApplication(new App(new AndroidInitializer()));
#endif
    SetDefaultOrientation();
}

And my App.xaml.cs:

public App(IPlatformInitializer initializer = null)
            : base(initializer)
        {
        }

        protected override async void OnInitialized()
        {
            InitializeComponent();
            LoadResources();

            await NavigationService.NavigateAsync("NavigationPage/LoginPage");
        }

        private void LoadResources()
        {
            Iconize.With(new MaterialModule());
        }

Note that I'm using PRISM. Do you see something wrong with the code?

thanks in advance :)

ShiroYacha commented 7 years ago

Hi @nazgul87 ,

I'am also using PRISM :)... it's weird I think that's all that I have done for Iconize. However I have quite some workarounds to make Gorilla work not sure if some actually impacted the use of Iconize...

On the other hand, I am not sure how Gorilla really works w.r.t. the initializing the Prism application since we do not call LoadApplication(new App()) (maybe @LeoHere can clarify this a bit?) so I force the Prism app's OnInitialized() logic in the flow by explicitly calling it after the Gorilla's LoadApplication().

Hope this helps...

gsaldana commented 7 years ago

Thanks @ShiroYacha, I'll try it hoping it works :P