Merge pull request #9077 from JosJuice/android-settings-initialized
Android: Wait for initialization before launching EmulationActivity
This commit is contained in:
commit
097a4f4ecf
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue