Skip to content
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

Android page switch issue #228

Closed
bugadani opened this issue Feb 1, 2017 · 13 comments
Closed

Android page switch issue #228

bugadani opened this issue Feb 1, 2017 · 13 comments
Projects
Milestone

Comments

@bugadani
Copy link

bugadani commented Feb 1, 2017

On Android, when SkiaSharp is used in a Xamarin Forms app, I encountered the following issue:
If I navigate from one page that has a SKGLView to an other page that has an SKGLView, the contents of the first view are drawn to the second page's view.

Refreshing the second page (i.e. by orientation change) results in the same effect: the first page's content being drawn on the second page's view.

@mattleibow
Copy link
Contributor

I just tested with Xamarin.Form's OpenGLView, and it does the same thing. I think this has to do with how Xamarin.Forms works - when you go to a new page, the old content is still underneath. In the case of Android's GLSurfaceView, the way it works is to basically punch a hole through the UI to the bottom-most GL view. You can see this by the fact that the previous view still fires it's paint event.

This is really an Android GLSurfaceView issue, but I am looking to see if I can replace it with a TextureView: #223

@bugadani
Copy link
Author

bugadani commented Feb 3, 2017

Thank you. As a workaround, removing the view from the hierarchy when the page disappears, seems to work.

@mattleibow
Copy link
Contributor

Closing this as I will have to implement a TextureView (#263) to properly avoid this issue.

@mattleibow
Copy link
Contributor

@bugadani I have reached what I think is good to go...

Give that a whirl and let me know what happens. The Xamarin.Forms view should now be using the TextureView under the hood.

@mattleibow mattleibow added this to the 1.60.0 milestone Feb 8, 2018
@mattleibow mattleibow added this to Done in v1.60.1 Feb 8, 2018
@bugadani
Copy link
Author

bugadani commented Feb 8, 2018

Cool, didn't expect a heads up! I will try to remove my workarounds and give it a go this weekend.

@bugadani
Copy link
Author

bugadani commented Feb 9, 2018

Hello! I've tried the packages and I can say that they have not solved my issue but made it worse.

As for my setup, currently I'm using a Galaxy S5 with android 6.0 and a Huawei P9 Lite 2016 with LineageOS 14.1 (Android 7.1) to test my apps.

My app uses a master-detail view as its menu, where the main detail page has a custom made chart using SKGLView. My original issue was that the chart was displayed on pages that went above this main page (i.e. an evaluation page with other charts and stuff) instead of the upper pages' charts and skglview views. Also, the Master part of the master-detail view was only rendered outside of the charts bounds.

After removing my workarounds I noticed that this issue was not present on my 7.1 device (which I got long after applying my workarounds...) but it was still present on the 6.0 device.

After installing the betas, this above issue remains as before, with the additional effect where everything is mirrored vertically (i.e. what was supposed to be drawn in the upper left corner is now drawn in the lower left, and texts are upside-down mirrored as well).

I'm not able to test it with other devices at the moment.

@mattleibow
Copy link
Contributor

@bugadani Thanks for the feedback. Could you attach a screenshot?
Besides the incorrect image, does the chart still appear on top of all the pages? Just to make sure that all the packages are correct, check to see if all the projects have been updated to v1.60.

@bugadani
Copy link
Author

bugadani commented Feb 9, 2018

one This one is from the 7.1 device (so this one will only show the mirroring) but not the other one as my work day has ended and I left the phone at the office.

It appears all packages were updated.

Yes, the chart appears above the other pages, but only where the other pages use SKGLView and only on Marshmallow (I would guess any below Nougat). This is the same behaviour as with the old implementation.

@mattleibow
Copy link
Contributor

Hmm. I created a set of tests.
SkiaSharp_v1.59.zip
SkiaSharp_v1.60.zip

Have a look and see what happens. I tested on a Nexus and Cubot (my Huwawei is out of reach at the momemnt, but I will test it). With v1.59, the second page appears over everything, but the view is still visible. With v1.60, the page slides up and covers everything.

This is what it should look like before navigating:

@bugadani
Copy link
Author

bugadani commented Feb 9, 2018

Apart from the crashes related to invalid casts your demos seem to do what they should: in v1.59 only the page title turns black, in v1.60 all of the page does. Also I don't experience the mirroring here, as well.

[30 minutes and a deleted paragraph later]

After fiddling around a bit I noticed that my chart started to render correctly while my other skia-based view was still mirrored. Looks like updating SkiaSharp did not trigger a rebuild of my projects. Looks good now on my P9 Lite, I'll be able to check the S5 next Tuesday. Thanks a lot for your work, your help and your demo (wouldn't have figured it out without that...) and I hope I'll have good news on Tuesday.

Have a nice weekend!

@mattleibow
Copy link
Contributor

Ah, no prob. Sorry about the crash, that was some hacky code I gave you.
Good to hear it works now - not sure why it didn't cause a rebuild.

@bugadani
Copy link
Author

Hey, so I had the change to try again on my marshmallow phone, works nicely there as well. Thanks for the fix, I'm now free to remove some ugly workarounds permanently.

@mattleibow
Copy link
Contributor

Awesome! Don't hesitate to open a new issue for any other things that you come across.

@mattleibow mattleibow removed this from Done in v1.60.1 Feb 23, 2018
@mattleibow mattleibow added this to Done in v1.60.0 May 5, 2018
@mono mono locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
v1.60.0
  
Done
Development

No branches or pull requests

2 participants