-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Move the unpackFiles step into an AsyncTask #990
Conversation
…oading screen while the unpack step is running.
Taking a second look at the code, I think I see why we get the black screen. I was assuming that once the SDL view was loaded, we no longer needed the loading screen, but apparently there's a delay between setting the view and the first actual render. Typically in my own apps I load up my WebView at this point so I didn't notice it. I'm going to run some tests but I bet adding another call to this.setLoadingScreen() right after mActivity.finishLoad() is called should fix it. |
I'm just trying some tests, but this seems to be working now, which is great! Just to check, is it ready to merge as far as you are concerned? |
// removed the loading screen. However, we still need it to | ||
// show until the app is ready to render, so pop it back up | ||
// on top of the SDL view. | ||
this.showLoadingScreen(); |
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.
Actually, I think this should be mActivity.showLoadingScreen() - I don't know why it worked for me before, but it's crashing now.
Yeah, I've been using it in my app and so far no issues, just a much nicer initial boot experience. :) In addition, I've gotten an --assets-dir argument working as well (though it's not quite ready for pushing yet), and with the combination there is virtually no hang or startup delay at all! :)
From: Alexander Taylor <[email protected]>
Reply-To: kivy/python-for-android <[email protected]>
Date: Saturday, January 28, 2017 at 12:51 PM
To: kivy/python-for-android <[email protected]>
Cc: kollivier <[email protected]>, Author <[email protected]>
Subject: Re: [kivy/python-for-android] Move the unpackFiles step into an AsyncTask (#990)
I'm just trying some tests, but this seems to be working now, which is great! Just to check, is it ready to merge as far as you are concerned?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Oh sorry, yes, that's correct. It should be mActivity, I thought I had pushed that already...
From: Alexander Taylor <[email protected]>
Reply-To: kivy/python-for-android <[email protected]>
Date: Saturday, January 28, 2017 at 1:09 PM
To: kivy/python-for-android <[email protected]>
Cc: kollivier <[email protected]>, Author <[email protected]>
Subject: Re: [kivy/python-for-android] Move the unpackFiles step into an AsyncTask (#990)
@inclement commented on this pull request.
In pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonActivity.java:
+ protected void onPostExecute(String result) {
+ // Figure out the directory where the game is. If the game was
+ // given to us via an intent, then we use the scheme-specific
+ // part of that intent to determine the file to launch. We
+ // also use the android.txt file to determine the orientation.
+ //
+ // Otherwise, we use the public data, if we have it, or the
+ // private data if we do not.
+ mActivity.finishLoad();
+
+ // finishLoad called setContentView with the SDL view, which
+ // removed the loading screen. However, we still need it to
+ // show until the app is ready to render, so pop it back up
+ // on top of the SDL view.
+ this.showLoadingScreen();
Actually, I think this should be mActivity.showLoadingScreen() - I don't know why it worked for me before, but it's crashing now.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Okay, I fixed it locally to test with so I just pushed that. Thanks! |
Cool, thanks!
From: Alexander Taylor <[email protected]>
Reply-To: kivy/python-for-android <[email protected]>
Date: Saturday, January 28, 2017 at 1:16 PM
To: kivy/python-for-android <[email protected]>
Cc: kollivier <[email protected]>, Author <[email protected]>
Subject: Re: [kivy/python-for-android] Move the unpackFiles step into an AsyncTask (#990)
Okay, I fixed it locally to test with so I just pushed that. Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Right now the loading screen does not show up until loading is actually pretty much complete because all the loading tasks block the UI thread. As a result, you will see a dark grey gradient background instead of the loading screen. For apps with more data to unpack, this can appear for longer and give the impression the app has hung. This is a fix for Issue #983.