Merge pull request #9502 from JosJuice/android-dol-elf-details

Android: Adjust logic for DOL/ELF long press
This commit is contained in:
Léo Lam 2021-02-13 01:03:26 +01:00 committed by GitHub
commit a2fa89b15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 18 deletions

View File

@ -155,16 +155,6 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
GameViewHolder holder = (GameViewHolder) view.getTag();
String gameId = holder.gameFile.getGameId();
if (gameId.isEmpty())
{
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.DolphinDialogBase);
builder.setTitle("Game Settings");
builder.setMessage("Files without game IDs don't support game-specific settings.");
builder.show();
return true;
}
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile);
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GamePropertiesDialog.TAG).commit();

View File

@ -53,10 +53,14 @@ public class GamePropertiesDialog extends DialogFragment
final String path = requireArguments().getString(ARG_PATH);
final String gameId = requireArguments().getString(ARG_GAMEID);
final int revision = requireArguments().getInt(ARG_REVISION);
final boolean isWii = requireArguments().getInt(ARG_PLATFORM) != Platform.GAMECUBE.toInt();
final int platform = requireArguments().getInt(ARG_PLATFORM);
final boolean shouldAllowConversion =
requireArguments().getBoolean(ARG_SHOULD_ALLOW_CONVERSION);
final boolean isDisc = platform == Platform.GAMECUBE.toInt() ||
platform == Platform.WII.toInt();
final boolean isWii = platform != Platform.GAMECUBE.toInt();
AlertDialogItemsBuilder itemsBuilder = new AlertDialogItemsBuilder(requireContext());
itemsBuilder.add(R.string.properties_details, (dialog, i) ->
@ -69,15 +73,18 @@ public class GamePropertiesDialog extends DialogFragment
ConvertActivity.launch(getContext(), path));
}
itemsBuilder.add(R.string.properties_set_default_iso, (dialog, i) ->
if (isDisc)
{
try (Settings settings = new Settings())
itemsBuilder.add(R.string.properties_set_default_iso, (dialog, i) ->
{
settings.loadSettings();
StringSetting.MAIN_DEFAULT_ISO.setString(settings, path);
settings.saveSettings(null, getContext());
}
});
try (Settings settings = new Settings())
{
settings.loadSettings();
StringSetting.MAIN_DEFAULT_ISO.setString(settings, path);
settings.saveSettings(null, getContext());
}
});
}
itemsBuilder.add(R.string.properties_edit_game_settings, (dialog, i) ->
SettingsActivity.launch(getContext(), MenuTag.SETTINGS, gameId, revision, isWii));

View File

@ -322,6 +322,7 @@
<item>Russia</item>
<item>Spain</item>
<item>Taiwan</item>
<item>World</item>
<item>Unknown</item>
</string-array>