113 changes: 113 additions & 0 deletions Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java
@@ -0,0 +1,113 @@
package org.dolphinemu.dolphinemu;

import java.io.File;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;

/**
* Represents an item in the folder browser list.
*/
public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
{
private final Context ctx;
private final String name;
private final String subtitle;
private final String path;
private final boolean isValid;
private final File underlyingFile;

/**
* Constructor
*
* @param ctx Context this FolderBrowserItem is being used in.
* @param name The name of the file/folder represented by this item.
* @param subtitle The subtitle of this FolderBrowserItem to display.
* @param path The path of the file/folder represented by this item.
* @param isValid Whether or not this item represents a file type that can be handled.
*/
public FolderBrowserItem(Context ctx, String name, String subtitle, String path, boolean isValid)
{
this.ctx = ctx;
this.name = name;
this.subtitle = subtitle;
this.path = path;
this.isValid = isValid;
this.underlyingFile = new File(path);
}

/**
* Gets the name of the file/folder represented by this FolderBrowserItem.
*
* @return the name of the file/folder represented by this FolderBrowserItem.
*/
public String getName()
{
return name;
}

/**
* Gets the subtitle text of this FolderBrowserItem.
*
* @return the subtitle text of this FolderBrowserItem.
*/
public String getSubtitle()
{
return subtitle;
}

/**
* Gets the path of the file/folder represented by this FolderBrowserItem.
*
* @return the path of the file/folder represented by this FolderBrowserItem.
*/
public String getPath()
{
return path;
}

/**
* Gets whether or not the file represented
* by this FolderBrowserItem is supported
* and can be handled correctly.
*
* @return whether or not the file represented
* by this FolderBrowserItem is supported
* and can be handled correctly.
*/
public boolean isValidItem()
{
return isValid;
}

/**
* Gets the {@link File} representation of the underlying file/folder
* represented by this FolderBrowserItem.
*
* @return the {@link File} representation of the underlying file/folder
* represented by this FolderBrowserItem.
*/
public File getUnderlyingFile()
{
return underlyingFile;
}

/**
* Gets whether or not this FolderBrowserItem represents a directory.
*
* @return true if this FolderBrowserItem represents a directory, false otherwise.
*/
public boolean isDirectory()
{
return underlyingFile.isDirectory();
}

public int compareTo(FolderBrowserItem other)
{
if(this.name != null)
return this.name.toLowerCase().compareTo(other.getName().toLowerCase());
else
throw new IllegalArgumentException();
}
}
48 changes: 45 additions & 3 deletions Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java
@@ -1,10 +1,14 @@
package org.dolphinemu.dolphinemu;

/**
/*
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

package org.dolphinemu.dolphinemu;

/**
* Represents a controller input item (button, stick, etc).
*/
public class InputConfigItem implements Comparable<InputConfigItem>{
private String m_name;
private String m_Config;
Expand All @@ -20,27 +24,65 @@ private void Init(String name, String config, String defaultBind)
m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, defaultBind);
}

/**
* Constructor
*
* @param name Name of the input config item.
* @param config Name of the key in the configuration file that this control modifies.
* @param defaultBind Default binding to fall back upon if binding fails.
*/
public InputConfigItem(String name, String config, String defaultBind)
{
Init(name, config, defaultBind);
}

/**
* Constructor that creates an InputConfigItem
* that has a default binding of "None"
*
* @param name Name of the input config item.
* @param config Name of the key in the configuration file that this control modifies.
*/
public InputConfigItem(String name, String config)
{
Init(name, config, "None");
}

/**
* Gets the name of this InputConfigItem.
*
* @return the name of this InputConfigItem
*/
public String getName()
{
return m_name;
}

/**
* Gets the config key this InputConfigItem modifies.
*
* @return the config key this InputConfigItem modifies.
*/
public String getConfig()
{
return m_Config;
}

/**
* Gets the currently set binding of this InputConfigItem
*
* @return the currently set binding of this InputConfigItem
*/
public String getBind()
{
return m_bind;
}

/**
* Sets a new binding for this InputConfigItem.
*
* @param bind The new binding.
*/
public void setBind(String bind)
{
m_bind = bind;
Expand Down
11 changes: 8 additions & 3 deletions Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
@@ -1,12 +1,17 @@
/*
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

package org.dolphinemu.dolphinemu;

import android.util.Log;
import android.view.Surface;

/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
* Class which contains methods that interact
* with the native side of the Dolphin code.
*/
public class NativeLibrary {
public static native void onTouchEvent(int Action, float X, float Y);
Expand Down
48 changes: 26 additions & 22 deletions Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java
Expand Up @@ -16,34 +16,38 @@ public class SideMenuAdapter extends ArrayAdapter<SideMenuItem>{
private List<SideMenuItem>items;

public SideMenuAdapter(Context context, int textViewResourceId,
List<SideMenuItem> objects) {
List<SideMenuItem> objects)
{
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}

public SideMenuItem getItem(int i)
{
{
return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final SideMenuItem o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.SideMenuTitle);

if(t1!=null)
t1.setText(o.getName());
}
return v;
}



}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;
if (v == null)
{
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}

final SideMenuItem o = items.get(position);
if (o != null)
{
TextView t1 = (TextView) v.findViewById(R.id.SideMenuTitle);

if(t1!=null)
t1.setText(o.getName());
}

return v;
}
}

34 changes: 28 additions & 6 deletions Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
@@ -1,25 +1,47 @@
package org.dolphinemu.dolphinemu;

/**
/*
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
* Refer to the license.txt file included.
*/

public class SideMenuItem implements Comparable<SideMenuItem>{
package org.dolphinemu.dolphinemu;


/**
* Represents an item that goes in the sidemenu of the app.
*/
public class SideMenuItem implements Comparable<SideMenuItem>
{
private String m_name;
private int m_id;

public SideMenuItem(String n, int id)
/**
* Constructor
*
* @param name The name of the SideMenuItem.
* @param id ID number of this specific SideMenuItem.
*/
public SideMenuItem(String name, int id)
{
m_name = n;
m_name = name;
m_id = id;
}

/**
* Gets the name of this SideMenuItem.
*
* @return the name of this SideMenuItem.
*/
public String getName()
{
return m_name;
}

/**
* Gets the ID of this SideMenuItem.
*
* @return the ID of this SideMenuItem.
*/
public int getID()
{
return m_id;
Expand Down