Android: Merge launchInstallWad into launchOpenFileActivity

This commit is contained in:
JosJuice 2021-01-17 22:16:20 +01:00
parent 80b56b6575
commit 4a394ffc9c
4 changed files with 8 additions and 27 deletions

View File

@ -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);
}
/**

View File

@ -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;
}

View File

@ -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.

View File

@ -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