From 4a394ffc9c6cbaa7a11de2a658948b2594ca6ab4 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 17 Jan 2021 22:16:20 +0100 Subject: [PATCH] Android: Merge launchInstallWad into launchOpenFileActivity --- .../dolphinemu/dolphinemu/ui/main/MainActivity.java | 13 ++----------- .../dolphinemu/ui/main/MainPresenter.java | 5 +++-- .../org/dolphinemu/dolphinemu/ui/main/MainView.java | 4 +--- .../dolphinemu/ui/main/TvMainActivity.java | 13 ++----------- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java index 7b4f886d87..90493e8cd4 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainActivity.java @@ -175,21 +175,12 @@ public final class MainActivity extends AppCompatActivity implements MainView } @Override - public void launchOpenFileActivity() + public void launchOpenFileActivity(int requestCode) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - startActivityForResult(intent, MainPresenter.REQUEST_GAME_FILE); - } - - @Override - public void launchInstallWAD() - { - Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("*/*"); - startActivityForResult(intent, MainPresenter.REQUEST_WAD_FILE); + startActivityForResult(intent, requestCode); } /** diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java index 9344a61e48..f51f269d58 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java @@ -91,11 +91,12 @@ public final class MainPresenter return true; case R.id.menu_open_file: - mView.launchOpenFileActivity(); + mView.launchOpenFileActivity(REQUEST_GAME_FILE); return true; case R.id.menu_install_wad: - new AfterDirectoryInitializationRunner().run(context, true, mView::launchInstallWAD); + new AfterDirectoryInitializationRunner().run(context, true, + () -> mView.launchOpenFileActivity(REQUEST_WAD_FILE)); return true; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainView.java index fc4ed31513..b2e6b74495 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainView.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainView.java @@ -21,9 +21,7 @@ public interface MainView void launchFileListActivity(); - void launchOpenFileActivity(); - - void launchInstallWAD(); + void launchOpenFileActivity(int requestCode); /** * To be called when the game file cache is updated. diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index 8e96083ce1..0e9150ee52 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -180,21 +180,12 @@ public final class TvMainActivity extends FragmentActivity implements MainView } @Override - public void launchOpenFileActivity() + public void launchOpenFileActivity(int requestCode) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); - startActivityForResult(intent, MainPresenter.REQUEST_GAME_FILE); - } - - @Override - public void launchInstallWAD() - { - Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("*/*"); - startActivityForResult(intent, MainPresenter.REQUEST_WAD_FILE); + startActivityForResult(intent, requestCode); } @Override