From 53bf55b1e9047a1065580a4e024fb5a74c5ec94a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 13:05:42 -0400 Subject: [PATCH] [Android] Make the file browser look much more nice and user friendly to use. This is what it now looks like: http://i.imgur.com/KOZgA1i.png As usual, if any bugs arise from this rather large change. Please report it so I can fix it. --- .../res/drawable-hdpi/ic_menu_file.png | Bin 0 -> 510 bytes .../res/drawable-hdpi/ic_menu_folder.png | Bin 0 -> 1449 bytes .../res/drawable-mdpi/ic_menu_file.png | Bin 0 -> 487 bytes .../res/drawable-mdpi/ic_menu_folder.png | Bin 0 -> 1312 bytes .../res/drawable-xhdpi/ic_menu_file.png | Bin 0 -> 580 bytes .../res/drawable-xhdpi/ic_menu_folder.png | Bin 0 -> 1617 bytes Source/Android/res/layout/about_layout.xml | 29 +++++ Source/Android/res/layout/folderbrowser.xml | 66 ++++++---- .../dolphinemu/dolphinemu/AboutFragment.java | 9 +- .../dolphinemu/dolphinemu/FolderBrowser.java | 18 +-- .../dolphinemu/FolderBrowserAdapter.java | 67 +++++++---- .../dolphinemu/FolderBrowserItem.java | 113 ++++++++++++++++++ .../dolphinemu/InputConfigItem.java | 48 +++++++- .../dolphinemu/dolphinemu/NativeLibrary.java | 11 +- .../dolphinemu/SideMenuAdapter.java | 48 ++++---- .../dolphinemu/dolphinemu/SideMenuItem.java | 34 +++++- 16 files changed, 346 insertions(+), 97 deletions(-) create mode 100644 Source/Android/res/drawable-hdpi/ic_menu_file.png create mode 100644 Source/Android/res/drawable-hdpi/ic_menu_folder.png create mode 100644 Source/Android/res/drawable-mdpi/ic_menu_file.png create mode 100644 Source/Android/res/drawable-mdpi/ic_menu_folder.png create mode 100644 Source/Android/res/drawable-xhdpi/ic_menu_file.png create mode 100644 Source/Android/res/drawable-xhdpi/ic_menu_folder.png create mode 100644 Source/Android/res/layout/about_layout.xml create mode 100644 Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java diff --git a/Source/Android/res/drawable-hdpi/ic_menu_file.png b/Source/Android/res/drawable-hdpi/ic_menu_file.png new file mode 100644 index 0000000000000000000000000000000000000000..f2047409059b819113f6ea6e455408f71a1f8bd0 GIT binary patch literal 510 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?FU|>mi z^mSxl*x1kgCy|wbfq}EYBeIx*f$uN~Gak=hk;1^hAXVZTQ4*Y=R#Ki=l*$m0n3-3i z=jR%tP-d)Ws%L0m@TF)W0|R5Or;B4qhV$DSzFvm|M2>#!V{vrXvJiAx-gmd<#gWzy zd5(1l8oBgV`mq!$>{wXw?}CG2`wWZ9RYF>$(kz%we5w_djj@@y0o_`tP;bhcu;wVko*C<&#=VIf#?DaF_gN69?(V zx1BC`uj%8JK9aBaPk1+D*%Pmbud}7L9}2dbxarvf=7LoZ*dD}RUA*T+aBq6$)L_kQ zJ}ZXmySx{UM%gs#vB@?ZUh#tQ-`#GVZxO1$610D182&4mzBpfMgO|-KyTHk}*g?K9 j=;WPz1BECS*(@J0g|9c-D&;o=0|SGntDnm{r-UW|cS_bh literal 0 HcmV?d00001 diff --git a/Source/Android/res/drawable-hdpi/ic_menu_folder.png b/Source/Android/res/drawable-hdpi/ic_menu_folder.png new file mode 100644 index 0000000000000000000000000000000000000000..6f441b41da840fd8bff666f47f3beb5925976e0c GIT binary patch literal 1449 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?FHY5gN(z}Nwo2iqz6QPp&Z!xh9#uuD!Bu`C$yM3OmMKd1b_zBXRu#Dg zxv3?I3Kh9IdBs*0wn|`gt@4VkK*IV;3ScEA*|tg$M@9GsC^+XAr7D=}8R#Y(m>DXV zndljs7+9KE>L?f)7#ips8tEID>lzwZnVMS}7%D)4lAVH0QA(Oskc%7CuA-DQTcwPW zk^(Dz{qpj1y>er{{GxPyLrY6beFGzXBO~3Slr-Jq%Dj@q3f;V7Wta&rsl~}fnFS@8 z`FRQ;6BCp2OG|8(l%U2|G&eP`1g19yq1O?oUQl8H1&EbPYEfocYKmJ? zey#%8(^i?d-C~Z@JgD9j+-|YJsaM}l!A2hxwMbD76AE&112Ms=5|l#i6c9;2H7~_h zsYuD*?x&Q&cLoL~X-^l&kcwMxW>|YOJBqY!u9RqMYMq*(Jgq58Giz~ctHO=jS&6#8 z#E+c2uiO-|qH~toKHVCHFuOp*&cae#aX-N(AGMQe*4)Jpn_Y!A-9NMQ^M#K#`a;i& z)-;H2UR;dvJ1~*IIcVQ0+3@J6 zkED#BWc-=&<*>}h)m8_yl$ky~x^Mc1+jaishlORYy8@=@Z{f*v@GMsQvqqv~Rk*{a za=vc|7$mMr_Ntw6n4>hY>+dU}oK-AOoGtD2n<77C9=gcBrP*|9!{LkPn)oj8%iUbz zINjy9XwHgnj6ZK%-(Y{dV0D{YUYX~X^#`YVDI8qttz>*G(&*`#yT|sGtmaIST>6k< zR`}HaHXf_{g!uX|D;b>l-I(3cpz=^|&MKCalT~c$d!(1}boozWo*mAqQZY|+W20}^ z`SR47f5IKbU#cq{j8*L>^{}67C{myHa%SQ`;VovVUnll{T{`Okzx%#^L!+fj_{&Sr zJLMf&Gik>D#=~iMPDE|}1dBA2ka{K_ YhP>zN)0ei^WPl1!Pgg&ebxsLQ00R>g-v9sr literal 0 HcmV?d00001 diff --git a/Source/Android/res/drawable-mdpi/ic_menu_file.png b/Source/Android/res/drawable-mdpi/ic_menu_file.png new file mode 100644 index 0000000000000000000000000000000000000000..dee2577897d33842c1c9677191bf04834c5c5aef GIT binary patch literal 487 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}jKx9jP7LeL$-HD>U|>mi z^mSxl*x1kgCy|wbfq}EYBeIx*f$uN~Gak=hk;1^hAXVZTQ4*Y=R#Ki=l*$m0n3-3i z=jR%tP-d)Ws%L0m@TF)W0|R52r;B4qg!|KLyS-Q(1zI1P3Vdu@SuWsXVkpcby1rwP zhLmK+gJdap4vE-)fkE*uk7#_ZS@r`%f(^Qu= zs?Oj1V%|^FO}oTklH#47vX41C!n^Iw+8y_Fqt7g1tk9aZ+mtW+Q?dl^qm`QGp5v9PI9)KTB=!`$SiYW<_6`2@*Aqx+IS|&cyDF&OL6}c^CG-JvD!#c z^Lu^Vp^f|pG{0YF_*u`mpYyiUy6ucVCRU2iDqQ1tdaunX=ZBtUtugt`1^bGRT~@PJf?zR+1A)_vivYFG7C?!0u{J85dw&PgAiU2a&Opk3e0bCb7lZ}c{a nlVZv@lT@O6Qo0Lg9W)R4RlUDDrM{Mdfq}u()z4*}Q$iB}miWfY literal 0 HcmV?d00001 diff --git a/Source/Android/res/drawable-mdpi/ic_menu_folder.png b/Source/Android/res/drawable-mdpi/ic_menu_folder.png new file mode 100644 index 0000000000000000000000000000000000000000..cc81e57f7ecc485edb05d35c1efda39a45bc3e85 GIT binary patch literal 1312 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}k|nMYCBgY=CFO}lsSJ)O z`AMk?p1FzXsX?iUDV2pMQ*9U+m{l@EB1$5BeXNr6bM+EIYV;~{3m8Da#=fE;F*!T6 zL?J0PJu}Z%>HY5gN(z}Nwo2iqz6QPp&Z!xh9#uuD!Bu`C$yM3OmMKd1b_zBXRu#Dg zxv3?I3Kh9IdBs*0wn|`gt@4VkK*IV;3ScEA*|tg$M@9GsC^+XAr7D=}8R#Y(m>DXV zndljs7+9KE>L?f)7#ips8tEID>lzwZnVMS}7%D)4lAVH0QA(Oskc%7CuA-DQTcwPW zk^(Dz{qpj1y>er{{GxPyLrY6beFGzXBO~3Slr-Jq%Dj@q3f;V7Wta&rsl~}fnFS@8 z`FRQ;6BCp2OG|8(l%U2|G&eP`1g19yq1OzxZL9Eiqkx(-V~f}adpF~SKm&-MjsTlNKp+F3UYA+F~O-4ltS$k5J^8Z zFU3}=NXg!=m8l|=fq`+7r;B4q#jQ8fcY85AinNs%Uwpu79WD4qXU!gyFuTU7H#nkh z{AAeIY}Yh5B7%FHSX`hBtLs`8Wu=ZTfh#V?|Lo@+NIT&pwAo#^?18eY*t6UJ&sa`w zIX2^ge)tRy6(%JEjy8vrA7jMcG|k?@YV^sHOU&Wm#~AhqX757oB}(}>UMlh~JJ2wV z;q`~7jZ0s$eU4JiNZDv3oFH_^bSJ;?9wz^vWe~PtQdU}A=-E=VuI!ED z5&gJ>suJN{`+`12YdTJK@M8IudPi(3%ZxXQ6`NTj`sFsPkf>K+&e?q}R={?lo8dq9 z%;Mz^mKUOZzJ=Vnt-0XWk|=boFyt=akR{0K#X-5C8xG literal 0 HcmV?d00001 diff --git a/Source/Android/res/drawable-xhdpi/ic_menu_file.png b/Source/Android/res/drawable-xhdpi/ic_menu_file.png new file mode 100644 index 0000000000000000000000000000000000000000..85369c338e1ffb721b44f074f4a515c1b25858af GIT binary patch literal 580 zcmeAS@N?(olHy`uVBq!ia0y~yU~m9o4mJh`hEk44ofy`glX=O&z`&C3 z=o-U3d6>)EG*?O@!im*JmdSLz$2WDeeo-4&GzJJh@ zb2zx)Ay`nve_>-shq=`11hH95@4P*BFLhSc!RaEK|H_&2ZFaj((5lbbD*ZSp6u7DSfj z^4eH)HE1jlXLS%^cy&w1NJoJ6z!s*mhg|O-gzacAzR~pM&VCoh3n7eKT|wk#xyH;N zl6BM4d(L+=Em+Bv1tz`Z8rdzHzx?qGWH1SJ$OVxH*0?L|<94VK*AQTJ2xfhAKsAP0 zzBR_YfU$bQIq4Y2KOc*t7=M3Y(f<(hKvb^r`SQ=Rv=b!5{v~o=syr(i5G}&ctflae z+d+gO(4qhI&3`s||C?NP-LT{(JaZG%Q-e|yQz{EjrrIztFso#SM3hAM`dB6B=jtVb)aX^@7BGN-jeSKyVsdtB zi9%9pdS;%j()-=}l@u~lY?Z=IeGPmIoKrJ0J*tXQgRA^PlB=?lEmM^2?G$V(tSWK~ za#KqZ6)JLb@`|l0Y?Z*~TICg6frRyy6u?SKvTcwn`Gtf;oFf&vz zGto0NF|ahT)KM@pFf`CNG}1RP*EKY-GBvj{FjRm7B|8P1qLehNAQv~NT}3Hrwn`Z# zB?VUc`sL;2dgaD?`9IbD3=a&{Grv{~_DTCZpVC7ttnpl!w6q28x0}I7~jQo=P;*9(P z1?ON>JwpZG#N^C8kO)|ZudkJ7UU5lcUUI6Zi>*>cZh>BAW{Q=osk4Ebk*TSvlYyI| zp{t>#iJ_&diIcOVo2j9>iIX8ruSMv>2~2MaLa!N4y`aPZ3J@!o)S}F?)D*X( z{9FaFr>!z^yTur%c~HG6xZPrcQ?I_Af{i{XYLTKECKTl224aF!B`Ag3DIk)5YF>)1 zQjwCq-S%yl-ZL;T9rko_45_&FW|nWZaG*$=`enng?sqP4+z#>!Fn4)tu80j2e>e3X zU{-qFb$e(v~wbtNCn7(k4!* ze7E!aykhI67Jba~7pE}!G;kU)svTgN!62N#;U72Yfr!PHi!%laVxqZ#tQAP^73TdytI|;98?oQ}8WBl92Cc*Z2 z9~Z|A*5?Nm=d-?Hon9lV5Xk=gfT8Z~g#C+;&V9(W$+?{jnvcbQ=_YW*u$yZx2)G;kWJ1vV$ot+h zsfVweC~iJ}|L^{sf9KlXZtZT!O_1C3 zWivl=-(l>J25>d@)0L)@tIqEYJBu%`pP>`qOQGqX5;XAkH3@H`|7#dIu^MdDekF^ zXPpxHXU%Vo1xJonpIYjr_3DK_JD>WI#K!0UgFhT}XY~C1`NY;hji?jGwVeOv{HxM* zxKyuJP~*O`gDHh^PD$?l#k|GpJ_}2~ga@Zf&SWv!S-ws)ui;7Myz*85{zV!7{GG@)_9}-WNUWe(EzN3slH^y85}Sb4q9e0BV?S>i_@% literal 0 HcmV?d00001 diff --git a/Source/Android/res/layout/about_layout.xml b/Source/Android/res/layout/about_layout.xml new file mode 100644 index 0000000000..7189fd7ce5 --- /dev/null +++ b/Source/Android/res/layout/about_layout.xml @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml index 82b94e238f..61c6fba1ea 100644 --- a/Source/Android/res/layout/folderbrowser.xml +++ b/Source/Android/res/layout/folderbrowser.xml @@ -1,29 +1,43 @@ - - + android:layout_height="?android:attr/listPreferredItemHeight" + android:padding="3dip"> + + - - - - - - + + + + + diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 4a7b636ed6..4905027ae1 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -22,7 +22,6 @@ public class AboutFragment extends Fragment { private ListView mMainList; private FolderBrowserAdapter adapter; - private int configPosition = 0; boolean Configuring = false; boolean firstEvent = true; @@ -39,11 +38,11 @@ public class AboutFragment extends Fragment { String yes = getString(R.string.yes); String no = getString(R.string.no); - List Input = new ArrayList(); - Input.add(new GameListItem(m_activity, getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true)); - Input.add(new GameListItem(m_activity, getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true)); + List Input = new ArrayList(); + Input.add(new FolderBrowserItem(m_activity, getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true)); + Input.add(new FolderBrowserItem(m_activity, getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true)); - adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input); + adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input); mMainList.setAdapter(adapter); return mMainList; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 817a9152c5..aa44ad83ca 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -26,8 +26,8 @@ public class FolderBrowser extends Fragment { { m_activity.setTitle(getString(R.string.current_dir) + currDir.getName()); File[] dirs = currDir.listFiles(); - Listdir = new ArrayList(); - Listfls = new ArrayList(); + Listdir = new ArrayList(); + Listfls = new ArrayList(); // Supported extensions to filter by Set validExts = new HashSet(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf", ".dff")); @@ -44,17 +44,17 @@ public class FolderBrowser extends Fragment { { if(entry.isDirectory()) { - dir.add(new GameListItem(m_activity, entryName, getString(R.string.folder), entry.getAbsolutePath(), true)); + dir.add(new FolderBrowserItem(m_activity, entryName, getString(R.string.folder), entry.getAbsolutePath(), true)); } else { if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) { - fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); + fls.add(new FolderBrowserItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); } else if (invalidExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) { - fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), false)); + fls.add(new FolderBrowserItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), false)); } } } @@ -70,7 +70,7 @@ public class FolderBrowser extends Fragment { // Check for a parent directory to the one we're currently in. if (!currDir.getPath().equalsIgnoreCase("/")) - dir.add(0, new GameListItem(m_activity, "..", getString(R.string.parent_directory), currDir.getParent(), true)); + dir.add(0, new FolderBrowserItem(m_activity, "..", getString(R.string.parent_directory), currDir.getParent(), true)); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); @@ -94,15 +94,15 @@ public class FolderBrowser extends Fragment { { public void onItemClick(AdapterView parent, View view, int position, long id) { - GameListItem o = adapter.getItem(position); - if(o.getData().equalsIgnoreCase(getString(R.string.folder)) || o.getData().equalsIgnoreCase(getString(R.string.parent_directory))) + FolderBrowserItem o = adapter.getItem(position); + if(o.isDirectory() || o.getSubtitle().equalsIgnoreCase(getString(R.string.parent_directory))) { currentDir = new File(o.getPath()); Fill(currentDir); } else { - if (o.isValid()) + if (o.isValidItem()) FolderSelected(); else Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show(); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index 30c1747781..0c38aa7b2f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -1,58 +1,79 @@ package org.dolphinemu.dolphinemu; import android.content.Context; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.ImageView; import android.widget.TextView; import java.util.List; -public class FolderBrowserAdapter extends ArrayAdapter{ +public class FolderBrowserAdapter extends ArrayAdapter{ private Context c; private int id; - private Listitems; + private List items; - public FolderBrowserAdapter(Context context, int textViewResourceId, - List objects) { + public FolderBrowserAdapter(Context context, int textViewResourceId, List objects) { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; items = objects; } - public GameListItem getItem(int i) + public FolderBrowserItem getItem(int i) { return items.get(i); } + @Override - public View getView(int position, View convertView, ViewGroup parent) { + 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); + if (v == null) + { + LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + v = vi.inflate(id, parent, false); } - final GameListItem o = items.get(position); - if (o != null) { - TextView t1 = (TextView) v.findViewById(R.id.FolderTitle); - TextView t2 = (TextView) v.findViewById(R.id.FolderSubTitle); + + final FolderBrowserItem item = items.get(position); + if (item != null) + { + ImageView iconView = (ImageView) v.findViewById(R.id.ImageIcon); + TextView mainText = (TextView) v.findViewById(R.id.FolderTitle); + TextView subtitleText = (TextView) v.findViewById(R.id.FolderSubTitle); - if(t1!=null) + if(mainText != null) { - t1.setText(o.getName()); - if (!o.isValid()) - t1.setTextColor(0xFFFF0000); + mainText.setText(item.getName()); + + if (!item.isValidItem()) + { + mainText.setTextColor(0xFFFF0000); + } + } + + if(subtitleText != null) + { + subtitleText.setText(item.getSubtitle()); + } + + if (iconView != null) + { + if (item.isDirectory()) + { + iconView.setImageResource(R.drawable.ic_menu_folder); + } + else + { + iconView.setImageResource(R.drawable.ic_menu_file); + } } - if(t2!=null) - t2.setText(o.getData()); } return v; } - - - } - diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java new file mode 100644 index 0000000000..d2f8773e24 --- /dev/null +++ b/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 +{ + 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(); + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java index ff8a077703..0a6f69a1d0 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java +++ b/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{ private String m_name; private String m_Config; @@ -20,27 +24,65 @@ public class InputConfigItem implements Comparable{ 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; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index f089362c38..da58274c5f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/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); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java index 599ce5007a..eb2143becb 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java @@ -16,34 +16,38 @@ public class SideMenuAdapter extends ArrayAdapter{ private Listitems; public SideMenuAdapter(Context context, int textViewResourceId, - List objects) { + List 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; + } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java index e24842bed1..6d204d0d69 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java +++ b/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{ +package org.dolphinemu.dolphinemu; + + +/** + * Represents an item that goes in the sidemenu of the app. + */ +public class SideMenuItem implements Comparable +{ 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;