Android: Pass GameFile to GamePropertiesDialog::newInstance

This commit is contained in:
JosJuice 2020-06-23 18:31:39 +02:00
parent 8c999cf3b1
commit 5d13f3675f
3 changed files with 11 additions and 15 deletions

View File

@ -156,9 +156,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
return true;
}
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile.getPath(),
gameId, holder.gameFile.getRevision(), holder.gameFile.getPlatform());
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile);
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GamePropertiesDialog.TAG).commit();

View File

@ -100,9 +100,7 @@ public final class GameRowPresenter extends Presenter
return true;
}
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile.getPath(),
gameId, holder.gameFile.getRevision(), holder.gameFile.getPlatform());
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile);
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GamePropertiesDialog.TAG).commit();

View File

@ -14,6 +14,7 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
import org.dolphinemu.dolphinemu.model.GameFile;
import org.dolphinemu.dolphinemu.ui.platform.Platform;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.utils.Log;
@ -23,21 +24,20 @@ import java.io.File;
public class GamePropertiesDialog extends DialogFragment
{
public static final String TAG = "GamePropertiesDialog";
public static final String ARG_PATH = "path";
public static final String ARG_GAMEID = "game_id";
private static final String ARG_PATH = "path";
private static final String ARG_GAMEID = "game_id";
public static final String ARG_REVISION = "revision";
public static final String ARG_PLATFORM = "platform";
private static final String ARG_PLATFORM = "platform";
public static GamePropertiesDialog newInstance(String path, String gameId, int revision,
int platform)
public static GamePropertiesDialog newInstance(GameFile gameFile)
{
GamePropertiesDialog fragment = new GamePropertiesDialog();
Bundle arguments = new Bundle();
arguments.putString(ARG_PATH, path);
arguments.putString(ARG_GAMEID, gameId);
arguments.putInt(ARG_REVISION, revision);
arguments.putInt(ARG_PLATFORM, platform);
arguments.putString(ARG_PATH, gameFile.getPath());
arguments.putString(ARG_GAMEID, gameFile.getGameId());
arguments.putInt(ARG_REVISION, gameFile.getRevision());
arguments.putInt(ARG_PLATFORM, gameFile.getPlatform());
fragment.setArguments(arguments);
return fragment;