Skip to content

PythonActivity.java is calling considerLoadingScreenRemoval too early #1884

Closed

Description

@GoBig87

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.

Activity

  1. ghost
    self-assigned this
    on Jun 23, 2019
  2. tkuam commented on Jun 23, 2019

    @tkuam

    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.

  3. ghost added on Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions