From 958590beaa18208b13811f15e6e081a3ebb31202 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 12 Aug 2013 04:44:08 -0500 Subject: [Android] Fix OpenGL ES 3 detection on Nexus 10. Nexus 10 defaults to GLES1 context when not specified while Adreno defaults to GLES2. Thanks to Jeremy D Miller for noticing and finding out why this was failing. --- Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index 1263c03798..daf9aeb1c6 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -38,13 +38,18 @@ public class PrefsFragment extends PreferenceFragment { EGL10.EGL_RENDERABLE_TYPE, 4, EGL10.EGL_NONE }; + int EGL_CONTEXT_CLIENT_VERSION = 0x3098; + int[] ctx_attribs = new int[] { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL10.EGL_NONE + }; // No error checking performed, minimum required code to elucidate logic mEGL = (EGL10) EGLContext.getEGL(); mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); mEGL.eglInitialize(mEGLDisplay, version); mEGLConfig = chooseConfig(); // Choosing a config is a little more complicated - mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, null); + mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, ctx_attribs); mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList); mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext); mGL = (GL10) mEGLContext.getGL(); -- cgit v1.2.3 From 68e12407a5835687255e104019a75de9f8dfe4f5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 12 Aug 2013 15:16:15 -0400 Subject: [Android] Remove unnecessary explicit indexing of entries in a List within AboutFragment.java Indexes are handled internally within a List object. --- Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 5c47b79a3e..906736b039 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -37,10 +37,9 @@ public class AboutFragment extends Fragment { mMainList = (ListView) rootView.findViewById(R.id.gamelist); List Input = new ArrayList(); - int a = 0; + Input.add(new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); + Input.add(new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); - Input.add(a++, new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); - Input.add(a++, new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input); mMainList.setAdapter(adapter); -- cgit v1.2.3 From 00b034f991ffedd2fb30040dea715b2287563cc0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 12 Aug 2013 15:32:52 -0400 Subject: [Android] Seems like InputConfigFragment.java also had explicit list indexing. Removed it from here too. --- .../dolphinemu/dolphinemu/InputConfigFragment.java | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index 3a6e855c3b..91f550d2a2 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -47,29 +47,27 @@ public class InputConfigFragment extends Fragment Bundle savedInstanceState) { List Input = new ArrayList(); - int a = 0; - - Input.add(a++, new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True")); - Input.add(a++, new InputConfigItem("Button A", "Android-InputA")); - Input.add(a++, new InputConfigItem("Button B", "Android-InputB")); - Input.add(a++, new InputConfigItem("Button Start", "Android-InputStart")); - Input.add(a++, new InputConfigItem("Button X", "Android-InputX")); - Input.add(a++, new InputConfigItem("Button Y", "Android-InputY")); - Input.add(a++, new InputConfigItem("Button Z", "Android-InputZ")); - Input.add(a++, new InputConfigItem("D-Pad Up", "Android-DPadUp")); - Input.add(a++, new InputConfigItem("D-Pad Down", "Android-DPadDown")); - Input.add(a++, new InputConfigItem("D-Pad Left", "Android-DPadLeft")); - Input.add(a++, new InputConfigItem("D-Pad Right", "Android-DPadRight")); - Input.add(a++, new InputConfigItem("Main Stick Up", "Android-MainUp")); - Input.add(a++, new InputConfigItem("Main Stick Down", "Android-MainDown")); - Input.add(a++, new InputConfigItem("Main Stick Left", "Android-MainLeft")); - Input.add(a++, new InputConfigItem("Main Stick Right", "Android-MainRight")); - Input.add(a++, new InputConfigItem("C Stick Up", "Android-CStickUp")); - Input.add(a++, new InputConfigItem("C Stick Down", "Android-CStickDown")); - Input.add(a++, new InputConfigItem("C Stick Left", "Android-CStickLeft")); - Input.add(a++, new InputConfigItem("C Stick Right", "Android-CStickRight")); - Input.add(a++, new InputConfigItem("Trigger L", "Android-InputL")); - Input.add(a++, new InputConfigItem("Trigger R", "Android-InputR")); + Input.add(new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True")); + Input.add(new InputConfigItem("Button A", "Android-InputA")); + Input.add(new InputConfigItem("Button B", "Android-InputB")); + Input.add(new InputConfigItem("Button Start", "Android-InputStart")); + Input.add(new InputConfigItem("Button X", "Android-InputX")); + Input.add(new InputConfigItem("Button Y", "Android-InputY")); + Input.add(new InputConfigItem("Button Z", "Android-InputZ")); + Input.add(new InputConfigItem("D-Pad Up", "Android-DPadUp")); + Input.add(new InputConfigItem("D-Pad Down", "Android-DPadDown")); + Input.add(new InputConfigItem("D-Pad Left", "Android-DPadLeft")); + Input.add(new InputConfigItem("D-Pad Right", "Android-DPadRight")); + Input.add(new InputConfigItem("Main Stick Up", "Android-MainUp")); + Input.add(new InputConfigItem("Main Stick Down", "Android-MainDown")); + Input.add(new InputConfigItem("Main Stick Left", "Android-MainLeft")); + Input.add(new InputConfigItem("Main Stick Right", "Android-MainRight")); + Input.add(new InputConfigItem("C Stick Up", "Android-CStickUp")); + Input.add(new InputConfigItem("C Stick Down", "Android-CStickDown")); + Input.add(new InputConfigItem("C Stick Left", "Android-CStickLeft")); + Input.add(new InputConfigItem("C Stick Right", "Android-CStickRight")); + Input.add(new InputConfigItem("Trigger L", "Android-InputL")); + Input.add(new InputConfigItem("Trigger R", "Android-InputR")); adapter = new InputConfigAdapter(m_activity, R.layout.folderbrowser, Input); View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); -- cgit v1.2.3 From 3b272d81b45f47d3fb0aab8ff0a1736fb1788f1e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 12 Aug 2013 19:41:23 -0400 Subject: [Android] Use a HashMap in PrefsFragment.java instead of two CharSequence arrays. This way, we hold the [key|value] pairs together in one object and reduce overall code clutter. --- .../org/dolphinemu/dolphinemu/PrefsFragment.java | 45 +++++++++------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index daf9aeb1c6..e16b2503c3 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -1,5 +1,7 @@ package org.dolphinemu.dolphinemu; +import java.util.HashMap; + import android.app.Activity; import android.os.Build; import android.os.Bundle; @@ -138,36 +140,28 @@ public class PrefsFragment extends PreferenceFragment { addPreferencesFromResource(R.layout.prefs); final ListPreference etp = new ListPreference(m_activity); - CharSequence[] _entries; - CharSequence[] _entryvalues; + final HashMap entries = new HashMap(); if (Build.CPU_ABI.contains("x86")) { - _entries = new CharSequence[] { - "Interpreter", - "JIT64 Recompiler", - "JITIL Recompiler", - }; - _entryvalues = new CharSequence[] {"0", "1", "2"}; + entries.put("Interpreter", "0"); + entries.put("JIT64 Recompiler", "1"); + entries.put("JITIL Recompiler", "2"); } else if (Build.CPU_ABI.contains("arm")) { - _entries = new CharSequence[] { - "Interpreter", - "JIT ARM Recompiler", - }; - _entryvalues = new CharSequence[] {"0", "3"}; + entries.put("Interpreter", "0"); + entries.put("JIT ARM Recompiler", "3"); } else { - _entries = new CharSequence[] { - "Interpreter", - }; - _entryvalues = new CharSequence[] {"0"}; + entries.put("Interpreter", "0"); } - - etp.setEntries(_entries); - etp.setEntryValues(_entryvalues); + + // Convert the key/value sections to arrays respectively so the list can be set. + // If Java had proper generics it wouldn't look this disgusting. + etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); + etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); etp.setKey("cpupref"); etp.setTitle("CPU Core"); etp.setSummary("Emulation core to use"); @@ -185,17 +179,16 @@ public class PrefsFragment extends PreferenceFragment { final ListPreference videobackend = new ListPreference(m_activity); - _entries = new CharSequence[] { - "Software Renderer", - }; - _entryvalues = new CharSequence[] {"Software Renderer"}; + // Add available graphics renderers to the hashmap to add to the list. + entries.clear(); + entries.put("Software Renderer", "Software Renderer"); // TODO: I think this is a bug? The value shouldn't be the same as the key? videobackend.setKey("gpupref"); videobackend.setTitle("Video Backend"); videobackend.setSummary("Video backend to use"); - videobackend.setEntries(_entries); - videobackend.setEntryValues(_entryvalues); + videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); + videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); mCategory.addPreference(videobackend); } -- cgit v1.2.3 From b823983199e6cb09fb2f0335f49b90ba0ca95bd3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 12 Aug 2013 21:22:20 -0400 Subject: [Android] Multi-language support (or at least the basic foundation of it). Added an example translation (Japanese). So now the Android version can both display in English and Japanese, depending on what the Android device's system language is set to. Also did a tiny clean-up of InputConfigItem.java so that the parameters are slightly more descriptive. Now, to do a translation in [x] language, all you have to do is take the normal English strings.xml and translate the XML entries into said language, and simply make a folder in the /res/ sub-directory in the form of values-[region code]. IE) With the Japanese translation, it is in the folder /res/values-ja No configuration other than that is needed. After doing the above, the language should load fine on any device when set to that specific system language. By default, if a translation file does not exist for a given system language. The app will automatically fall back to using the English translation. This *should* be bug-free since I did check everything multiple times. But if any issues occur, please report them so that I can fix them. --- Source/Android/res/layout/prefs.xml | 16 ++--- Source/Android/res/values-ja/strings.xml | 83 ++++++++++++++++++++++ Source/Android/res/values/strings.xml | 75 +++++++++++++++++++ .../org/dolphinemu/dolphinemu/AboutFragment.java | 7 +- .../org/dolphinemu/dolphinemu/DolphinEmulator.java | 2 +- .../org/dolphinemu/dolphinemu/FolderBrowser.java | 16 +++-- .../dolphinemu/dolphinemu/GameListActivity.java | 18 ++--- .../dolphinemu/dolphinemu/GameListFragment.java | 6 +- .../dolphinemu/dolphinemu/InputConfigFragment.java | 56 ++++++++------- .../org/dolphinemu/dolphinemu/InputConfigItem.java | 20 +++--- .../org/dolphinemu/dolphinemu/PrefsFragment.java | 22 +++--- 11 files changed, 244 insertions(+), 77 deletions(-) create mode 100644 Source/Android/res/values-ja/strings.xml (limited to 'Source/Android') diff --git a/Source/Android/res/layout/prefs.xml b/Source/Android/res/layout/prefs.xml index 34700f56b7..d8d8664a97 100644 --- a/Source/Android/res/layout/prefs.xml +++ b/Source/Android/res/layout/prefs.xml @@ -2,23 +2,23 @@ + android:summary="@string/on_off" + android:title="@string/dual_core" /> + android:summary="@string/video_backend_to_use" + android:title="@string/video_backend" /> \ No newline at end of file diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml new file mode 100644 index 0000000000..329d464ccb --- /dev/null +++ b/Source/Android/res/values-ja/strings.xml @@ -0,0 +1,83 @@ + + + + + Dolphin Emulator + + + ナビゲーションウィンドウを開く + ナビゲーションウィンドウを閉じる + + + ビルドのバージョン: + サポートのOpenGL ES 3: + + + 現在のディレクトリ: + 親ディレクトリ + フォルダ + ファイルサイズ: + 圧縮ファイル形式はサポートされていません + + + ゲームリスト + フォルダの参照 + 設定 + ゲームパッド設定 + について + ファイルブラウザのロード + 設定のロード + ゲームパッド設定のロード + メニューについてのロード + + + クリックされたファイル: + + + 画面上のコントロールを描画 + Aボタン + Bボタン + スタートボタン + Xボタン + Yボタン + Zボタン + D-Pad: ↑ + D-Pad: ↓ + D-Pad: ← + D-Pad: → + コントロールスティック: ↑ + コントロールスティック: ↓ + コントロールスティック: ← + コントロールスティック: → + C-スティック: ↑ + C-スティック: ↓ + C-スティック: ← + C-スティック: → + 左のトリガー + 右のトリガー + + コントロールは画面上に描画されていない + コントロールは画面上に描画されています + %1$sを設定するにはボタンを押して + + + Interpreter + JIT64 Recompiler + JITIL Recompiler + JIT ARM Recompiler + CPUコア + CPU設定 + 使用するエミュレーションコア + デュアルコア + 有効/無効 + + ビデオ設定 + Software Renderer + ビデオレンダラ + 使用するビデオレンダラー + + + はい + いいえ + + diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 40a14e3b4e..ea1e02297a 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -1,8 +1,83 @@ + Dolphin Emulator + + Open navigation drawer Close navigation drawer + + + Build Revision: + Supports OpenGL ES 3: + + + Current Dir: + Parent Directory + Folder + File Size: + Can not use compressed file types + + + Game List + Browse Folder + Settings + Gamepad Config + About + Loading up the browser + Loading up settings + Loading up gamepad config + Loading about menu + + + File clicked: + + + Draw on-screen controls + Button A + Button B + Button Start + Button X + Button Y + Button Z + D-Pad Up + D-Pad Down + D-Pad Left + D-Pad Right + Main Stick Up + Main Stick Down + Main Stick Left + Main Stick Right + C Stick Up + C Stick Down + C Stick Left + C Stick Right + Trigger L + Trigger R + + Not drawing on-screen controls + Drawing on-screen controls + Press button to configure %1$s + + + Interpreter + JIT64 Recompiler + JITIL Recompiler + JIT ARM Recompiler + CPU Core + CPU Settings + Emulation core to use + Dual Core + On/Off + + Video Settings + Software Renderer + Video Backend + Video backend to use + + + Yes + No diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 906736b039..4a7b636ed6 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -35,10 +35,13 @@ public class AboutFragment extends Fragment { Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); mMainList = (ListView) rootView.findViewById(R.id.gamelist); + + String yes = getString(R.string.yes); + String no = getString(R.string.no); List Input = new ArrayList(); - Input.add(new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); - Input.add(new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); + 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)); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input); mMainList.setAdapter(adapter); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index 6cad8cb3bd..fefb13ec14 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -38,7 +38,7 @@ public class DolphinEmulator extends Activity out.close(); out = null; } catch(IOException e) { - Log.e("tag", "Failed to copy asset file: " + asset, e); + Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e); } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 9094486197..ee96f445ce 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -24,7 +24,7 @@ public class FolderBrowser extends Fragment { // Populates the FolderView with the given currDir's contents. private void Fill(File currDir) { - m_activity.setTitle("Current Dir: " + currDir.getName()); + m_activity.setTitle(getString(R.string.current_dir) + currDir.getName()); File[] dirs = currDir.listFiles(); Listdir = new ArrayList(); Listfls = new ArrayList(); @@ -44,17 +44,17 @@ public class FolderBrowser extends Fragment { { if(entry.isDirectory()) { - dir.add(new GameListItem(m_activity, entryName,"Folder",entry.getAbsolutePath(), true)); + dir.add(new GameListItem(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,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); + fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); } else if (archiveExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) { - fls.add(new GameListItem(m_activity, entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), false)); + fls.add(new GameListItem(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, "..", "Parent Directory", currDir.getParent(), true)); + dir.add(0, new GameListItem(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); @@ -95,16 +95,18 @@ 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("folder") || o.getData().equalsIgnoreCase("parent directory")) + if(o.getData().equalsIgnoreCase(getString(R.string.folder)) || o.getData().equalsIgnoreCase(getString(R.string.parent_directory))) { currentDir = new File(o.getPath()); Fill(currentDir); } else + { if (o.isValid()) FolderSelected(); else - Toast.makeText(m_activity, "Can not use compressed file types.", Toast.LENGTH_LONG).show(); + Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show(); + } } }; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java index 9a48de4d8b..845bf72bdd 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java @@ -52,11 +52,11 @@ public class GameListActivity extends Activity mDrawerList = (ListView) findViewById(R.id.left_drawer); List dir = new ArrayList(); - dir.add(new SideMenuItem("Game List", 0)); - dir.add(new SideMenuItem("Browse Folder", 1)); - dir.add(new SideMenuItem("Settings", 2)); - dir.add(new SideMenuItem("Gamepad Config", 3)); - dir.add(new SideMenuItem("About", 4)); + dir.add(new SideMenuItem(getString(R.string.game_list), 0)); + dir.add(new SideMenuItem(getString(R.string.browse_folder), 1)); + dir.add(new SideMenuItem(getString(R.string.settings), 2)); + dir.add(new SideMenuItem(getString(R.string.gamepad_config), 3)); + dir.add(new SideMenuItem(getString(R.string.about), 4)); mDrawerAdapter = new SideMenuAdapter(this, R.layout.sidemenu, dir); mDrawerList.setAdapter(mDrawerAdapter); @@ -179,7 +179,7 @@ public class GameListActivity extends Activity break; case 1: { - Toast.makeText(mMe, "Loading up the browser", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_browser), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 1; mCurFragment = new FolderBrowser(); FragmentManager fragmentManager = getFragmentManager(); @@ -188,7 +188,7 @@ public class GameListActivity extends Activity break; case 2: { - Toast.makeText(mMe, "Loading up settings", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_settings), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 2; mCurFragment = new PrefsFragment(); FragmentManager fragmentManager = getFragmentManager(); @@ -197,7 +197,7 @@ public class GameListActivity extends Activity break; case 3: { - Toast.makeText(mMe, "Loading up gamepad config", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_gamepad), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 3; mCurFragment = new InputConfigFragment(); FragmentManager fragmentManager = getFragmentManager(); @@ -206,7 +206,7 @@ public class GameListActivity extends Activity break; case 4: { - Toast.makeText(mMe, "Loading up About", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.about), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 4; mCurFragment = new AboutFragment(); FragmentManager fragmentManager = getFragmentManager(); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java index 152c18662b..efcee489a8 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java @@ -63,7 +63,7 @@ public class GameListFragment extends Fragment if(!entry.isDirectory()) { if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) - fls.add(new GameListItem(mMe.getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); + fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); } } } @@ -96,7 +96,7 @@ public class GameListFragment extends Fragment public void onItemClick(AdapterView parent, View view, int position, long id) { GameListItem o = mGameAdapter.getItem(position); - if(!(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory"))) + if(!(o.getData().equalsIgnoreCase(getString(R.string.folder))||o.getData().equalsIgnoreCase(getString(R.string.parent_directory)))) { onFileClick(o.getPath()); } @@ -104,7 +104,7 @@ public class GameListFragment extends Fragment }; private void onFileClick(String o) { - Toast.makeText(mMe, "File Clicked: " + o, Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.file_clicked) + o, Toast.LENGTH_SHORT).show(); Intent intent = new Intent(); intent.putExtra("Select", o); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index 91f550d2a2..b11dc4a34b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -47,27 +47,27 @@ public class InputConfigFragment extends Fragment Bundle savedInstanceState) { List Input = new ArrayList(); - Input.add(new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True")); - Input.add(new InputConfigItem("Button A", "Android-InputA")); - Input.add(new InputConfigItem("Button B", "Android-InputB")); - Input.add(new InputConfigItem("Button Start", "Android-InputStart")); - Input.add(new InputConfigItem("Button X", "Android-InputX")); - Input.add(new InputConfigItem("Button Y", "Android-InputY")); - Input.add(new InputConfigItem("Button Z", "Android-InputZ")); - Input.add(new InputConfigItem("D-Pad Up", "Android-DPadUp")); - Input.add(new InputConfigItem("D-Pad Down", "Android-DPadDown")); - Input.add(new InputConfigItem("D-Pad Left", "Android-DPadLeft")); - Input.add(new InputConfigItem("D-Pad Right", "Android-DPadRight")); - Input.add(new InputConfigItem("Main Stick Up", "Android-MainUp")); - Input.add(new InputConfigItem("Main Stick Down", "Android-MainDown")); - Input.add(new InputConfigItem("Main Stick Left", "Android-MainLeft")); - Input.add(new InputConfigItem("Main Stick Right", "Android-MainRight")); - Input.add(new InputConfigItem("C Stick Up", "Android-CStickUp")); - Input.add(new InputConfigItem("C Stick Down", "Android-CStickDown")); - Input.add(new InputConfigItem("C Stick Left", "Android-CStickLeft")); - Input.add(new InputConfigItem("C Stick Right", "Android-CStickRight")); - Input.add(new InputConfigItem("Trigger L", "Android-InputL")); - Input.add(new InputConfigItem("Trigger R", "Android-InputR")); + Input.add(new InputConfigItem(getString(R.string.draw_onscreen_controls), "Android-ScreenControls", "True")); + Input.add(new InputConfigItem(getString(R.string.button_a), "Android-InputA")); + Input.add(new InputConfigItem(getString(R.string.button_b), "Android-InputB")); + Input.add(new InputConfigItem(getString(R.string.button_start), "Android-InputStart")); + Input.add(new InputConfigItem(getString(R.string.button_x), "Android-InputX")); + Input.add(new InputConfigItem(getString(R.string.button_y), "Android-InputY")); + Input.add(new InputConfigItem(getString(R.string.button_z), "Android-InputZ")); + Input.add(new InputConfigItem(getString(R.string.dpad_up), "Android-DPadUp")); + Input.add(new InputConfigItem(getString(R.string.dpad_down), "Android-DPadDown")); + Input.add(new InputConfigItem(getString(R.string.dpad_left), "Android-DPadLeft")); + Input.add(new InputConfigItem(getString(R.string.dpad_right), "Android-DPadRight")); + Input.add(new InputConfigItem(getString(R.string.main_stick_up), "Android-MainUp")); + Input.add(new InputConfigItem(getString(R.string.main_stick_down), "Android-MainDown")); + Input.add(new InputConfigItem(getString(R.string.main_stick_left), "Android-MainLeft")); + Input.add(new InputConfigItem(getString(R.string.main_stick_right), "Android-MainRight")); + Input.add(new InputConfigItem(getString(R.string.c_stick_up), "Android-CStickUp")); + Input.add(new InputConfigItem(getString(R.string.c_stick_down), "Android-CStickDown")); + Input.add(new InputConfigItem(getString(R.string.c_stick_left), "Android-CStickLeft")); + Input.add(new InputConfigItem(getString(R.string.c_stick_right), "Android-CStickRight")); + Input.add(new InputConfigItem(getString(R.string.trigger_left), "Android-InputL")); + Input.add(new InputConfigItem(getString(R.string.trigger_right), "Android-InputR")); adapter = new InputConfigAdapter(m_activity, R.layout.folderbrowser, Input); View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); @@ -88,12 +88,12 @@ public class InputConfigFragment extends Fragment String newBind; if (o.getBind().equals("True")) { - Toast.makeText(m_activity, "Not Drawing on screen controls", Toast.LENGTH_SHORT).show(); + Toast.makeText(m_activity, getString(R.string.not_drawing_onscreen_controls), Toast.LENGTH_SHORT).show(); newBind = "False"; } else { - Toast.makeText(m_activity, "Drawing on screen controls", Toast.LENGTH_SHORT).show(); + Toast.makeText(m_activity, getString(R.string.drawing_onscreen_controls), Toast.LENGTH_SHORT).show(); newBind = "True"; } adapter.remove(o); @@ -101,7 +101,8 @@ public class InputConfigFragment extends Fragment adapter.insert(o, position); break; default: // gamepad controls - Toast.makeText(m_activity, "Press button to configure " + o.getName(), Toast.LENGTH_SHORT).show(); + + Toast.makeText(m_activity, getString(R.string.press_button_to_config, o.getName()), Toast.LENGTH_SHORT).show(); configPosition = position; Configuring = true; firstEvent = true; @@ -136,9 +137,12 @@ public class InputConfigFragment extends Fragment if (firstEvent) { m_values.clear(); - for (InputDevice.MotionRange range : motions) { + + for (InputDevice.MotionRange range : motions) + { m_values.add(event.getAxisValue(range.getAxis())); } + firstEvent = false; } else @@ -164,7 +168,7 @@ public class InputConfigFragment extends Fragment } public boolean onKeyEvent(KeyEvent event) { - Log.w("Dolphinemu", "Got Event " + event.getAction()); + Log.w("InputConfigFragment", "Got Event " + event.getAction()); switch (event.getAction()) { case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_UP: diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java index 7511406dc9..ff8a077703 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java @@ -10,24 +10,24 @@ public class InputConfigItem implements Comparable{ private String m_Config; private String m_bind; - private void Init(String n, String c, String d) + private void Init(String name, String config, String defaultBind) { - m_name = n; - m_Config = c; + m_name = name; + m_Config = config; String ConfigValues[] = m_Config.split("-"); String Key = ConfigValues[0]; String Value = ConfigValues[1]; - m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, d); + m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, defaultBind); } - public InputConfigItem(String n, String c, String d) + public InputConfigItem(String name, String config, String defaultBind) { - Init(n, c, d); + Init(name, config, defaultBind); } - public InputConfigItem(String n, String c) + public InputConfigItem(String name, String config) { - Init(n, c, "None"); + Init(name, config, "None"); } public String getName() { @@ -41,9 +41,9 @@ public class InputConfigItem implements Comparable{ { return m_bind; } - public void setBind(String b) + public void setBind(String bind) { - m_bind = b; + m_bind = bind; } public int compareTo(InputConfigItem o) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index e16b2503c3..e56aeeb479 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -144,18 +144,18 @@ public class PrefsFragment extends PreferenceFragment { if (Build.CPU_ABI.contains("x86")) { - entries.put("Interpreter", "0"); - entries.put("JIT64 Recompiler", "1"); - entries.put("JITIL Recompiler", "2"); + entries.put(getString(R.string.interpreter), "0"); + entries.put(getString(R.string.jit64_recompiler), "1"); + entries.put(getString(R.string.jitil_recompiler), "2"); } else if (Build.CPU_ABI.contains("arm")) { - entries.put("Interpreter", "0"); - entries.put("JIT ARM Recompiler", "3"); + entries.put(getString(R.string.interpreter), "0"); + entries.put(getString(R.string.jit_arm_recompiler), "3"); } else { - entries.put("Interpreter", "0"); + entries.put(getString(R.string.interpreter), "0"); } // Convert the key/value sections to arrays respectively so the list can be set. @@ -163,8 +163,8 @@ public class PrefsFragment extends PreferenceFragment { etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); etp.setKey("cpupref"); - etp.setTitle("CPU Core"); - etp.setSummary("Emulation core to use"); + etp.setTitle(getString(R.string.cpu_core)); + etp.setSummary(getString(R.string.emu_core_to_use)); PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat"); mCategory.addPreference(etp); @@ -181,11 +181,11 @@ public class PrefsFragment extends PreferenceFragment { // Add available graphics renderers to the hashmap to add to the list. entries.clear(); - entries.put("Software Renderer", "Software Renderer"); // TODO: I think this is a bug? The value shouldn't be the same as the key? + entries.put(getString(R.string.software_renderer), "Software Renderer"); videobackend.setKey("gpupref"); - videobackend.setTitle("Video Backend"); - videobackend.setSummary("Video backend to use"); + videobackend.setTitle(getString(R.string.video_backend)); + videobackend.setSummary(getString(R.string.video_backend_to_use)); videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); -- cgit v1.2.3 From 2d7244f6d51b6cdecd6d4dc14ae6a6786b883d58 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 08:50:21 -0400 Subject: [Android] Change the name of a variable in FolderBrowser.java to better reflect its purpose Compressed file formats are not valid, so it's best to rename this to invalidExts. --- Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index ee96f445ce..817a9152c5 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -31,7 +31,7 @@ public class FolderBrowser extends Fragment { // Supported extensions to filter by Set validExts = new HashSet(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf", ".dff")); - Set archiveExts = new HashSet(Arrays.asList(".zip", ".rar", ".7z")); + Set invalidExts = new HashSet(Arrays.asList(".zip", ".rar", ".7z")); // Search for any directories or supported files within the current dir. try @@ -52,7 +52,7 @@ public class FolderBrowser extends Fragment { { fls.add(new GameListItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); } - else if (archiveExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) + 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)); } -- cgit v1.2.3 From e3617a55a01d05a7dde37dfc37e662bfd91f42de Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 08:58:50 -0400 Subject: [Android] Clean up the function CopyAsset in DolphinEmulator.java. [streamtype].flush() is called when [streamtype].close() is called. No need to null the references either after calling close(), the garbage collection will take care of it. --- Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index fefb13ec14..cf2ad33e4f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -33,10 +33,7 @@ public class DolphinEmulator extends Activity out = new FileOutputStream(output); copyFile(in, out); in.close(); - in = null; - out.flush(); out.close(); - out = null; } catch(IOException e) { Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e); } @@ -78,7 +75,6 @@ public class DolphinEmulator extends Activity super.onCreate(savedInstanceState); if (savedInstanceState == null) { - Intent ListIntent = new Intent(this, GameListActivity.class); startActivityForResult(ListIntent, 1); -- cgit v1.2.3 From 0916d0797c0d6e2da6e9b59f2ac92cfc99b569c4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 09:13:46 -0400 Subject: Simplify asset copying code a little bit in DolphinEmulator.java Since the directories are already cached (with smaller variable names), use these instead so we can shorten the length of each line. --- .../org/dolphinemu/dolphinemu/DolphinEmulator.java | 44 ++++++---------------- 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index cf2ad33e4f..40e5b6e98a 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -92,41 +92,19 @@ public class DolphinEmulator extends Activity directory.mkdirs(); // Copy assets if needed - java.io.File file = new java.io.File( - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_coef.bin"); + File file = new File(GCDir + File.separator + "dsp_coef.bin"); if(!file.exists()) { - CopyAsset("ButtonA.png", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "ButtonA.png"); - CopyAsset("ButtonB.png", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "ButtonB.png"); - CopyAsset("ButtonStart.png", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "ButtonStart.png"); - CopyAsset("NoBanner.png", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "NoBanner.png"); - CopyAsset("GCPadNew.ini", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "Config" + File.separator + "GCPadNew.ini"); - CopyAsset("Dolphin.ini", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "Config" + File.separator + "Dolphin.ini"); - CopyAsset("dsp_coef.bin", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_coef.bin"); - CopyAsset("dsp_rom.bin", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_rom.bin"); - CopyAsset("font_ansi.bin", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "GC" + File.separator + "font_ansi.bin"); - CopyAsset("font_sjis.bin", - Environment.getExternalStorageDirectory()+File.separator+ - "dolphin-emu" + File.separator + "GC" + File.separator + "font_sjis.bin"); + CopyAsset("ButtonA.png", BaseDir + File.separator + "ButtonA.png"); + CopyAsset("ButtonB.png", BaseDir + File.separator + "ButtonB.png"); + CopyAsset("ButtonStart.png", BaseDir + File.separator + "ButtonStart.png"); + CopyAsset("NoBanner.png", BaseDir + File.separator + "NoBanner.png"); + CopyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini"); + CopyAsset("Dolphin.ini", ConfigDir + File.separator + "Dolphin.ini"); + CopyAsset("dsp_coef.bin", GCDir + File.separator + "dsp_coef.bin"); + CopyAsset("dsp_rom.bin", GCDir + File.separator + "dsp_rom.bin"); + CopyAsset("font_ansi.bin", GCDir + File.separator + "font_ansi.bin"); + CopyAsset("font_sjis.bin", GCDir + File.separator + "font_sjis.bin"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = prefs.edit(); -- cgit v1.2.3 From 2015484c24b817b9980d0f59e0cde1a4435cc789 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 09:23:11 -0400 Subject: [Android] Some tiny cleanups in DolphinEmulator.java - Join variable declaration and assignments in function onTouchEvent() - Change a for-loop into a foreach loop in dispatchGenericMotionEvent(). Makes the loop body a single statement. --- .../src/org/dolphinemu/dolphinemu/DolphinEmulator.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index 40e5b6e98a..d4177de5a4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -143,11 +143,9 @@ public class DolphinEmulator extends Activity @Override public boolean onTouchEvent(MotionEvent event) { - float X, Y; - int Action; - X = event.getX(); - Y = event.getY(); - Action = event.getActionMasked(); + float X = event.getX(); + float Y = event.getY(); + int Action = event.getActionMasked(); // Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0 float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f; @@ -207,14 +205,13 @@ public class DolphinEmulator extends Activity InputDevice input = event.getDevice(); List motions = input.getMotionRanges(); - for (int a = 0; a < motions.size(); ++a) + + for (InputDevice.MotionRange range : motions) { - InputDevice.MotionRange range; - range = motions.get(a); - NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis())); + NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis())); } return true; } -} \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3 From debd5b42cf9ca56a33d76f19b1f6b586f0de697c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 09:48:18 -0400 Subject: [Android] Clean up function SupportsGLES3 in PrefsFragment.java a little bit. --- .../org/dolphinemu/dolphinemu/PrefsFragment.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index e56aeeb479..4f088a58b4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -97,33 +97,35 @@ public class PrefsFragment extends PreferenceFragment { } static public boolean SupportsGLES3() { - String m_GLVersion; - String m_GLVendor; - String m_GLRenderer; - VersionCheck mbuffer = new VersionCheck(); - m_GLVersion = mbuffer.getVersion(); - m_GLVendor = mbuffer.getVendor(); - m_GLRenderer = mbuffer.getRenderer(); + String m_GLVersion = mbuffer.getVersion(); + String m_GLVendor = mbuffer.getVendor(); + String m_GLRenderer = mbuffer.getRenderer(); boolean mSupportsGLES3 = false; - if (m_GLVersion.contains("OpenGL ES 3.0") || - m_GLVersion.equals("OpenGL ES 3.0")) // 3.0 support + // Check for OpenGL ES 3 support (General case). + if (m_GLVersion.contains("OpenGL ES 3.0") || m_GLVersion.equals("OpenGL ES 3.0")) mSupportsGLES3 = true; + + // Checking for OpenGL ES 3 support for certain Qualcomm devices. if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm")) { if (m_GLRenderer.contains("Adreno (TM) 3")) { - int mVStart, mVEnd = 0; + int mVStart = m_GLVersion.indexOf("V@") + 2; + int mVEnd = 0; float mVersion; - mVStart = m_GLVersion.indexOf("V@") + 2; + for (int a = mVStart; a < m_GLVersion.length(); ++a) + { if (m_GLVersion.charAt(a) == ' ') { mVEnd = a; break; } + } + mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd)); if (mVersion >= 14.0f) -- cgit v1.2.3 From a8fcd50cd7c58a610169c38032ab3928a3229b82 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 10:09:42 -0400 Subject: [Android] Integer.toString isn't required in this string declaration. Concatenation handles this. For example: "string" + 1 will just be concatenated as "string1" implicitly. --- Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java index efcee489a8..8e4d2cb244 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java @@ -49,7 +49,7 @@ public class GameListFragment extends Fragment for (int a = 0; a < intDirectories; ++a) { - String BrowseDir = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + Integer.toString(a), ""); + String BrowseDir = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + a, ""); File currentDir = new File(BrowseDir); File[]dirs = currentDir.listFiles(); try -- cgit v1.2.3 From 8fbf11a0d9f507f6f4589e5333317697deb986a7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 12:10:42 -0400 Subject: [Android] Add translatable="false" to the names of the string arrays in prefvalues.xml. --- Source/Android/res/values/prefvalues.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/res/values/prefvalues.xml b/Source/Android/res/values/prefvalues.xml index 409666e328..8564801f6f 100644 --- a/Source/Android/res/values/prefvalues.xml +++ b/Source/Android/res/values/prefvalues.xml @@ -1,11 +1,11 @@ - + Software Renderer OpenGL ES 3 - + Software Renderer OGL -- cgit v1.2.3 From 53bf55b1e9047a1065580a4e024fb5a74c5ec94a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 13:05:42 -0400 Subject: [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. --- Source/Android/res/drawable-hdpi/ic_menu_file.png | Bin 0 -> 510 bytes .../Android/res/drawable-hdpi/ic_menu_folder.png | Bin 0 -> 1449 bytes Source/Android/res/drawable-mdpi/ic_menu_file.png | Bin 0 -> 487 bytes .../Android/res/drawable-mdpi/ic_menu_folder.png | Bin 0 -> 1312 bytes Source/Android/res/drawable-xhdpi/ic_menu_file.png | Bin 0 -> 580 bytes .../Android/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 +++++++----- .../org/dolphinemu/dolphinemu/AboutFragment.java | 9 +- .../org/dolphinemu/dolphinemu/FolderBrowser.java | 18 ++-- .../dolphinemu/FolderBrowserAdapter.java | 67 +++++++----- .../dolphinemu/dolphinemu/FolderBrowserItem.java | 113 +++++++++++++++++++++ .../org/dolphinemu/dolphinemu/InputConfigItem.java | 48 ++++++++- .../org/dolphinemu/dolphinemu/NativeLibrary.java | 11 +- .../org/dolphinemu/dolphinemu/SideMenuAdapter.java | 48 +++++---- .../org/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 (limited to 'Source/Android') 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 0000000000..f204740905 Binary files /dev/null and b/Source/Android/res/drawable-hdpi/ic_menu_file.png differ 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 0000000000..6f441b41da Binary files /dev/null and b/Source/Android/res/drawable-hdpi/ic_menu_folder.png differ 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 0000000000..dee2577897 Binary files /dev/null and b/Source/Android/res/drawable-mdpi/ic_menu_file.png differ 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 0000000000..cc81e57f7e Binary files /dev/null and b/Source/Android/res/drawable-mdpi/ic_menu_folder.png differ 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 0000000000..85369c338e Binary files /dev/null and b/Source/Android/res/drawable-xhdpi/ic_menu_file.png differ diff --git a/Source/Android/res/drawable-xhdpi/ic_menu_folder.png b/Source/Android/res/drawable-xhdpi/ic_menu_folder.png new file mode 100644 index 0000000000..78500a93c1 Binary files /dev/null and b/Source/Android/res/drawable-xhdpi/ic_menu_folder.png differ 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) + { + mainText.setText(item.getName()); + + if (!item.isValidItem()) + { + mainText.setTextColor(0xFFFF0000); + } + } + + if(subtitleText != null) + { + subtitleText.setText(item.getSubtitle()); + } + + if (iconView != null) { - t1.setText(o.getName()); - if (!o.isValid()) - t1.setTextColor(0xFFFF0000); + 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; -- cgit v1.2.3 From 3cc8f7747e22f9a2a519a5dd559ac338791aae2b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Aug 2013 14:32:46 -0400 Subject: [Android] Main title text for the file browser items are bolded again. Must have removed it accidentally during the previous large refactor. --- Source/Android/res/layout/folderbrowser.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml index 61c6fba1ea..adfd72ed35 100644 --- a/Source/Android/res/layout/folderbrowser.xml +++ b/Source/Android/res/layout/folderbrowser.xml @@ -38,6 +38,6 @@ android:layout_alignWithParentIfMissing="true" android:gravity="center_vertical" - android:text="Title" /> - + android:text="Title" + android:textStyle="bold" />/> -- cgit v1.2.3 From 0142efbb2a4479d2e772d6c715057273638c7557 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 07:17:45 -0400 Subject: [Android] Add 'final' to all of the class declarations. This prevents inheritance of the classes (will throw a compiler error if you try and extend any of the classes). This is mainly syntactical sugar and form. Nothing major. --- Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java | 2 +- Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 4905027ae1..1e2ff17061 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -16,7 +16,7 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class AboutFragment extends Fragment { +public final class AboutFragment extends Fragment { private static Activity m_activity; private ListView mMainList; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index d4177de5a4..ff4e989d28 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -17,7 +17,7 @@ import android.view.WindowManager; import java.io.*; import java.util.List; -public class DolphinEmulator extends Activity +public final class DolphinEmulator extends Activity { static private NativeGLSurfaceView GLview = null; static private boolean Running = false; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index aa44ad83ca..f180a5b198 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -14,7 +14,7 @@ import android.widget.Toast; import java.io.File; import java.util.*; -public class FolderBrowser extends Fragment { +public final class FolderBrowser extends Fragment { private Activity m_activity; private FolderBrowserAdapter adapter; private ListView mDrawerList; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index 0c38aa7b2f..ea326ecca4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -11,7 +11,7 @@ import android.widget.TextView; import java.util.List; -public class FolderBrowserAdapter extends ArrayAdapter{ +public final class FolderBrowserAdapter extends ArrayAdapter{ private Context c; private int id; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java index 845bf72bdd..564de80df4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java @@ -22,7 +22,7 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class GameListActivity extends Activity +public final class GameListActivity extends Activity implements GameListFragment.OnGameListZeroListener{ private int mCurFragmentNum = 0; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java index 986f33555b..e31072d2b7 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java @@ -10,7 +10,7 @@ import android.widget.TextView; import java.util.List; -public class GameListAdapter extends ArrayAdapter{ +public final class GameListAdapter extends ArrayAdapter{ private Context c; private int id; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java index 8e4d2cb244..a513530a28 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java @@ -24,7 +24,7 @@ import java.util.Set; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class GameListFragment extends Fragment +public final class GameListFragment extends Fragment { private ListView mMainList; private GameListAdapter mGameAdapter; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java index 427cd132f8..58cc291326 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java @@ -8,7 +8,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -public class GameListItem implements Comparable{ +public final class GameListItem implements Comparable{ private String name; private String data; private String path; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java index b0984dd08a..c7e23f3cfa 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java @@ -14,7 +14,7 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class InputConfigAdapter extends ArrayAdapter { +public final class InputConfigAdapter extends ArrayAdapter { private Context c; private int id; private List items; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index b11dc4a34b..50e49a2383 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -18,7 +18,7 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class InputConfigFragment extends Fragment +public final class InputConfigFragment extends Fragment implements GameListActivity.OnGameConfigListener{ private Activity m_activity; private ListView mDrawerList; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java index 0a6f69a1d0..13bf8b9f3c 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java @@ -9,7 +9,7 @@ package org.dolphinemu.dolphinemu; /** * Represents a controller input item (button, stick, etc). */ -public class InputConfigItem implements Comparable{ +public final class InputConfigItem implements Comparable{ private String m_name; private String m_Config; private String m_bind; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java index 030c7ed823..edeb3eeac4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java @@ -4,7 +4,7 @@ import android.content.Context; import android.view.SurfaceHolder; import android.view.SurfaceView; -public class NativeGLSurfaceView extends SurfaceView { +public final class NativeGLSurfaceView extends SurfaceView { static private Thread myRun; static private boolean Running = false; static private boolean Created = false; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index da58274c5f..5d6aa1ac23 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -13,7 +13,7 @@ import android.view.Surface; * Class which contains methods that interact * with the native side of the Dolphin code. */ -public class NativeLibrary { +public final class NativeLibrary { public static native void onTouchEvent(int Action, float X, float Y); public static native void onGamePadEvent(String Device, int Button, int Action); public static native void onGamePadMoveEvent(String Device, int Axis, float Value); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index 4f088a58b4..5dd2afa969 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -17,7 +17,7 @@ import javax.microedition.khronos.opengles.GL10; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class PrefsFragment extends PreferenceFragment { +public final class PrefsFragment extends PreferenceFragment { private Activity m_activity; static public class VersionCheck { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java index eb2143becb..d47cbc96ba 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java @@ -9,7 +9,7 @@ import android.widget.TextView; import java.util.List; -public class SideMenuAdapter extends ArrayAdapter{ +public final class SideMenuAdapter extends ArrayAdapter{ private Context c; private int id; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java index 6d204d0d69..25869b77e7 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java @@ -10,7 +10,7 @@ package org.dolphinemu.dolphinemu; /** * Represents an item that goes in the sidemenu of the app. */ -public class SideMenuItem implements Comparable +public final class SideMenuItem implements Comparable { private String m_name; private int m_id; -- cgit v1.2.3 From 39eeb370321d4da0f995b71814e95451b81a5152 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 07:33:17 -0400 Subject: [Android] Correct the accessibility scope of a method and variable in InputConfigFragment.java. Also, join a variable's declaration and assignment in the onMotionEvent() function. If no explicit accessibility term (private, protected, public, etc) is given, then the permission level is set to something called 'package-private' which means it is set to the scope of the whole package. So technically any class could have access to this method and variable, which is likely not what we want. --- .../src/org/dolphinemu/dolphinemu/InputConfigFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index 50e49a2383..5be1416944 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -111,9 +111,9 @@ public final class InputConfigFragment extends Fragment } }; - static ArrayList m_values = new ArrayList(); + private static ArrayList m_values = new ArrayList(); - void AssignBind(String bind) + private void AssignBind(String bind) { InputConfigItem o = adapter.getItem(configPosition); adapter.remove(o); @@ -149,8 +149,8 @@ public final class InputConfigFragment extends Fragment { for (int a = 0; a < motions.size(); ++a) { - InputDevice.MotionRange range; - range = motions.get(a); + InputDevice.MotionRange range = motions.get(a); + if (m_values.get(a) > (event.getAxisValue(range.getAxis()) + 0.5f)) { AssignBind("Device '" + InputConfigFragment.getInputDesc(input) + "'-Axis " + range.getAxis() + "-"); -- cgit v1.2.3 From 6f1612d99cb7acd79434eac24916a9d0b0c52ff5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 14:33:47 -0400 Subject: [Android] Fix the gamepad settings view inflation. In some cases, it would fail to inflate correctly in the sense that it would only show the binding status and not the name of the actual control that was being binded. --- Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java index c7e23f3cfa..ad3a5211c8 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java @@ -36,7 +36,7 @@ public final class InputConfigAdapter extends ArrayAdapter { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - v = vi.inflate(id, null); + v = vi.inflate(id, parent, false); } final InputConfigItem o = items.get(position); if (o != null) { -- cgit v1.2.3 From 94397a44cc556198caf79da20f649a928758cbcc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 15:03:07 -0400 Subject: [Android] General formatting clean-up. Made some class variables final, since they should convey that they cannot be changed after the first assignment. Made the formatting consistent between files. --- .../org/dolphinemu/dolphinemu/AboutFragment.java | 21 +++++--- .../org/dolphinemu/dolphinemu/DolphinEmulator.java | 36 +++++++++----- .../org/dolphinemu/dolphinemu/FolderBrowser.java | 17 ++++--- .../dolphinemu/FolderBrowserAdapter.java | 14 +++--- .../dolphinemu/dolphinemu/GameListActivity.java | 56 +++++++++++++++++----- .../org/dolphinemu/dolphinemu/GameListAdapter.java | 47 ++++++++++-------- .../dolphinemu/dolphinemu/GameListFragment.java | 26 ++++++---- .../org/dolphinemu/dolphinemu/GameListItem.java | 40 ++++++++++------ .../dolphinemu/dolphinemu/InputConfigAdapter.java | 45 +++++++++-------- .../dolphinemu/dolphinemu/InputConfigFragment.java | 30 +++++++++--- .../org/dolphinemu/dolphinemu/InputConfigItem.java | 3 +- .../dolphinemu/dolphinemu/NativeGLSurfaceView.java | 20 ++++---- .../org/dolphinemu/dolphinemu/NativeLibrary.java | 3 +- .../org/dolphinemu/dolphinemu/PrefsFragment.java | 30 ++++++++---- .../org/dolphinemu/dolphinemu/SideMenuAdapter.java | 24 +++++----- .../org/dolphinemu/dolphinemu/SideMenuItem.java | 4 +- 16 files changed, 269 insertions(+), 147 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 1e2ff17061..e05d1c7db2 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -16,7 +16,8 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public final class AboutFragment extends Fragment { +public final class AboutFragment extends Fragment +{ private static Activity m_activity; private ListView mMainList; @@ -25,13 +26,14 @@ public final class AboutFragment extends Fragment { boolean Configuring = false; boolean firstEvent = true; - public AboutFragment() { + public AboutFragment() + { // Empty constructor required for fragment subclasses } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); mMainList = (ListView) rootView.findViewById(R.id.gamelist); @@ -47,15 +49,20 @@ public final class AboutFragment extends Fragment { return mMainList; } + @Override - public void onAttach(Activity activity) { + public void onAttach(Activity activity) + { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception - try { + try + { m_activity = activity; - } catch (ClassCastException e) { + } + catch (ClassCastException e) + { throw new ClassCastException(activity.toString() + " must implement OnGameListZeroListener"); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index ff4e989d28..d1e23d1e53 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -25,24 +25,32 @@ public final class DolphinEmulator extends Activity private float screenWidth; private float screenHeight; - private void CopyAsset(String asset, String output) { + private void CopyAsset(String asset, String output) + { InputStream in = null; OutputStream out = null; - try { + + try + { in = getAssets().open(asset); out = new FileOutputStream(output); copyFile(in, out); in.close(); out.close(); - } catch(IOException e) { + } + catch(IOException e) + { Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e); } } - private void copyFile(InputStream in, OutputStream out) throws IOException { + private void copyFile(InputStream in, OutputStream out) throws IOException + { byte[] buffer = new byte[1024]; int read; - while((read = in.read(buffer)) != -1){ + + while((read = in.read(buffer)) != -1) + { out.write(buffer, 0, read); } } @@ -54,6 +62,7 @@ public final class DolphinEmulator extends Activity if (Running) NativeLibrary.StopEmulation(); } + @Override public void onPause() { @@ -61,6 +70,7 @@ public final class DolphinEmulator extends Activity if (Running) NativeLibrary.PauseEmulation(); } + @Override public void onResume() { @@ -71,7 +81,8 @@ public final class DolphinEmulator extends Activity /** Called when the activity is first created. */ @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) + { super.onCreate(savedInstanceState); if (savedInstanceState == null) { @@ -158,7 +169,8 @@ public final class DolphinEmulator extends Activity // Gets button presses @Override - public boolean dispatchKeyEvent(KeyEvent event) { + public boolean dispatchKeyEvent(KeyEvent event) + { int action = 0; // Special catch for the back key @@ -180,7 +192,8 @@ public final class DolphinEmulator extends Activity if (Running) { - switch (event.getAction()) { + switch (event.getAction()) + { case KeyEvent.ACTION_DOWN: action = 0; break; @@ -198,8 +211,10 @@ public final class DolphinEmulator extends Activity } @Override - public boolean dispatchGenericMotionEvent(MotionEvent event) { - if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running) { + public boolean dispatchGenericMotionEvent(MotionEvent event) + { + if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running) + { return super.dispatchGenericMotionEvent(event); } @@ -213,5 +228,4 @@ public final class DolphinEmulator extends Activity return true; } - } \ No newline at end of file diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index f180a5b198..e60378c2cd 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -14,7 +14,8 @@ import android.widget.Toast; import java.io.File; import java.util.*; -public final class FolderBrowser extends Fragment { +public final class FolderBrowser extends Fragment +{ private Activity m_activity; private FolderBrowserAdapter adapter; private ListView mDrawerList; @@ -77,9 +78,9 @@ public final class FolderBrowser extends Fragment { mDrawerList.setAdapter(adapter); mDrawerList.setOnItemClickListener(mMenuItemClickListener); } + @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if(currentDir == null) currentDir = new File(Environment.getExternalStorageDirectory().getPath()); @@ -111,14 +112,18 @@ public final class FolderBrowser extends Fragment { }; @Override - public void onAttach(Activity activity) { + public void onAttach(Activity activity) + { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception - try { + try + { m_activity = activity; - } catch (ClassCastException e) { + } + catch (ClassCastException e) + { throw new ClassCastException(activity.toString() + " must implement OnGameListZeroListener"); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index ea326ecca4..dea96ce9d6 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -1,7 +1,6 @@ package org.dolphinemu.dolphinemu; import android.content.Context; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -11,13 +10,14 @@ import android.widget.TextView; import java.util.List; -public final class FolderBrowserAdapter extends ArrayAdapter{ +public final class FolderBrowserAdapter extends ArrayAdapter +{ + private final Context c; + private final int id; + private final List items; - private Context c; - private int id; - 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; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java index 564de80df4..2bd61cb0f2 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java @@ -23,7 +23,8 @@ import java.util.List; * Refer to the license.txt file included. */ public final class GameListActivity extends Activity - implements GameListFragment.OnGameListZeroListener{ + implements GameListFragment.OnGameListZeroListener +{ private int mCurFragmentNum = 0; private Fragment mCurFragment; @@ -43,7 +44,8 @@ public final class GameListActivity extends Activity } @Override - protected void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) + { super.onCreate(savedInstanceState); setContentView(R.layout.gamelist_activity); mMe = this; @@ -94,16 +96,19 @@ public final class GameListActivity extends Activity FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } + public void SwitchPage(int toPage) { if (mCurFragmentNum == toPage) return; + switch (mCurFragmentNum) { // Folder browser case 1: recreateFragment(); - break; + break; + // Settings case 2: { @@ -147,6 +152,7 @@ public final class GameListActivity extends Activity } } break; + case 3: // Gamepad settings { InputConfigAdapter adapter = ((InputConfigFragment)mCurFragment).getAdapter(); @@ -162,11 +168,13 @@ public final class GameListActivity extends Activity } } break; + case 0: // Game List case 4: // About /* Do Nothing */ break; } + switch(toPage) { case 0: @@ -177,6 +185,7 @@ public final class GameListActivity extends Activity fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } break; + case 1: { Toast.makeText(mMe, getString(R.string.loading_browser), Toast.LENGTH_SHORT).show(); @@ -186,6 +195,7 @@ public final class GameListActivity extends Activity fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } break; + case 2: { Toast.makeText(mMe, getString(R.string.loading_settings), Toast.LENGTH_SHORT).show(); @@ -195,6 +205,7 @@ public final class GameListActivity extends Activity fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } break; + case 3: { Toast.makeText(mMe, getString(R.string.loading_gamepad), Toast.LENGTH_SHORT).show(); @@ -204,6 +215,7 @@ public final class GameListActivity extends Activity fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } break; + case 4: { Toast.makeText(mMe, getString(R.string.about), Toast.LENGTH_SHORT).show(); @@ -213,10 +225,12 @@ public final class GameListActivity extends Activity fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit(); } break; + default: break; } } + private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) @@ -232,57 +246,75 @@ public final class GameListActivity extends Activity */ @Override - protected void onPostCreate(Bundle savedInstanceState) { + protected void onPostCreate(Bundle savedInstanceState) + { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Override - public void onConfigurationChanged(Configuration newConfig) { + public void onConfigurationChanged(Configuration newConfig) + { super.onConfigurationChanged(newConfig); - // Pass any configuration change to the drawer toggls + // Pass any configuration change to the drawer toggle mDrawerToggle.onConfigurationChanged(newConfig); } /* Called whenever we call invalidateOptionsMenu() */ @Override - public boolean onPrepareOptionsMenu(Menu menu) { + public boolean onPrepareOptionsMenu(Menu menu) + { return super.onPrepareOptionsMenu(menu); } @Override - public boolean onOptionsItemSelected(MenuItem item) { + public boolean onOptionsItemSelected(MenuItem item) + { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. - if (mDrawerToggle.onOptionsItemSelected(item)) { + if (mDrawerToggle.onOptionsItemSelected(item)) + { return true; } + return super.onOptionsItemSelected(item); } + public void onBackPressed() { SwitchPage(0); } - public interface OnGameConfigListener { + public interface OnGameConfigListener + { public boolean onMotionEvent(MotionEvent event); public boolean onKeyEvent(KeyEvent event); } + // Gets move(triggers, joystick) events @Override - public boolean dispatchGenericMotionEvent(MotionEvent event) { + public boolean dispatchGenericMotionEvent(MotionEvent event) + { if (mCurFragmentNum == 3) + { if (((OnGameConfigListener)mCurFragment).onMotionEvent(event)) return true; + } + return super.dispatchGenericMotionEvent(event); } + // Gets button presses @Override - public boolean dispatchKeyEvent(KeyEvent event) { + public boolean dispatchKeyEvent(KeyEvent event) + { if (mCurFragmentNum == 3) + { if (((OnGameConfigListener)mCurFragment).onKeyEvent(event)) return true; + } + return super.dispatchKeyEvent(event); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java index e31072d2b7..d7170bb474 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java @@ -10,13 +10,14 @@ import android.widget.TextView; import java.util.List; -public final class GameListAdapter extends ArrayAdapter{ +public final class GameListAdapter extends ArrayAdapter +{ + private final Context c; + private final int id; + private final Listitems; - private Context c; - private int id; - private Listitems; - - public GameListAdapter(Context context, int textViewResourceId, List objects) { + public GameListAdapter(Context context, int textViewResourceId, List objects) + { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; @@ -29,26 +30,30 @@ public final class GameListAdapter extends ArrayAdapter{ } @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) { + if (v == null) + { LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(id, null); } - final GameListItem o = items.get(position); - if (o != null) { - TextView t1 = (TextView) v.findViewById(R.id.GameItemTitle); - TextView t2 = (TextView) v.findViewById(R.id.GameItemSubText); - ImageView v1 = (ImageView) v.findViewById(R.id.GameItemIcon); - - if(t1!=null) - t1.setText(o.getName()); - if(t2!=null) - t2.setText(o.getData()); - if(v1!=null) - v1.setImageBitmap(o.getImage()); - } + final GameListItem item = items.get(position); + if (item != null) + { + TextView title = (TextView) v.findViewById(R.id.GameItemTitle); + TextView subtitle = (TextView) v.findViewById(R.id.GameItemSubText); + ImageView icon = (ImageView) v.findViewById(R.id.GameItemIcon); + + if(title != null) + title.setText(item.getName()); + if(subtitle != null) + subtitle.setText(item.getData()); + if(icon != null) + icon.setImageBitmap(item.getImage()); + } + return v; } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java index a513530a28..13f66c1c83 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java @@ -31,13 +31,16 @@ public final class GameListFragment extends Fragment private static GameListActivity mMe; OnGameListZeroListener mCallback; - public interface OnGameListZeroListener { + public interface OnGameListZeroListener + { public void onZeroFiles(); } - public GameListFragment() { + public GameListFragment() + { // Empty constructor required for fragment subclasses } + private void Fill() { List fls = new ArrayList(); @@ -51,7 +54,7 @@ public final class GameListFragment extends Fragment { String BrowseDir = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + a, ""); File currentDir = new File(BrowseDir); - File[]dirs = currentDir.listFiles(); + File[] dirs = currentDir.listFiles(); try { for(File entry : dirs) @@ -81,8 +84,8 @@ public final class GameListFragment extends Fragment } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); mMainList = (ListView) rootView.findViewById(R.id.gamelist); mMainList.setOnItemClickListener(mGameItemClickListener); @@ -91,6 +94,7 @@ public final class GameListFragment extends Fragment return mMainList; } + private AdapterView.OnItemClickListener mGameItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) @@ -102,6 +106,7 @@ public final class GameListFragment extends Fragment } } }; + private void onFileClick(String o) { Toast.makeText(mMe, getString(R.string.file_clicked) + o, Toast.LENGTH_SHORT).show(); @@ -111,16 +116,21 @@ public final class GameListFragment extends Fragment mMe.setResult(Activity.RESULT_OK, intent); mMe.finish(); } + @Override - public void onAttach(Activity activity) { + public void onAttach(Activity activity) + { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception - try { + try + { mCallback = (OnGameListZeroListener) activity; mMe = (GameListActivity) activity; - } catch (ClassCastException e) { + } + catch (ClassCastException e) + { throw new ClassCastException(activity.toString() + " must implement OnGameListZeroListener"); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java index 58cc291326..a9ef41c6d4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java @@ -8,36 +8,44 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -public final class GameListItem implements Comparable{ - private String name; - private String data; - private String path; +public final class GameListItem implements Comparable +{ + private final String name; + private final String data; + private final String path; + private final boolean isValid; private Bitmap image; - private boolean m_valid; - public GameListItem(Context ctx, String n,String d,String p, boolean valid) + public GameListItem(Context ctx, String name, String data, String path, boolean isValid) { - name = n; - data = d; - path = p; - m_valid = valid; + this.name = name; + this.data = data; + this.path = path; + this.isValid = isValid; + File file = new File(path); if (!file.isDirectory() && !path.equals("")) { int[] Banner = NativeLibrary.GetBanner(path); if (Banner[0] == 0) { - try { - InputStream path = ctx.getAssets().open("NoBanner.png"); - image = BitmapFactory.decodeStream(path); - } catch (IOException e) { + try + { + InputStream noBannerPath = ctx.getAssets().open("NoBanner.png"); + image = BitmapFactory.decodeStream(noBannerPath); + } + catch (IOException e) + { // TODO Auto-generated catch block e.printStackTrace(); } } else + { image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888); + } + name = NativeLibrary.GetTitle(path); } } @@ -56,13 +64,15 @@ public final class GameListItem implements Comparable{ { return path; } + public Bitmap getImage() { return image; } + public boolean isValid() { - return m_valid; + return isValid; } public int compareTo(GameListItem o) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java index ad3a5211c8..12541b8b37 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java @@ -14,13 +14,14 @@ import java.util.List; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public final class InputConfigAdapter extends ArrayAdapter { - private Context c; - private int id; - private List items; +public final class InputConfigAdapter extends ArrayAdapter +{ + private final Context c; + private final int id; + private final List items; - public InputConfigAdapter(Context context, int textViewResourceId, - List objects) { + public InputConfigAdapter(Context context, int textViewResourceId, List objects) + { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; @@ -31,26 +32,30 @@ public final class InputConfigAdapter extends ArrayAdapter { { 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) { + if (v == null) + { LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(id, parent, false); } - final InputConfigItem o = items.get(position); - if (o != null) { - TextView t1 = (TextView) v.findViewById(R.id.FolderTitle); - TextView t2 = (TextView) v.findViewById(R.id.FolderSubTitle); - - if(t1!=null) - t1.setText(o.getName()); - if(t2!=null) - t2.setText(o.getBind()); + + final InputConfigItem item = items.get(position); + if (item != null) + { + TextView title = (TextView) v.findViewById(R.id.FolderTitle); + TextView subtitle = (TextView) v.findViewById(R.id.FolderSubTitle); + + if(title != null) + title.setText(item.getName()); + + if(subtitle != null) + subtitle.setText(item.getBind()); } + return v; } - - - } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index 5be1416944..530f8b1d3b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -19,7 +19,8 @@ import java.util.List; * Refer to the license.txt file included. */ public final class InputConfigFragment extends Fragment - implements GameListActivity.OnGameConfigListener{ + implements GameListActivity.OnGameConfigListener +{ private Activity m_activity; private ListView mDrawerList; private InputConfigAdapter adapter; @@ -31,20 +32,24 @@ public final class InputConfigFragment extends Fragment { if (input == null) return "null"; // Happens when the inputdevice is from an unknown source + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) + { return input.getDescriptor(); + } else { List motions = input.getMotionRanges(); String fakeid = ""; + for (InputDevice.MotionRange range : motions) fakeid += range.getAxis(); + return fakeid; } } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { List Input = new ArrayList(); Input.add(new InputConfigItem(getString(R.string.draw_onscreen_controls), "Android-ScreenControls", "True")); @@ -77,6 +82,7 @@ public final class InputConfigFragment extends Fragment mDrawerList.setOnItemClickListener(mMenuItemClickListener); return mDrawerList; } + private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) @@ -100,6 +106,7 @@ public final class InputConfigFragment extends Fragment o.setBind(newBind); adapter.insert(o, position); break; + default: // gamepad controls Toast.makeText(m_activity, getString(R.string.press_button_to_config, o.getName()), Toast.LENGTH_SHORT).show(); @@ -120,10 +127,12 @@ public final class InputConfigFragment extends Fragment o.setBind(bind); adapter.insert(o, configPosition); } + public InputConfigAdapter getAdapter() { return adapter; } + // Called from GameListActivity public boolean onMotionEvent(MotionEvent event) { @@ -166,10 +175,12 @@ public final class InputConfigFragment extends Fragment } return true; } + public boolean onKeyEvent(KeyEvent event) { Log.w("InputConfigFragment", "Got Event " + event.getAction()); - switch (event.getAction()) { + switch (event.getAction()) + { case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_UP: if (Configuring) @@ -179,6 +190,7 @@ public final class InputConfigFragment extends Fragment Configuring = false; return true; } + default: break; } @@ -187,14 +199,18 @@ public final class InputConfigFragment extends Fragment } @Override - public void onAttach(Activity activity) { + public void onAttach(Activity activity) + { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception - try { + try + { m_activity = activity; - } catch (ClassCastException e) { + } + catch (ClassCastException e) + { throw new ClassCastException(activity.toString() + " must implement OnGameListZeroListener"); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java index 13bf8b9f3c..70e68261ec 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java @@ -9,7 +9,8 @@ package org.dolphinemu.dolphinemu; /** * Represents a controller input item (button, stick, etc). */ -public final class InputConfigItem implements Comparable{ +public final class InputConfigItem implements Comparable +{ private String m_name; private String m_Config; private String m_bind; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java index edeb3eeac4..ffe89714be 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java @@ -4,12 +4,14 @@ import android.content.Context; import android.view.SurfaceHolder; import android.view.SurfaceView; -public final class NativeGLSurfaceView extends SurfaceView { +public final class NativeGLSurfaceView extends SurfaceView +{ static private Thread myRun; static private boolean Running = false; static private boolean Created = false; - public NativeGLSurfaceView(Context context) { + public NativeGLSurfaceView(Context context) + { super(context); if (!Created) { @@ -20,8 +22,10 @@ public final class NativeGLSurfaceView extends SurfaceView { NativeLibrary.Run(getHolder().getSurface()); } }; + getHolder().addCallback(new SurfaceHolder.Callback() { - public void surfaceCreated(SurfaceHolder holder) { + public void surfaceCreated(SurfaceHolder holder) + { // TODO Auto-generated method stub if (!Running) { @@ -30,17 +34,17 @@ public final class NativeGLSurfaceView extends SurfaceView { } } - public void surfaceChanged(SurfaceHolder arg0, int arg1, - int arg2, int arg3) { + public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) + { // TODO Auto-generated method stub - } - public void surfaceDestroyed(SurfaceHolder arg0) { + public void surfaceDestroyed(SurfaceHolder arg0) + { // TODO Auto-generated method stub - } }); + Created = true; } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index 5d6aa1ac23..14f7527c1d 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -13,7 +13,8 @@ import android.view.Surface; * Class which contains methods that interact * with the native side of the Dolphin code. */ -public final class NativeLibrary { +public final class NativeLibrary +{ public static native void onTouchEvent(int Action, float X, float Y); public static native void onGamePadEvent(String Device, int Button, int Action); public static native void onGamePadMoveEvent(String Device, int Axis, float Value); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index 5dd2afa969..ad69a89a9d 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -17,10 +17,12 @@ import javax.microedition.khronos.opengles.GL10; * Licensed under GPLv2 * Refer to the license.txt file included. */ -public final class PrefsFragment extends PreferenceFragment { +public final class PrefsFragment extends PreferenceFragment +{ private Activity m_activity; - static public class VersionCheck { + static public class VersionCheck + { EGL10 mEGL; EGLDisplay mEGLDisplay; EGLConfig[] mEGLConfigs; @@ -31,8 +33,8 @@ public final class PrefsFragment extends PreferenceFragment { String mThreadOwner; - public VersionCheck() { - + public VersionCheck() + { int[] version = new int[2]; int[] attribList = new int[] { EGL10.EGL_WIDTH, 1, @@ -69,11 +71,14 @@ public final class PrefsFragment extends PreferenceFragment { { return mGL.glGetString(GL10.GL_VENDOR); } + public String getRenderer() { return mGL.glGetString(GL10.GL_RENDERER); } - private EGLConfig chooseConfig() { + + private EGLConfig chooseConfig() + { int[] attribList = new int[] { EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_STENCIL_SIZE, 0, @@ -95,6 +100,7 @@ public final class PrefsFragment extends PreferenceFragment { return mEGLConfigs[0]; // Best match is probably the first configuration } } + static public boolean SupportsGLES3() { VersionCheck mbuffer = new VersionCheck(); @@ -134,8 +140,10 @@ public final class PrefsFragment extends PreferenceFragment { } return mSupportsGLES3; } + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) + { super.onCreate(savedInstanceState); // Load the preferences from an XML resource @@ -197,14 +205,18 @@ public final class PrefsFragment extends PreferenceFragment { } @Override - public void onAttach(Activity activity) { + public void onAttach(Activity activity) + { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception - try { + try + { m_activity = activity; - } catch (ClassCastException e) { + } + catch (ClassCastException e) + { throw new ClassCastException(activity.toString() + " must implement OnGameListZeroListener"); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java index d47cbc96ba..11c071b026 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java @@ -9,14 +9,13 @@ import android.widget.TextView; import java.util.List; -public final class SideMenuAdapter extends ArrayAdapter{ - - private Context c; - private int id; - private Listitems; +public final class SideMenuAdapter extends ArrayAdapter +{ + private final Context c; + private final int id; + private final Listitems; - public SideMenuAdapter(Context context, int textViewResourceId, - List objects) + public SideMenuAdapter(Context context, int textViewResourceId, List objects) { super(context, textViewResourceId, objects); c = context; @@ -28,6 +27,7 @@ public final class SideMenuAdapter extends ArrayAdapter{ { return items.get(i); } + @Override public View getView(int position, View convertView, ViewGroup parent) { @@ -38,13 +38,13 @@ public final class SideMenuAdapter extends ArrayAdapter{ v = vi.inflate(id, null); } - final SideMenuItem o = items.get(position); - if (o != null) + final SideMenuItem item = items.get(position); + if (item != null) { - TextView t1 = (TextView) v.findViewById(R.id.SideMenuTitle); + TextView title = (TextView) v.findViewById(R.id.SideMenuTitle); - if(t1!=null) - t1.setText(o.getName()); + if(title != null) + title.setText(item.getName()); } return v; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java index 25869b77e7..51ebc93c19 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java @@ -12,8 +12,8 @@ package org.dolphinemu.dolphinemu; */ public final class SideMenuItem implements Comparable { - private String m_name; - private int m_id; + private final String m_name; + private final int m_id; /** * Constructor -- cgit v1.2.3 From 9c27fedd6ddc9ead11bd83d119b0a7efb4c3f482 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 19:49:39 -0400 Subject: [Android] Remove the subtitles on all folders in the folder browser. No need to have the subtitle "Folder" when it's visibly indicated by the icon of a folder next to it. Now it looks like this: http://i.imgur.com/CbUSqgg.png --- Source/Android/res/layout/folderbrowser.xml | 2 +- .../src/org/dolphinemu/dolphinemu/FolderBrowser.java | 2 +- .../dolphinemu/dolphinemu/FolderBrowserAdapter.java | 11 ++++++++++- .../org/dolphinemu/dolphinemu/FolderBrowserItem.java | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml index adfd72ed35..3f7be27552 100644 --- a/Source/Android/res/layout/folderbrowser.xml +++ b/Source/Android/res/layout/folderbrowser.xml @@ -39,5 +39,5 @@ android:gravity="center_vertical" android:text="Title" - android:textStyle="bold" />/> + android:textStyle="bold" /> diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index e60378c2cd..3e2c93a3eb 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -45,7 +45,7 @@ public final class FolderBrowser extends Fragment { if(entry.isDirectory()) { - dir.add(new FolderBrowserItem(m_activity, entryName, getString(R.string.folder), entry.getAbsolutePath(), true)); + dir.add(new FolderBrowserItem(m_activity, entryName, entry.getAbsolutePath(), true)); } else { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index dea96ce9d6..979ad35865 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -1,6 +1,7 @@ package org.dolphinemu.dolphinemu; import android.content.Context; +import android.content.res.Resources; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -58,7 +59,15 @@ public final class FolderBrowserAdapter extends ArrayAdapter if(subtitleText != null) { - subtitleText.setText(item.getSubtitle()); + // Remove the subtitle for all folders, except for the parent directory folder. + if (item.isDirectory() && !item.getSubtitle().equals(c.getResources().getString(R.string.parent_directory))) + { + subtitleText.setVisibility(View.GONE); + } + else + { + subtitleText.setText(item.getSubtitle()); + } } if (iconView != null) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java index d2f8773e24..a895da8c43 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java @@ -37,6 +37,24 @@ public final class FolderBrowserItem implements Comparable this.underlyingFile = new File(path); } + /** + * Constructor. Initializes a FolderBrowserItem with an empty subtitle. + * + * @param ctx Context this FolderBrowserItem is being used in. + * @param name The name of the file/folder represented by this item. + * @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 path, boolean isValid) + { + this.ctx = ctx; + this.name = name; + this.subtitle = ""; + this.path = path; + this.isValid = isValid; + this.underlyingFile = new File(path); + } + /** * Gets the name of the file/folder represented by this FolderBrowserItem. * -- cgit v1.2.3 From 3e6f9d22db84fdaf904f72509596cac55d243c1e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 20:43:29 -0400 Subject: [Android] Add a faint divider line between each folder browser item. See here for how it looks: http://i.imgur.com/CGX9NTt.png --- Source/Android/res/layout/folderbrowser.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Source/Android') diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml index 3f7be27552..d3ee4538fa 100644 --- a/Source/Android/res/layout/folderbrowser.xml +++ b/Source/Android/res/layout/folderbrowser.xml @@ -40,4 +40,14 @@ android:gravity="center_vertical" android:text="Title" android:textStyle="bold" /> + + -- cgit v1.2.3 From 072fac4a740fad70a23c63c13503400d69fb9074 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2013 20:49:26 -0400 Subject: [Android] Remove a redundant LinearLayout in one of the layout files. --- Source/Android/res/layout/sidemenu.xml | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/res/layout/sidemenu.xml b/Source/Android/res/layout/sidemenu.xml index 76bc937489..6f4b8d3e5d 100644 --- a/Source/Android/res/layout/sidemenu.xml +++ b/Source/Android/res/layout/sidemenu.xml @@ -5,10 +5,6 @@ android:gravity="left" android:orientation="vertical" > - - - -- cgit v1.2.3