Android: Adjust logic for DOL/ELF long press

Android follow-up for 83c1277. Removes some now unnecessary code
and disables "Set as Default ISO" for DOL, ELF and WAD files.
This commit is contained in:
JosJuice 2021-02-11 22:32:20 +01:00
parent bf758fbe7c
commit 606e6ca3ba
2 changed files with 15 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));