diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-23 14:21:48 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-04-23 14:27:49 -0500 |
| commit | bd72e13dd42a2ad276e5836570972c601a74e562 (patch) | |
| tree | 402a25cbe42292d7786af24949c7a2986feae112 /Source/Android | |
| parent | 453fdff4bd3307dae1554894788f8cd8daa28f78 (diff) | |
Generally make the Android UI better.
Diffstat (limited to 'Source/Android')
16 files changed, 591 insertions, 160 deletions
diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml index 624f7b2df9..82573aa8aa 100644 --- a/Source/Android/AndroidManifest.xml +++ b/Source/Android/AndroidManifest.xml @@ -26,7 +26,13 @@ </intent-filter> </activity> <activity - android:name=".NativeListView" + android:name="org.dolphinemu.dolphinemu.GameListView" + android:label="@string/app_name" + android:theme="@android:style/Theme" + android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" > + </activity> + <activity + android:name="org.dolphinemu.dolphinemu.FolderBrowser" android:label="@string/app_name" android:theme="@android:style/Theme" android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" > diff --git a/Source/Android/assets/Dolphin.png b/Source/Android/assets/Dolphin.png Binary files differdeleted file mode 100644 index 74d6c88801..0000000000 --- a/Source/Android/assets/Dolphin.png +++ /dev/null diff --git a/Source/Android/project.properties b/Source/Android/project.properties index a3ee5ab64f..91be165ce3 100644 --- a/Source/Android/project.properties +++ b/Source/Android/project.properties @@ -12,3 +12,4 @@ # Project target. target=android-17 +android.library.reference.1=../../Externals/android-menudrawer/library diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml new file mode 100644 index 0000000000..ae480d0807 --- /dev/null +++ b/Source/Android/res/layout/folderbrowser.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" > + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" > + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" > + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" > + </LinearLayout> + + <TextView + android:id="@+id/TextView01" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="5dip" + android:layout_marginTop="5dip" + android:singleLine="true" + android:text="@+id/TextView01" + android:textStyle="bold" /> + + <TextView + android:id="@+id/TextView02" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="10dip" + android:text="@+id/TextView02" /> + + </LinearLayout> + + </LinearLayout> + + + +</LinearLayout> diff --git a/Source/Android/res/layout/folderbrowserfooter.xml b/Source/Android/res/layout/folderbrowserfooter.xml new file mode 100644 index 0000000000..9c0e11d81b --- /dev/null +++ b/Source/Android/res/layout/folderbrowserfooter.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + +</LinearLayout>
\ No newline at end of file diff --git a/Source/Android/res/layout/main.xml b/Source/Android/res/layout/main.xml index 6116f6c33d..1b19ad19fe 100644 --- a/Source/Android/res/layout/main.xml +++ b/Source/Android/res/layout/main.xml @@ -1,26 +1,42 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="fill_parent" android:orientation="vertical" > - <TextView - android:id="@+id/TextView01" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="5dip" - android:layout_marginTop="5dip" - android:singleLine="true" - android:text="@+id/TextView01" - android:textStyle="bold" > - </TextView> - - <TextView - android:id="@+id/TextView02" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="10dip" - android:text="@+id/TextView02" > - </TextView> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" > + + <ImageView + android:id="@+id/imageView1" + android:layout_width="96dp" + android:layout_height="match_parent" /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:id="@+id/TextView01" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="5dip" + android:layout_marginTop="5dip" + android:singleLine="true" + android:text="@+id/TextView01" + android:textStyle="bold" /> + + <TextView + android:id="@+id/TextView02" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="10dip" + android:text="@+id/TextView02" /> + + </LinearLayout> + + </LinearLayout> </LinearLayout> diff --git a/Source/Android/res/layout/sidemenu.xml b/Source/Android/res/layout/sidemenu.xml new file mode 100644 index 0000000000..57ab67e3ca --- /dev/null +++ b/Source/Android/res/layout/sidemenu.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:gravity="left" + android:orientation="vertical" > + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" > + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:id="@+id/TextView01" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="5dip" + android:layout_marginTop="5dip" + android:singleLine="true" + android:text="@+id/TextView01" + android:textAppearance="?android:attr/textAppearanceLarge" + android:textStyle="bold" /> + + </LinearLayout> + </LinearLayout> + +</LinearLayout> diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index a989bf68d5..82d186de26 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -6,6 +6,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import net.simonvt.menudrawer.MenuDrawer; + import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -88,7 +90,8 @@ public class DolphinEmulator<MainActivity> extends Activity super.onCreate(savedInstanceState); if (savedInstanceState == null) { - Intent ListIntent = new Intent(this, NativeListView.class); + + Intent ListIntent = new Intent(this, GameListView.class); startActivityForResult(ListIntent, 1); // Make the assets directory @@ -120,13 +123,22 @@ public class DolphinEmulator<MainActivity> extends Activity CopyAsset("Dolphin.png", Environment.getExternalStorageDirectory()+File.separator+ "dolphin-emu" + File.separator + "Dolphin.png"); + CopyAsset("Back.png", + Environment.getExternalStorageDirectory()+File.separator+ + "dolphin-emu" + File.separator + "Back.png"); + CopyAsset("Folder.png", + Environment.getExternalStorageDirectory()+File.separator+ + "dolphin-emu" + File.separator + "Folder.png"); + CopyAsset("Background.glsl", + Environment.getExternalStorageDirectory()+File.separator+ + "dolphin-emu" + File.separator + "Background.glsl"); CopyAsset("GCPadNew.ini", Environment.getExternalStorageDirectory()+File.separator+ "dolphin-emu" + File.separator +"Config"+ File.separator +"GCPadNew.ini"); } } } - + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java new file mode 100644 index 0000000000..68203413b7 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -0,0 +1,98 @@ +package org.dolphinemu.dolphinemu; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.simonvt.menudrawer.MenuDrawer; + +import android.app.Activity; +import android.app.ListActivity; +import android.content.Intent; +import android.os.Bundle; +import android.os.Environment; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemLongClickListener; +import android.widget.BaseAdapter; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +public class FolderBrowser extends ListActivity { + private GameListAdapter adapter; + private static File currentDir = null; + private void Fill(File f) + { + File[]dirs = f.listFiles(); + this.setTitle("Current Dir: " + f.getName()); + List<GameListItem>dir = new ArrayList<GameListItem>(); + List<GameListItem>fls = new ArrayList<GameListItem>(); + + try + { + for(File ff: dirs) + { + if (ff.getName().charAt(0) != '.') + if(ff.isDirectory()) + dir.add(new GameListItem(getApplicationContext(), ff.getName(),"Folder",ff.getAbsolutePath())); + else + if (ff.getName().toLowerCase().contains(".gcm") || + ff.getName().toLowerCase().contains(".iso") || + ff.getName().toLowerCase().contains(".wbfs") || + ff.getName().toLowerCase().contains(".gcz") || + ff.getName().toLowerCase().contains(".dol") || + ff.getName().toLowerCase().contains(".elf")) + fls.add(new GameListItem(getApplicationContext(), ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath())); + } + } + catch(Exception e) + { + } + + Collections.sort(dir); + Collections.sort(fls); + dir.addAll(fls); + if (!f.getName().equalsIgnoreCase("sdcard")) + dir.add(0, new GameListItem(getApplicationContext(), "..", "Parent Directory", f.getParent())); + + adapter = new GameListAdapter(this,R.layout.folderbrowser,dir); + this.setListAdapter(adapter); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + // TODO Auto-generated method stub + super.onListItemClick(l, v, position, id); + GameListItem o = adapter.getItem(position); + if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){ + currentDir = new File(o.getPath()); + Fill(currentDir); + } + } + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + if(currentDir == null) + currentDir = new File(Environment.getExternalStorageDirectory().getPath()); + Fill(currentDir); + } + @Override + public void onBackPressed() { + Intent intent = new Intent(); + intent.putExtra("Select", currentDir.getPath()); + setResult(Activity.RESULT_OK, intent); + + this.finish(); + super.onBackPressed(); + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java index b49149a36c..f0aa522a1f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FileArrayAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java @@ -7,22 +7,23 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.ImageView; import android.widget.TextView; -public class FileArrayAdapter extends ArrayAdapter<Option>{ +public class GameListAdapter extends ArrayAdapter<GameListItem>{ private Context c; private int id; - private List<Option>items; + private List<GameListItem>items; - public FileArrayAdapter(Context context, int textViewResourceId, - List<Option> objects) { + public GameListAdapter(Context context, int textViewResourceId, + List<GameListItem> objects) { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; items = objects; } - public Option getItem(int i) + public GameListItem getItem(int i) { return items.get(i); } @@ -33,15 +34,18 @@ public class FileArrayAdapter extends ArrayAdapter<Option>{ LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(id, null); } - final Option o = items.get(position); + final GameListItem o = items.get(position); if (o != null) { TextView t1 = (TextView) v.findViewById(R.id.TextView01); TextView t2 = (TextView) v.findViewById(R.id.TextView02); + ImageView v1 = (ImageView) v.findViewById(R.id.imageView1); if(t1!=null) t1.setText(o.getName()); if(t2!=null) t2.setText(o.getData()); + if(v1!=null) + v1.setImageBitmap(o.getImage()); } return v; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java new file mode 100644 index 0000000000..87137db48d --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java @@ -0,0 +1,84 @@ +package org.dolphinemu.dolphinemu; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.util.Log; + +public class GameListItem implements Comparable<GameListItem>{ + private String name; + private String data; + private String path; + private Bitmap image; + public static native int[] GetBanner(String filename); + public static native String GetTitle(String filename); + static + { + try + { + System.loadLibrary("dolphin-emu-nogui"); + } + catch (Exception ex) + { + Log.w("me", ex.toString()); + } + } + + public GameListItem(Context ctx, String n,String d,String p) + { + name = n; + data = d; + path = p; + File file = new File(path); + if (!file.isDirectory()) + { + int[] Banner = GetBanner(path); + if (Banner[0] == 0) + { + try { + InputStream path = ctx.getAssets().open("NoBanner.png"); + image = BitmapFactory.decodeStream(path); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + else + image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888); + name = GetTitle(path); + } + } + + public String getName() + { + return name; + } + + public String getData() + { + return data; + } + + public String getPath() + { + return path; + } + public Bitmap getImage() + { + return image; + } + + public int compareTo(GameListItem o) + { + if(this.name != null) + return this.name.toLowerCase().compareTo(o.getName().toLowerCase()); + else + throw new IllegalArgumentException(); + } +} + diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListView.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListView.java new file mode 100644 index 0000000000..d585ead372 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListView.java @@ -0,0 +1,181 @@ +package org.dolphinemu.dolphinemu; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.simonvt.menudrawer.MenuDrawer; + +import android.app.Activity; +import android.app.ListActivity; +import android.content.Intent; +import android.os.Bundle; +import android.os.Environment; +import android.util.DisplayMetrics; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.Surface; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +public class GameListView extends ListActivity { + private GameListAdapter adapter; + private static File currentDir = null; + private MenuDrawer mDrawer; + + private SideMenuAdapter mAdapter; + private ListView mList; + private static GameListView me; + public static native String GetConfig(String Key, String Value, String Default); + public static native void SetConfig(String Key, String Value, String Default); + + private void Fill(File f) + { + File[]dirs = f.listFiles(); + this.setTitle("Game List"); + List<GameListItem>dir = new ArrayList<GameListItem>(); + List<GameListItem>fls = new ArrayList<GameListItem>(); + + try + { + for(File ff: dirs) + { + if (ff.getName().charAt(0) != '.') + if(!ff.isDirectory()) + if (ff.getName().toLowerCase().contains(".gcm") || + ff.getName().toLowerCase().contains(".iso") || + ff.getName().toLowerCase().contains(".wbfs") || + ff.getName().toLowerCase().contains(".gcz") || + ff.getName().toLowerCase().contains(".dol") || + ff.getName().toLowerCase().contains(".elf")) + fls.add(new GameListItem(getApplicationContext(), ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath())); + } + } + catch(Exception e) + { + } + + Collections.sort(dir); + Collections.sort(fls); + dir.addAll(fls); + + adapter = new GameListAdapter(this,R.layout.main,dir); + this.setListAdapter(adapter); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + // TODO Auto-generated method stub + super.onListItemClick(l, v, position, id); + GameListItem o = adapter.getItem(position); + if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){ + } + else + { + onFileClick(o.getPath()); + } + } + + private void onFileClick(String o) + { + Toast.makeText(this, "File Clicked: " + o, Toast.LENGTH_SHORT).show(); + + Intent intent = new Intent(); + intent.putExtra("Select", o); + setResult(Activity.RESULT_OK, intent); + + this.finish(); + } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == Activity.RESULT_OK) + { + String FileName = data.getStringExtra("Select"); + Toast.makeText(this, "Folder Selected: " + FileName, Toast.LENGTH_SHORT).show(); + SetConfig("General", "GCMPathes", "1"); + SetConfig("General", "GCMPaths0", FileName); + + currentDir = new File(FileName); + Fill(currentDir); + } + } + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + me = this; + + mDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT); + + String BrowseDir = GetConfig("General", "GCMPaths0", ""); + if(currentDir == null) + currentDir = new File(BrowseDir); + Fill(currentDir); + + List<SideMenuItem>dir = new ArrayList<SideMenuItem>(); + dir.add(new SideMenuItem("Browse Folder", 0)); + + mList = new ListView(this); + mAdapter = new SideMenuAdapter(this,R.layout.sidemenu,dir); + mList.setAdapter(mAdapter); + mList.setOnItemClickListener(mItemClickListener); + + mDrawer.setMenuView(mList); + } + private AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() { + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + SideMenuItem o = mAdapter.getItem(position); + + switch(o.getID()) + { + case 0: + Toast.makeText(me, "Loading up the browser", Toast.LENGTH_SHORT).show(); + Intent ListIntent = new Intent(me, FolderBrowser.class); + startActivityForResult(ListIntent, 1); + break; + default: + break; + } + mDrawer.closeMenu(); + } + }; + @Override + public void setContentView(int layoutResID) { + // This override is only needed when using MENU_DRAG_CONTENT. + mDrawer.setContentView(layoutResID); + onContentChanged(); + } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + mDrawer.toggleMenu(); + return true; + } + + return super.onOptionsItemSelected(item); + } + + @Override + public void onBackPressed() { + final int drawerState = mDrawer.getDrawerState(); + if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) { + mDrawer.closeMenu(); + return; + } + + super.onBackPressed(); + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java deleted file mode 100644 index 678d10f035..0000000000 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeListView.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.dolphinemu.dolphinemu; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import android.app.Activity; -import android.app.ListActivity; -import android.content.Intent; -import android.os.Bundle; -import android.os.Environment; -import android.view.View; -import android.widget.ListView; -import android.widget.Toast; - -public class NativeListView extends ListActivity { - private FileArrayAdapter adapter; - private static File currentDir = null; - - private void Fill(File f) - { - File[]dirs = f.listFiles(); - this.setTitle("Current Dir: " + f.getName()); - List<Option>dir = new ArrayList<Option>(); - List<Option>fls = new ArrayList<Option>(); - - try - { - for(File ff: dirs) - { - if (ff.getName().charAt(0) != '.') - if(ff.isDirectory()) - dir.add(new Option(ff.getName(),"Folder",ff.getAbsolutePath())); - else - if (ff.getName().toLowerCase().contains(".gcm") || - ff.getName().toLowerCase().contains(".iso") || - ff.getName().toLowerCase().contains(".wbfs") || - ff.getName().toLowerCase().contains(".gcz") || - ff.getName().toLowerCase().contains(".dol") || - ff.getName().toLowerCase().contains(".elf")) - fls.add(new Option(ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath())); - } - } - catch(Exception e) - { - } - - Collections.sort(dir); - Collections.sort(fls); - dir.addAll(fls); - - if(!f.getName().equalsIgnoreCase("sdcard")) - dir.add(0,new Option("..","Parent Directory",f.getParent())); - adapter = new FileArrayAdapter(this,R.layout.main,dir); - this.setListAdapter(adapter); - } - - @Override - protected void onListItemClick(ListView l, View v, int position, long id) { - // TODO Auto-generated method stub - super.onListItemClick(l, v, position, id); - Option o = adapter.getItem(position); - if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){ - currentDir = new File(o.getPath()); - Fill(currentDir); - } - else - { - onFileClick(o.getPath()); - } - } - - private void onFileClick(String o) - { - Toast.makeText(this, "File Clicked: " + o, Toast.LENGTH_SHORT).show(); - - Intent intent = new Intent(); - intent.putExtra("Select", o); - setResult(Activity.RESULT_OK, intent); - - this.finish(); - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - if(currentDir == null) - currentDir = new File(Environment.getExternalStorageDirectory().getPath()); - Fill(currentDir); - } -} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/Option.java b/Source/Android/src/org/dolphinemu/dolphinemu/Option.java deleted file mode 100644 index dba6dfd534..0000000000 --- a/Source/Android/src/org/dolphinemu/dolphinemu/Option.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.dolphinemu.dolphinemu; - -public class Option implements Comparable<Option>{ - private String name; - private String data; - private String path; - - public Option(String n,String d,String p) - { - name = n; - data = d; - path = p; - } - - public String getName() - { - return name; - } - - public String getData() - { - return data; - } - - public String getPath() - { - return path; - } - - public int compareTo(Option o) - { - if(this.name != null) - return this.name.toLowerCase().compareTo(o.getName().toLowerCase()); - else - throw new IllegalArgumentException(); - } -} - diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java new file mode 100644 index 0000000000..e1c0ed5e31 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java @@ -0,0 +1,49 @@ +package org.dolphinemu.dolphinemu; + +import java.util.List; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +public class SideMenuAdapter extends ArrayAdapter<SideMenuItem>{ + + private Context c; + private int id; + private List<SideMenuItem>items; + + public SideMenuAdapter(Context context, int textViewResourceId, + 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.TextView01); + + if(t1!=null) + t1.setText(o.getName()); + } + return v; + } + + + +} + diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java new file mode 100644 index 0000000000..80f3eaec64 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java @@ -0,0 +1,30 @@ +package org.dolphinemu.dolphinemu; + +public class SideMenuItem implements Comparable<SideMenuItem>{ + private String m_name; + private int m_id; + + public SideMenuItem(String n, int id) + { + m_name = n; + m_id = id; + } + + public String getName() + { + return m_name; + } + public int getID() + { + return m_id; + } + + public int compareTo(SideMenuItem o) + { + if(this.m_name != null) + return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase()); + else + throw new IllegalArgumentException(); + } +} + |
