mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(Android frontend) Refactor RetroActivity launching
This commit is contained in:
parent
d255dea771
commit
d6486df835
@ -8,6 +8,7 @@ import java.io.InputStreamReader;
|
|||||||
|
|
||||||
import com.retroarch.R;
|
import com.retroarch.R;
|
||||||
import com.retroarch.browser.mainmenu.MainMenuActivity;
|
import com.retroarch.browser.mainmenu.MainMenuActivity;
|
||||||
|
import com.retroarch.browser.mainmenu.MainMenuFragment;
|
||||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||||
import com.retroarch.browser.retroactivity.RetroActivityFuture;
|
import com.retroarch.browser.retroactivity.RetroActivityFuture;
|
||||||
import com.retroarch.browser.retroactivity.RetroActivityPast;
|
import com.retroarch.browser.retroactivity.RetroActivityPast;
|
||||||
@ -104,6 +105,7 @@ public final class HistorySelection extends DialogFragment
|
|||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final OnItemClickListener onItemClickListener = new OnItemClickListener()
|
private final OnItemClickListener onItemClickListener = new OnItemClickListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -124,11 +126,12 @@ public final class HistorySelection extends DialogFragment
|
|||||||
Settings.Secure.DEFAULT_INPUT_METHOD);
|
Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||||
Toast.makeText(ctx, String.format(getString(R.string.loading_gamepath), gamePath), Toast.LENGTH_SHORT).show();
|
Toast.makeText(ctx, String.format(getString(R.string.loading_gamepath), gamePath), Toast.LENGTH_SHORT).show();
|
||||||
Intent retro = getRetroActivity();
|
Intent retro = getRetroActivity();
|
||||||
retro.putExtra("ROM", gamePath);
|
MainMenuFragment.startRetroActivity(retro,
|
||||||
retro.putExtra("LIBRETRO", corePath);
|
gamePath,
|
||||||
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
|
corePath,
|
||||||
retro.putExtra("IME", current_ime);
|
UserPreferences.getDefaultConfigPath(ctx),
|
||||||
retro.putExtra("DATADIR", getActivity().getApplicationInfo().dataDir);
|
current_ime,
|
||||||
|
getActivity().getApplicationInfo().dataDir);
|
||||||
startActivity(retro);
|
startActivity(retro);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import com.retroarch.R;
|
|||||||
import com.retroarch.browser.FileWrapper;
|
import com.retroarch.browser.FileWrapper;
|
||||||
import com.retroarch.browser.IconAdapter;
|
import com.retroarch.browser.IconAdapter;
|
||||||
import com.retroarch.browser.ModuleWrapper;
|
import com.retroarch.browser.ModuleWrapper;
|
||||||
|
import com.retroarch.browser.mainmenu.MainMenuFragment;
|
||||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||||
import com.retroarch.browser.retroactivity.RetroActivityFuture;
|
import com.retroarch.browser.retroactivity.RetroActivityFuture;
|
||||||
import com.retroarch.browser.retroactivity.RetroActivityPast;
|
import com.retroarch.browser.retroactivity.RetroActivityPast;
|
||||||
@ -275,12 +276,13 @@ public final class DetectCoreDirectoryFragment extends DirectoryFragment
|
|||||||
retro = new Intent(getActivity(), RetroActivityPast.class);
|
retro = new Intent(getActivity(), RetroActivityPast.class);
|
||||||
|
|
||||||
UserPreferences.updateConfigFile(getActivity());
|
UserPreferences.updateConfigFile(getActivity());
|
||||||
String current_ime = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
MainMenuFragment.startRetroActivity(
|
||||||
retro.putExtra("ROM", contentPath);
|
retro,
|
||||||
retro.putExtra("LIBRETRO", corePath);
|
contentPath,
|
||||||
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(getActivity()));
|
corePath,
|
||||||
retro.putExtra("IME", current_ime);
|
UserPreferences.getDefaultConfigPath(getActivity()),
|
||||||
retro.putExtra("DATADIR", getActivity().getApplicationInfo().dataDir);
|
Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD),
|
||||||
|
getActivity().getApplicationInfo().dataDir);
|
||||||
startActivity(retro);
|
startActivity(retro);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -209,15 +209,16 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
|
|||||||
if (prefKey.equals("resumeContentPref"))
|
if (prefKey.equals("resumeContentPref"))
|
||||||
{
|
{
|
||||||
UserPreferences.updateConfigFile(ctx);
|
UserPreferences.updateConfigFile(ctx);
|
||||||
|
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
final String libretro_path = prefs.getString("libretro_path", ctx.getApplicationInfo().dataDir + "/cores");
|
|
||||||
final String current_ime = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
|
||||||
final Intent retro = getRetroActivity();
|
final Intent retro = getRetroActivity();
|
||||||
retro.putExtra("LIBRETRO", libretro_path);
|
|
||||||
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
|
MainMenuFragment.startRetroActivity(
|
||||||
retro.putExtra("IME", current_ime);
|
retro,
|
||||||
retro.putExtra("DATADIR", ctx.getApplicationInfo().dataDir);
|
null,
|
||||||
|
prefs.getString("libretro_path", ctx.getApplicationInfo().dataDir + "/cores"),
|
||||||
|
UserPreferences.getDefaultConfigPath(ctx),
|
||||||
|
Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD),
|
||||||
|
ctx.getApplicationInfo().dataDir);
|
||||||
startActivity(retro);
|
startActivity(retro);
|
||||||
}
|
}
|
||||||
// Load Core Preference
|
// Load Core Preference
|
||||||
@ -281,17 +282,29 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
|
|||||||
public void onDirectoryFragmentClosed(String path)
|
public void onDirectoryFragmentClosed(String path)
|
||||||
{
|
{
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
final String libretro_path = prefs.getString("libretro_path", "");
|
|
||||||
|
|
||||||
UserPreferences.updateConfigFile(ctx);
|
UserPreferences.updateConfigFile(ctx);
|
||||||
String current_ime = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
|
||||||
Toast.makeText(ctx, String.format(getString(R.string.loading_data), path), Toast.LENGTH_SHORT).show();
|
Toast.makeText(ctx, String.format(getString(R.string.loading_data), path), Toast.LENGTH_SHORT).show();
|
||||||
Intent retro = getRetroActivity();
|
Intent retro = getRetroActivity();
|
||||||
retro.putExtra("ROM", path);
|
MainMenuFragment.startRetroActivity(
|
||||||
retro.putExtra("LIBRETRO", libretro_path);
|
retro,
|
||||||
retro.putExtra("CONFIGFILE", UserPreferences.getDefaultConfigPath(ctx));
|
path,
|
||||||
retro.putExtra("IME", current_ime);
|
prefs.getString("libretro_path", ""),
|
||||||
retro.putExtra("DATADIR", ctx.getApplicationInfo().dataDir);
|
UserPreferences.getDefaultConfigPath(ctx),
|
||||||
|
Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD),
|
||||||
|
ctx.getApplicationInfo().dataDir);
|
||||||
startActivity(retro);
|
startActivity(retro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startRetroActivity(Intent retro, String contentPath, String corePath,
|
||||||
|
String configFilePath, String imePath, String dataDirPath)
|
||||||
|
{
|
||||||
|
if (contentPath != null) {
|
||||||
|
retro.putExtra("ROM", contentPath);
|
||||||
|
}
|
||||||
|
retro.putExtra("LIBRETRO", corePath);
|
||||||
|
retro.putExtra("CONFIGFILE", configFilePath);
|
||||||
|
retro.putExtra("IME", imePath);
|
||||||
|
retro.putExtra("DATADIR", dataDirPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user