Android: Bring back the game details dialog

It was made inaccessible in e19922c (I'm not sure why)
and then removed by 593b697.
This commit is contained in:
JosJuice 2019-06-15 19:08:35 +02:00
parent 870912722e
commit 00c4dad784
5 changed files with 25 additions and 11 deletions

View File

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

View File

@ -91,7 +91,8 @@ public final class GameRowPresenter extends Presenter
}
GameSettingsDialog fragment =
GameSettingsDialog.newInstance(gameId, holder.gameFile.getPlatform());
GameSettingsDialog.newInstance(holder.gameFile.getPath(), gameId,
holder.gameFile.getPlatform());
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
.add(fragment, GameSettingsDialog.TAG).commit();

View File

@ -1,14 +1,16 @@
package org.dolphinemu.dolphinemu.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.DialogFragment;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.squareup.picasso.Picasso;
import org.dolphinemu.dolphinemu.R;
@ -38,7 +40,7 @@ public final class GameDetailsDialog extends DialogFragment
{
GameFile gameFile = GameFileCacheService.addOrGet(getArguments().getString(ARG_GAME_PATH));
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater()
.inflate(R.layout.dialog_game_details, null);

View File

@ -6,6 +6,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import android.widget.Toast;
@ -20,14 +21,16 @@ import java.io.File;
public class GameSettingsDialog extends DialogFragment
{
public static final String TAG = "GameSettingsDialog";
public static final String ARG_PATH = "path";
public static final String ARG_GAMEID = "game_id";
public static final String ARG_PLATFORM = "platform";
public static GameSettingsDialog newInstance(String gameId, int platform)
public static GameSettingsDialog newInstance(String path, String gameId, int platform)
{
GameSettingsDialog fragment = new GameSettingsDialog();
Bundle arguments = new Bundle();
arguments.putString(ARG_PATH, path);
arguments.putString(ARG_GAMEID, gameId);
arguments.putInt(ARG_PLATFORM, platform);
fragment.setArguments(arguments);
@ -41,6 +44,7 @@ public class GameSettingsDialog extends DialogFragment
{
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
String path = requireArguments().getString(ARG_PATH);
String gameId = requireArguments().getString(ARG_GAMEID);
int platform = requireArguments().getInt(ARG_PLATFORM);
@ -52,22 +56,26 @@ public class GameSettingsDialog extends DialogFragment
switch (which)
{
case 0:
SettingsActivity.launch(getContext(), MenuTag.CONFIG, gameId);
GameDetailsDialog.newInstance(path).show((requireActivity())
.getSupportFragmentManager(), "game_details");
break;
case 1:
SettingsActivity.launch(getContext(), MenuTag.GRAPHICS, gameId);
SettingsActivity.launch(getContext(), MenuTag.CONFIG, gameId);
break;
case 2:
SettingsActivity.launch(getContext(), MenuTag.GCPAD_TYPE, gameId);
SettingsActivity.launch(getContext(), MenuTag.GRAPHICS, gameId);
break;
case 3:
SettingsActivity.launch(getContext(), MenuTag.GCPAD_TYPE, gameId);
break;
case 4:
// Clear option for GC, Wii controls for else
if (platform == Platform.GAMECUBE.toInt())
clearGameSettings(gameId);
else
SettingsActivity.launch(getActivity(), MenuTag.WIIMOTE, gameId);
break;
case 4:
case 5:
clearGameSettings(gameId);
break;
}

View File

@ -336,12 +336,14 @@
</string-array>
<string-array name="gameSettingsMenusGC">
<item>Details</item>
<item>Core Settings</item>
<item>GFX Settings</item>
<item>GameCube Controller Settings</item>
<item>Clear Game Settings</item>
</string-array>
<string-array name="gameSettingsMenusWii">
<item>Details</item>
<item>Core Settings</item>
<item>GFX Settings</item>
<item>GameCube Controller Settings</item>