Merge pull request #9077 from JosJuice/android-settings-initialized

Android: Wait for initialization before launching EmulationActivity
This commit is contained in:
JMC47 2020-09-16 16:37:28 -04:00 committed by GitHub
commit 097a4f4ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View File

@ -47,6 +47,7 @@ import org.dolphinemu.dolphinemu.services.GameFileCacheService;
import org.dolphinemu.dolphinemu.ui.main.MainActivity;
import org.dolphinemu.dolphinemu.ui.main.TvMainActivity;
import org.dolphinemu.dolphinemu.ui.platform.Platform;
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
import org.dolphinemu.dolphinemu.utils.IniFile;
@ -193,7 +194,9 @@ public final class EmulationActivity extends AppCompatActivity
launcher.putExtra(EXTRA_SELECTED_TITLE, gameFile.getTitle());
launcher.putExtra(EXTRA_SELECTED_GAMEID, gameFile.getGameId());
launcher.putExtra(EXTRA_PLATFORM, gameFile.getPlatform());
activity.startActivity(launcher);
new AfterDirectoryInitializationRunner().run(activity, true,
() -> activity.startActivity(launcher));
}
public static void launchFile(FragmentActivity activity, String[] filePaths)
@ -230,7 +233,8 @@ public final class EmulationActivity extends AppCompatActivity
launcher.putExtra(EXTRA_PLATFORM, Platform.GAMECUBE);
}
activity.startActivity(launcher);
new AfterDirectoryInitializationRunner().run(activity, true,
() -> activity.startActivity(launcher));
}
public static void stopIgnoringLaunchRequests()

View File

@ -19,7 +19,6 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
import org.dolphinemu.dolphinemu.overlay.InputOverlay;
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
import org.dolphinemu.dolphinemu.utils.Log;
import java.io.File;
@ -34,8 +33,6 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
private EmulationState mEmulationState;
private AfterDirectoryInitializationRunner mAfterDirectoryInitializationRunner;
private EmulationActivity activity;
public static EmulationFragment newInstance(String[] gamePaths)
@ -109,21 +106,12 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
public void onResume()
{
super.onResume();
mAfterDirectoryInitializationRunner = new AfterDirectoryInitializationRunner();
mAfterDirectoryInitializationRunner.run(requireContext(), true,
() -> mEmulationState.run(activity.isActivityRecreated()));
mEmulationState.run(activity.isActivityRecreated());
}
@Override
public void onPause()
{
if (mAfterDirectoryInitializationRunner != null)
{
mAfterDirectoryInitializationRunner.cancel();
mAfterDirectoryInitializationRunner = null;
}
if (mEmulationState.isRunning())
mEmulationState.pause();
super.onPause();