summaryrefslogtreecommitdiff
path: root/Source/Android/src
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2013-06-27 04:47:39 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2013-06-27 04:47:39 -0500
commit72257d5f699d7d234c035547c02c5d9781bb2e11 (patch)
treeb1dbb5b8514b0e1c69fee94b497cddc1a392d698 /Source/Android/src
parent72d49e05a75103924cd2d990388bd6306f71cfa9 (diff)
[Android] Support clicking on games in the folder browser to add the folder currently in. Mostly for derps that keep trying to run the game from the folder browser.
Diffstat (limited to 'Source/Android/src')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java48
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java19
2 files changed, 47 insertions, 20 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
index a7f70c08af..1afeff417e 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
@@ -173,24 +173,46 @@ public class DolphinEmulator<MainActivity> extends Activity
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int action = 0;
- switch (event.getAction()) {
- case KeyEvent.ACTION_DOWN:
- action = 0;
- break;
- case KeyEvent.ACTION_UP:
- action = 1;
- break;
- default:
- break;
+
+ // Special catch for the back key
+ // Currently disabled because stopping and starting emulation is broken.
+ /*
+ if ( event.getSource() == InputDevice.SOURCE_KEYBOARD
+ && event.getKeyCode() == KeyEvent.KEYCODE_BACK
+ && event.getAction() == KeyEvent.ACTION_UP
+ )
+ {
+ if (Running)
+ NativeLibrary.StopEmulation();
+ Running = false;
+ Intent ListIntent = new Intent(this, GameListActivity.class);
+ startActivityForResult(ListIntent, 1);
+ return true;
}
- InputDevice input = event.getDevice();
- NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action);
- return true;
+ */
+
+ if (Running)
+ {
+ switch (event.getAction()) {
+ case KeyEvent.ACTION_DOWN:
+ action = 0;
+ break;
+ case KeyEvent.ACTION_UP:
+ action = 1;
+ break;
+ default:
+ return false;
+ }
+ InputDevice input = event.getDevice();
+ NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action);
+ return true;
+ }
+ return false;
}
@Override
public boolean dispatchGenericMotionEvent(MotionEvent event) {
- if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) {
+ if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running) {
return super.dispatchGenericMotionEvent(event);
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
index 0ceb776a77..d0e16e67a5 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
@@ -60,10 +60,12 @@ public class FolderBrowser extends ListActivity {
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
GameListItem o = adapter.getItem(position);
- if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
+ if(o.getData().equalsIgnoreCase("folder") || o.getData().equalsIgnoreCase("parent directory")){
currentDir = new File(o.getPath());
Fill(currentDir);
}
+ else
+ FolderSelected();
}
@Override
@@ -83,11 +85,14 @@ public class FolderBrowser extends ListActivity {
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- Intent intent = new Intent();
- intent.putExtra("Select", currentDir.getPath());
- setResult(Activity.RESULT_OK, intent);
-
- this.finish();
- return true;
+ FolderSelected();
+ return true;
}
+ private void FolderSelected()
+ {
+ Intent intent = new Intent();
+ intent.putExtra("Select", currentDir.getPath());
+ setResult(Activity.RESULT_OK, intent);
+ this.finish();
+ }
}