[Android] General cleanup. Add more documentation.
Remove some accidental changes that slipped through. Don't want to have input settings in the settings menu just yet.
This commit is contained in:
parent
951bbcd6ce
commit
41c25d0c90
|
@ -23,17 +23,8 @@ import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment;
|
||||||
public final class AboutFragment extends Fragment
|
public final class AboutFragment extends Fragment
|
||||||
{
|
{
|
||||||
private static Activity m_activity;
|
private static Activity m_activity;
|
||||||
|
|
||||||
private ListView mMainList;
|
private ListView mMainList;
|
||||||
|
|
||||||
private FolderBrowserAdapter adapter;
|
private FolderBrowserAdapter adapter;
|
||||||
boolean Configuring = false;
|
|
||||||
boolean firstEvent = true;
|
|
||||||
|
|
||||||
public AboutFragment()
|
|
||||||
{
|
|
||||||
// Empty constructor required for fragment subclasses
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
|
|
@ -4,12 +4,20 @@ import android.content.Context;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The surface that rendering is done to.
|
||||||
|
*/
|
||||||
public final class NativeGLSurfaceView extends SurfaceView
|
public final class NativeGLSurfaceView extends SurfaceView
|
||||||
{
|
{
|
||||||
private static Thread myRun;
|
private static Thread myRun;
|
||||||
private static boolean Running = false;
|
private static boolean Running = false;
|
||||||
private static boolean Created = false;
|
private static boolean Created = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param context The current {@link Context}.
|
||||||
|
*/
|
||||||
public NativeGLSurfaceView(Context context)
|
public NativeGLSurfaceView(Context context)
|
||||||
{
|
{
|
||||||
super(context);
|
super(context);
|
||||||
|
|
|
@ -19,6 +19,19 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
|
import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A basic folder browser {@link Fragment} that allows
|
||||||
|
* the user to select ISOs/ROMs for playing within the
|
||||||
|
* emulator.
|
||||||
|
* <p>
|
||||||
|
* Any valid ISO/ROM selected in this will be added to
|
||||||
|
* the game list for easy browsing the next time the
|
||||||
|
* application is used.
|
||||||
|
* <p>
|
||||||
|
* Note that invalid items will be shown in the color red. <br/>
|
||||||
|
* Also note that this file browser does not display files
|
||||||
|
* or directories that are hidden
|
||||||
|
*/
|
||||||
public final class FolderBrowser extends Fragment
|
public final class FolderBrowser extends Fragment
|
||||||
{
|
{
|
||||||
private Activity m_activity;
|
private Activity m_activity;
|
||||||
|
@ -69,7 +82,7 @@ public final class FolderBrowser extends Fragment
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.d("EXCEPTION", ex.toString());
|
Log.e("Exception-FolderBrowser", ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +149,8 @@ public final class FolderBrowser extends Fragment
|
||||||
+ " must implement OnGameListZeroListener");
|
+ " must implement OnGameListZeroListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void FolderSelected()
|
private void FolderSelected()
|
||||||
{
|
{
|
||||||
String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
|
String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
|
||||||
|
|
|
@ -12,6 +12,12 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ArrayAdapter} that backs the file browser.
|
||||||
|
* <p>
|
||||||
|
* This is responsible for correctly handling the display
|
||||||
|
* of the items for the UI.
|
||||||
|
*/
|
||||||
public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
|
public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
|
||||||
{
|
{
|
||||||
private final Context c;
|
private final Context c;
|
||||||
|
@ -26,6 +32,7 @@ public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
|
||||||
items = objects;
|
items = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FolderBrowserItem getItem(int i)
|
public FolderBrowserItem getItem(int i)
|
||||||
{
|
{
|
||||||
return items.get(i);
|
return items.get(i);
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -26,9 +32,8 @@ import org.dolphinemu.dolphinemu.sidemenu.SideMenuAdapter;
|
||||||
import org.dolphinemu.dolphinemu.sidemenu.SideMenuItem;
|
import org.dolphinemu.dolphinemu.sidemenu.SideMenuItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Dolphin Emulator Project
|
* The activity that implements all of the functions
|
||||||
* Licensed under GPLv2
|
* for the game list.
|
||||||
* Refer to the license.txt file included.
|
|
||||||
*/
|
*/
|
||||||
public final class GameListActivity extends Activity
|
public final class GameListActivity extends Activity
|
||||||
implements GameListFragment.OnGameListZeroListener
|
implements GameListFragment.OnGameListZeroListener
|
||||||
|
@ -40,8 +45,24 @@ public final class GameListActivity extends Activity
|
||||||
private DrawerLayout mDrawerLayout;
|
private DrawerLayout mDrawerLayout;
|
||||||
private SideMenuAdapter mDrawerAdapter;
|
private SideMenuAdapter mDrawerAdapter;
|
||||||
private ListView mDrawerList;
|
private ListView mDrawerList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface defining methods which handle
|
||||||
|
* the binding of specific key presses within
|
||||||
|
* the input mapping settings.
|
||||||
|
*/
|
||||||
|
public interface OnGameConfigListener
|
||||||
|
{
|
||||||
|
boolean onMotionEvent(MotionEvent event);
|
||||||
|
boolean onKeyEvent(KeyEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
// Called from the game list fragment
|
/**
|
||||||
|
* Called from the {@link GameListFragment}.
|
||||||
|
* <p>
|
||||||
|
* This is called when there are no games
|
||||||
|
* currently present within the game list.
|
||||||
|
*/
|
||||||
public void onZeroFiles()
|
public void onZeroFiles()
|
||||||
{
|
{
|
||||||
mDrawerLayout.openDrawer(mDrawerList);
|
mDrawerLayout.openDrawer(mDrawerList);
|
||||||
|
@ -100,6 +121,12 @@ public final class GameListActivity extends Activity
|
||||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switches to the {@link Fragment} represented
|
||||||
|
* by the given ID number.
|
||||||
|
*
|
||||||
|
* @param toPage the number representing the {@link Fragment} to switch to.l
|
||||||
|
*/
|
||||||
public void SwitchPage(int toPage)
|
public void SwitchPage(int toPage)
|
||||||
{
|
{
|
||||||
if (mCurFragmentNum == toPage)
|
if (mCurFragmentNum == toPage)
|
||||||
|
@ -194,11 +221,11 @@ public final class GameListActivity extends Activity
|
||||||
SwitchPage(o.getID());
|
SwitchPage(o.getID());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using the ActionBarDrawerToggle, you must call it during
|
* When using the ActionBarDrawerToggle, you must call it during
|
||||||
* onPostCreate() and onConfigurationChanged()...
|
* onPostCreate() and onConfigurationChanged()...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState)
|
protected void onPostCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
@ -235,17 +262,12 @@ public final class GameListActivity extends Activity
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onBackPressed()
|
public void onBackPressed()
|
||||||
{
|
{
|
||||||
SwitchPage(0);
|
SwitchPage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnGameConfigListener
|
|
||||||
{
|
|
||||||
public boolean onMotionEvent(MotionEvent event);
|
|
||||||
public boolean onKeyEvent(KeyEvent event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets move(triggers, joystick) events
|
// Gets move(triggers, joystick) events
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchGenericMotionEvent(MotionEvent event)
|
public boolean dispatchGenericMotionEvent(MotionEvent event)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -12,6 +18,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The adapter backing the game list.
|
||||||
|
* <p>
|
||||||
|
* Responsible for handling each game list item individually.
|
||||||
|
*/
|
||||||
public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
||||||
{
|
{
|
||||||
private final Context c;
|
private final Context c;
|
||||||
|
@ -26,6 +37,7 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
||||||
items = objects;
|
items = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public GameListItem getItem(int i)
|
public GameListItem getItem(int i)
|
||||||
{
|
{
|
||||||
return items.get(i);
|
return items.get(i);
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -22,26 +28,28 @@ import java.util.Set;
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Dolphin Emulator Project
|
* The {@link Fragment} responsible for displaying the game list.
|
||||||
* Licensed under GPLv2
|
|
||||||
* Refer to the license.txt file included.
|
|
||||||
*/
|
*/
|
||||||
public final class GameListFragment extends Fragment
|
public final class GameListFragment extends Fragment
|
||||||
{
|
{
|
||||||
private ListView mMainList;
|
private ListView mMainList;
|
||||||
private GameListAdapter mGameAdapter;
|
private GameListAdapter mGameAdapter;
|
||||||
private static GameListActivity mMe;
|
private static GameListActivity mMe;
|
||||||
OnGameListZeroListener mCallback;
|
private OnGameListZeroListener mCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface that defines how to handle the case
|
||||||
|
* when there are zero game.
|
||||||
|
*/
|
||||||
public interface OnGameListZeroListener
|
public interface OnGameListZeroListener
|
||||||
{
|
{
|
||||||
public void onZeroFiles();
|
/**
|
||||||
}
|
* This is called when there are no games
|
||||||
|
* currently present within the game list.
|
||||||
public GameListFragment()
|
*/
|
||||||
{
|
void onZeroFiles();
|
||||||
// Empty constructor required for fragment subclasses
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Fill()
|
private void Fill()
|
||||||
|
@ -97,8 +105,11 @@ public final class GameListFragment extends Fragment
|
||||||
|
|
||||||
mGameAdapter = new GameListAdapter(mMe, R.layout.gamelist_layout, fls);
|
mGameAdapter = new GameListAdapter(mMe, R.layout.gamelist_layout, fls);
|
||||||
mMainList.setAdapter(mGameAdapter);
|
mMainList.setAdapter(mGameAdapter);
|
||||||
if (fls.size() == 0)
|
|
||||||
|
if (fls.isEmpty())
|
||||||
|
{
|
||||||
mCallback.onZeroFiles();
|
mCallback.onZeroFiles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -10,6 +17,9 @@ import java.io.InputStream;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an item in the game list.
|
||||||
|
*/
|
||||||
public final class GameListItem implements Comparable<GameListItem>
|
public final class GameListItem implements Comparable<GameListItem>
|
||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -18,6 +28,15 @@ public final class GameListItem implements Comparable<GameListItem>
|
||||||
private final boolean isValid;
|
private final boolean isValid;
|
||||||
private Bitmap image;
|
private Bitmap image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param ctx The current {@link Context}
|
||||||
|
* @param name The name of this GameListItem.
|
||||||
|
* @param data The subtitle for this GameListItem
|
||||||
|
* @param path The file path for the game represented by this GameListItem.
|
||||||
|
* @param isValid Whether or not the emulator can handle this file.
|
||||||
|
*/
|
||||||
public GameListItem(Context ctx, String name, String data, String path, boolean isValid)
|
public GameListItem(Context ctx, String name, String data, String path, boolean isValid)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -44,8 +63,7 @@ public final class GameListItem implements Comparable<GameListItem>
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated catch block
|
Log.e("Exception-GameListItem", e.toString());
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -57,26 +75,51 @@ public final class GameListItem implements Comparable<GameListItem>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of this GameListItem.
|
||||||
|
*
|
||||||
|
* @return the name of this GameListItem.
|
||||||
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the subtitle of this GameListItem.
|
||||||
|
*
|
||||||
|
* @return the subtitle of this GameListItem.
|
||||||
|
*/
|
||||||
public String getData()
|
public String getData()
|
||||||
{
|
{
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the file path of the game represented by this GameListItem.
|
||||||
|
*
|
||||||
|
* @return the file path of the game represented by this GameListItem.
|
||||||
|
*/
|
||||||
public String getPath()
|
public String getPath()
|
||||||
{
|
{
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the image data for this game as a {@link Bitmap}.
|
||||||
|
*
|
||||||
|
* @return the image data for this game as a {@link Bitmap}.
|
||||||
|
*/
|
||||||
public Bitmap getImage()
|
public Bitmap getImage()
|
||||||
{
|
{
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether or not the emulator can handle this GameListItem.
|
||||||
|
*
|
||||||
|
* @return true, if this GameListItem can be handled by the emulator; false, otherwise.
|
||||||
|
*/
|
||||||
public boolean isValid()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
return isValid;
|
return isValid;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.inputconfig;
|
package org.dolphinemu.dolphinemu.inputconfig;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -12,9 +18,9 @@ import java.util.List;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Dolphin Emulator Project
|
* The adapter backing the input mapping configuration.
|
||||||
* Licensed under GPLv2
|
* <p>
|
||||||
* Refer to the license.txt file included.
|
* Responsible for handling the list items.
|
||||||
*/
|
*/
|
||||||
public final class InputConfigAdapter extends ArrayAdapter<InputConfigItem>
|
public final class InputConfigAdapter extends ArrayAdapter<InputConfigItem>
|
||||||
{
|
{
|
||||||
|
@ -30,6 +36,7 @@ public final class InputConfigAdapter extends ArrayAdapter<InputConfigItem>
|
||||||
items = objects;
|
items = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InputConfigItem getItem(int i)
|
public InputConfigItem getItem(int i)
|
||||||
{
|
{
|
||||||
return items.get(i);
|
return items.get(i);
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.inputconfig;
|
package org.dolphinemu.dolphinemu.inputconfig;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -17,9 +23,8 @@ import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
|
import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Dolphin Emulator Project
|
* The {@link Fragment} responsible for implementing the functionality
|
||||||
* Licensed under GPLv2
|
* within the input control mapping config.
|
||||||
* Refer to the license.txt file included.
|
|
||||||
*/
|
*/
|
||||||
public final class InputConfigFragment extends Fragment
|
public final class InputConfigFragment extends Fragment
|
||||||
implements GameListActivity.OnGameConfigListener
|
implements GameListActivity.OnGameConfigListener
|
||||||
|
@ -31,7 +36,14 @@ public final class InputConfigFragment extends Fragment
|
||||||
private boolean Configuring = false;
|
private boolean Configuring = false;
|
||||||
private boolean firstEvent = true;
|
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)
|
if (input == null)
|
||||||
return "null"; // Happens when the inputdevice is from an unknown source
|
return "null"; // Happens when the inputdevice is from an unknown source
|
||||||
|
@ -109,6 +121,11 @@ public final class InputConfigFragment extends Fragment
|
||||||
adapter.insert(o, configPosition);
|
adapter.insert(o, configPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current {@link InputConfigAdapter}
|
||||||
|
*
|
||||||
|
* @return the current {@link InputConfigAdapter}.
|
||||||
|
*/
|
||||||
public InputConfigAdapter getAdapter()
|
public InputConfigAdapter getAdapter()
|
||||||
{
|
{
|
||||||
return adapter;
|
return adapter;
|
||||||
|
@ -157,6 +174,7 @@ public final class InputConfigFragment extends Fragment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from GameListActivity
|
||||||
public boolean onKeyEvent(KeyEvent event)
|
public boolean onKeyEvent(KeyEvent event)
|
||||||
{
|
{
|
||||||
Log.w("InputConfigFragment", "Got Event " + event.getAction());
|
Log.w("InputConfigFragment", "Got Event " + event.getAction());
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.dolphinemu.dolphinemu.settings;
|
package org.dolphinemu.dolphinemu.settings;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment;
|
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.ActionBar.Tab;
|
import android.app.ActionBar.Tab;
|
||||||
|
@ -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
|
* 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}.
|
* switch to a {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||||
*/
|
*/
|
||||||
SectionsPagerAdapter mSectionsPagerAdapter;
|
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ViewPager} that will host the section contents.
|
* The {@link ViewPager} that will host the section contents.
|
||||||
*/
|
*/
|
||||||
ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
@ -73,7 +72,6 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
|
||||||
// the TabListener interface, as the callback (listener) for when
|
// the TabListener interface, as the callback (listener) for when
|
||||||
// this tab is selected.
|
// this tab is selected.
|
||||||
actionBar.addTab(actionBar.newTab().setText(R.string.cpu_settings).setTabListener(this));
|
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));
|
actionBar.addTab(actionBar.newTab().setText(R.string.video_settings).setTabListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +92,8 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to one of the
|
* A {@link FragmentPagerAdapter} that returns a fragment
|
||||||
* sections/tabs/pages.
|
* corresponding to one of the sections/tabs/pages.
|
||||||
*/
|
*/
|
||||||
public final class SectionsPagerAdapter extends FragmentPagerAdapter
|
public final class SectionsPagerAdapter extends FragmentPagerAdapter
|
||||||
{
|
{
|
||||||
|
@ -113,9 +111,6 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
|
||||||
return new CPUSettingsFragment();
|
return new CPUSettingsFragment();
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return new InputConfigFragment();
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return new VideoSettingsFragment();
|
return new VideoSettingsFragment();
|
||||||
|
|
||||||
default: // Should never happen.
|
default: // Should never happen.
|
||||||
|
@ -127,7 +122,7 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
|
||||||
public int getCount()
|
public int getCount()
|
||||||
{
|
{
|
||||||
// Show total pages.
|
// Show total pages.
|
||||||
return 3;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,9 +134,6 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen
|
||||||
return getString(R.string.cpu_settings).toUpperCase();
|
return getString(R.string.cpu_settings).toUpperCase();
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return "Input Settings";//getString(R.string)
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return getString(R.string.video_settings).toUpperCase();
|
return getString(R.string.video_settings).toUpperCase();
|
||||||
|
|
||||||
default: // Should never happen.
|
default: // Should never happen.
|
||||||
|
|
|
@ -27,15 +27,19 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||||
{
|
{
|
||||||
private Activity m_activity;
|
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;
|
private EGL10 mEGL;
|
||||||
EGLDisplay mEGLDisplay;
|
private EGLDisplay mEGLDisplay;
|
||||||
EGLConfig[] mEGLConfigs;
|
private EGLConfig[] mEGLConfigs;
|
||||||
EGLConfig mEGLConfig;
|
private EGLConfig mEGLConfig;
|
||||||
EGLContext mEGLContext;
|
private EGLContext mEGLContext;
|
||||||
EGLSurface mEGLSurface;
|
private EGLSurface mEGLSurface;
|
||||||
GL10 mGL;
|
private GL10 mGL;
|
||||||
|
|
||||||
String mThreadOwner;
|
String mThreadOwner;
|
||||||
|
|
||||||
|
@ -68,16 +72,31 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||||
mThreadOwner = Thread.currentThread().getName();
|
mThreadOwner = Thread.currentThread().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the OpenGL ES version string.
|
||||||
|
*
|
||||||
|
* @return the OpenGL ES version string.
|
||||||
|
*/
|
||||||
public String getVersion()
|
public String getVersion()
|
||||||
{
|
{
|
||||||
return mGL.glGetString(GL10.GL_VERSION);
|
return mGL.glGetString(GL10.GL_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the OpenGL ES vendor string.
|
||||||
|
*
|
||||||
|
* @return the OpenGL ES vendor string.
|
||||||
|
*/
|
||||||
public String getVendor()
|
public String getVendor()
|
||||||
{
|
{
|
||||||
return mGL.glGetString(GL10.GL_VENDOR);
|
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()
|
public String getRenderer()
|
||||||
{
|
{
|
||||||
return mGL.glGetString(GL10.GL_RENDERER);
|
return mGL.glGetString(GL10.GL_RENDERER);
|
||||||
|
@ -107,6 +126,11 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this device supports OpenGL ES 3.
|
||||||
|
*
|
||||||
|
* @return true if this device supports OpenGL ES 3; false otherwise.
|
||||||
|
*/
|
||||||
public static boolean SupportsGLES3()
|
public static boolean SupportsGLES3()
|
||||||
{
|
{
|
||||||
VersionCheck mbuffer = new VersionCheck();
|
VersionCheck mbuffer = new VersionCheck();
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Dolphin Emulator Project
|
||||||
|
* Licensed under GPLv2
|
||||||
|
* Refer to the license.txt file included.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu.sidemenu;
|
package org.dolphinemu.dolphinemu.sidemenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -11,6 +17,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
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>
|
public final class SideMenuAdapter extends ArrayAdapter<SideMenuItem>
|
||||||
{
|
{
|
||||||
private final Context c;
|
private final Context c;
|
||||||
|
@ -25,6 +36,7 @@ public final class SideMenuAdapter extends ArrayAdapter<SideMenuItem>
|
||||||
items = objects;
|
items = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SideMenuItem getItem(int i)
|
public SideMenuItem getItem(int i)
|
||||||
{
|
{
|
||||||
return items.get(i);
|
return items.get(i);
|
||||||
|
|
|
@ -12,8 +12,8 @@ package org.dolphinemu.dolphinemu.sidemenu;
|
||||||
*/
|
*/
|
||||||
public final class SideMenuItem implements Comparable<SideMenuItem>
|
public final class SideMenuItem implements Comparable<SideMenuItem>
|
||||||
{
|
{
|
||||||
private final String m_name;
|
private final String name;
|
||||||
private final int m_id;
|
private final int id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -23,8 +23,8 @@ public final class SideMenuItem implements Comparable<SideMenuItem>
|
||||||
*/
|
*/
|
||||||
public SideMenuItem(String name, int id)
|
public SideMenuItem(String name, int id)
|
||||||
{
|
{
|
||||||
m_name = name;
|
this.name = name;
|
||||||
m_id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ public final class SideMenuItem implements Comparable<SideMenuItem>
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return m_name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,13 +44,13 @@ public final class SideMenuItem implements Comparable<SideMenuItem>
|
||||||
*/
|
*/
|
||||||
public int getID()
|
public int getID()
|
||||||
{
|
{
|
||||||
return m_id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(SideMenuItem o)
|
public int compareTo(SideMenuItem o)
|
||||||
{
|
{
|
||||||
if (this.m_name != null)
|
if (name != null)
|
||||||
return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
|
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
|
||||||
else
|
else
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue