mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
[Android] Document a large amount of the Android front-end classes (also some methods).
Also adjusted the tab indentation of the GPL waiver method, was one tab too far.
This commit is contained in:
parent
d07d97e517
commit
071b2c8e6a
@ -14,8 +14,10 @@ import android.os.*;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
|
||||
// JELLY_BEAN_MR1 = 17
|
||||
|
||||
/**
|
||||
* {@link ListActivity} subclass that displays the list
|
||||
* of selectable cores for emulating games.
|
||||
*/
|
||||
public final class CoreSelection extends ListActivity {
|
||||
private IconAdapter<ModuleWrapper> adapter;
|
||||
|
||||
|
@ -15,6 +15,10 @@ import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* {@link Activity} subclass that provides the functionality
|
||||
* for the refresh rate testing for device displays.
|
||||
*/
|
||||
public final class DisplayRefreshRateTest extends Activity {
|
||||
|
||||
private class Renderer implements GLSurfaceView.Renderer {
|
||||
|
@ -6,6 +6,9 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Basic {@link PreferenceActivity} responsible for displaying the help articles.
|
||||
*/
|
||||
public final class HelpActivity extends PreferenceActivity {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
|
@ -17,6 +17,10 @@ import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Represents the {@link ListActivity} responsible
|
||||
* for displaying the list of previously played games.
|
||||
*/
|
||||
public final class HistorySelection extends ListActivity {
|
||||
|
||||
private IconAdapter<HistoryWrapper> adapter;
|
||||
|
@ -4,13 +4,24 @@ import java.io.File;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/**
|
||||
* Wraps a previously played game along with its core
|
||||
* for placement within the previously played history.
|
||||
*/
|
||||
public final class HistoryWrapper implements IconAdapterItem {
|
||||
|
||||
|
||||
private String gamePath;
|
||||
private String gamePathShort;
|
||||
private String corePath;
|
||||
private String coreName;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param gamePath Path to the previously played game.
|
||||
* @param corePath Path to the core the previously played game uses.
|
||||
* @param coreName The actual name of the core.
|
||||
*/
|
||||
public HistoryWrapper(String gamePath, String corePath, String coreName) {
|
||||
this.gamePath = gamePath;
|
||||
this.corePath = corePath;
|
||||
@ -23,15 +34,30 @@ public final class HistoryWrapper implements IconAdapterItem {
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the path to the previously played game.
|
||||
*
|
||||
* @return the path to the previously played game.
|
||||
*/
|
||||
public String getGamePath() {
|
||||
return gamePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the path to the core that the previously played game uses.
|
||||
*
|
||||
* @return the path to the core that the previously played game uses.
|
||||
*/
|
||||
public String getCorePath() {
|
||||
return corePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the core used with the previously played game.
|
||||
*
|
||||
* @return the name of the core used with the previously played game.
|
||||
*/
|
||||
public String getCoreName() {
|
||||
return coreName;
|
||||
}
|
||||
|
@ -21,6 +21,10 @@ import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* {@link PreferenceActivity} subclass that provides all of the
|
||||
* functionality of the main menu screen.
|
||||
*/
|
||||
public final class MainMenuActivity extends PreferenceActivity {
|
||||
private static MainMenuActivity instance = null;
|
||||
private static final int ACTIVITY_LOAD_ROM = 0;
|
||||
@ -30,30 +34,30 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
private static String libretro_name;
|
||||
|
||||
private void showGPLWaiver() {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.gpl_waiver)
|
||||
.setMessage(R.string.gpl_waiver_desc)
|
||||
.setPositiveButton("Keep", null)
|
||||
.setNegativeButton("Remove non-GPL cores",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final File[] libs = new File(getApplicationInfo().dataDir, "/cores").listFiles();
|
||||
for (final File lib : libs) {
|
||||
ModuleWrapper module = new ModuleWrapper(getApplicationContext(), lib);
|
||||
|
||||
boolean gplv3 = module.getCoreLicense().equals("GPLv3");
|
||||
boolean gplv2 = module.getCoreLicense().equals("GPLv2");
|
||||
|
||||
if (!gplv3 && !gplv2) {
|
||||
String libName = lib.getName();
|
||||
Log.i("GPL WAIVER", "Deleting non-GPL core" + libName + "...");
|
||||
lib.delete();
|
||||
}
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.gpl_waiver)
|
||||
.setMessage(R.string.gpl_waiver_desc)
|
||||
.setPositiveButton("Keep", null)
|
||||
.setNegativeButton("Remove non-GPL cores",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final File[] libs = new File(getApplicationInfo().dataDir, "/cores").listFiles();
|
||||
for (final File lib : libs) {
|
||||
ModuleWrapper module = new ModuleWrapper(getApplicationContext(), lib);
|
||||
|
||||
boolean gplv3 = module.getCoreLicense().equals("GPLv3");
|
||||
boolean gplv2 = module.getCoreLicense().equals("GPLv2");
|
||||
|
||||
if (!gplv3 && !gplv2) {
|
||||
String libName = lib.getName();
|
||||
Log.i("GPL WAIVER", "Deleting non-GPL core" + libName + "...");
|
||||
lib.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.retroarch.browser;
|
||||
|
||||
// Helper class which calls into JNI for various tasks.
|
||||
/**
|
||||
* Helper class which calls into JNI for various tasks.
|
||||
*/
|
||||
public final class NativeInterface {
|
||||
|
||||
static {
|
||||
|
@ -8,6 +8,9 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* The {@link Activity} derivative responsible for displaying the TV Mode feature.
|
||||
*/
|
||||
public final class RetroTVMode extends Activity {
|
||||
private static final String TAG = "RetroTVMode";
|
||||
private static final int ACTIVITY_RETROARCH = 1;
|
||||
|
@ -15,7 +15,17 @@ import android.os.*;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
|
||||
|
||||
/**
|
||||
* {@link ListActivity} subclass that provides a file-browser
|
||||
* like UI for browsing for specific files.
|
||||
* <p>
|
||||
* This file browser also allows for custom filtering
|
||||
* depending on the type of class that inherits it.
|
||||
* <p>
|
||||
* This file browser also uses an implementation of a
|
||||
* backstack for remembering previously browsed folders
|
||||
* within this DirectoryActivity.
|
||||
*/
|
||||
public class DirectoryActivity extends ListActivity {
|
||||
private IconAdapter<FileWrapper> adapter;
|
||||
private File listedDirectory;
|
||||
@ -180,14 +190,37 @@ public class DirectoryActivity extends ListActivity {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows specifying an allowed file extension.
|
||||
* <p>
|
||||
* Any files that contain this file extension will be shown
|
||||
* within the DirectoryActivity file browser. Those that don't
|
||||
* contain this extension will not be shows.
|
||||
* <p>
|
||||
* It is possible to specify more than one allowed extension by
|
||||
* simply calling this method with a different file extension specified.
|
||||
*
|
||||
* @param ext The file extension to allow being shown in this DirectoryActivity.
|
||||
*/
|
||||
protected void addAllowedExt(String ext) {
|
||||
if (allowedExt == null)
|
||||
allowedExt = new ArrayList<String>();
|
||||
|
||||
allowedExt.add(ext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows specifying a disallowed file extension.
|
||||
* <p>
|
||||
* Any files that contain this file extension will not be shown
|
||||
* within the DirectoryActivity file browser.
|
||||
* <p>
|
||||
* It is possible to specify more than one disallowed extension by
|
||||
* simply calling this method with a different file extension specified.
|
||||
*
|
||||
* @param ext The file extension to hide from being shown in this DirectoryActivity.
|
||||
*/
|
||||
protected void addDisallowedExt(String ext) {
|
||||
if (disallowedExt == null)
|
||||
disallowedExt = new ArrayList<String>();
|
||||
|
@ -4,6 +4,12 @@ import java.io.File;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem for input overlays.
|
||||
* @author Lioncash-yay
|
||||
*
|
||||
*/
|
||||
public final class OverlayActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -7,6 +7,11 @@ import com.retroarch.browser.preferences.util.UserPreferences;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem for selecting
|
||||
* a ROM file to execute during emulation.
|
||||
*/
|
||||
public final class ROMActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -2,6 +2,11 @@ package com.retroarch.browser.diractivities;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem to select
|
||||
* a custom ROM directory.
|
||||
*/
|
||||
public final class ROMDirActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -2,6 +2,11 @@ package com.retroarch.browser.diractivities;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem for selecting
|
||||
* a custom save file directory.
|
||||
*/
|
||||
public final class SRMDirActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -4,6 +4,11 @@ import java.io.File;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem for selecting
|
||||
* a shader to use during emulation.
|
||||
*/
|
||||
public final class ShaderActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -2,6 +2,11 @@ package com.retroarch.browser.diractivities;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem to select
|
||||
* a custom save state directory.
|
||||
*/
|
||||
public final class StateDirActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -2,6 +2,13 @@ package com.retroarch.browser.diractivities;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* {@link DirectoryActivity} subclass used for the sole
|
||||
* purpose of navigating the Android filesystem for selecting
|
||||
* a custom 'System' directory that the cores will look in for
|
||||
* required files, such as BIOS files and other miscellaneous
|
||||
* system-required files.
|
||||
*/
|
||||
public final class SystemDirActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user