PythonActivity.java is calling considerLoadingScreenRemoval too early
I'm using release-2019.06.06 and the loading screen turn to black while loading my app. The issue is coming from https://github.com/kivy/python-for-android/blob/release-2019.06.06/pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java inside
/** Confirm that the app's main routine has been launched.
**/
@Override
public void appConfirmedActive() { <--- This is called fairly early in the boot process
if (!mAppConfirmedActive) {
Log.v(TAG, "appConfirmedActive() -> preparing loading screen removal");
mAppConfirmedActive = true;
considerLoadingScreenRemoval();
}
}
/** This is called from various places to check whether the app's main
* routine has been launched already, and if it has, then the loading
* screen will be removed.
**/
public void considerLoadingScreenRemoval() {
if (loadingScreenRemovalTimer != null) <-- I dont think this catches and it skips
return;
runOnUiThread(new Runnable() {
public void run() {
if (((PythonActivity)PythonActivity.mSingleton).mAppConfirmedActive &&
loadingScreenRemovalTimer == null) {
// Remove loading screen but with a delay.
// (app can use p4a's android.loadingscreen module to
// do it quicker if it wants to)
// get a handler (call from main thread)
// this will run when timer elapses
TimerTask removalTask = new TimerTask() {
@Override
public void run() {
// post a runnable to the handler
runOnUiThread(new Runnable() {
@Override
public void run() {
PythonActivity activity =
((PythonActivity)PythonActivity.mSingleton);
if (activity != null)
activity.removeLoadingScreen();
}
});
}
};
loadingScreenRemovalTimer = new Timer();
loadingScreenRemovalTimer.schedule(removalTask, 5000); <- I tried bumping this up to 15000 but it did nothing
}
}
});
}
I put a hack in here like this
public void considerLoadingScreenRemoval() {
if (true){
return;
}
and my loading screen stays the appropriate time.
I've experienced the same with my app after switching to the latest p4a-master. Looks like you tried adding time to the loadingScreenRemovalTimer which I attempted as well, which just lengthened the time the pre-splash screen was up, but didn't seem to decrease the time that the black screen stayed up once the pre-splash was removed.
Seems like I may have broken something about the timer, I'll add some more debug output and see if I can figure out why exactly it isn't working