Merge pull request #8962 from JosJuice/android-saf-wad
Android: Use storage access framework for importing WADs
This commit is contained in:
commit
43d11ca3eb
|
@ -297,9 +297,6 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
case MainPresenter.REQUEST_GAME_FILE:
|
||||
extensions = FileBrowserHelper.GAME_EXTENSIONS;
|
||||
break;
|
||||
case MainPresenter.REQUEST_WAD_FILE:
|
||||
extensions = FileBrowserHelper.WAD_EXTENSION;
|
||||
break;
|
||||
default:
|
||||
throw new InvalidParameterException("Unhandled request code");
|
||||
}
|
||||
|
|
|
@ -175,8 +175,10 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
|||
@Override
|
||||
public void launchInstallWAD()
|
||||
{
|
||||
FileBrowserHelper.openFilePicker(this, MainPresenter.REQUEST_WAD_FILE, false,
|
||||
FileBrowserHelper.WAD_EXTENSION);
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
startActivityForResult(intent, MainPresenter.REQUEST_WAD_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,7 +205,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
|||
break;
|
||||
|
||||
case MainPresenter.REQUEST_WAD_FILE:
|
||||
mPresenter.installWAD(FileBrowserHelper.getSelectedPath(result));
|
||||
mPresenter.installWAD(result.getData().toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.dolphinemu.dolphinemu.R;
|
|||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.model.GameFileCache;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
|
||||
|
||||
public final class MainPresenter
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ public final class MainPresenter
|
|||
return true;
|
||||
|
||||
case R.id.menu_install_wad:
|
||||
mView.launchInstallWAD();
|
||||
new AfterDirectoryInitializationRunner().run(context, true, mView::launchInstallWAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,8 +179,10 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
|||
@Override
|
||||
public void launchInstallWAD()
|
||||
{
|
||||
FileBrowserHelper.openFilePicker(this, MainPresenter.REQUEST_WAD_FILE, false,
|
||||
FileBrowserHelper.WAD_EXTENSION);
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
startActivityForResult(intent, MainPresenter.REQUEST_WAD_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -226,7 +228,7 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
|||
break;
|
||||
|
||||
case MainPresenter.REQUEST_WAD_FILE:
|
||||
mPresenter.installWAD(FileBrowserHelper.getSelectedPath(result));
|
||||
mPresenter.installWAD(result.getData().toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@ public final class FileBrowserHelper
|
|||
public static final HashSet<String> RAW_EXTENSION = new HashSet<>(Collections.singletonList(
|
||||
"raw"));
|
||||
|
||||
public static final HashSet<String> WAD_EXTENSION = new HashSet<>(Collections.singletonList(
|
||||
"wad"));
|
||||
|
||||
public static void openDirectoryPicker(FragmentActivity activity, HashSet<String> extensions)
|
||||
{
|
||||
Intent i = new Intent(activity, CustomFilePickerActivity.class);
|
||||
|
|
Loading…
Reference in New Issue