@@ -1,3 +1,9 @@
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

package org.dolphinemu.dolphinemu.inputconfig;

import android.content.Context;
Expand All @@ -12,9 +18,9 @@
import org.dolphinemu.dolphinemu.R;

/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
* The adapter backing the input mapping configuration.
* <p>
* Responsible for handling the list items.
*/
public final class InputConfigAdapter extends ArrayAdapter<InputConfigItem>
{
Expand All @@ -30,6 +36,7 @@ public InputConfigAdapter(Context context, int textViewResourceId, List<InputCon
items = objects;
}

@Override
public InputConfigItem getItem(int i)
{
return items.get(i);
Expand Down
@@ -1,3 +1,9 @@
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

package org.dolphinemu.dolphinemu.inputconfig;

import android.app.Activity;
Expand All @@ -17,9 +23,8 @@
import org.dolphinemu.dolphinemu.gamelist.GameListActivity;

/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
* The {@link Fragment} responsible for implementing the functionality
* within the input control mapping config.
*/
public final class InputConfigFragment extends Fragment
implements GameListActivity.OnGameConfigListener
Expand All @@ -31,7 +36,14 @@ public final class InputConfigFragment extends Fragment
private boolean Configuring = false;
private boolean firstEvent = true;

static public String getInputDesc(InputDevice input)
/**
* Gets the descriptor for the given {@link InputDevice}.
*
* @param input The {@link InputDevice} to get the descriptor of.
*
* @return the descriptor for the given {@link InputDevice}.
*/
public static String getInputDesc(InputDevice input)
{
if (input == null)
return "null"; // Happens when the inputdevice is from an unknown source
Expand Down Expand Up @@ -109,6 +121,11 @@ private void AssignBind(String bind)
adapter.insert(o, configPosition);
}

/**
* Gets the current {@link InputConfigAdapter}
*
* @return the current {@link InputConfigAdapter}.
*/
public InputConfigAdapter getAdapter()
{
return adapter;
Expand Down Expand Up @@ -157,6 +174,7 @@ else if (m_values.get(a) < (event.getAxisValue(range.getAxis()) - 0.5f))
return true;
}

// Called from GameListActivity
public boolean onKeyEvent(KeyEvent event)
{
Log.w("InputConfigFragment", "Got Event " + event.getAction());
Expand Down
Expand Up @@ -7,7 +7,6 @@
package org.dolphinemu.dolphinemu.settings;

import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
Expand All @@ -31,12 +30,12 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
* keep every loaded fragment in memory. If this becomes too memory intensive, it may be best to
* switch to a {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
SectionsPagerAdapter mSectionsPagerAdapter;
private SectionsPagerAdapter mSectionsPagerAdapter;

/**
* The {@link ViewPager} that will host the section contents.
*/
ViewPager mViewPager;
private ViewPager mViewPager;

@Override
protected void onCreate(Bundle savedInstanceState)
Expand Down Expand Up @@ -73,7 +72,6 @@ public void onPageSelected(int position)
// the TabListener interface, as the callback (listener) for when
// this tab is selected.
actionBar.addTab(actionBar.newTab().setText(R.string.cpu_settings).setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("Input Settings").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText(R.string.video_settings).setTabListener(this));
}

Expand All @@ -94,8 +92,8 @@ public void onTabUnselected(Tab tab, FragmentTransaction ft)
}

/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to one of the
* sections/tabs/pages.
* A {@link FragmentPagerAdapter} that returns a fragment
* corresponding to one of the sections/tabs/pages.
*/
public final class SectionsPagerAdapter extends FragmentPagerAdapter
{
Expand All @@ -113,9 +111,6 @@ public Fragment getItem(int position)
return new CPUSettingsFragment();

case 1:
return new InputConfigFragment();

case 2:
return new VideoSettingsFragment();

default: // Should never happen.
Expand All @@ -127,7 +122,7 @@ public Fragment getItem(int position)
public int getCount()
{
// Show total pages.
return 3;
return 2;
}

@Override
Expand All @@ -139,9 +134,6 @@ public CharSequence getPageTitle(int position)
return getString(R.string.cpu_settings).toUpperCase();

case 1:
return "Input Settings";//getString(R.string)

case 2:
return getString(R.string.video_settings).toUpperCase();

default: // Should never happen.
Expand Down
Expand Up @@ -27,15 +27,19 @@ public final class VideoSettingsFragment extends PreferenceFragment
{
private Activity m_activity;

public static class VersionCheck
/**
* Class which provides a means to check various
* info about the OpenGL ES support for a device.
*/
public static final class VersionCheck
{
EGL10 mEGL;
EGLDisplay mEGLDisplay;
EGLConfig[] mEGLConfigs;
EGLConfig mEGLConfig;
EGLContext mEGLContext;
EGLSurface mEGLSurface;
GL10 mGL;
private EGL10 mEGL;
private EGLDisplay mEGLDisplay;
private EGLConfig[] mEGLConfigs;
private EGLConfig mEGLConfig;
private EGLContext mEGLContext;
private EGLSurface mEGLSurface;
private GL10 mGL;

String mThreadOwner;

Expand Down Expand Up @@ -68,16 +72,31 @@ public VersionCheck()
mThreadOwner = Thread.currentThread().getName();
}

/**
* Gets the OpenGL ES version string.
*
* @return the OpenGL ES version string.
*/
public String getVersion()
{
return mGL.glGetString(GL10.GL_VERSION);
}

/**
* Gets the OpenGL ES vendor string.
*
* @return the OpenGL ES vendor string.
*/
public String getVendor()
{
return mGL.glGetString(GL10.GL_VENDOR);
}

/**
* Gets the name of the OpenGL ES renderer.
*
* @return the name of the OpenGL ES renderer.
*/
public String getRenderer()
{
return mGL.glGetString(GL10.GL_RENDERER);
Expand Down Expand Up @@ -107,6 +126,11 @@ private EGLConfig chooseConfig()
}
}

/**
* Checks if this device supports OpenGL ES 3.
*
* @return true if this device supports OpenGL ES 3; false otherwise.
*/
public static boolean SupportsGLES3()
{
VersionCheck mbuffer = new VersionCheck();
Expand Down
@@ -1,3 +1,9 @@
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

package org.dolphinemu.dolphinemu.sidemenu;

import android.content.Context;
Expand All @@ -11,6 +17,11 @@

import org.dolphinemu.dolphinemu.R;

/**
* Adapter that backs the sidebar menu.
* <p>
* Responsible for handling the elements of each sidebar item.
*/
public final class SideMenuAdapter extends ArrayAdapter<SideMenuItem>
{
private final Context c;
Expand All @@ -25,6 +36,7 @@ public SideMenuAdapter(Context context, int textViewResourceId, List<SideMenuIte
items = objects;
}

@Override
public SideMenuItem getItem(int i)
{
return items.get(i);
Expand Down
Expand Up @@ -12,8 +12,8 @@
*/
public final class SideMenuItem implements Comparable<SideMenuItem>
{
private final String m_name;
private final int m_id;
private final String name;
private final int id;

/**
* Constructor
Expand All @@ -23,8 +23,8 @@ public final class SideMenuItem implements Comparable<SideMenuItem>
*/
public SideMenuItem(String name, int id)
{
m_name = name;
m_id = id;
this.name = name;
this.id = id;
}

/**
Expand All @@ -34,7 +34,7 @@ public SideMenuItem(String name, int id)
*/
public String getName()
{
return m_name;
return name;
}

/**
Expand All @@ -44,13 +44,13 @@ public String getName()
*/
public int getID()
{
return m_id;
return id;
}

public int compareTo(SideMenuItem o)
{
if (this.m_name != null)
return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
if (name != null)
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
else
throw new IllegalArgumentException();
}
Expand Down