summaryrefslogtreecommitdiff
path: root/Source/Android/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-08-29 22:52:09 -0400
committerLioncash <mathew1800@gmail.com>2013-08-29 22:52:09 -0400
commitcf96bfc2be70c69b8196ab8c054441832e3b9315 (patch)
tree85d1484e5958a5cfed947237572fc254a2222f56 /Source/Android/src
parent0df64775ea50e58aabdd4ee4dec1f0b944036a3d (diff)
[Android] Add a button in the emulation view that allows a person to exit emulation and go back to the game list.
However, this does not work correctly yet. It will stop correctly. But the SurfaceView will not render the next game selected.
Diffstat (limited to 'Source/Android/src')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java39
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java1
2 files changed, 39 insertions, 1 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java
index 7a81306468..aab01ad1ce 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java
@@ -5,7 +5,10 @@ import java.util.List;
import org.dolphinemu.dolphinemu.settings.InputConfigFragment;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
@@ -77,6 +80,7 @@ public final class EmulationActivity extends Activity
public void onStop()
{
super.onStop();
+
if (Running)
NativeLibrary.StopEmulation();
}
@@ -85,6 +89,7 @@ public final class EmulationActivity extends Activity
public void onPause()
{
super.onPause();
+
if (Running)
NativeLibrary.PauseEmulation();
}
@@ -93,11 +98,24 @@ public final class EmulationActivity extends Activity
public void onResume()
{
super.onResume();
+
if (Running)
NativeLibrary.UnPauseEmulation();
}
@Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+
+ if (Running)
+ {
+ NativeLibrary.StopEmulation();
+ Running = false;
+ }
+ }
+
+ @Override
public boolean onTouchEvent(MotionEvent event)
{
float X = event.getX();
@@ -185,6 +203,27 @@ public final class EmulationActivity extends Activity
NativeLibrary.LoadState(4);
return true;
+ case R.id.exitEmulation:
+ {
+ // Create a confirmation method for quitting the current emulation instance.
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(getString(R.string.overlay_exit_emulation));
+ builder.setMessage(R.string.overlay_exit_emulation_confirm);
+ builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which)
+ {
+ finish();
+ }
+ });
+ builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which)
+ {
+ // Do nothing. Just makes the No button appear.
+ }
+ });
+ builder.show();
+ }
+
default:
return super.onOptionsItemSelected( item );
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
index d5739d68ed..e0aefa153a 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
@@ -136,7 +136,6 @@ public final class GameListFragment extends Fragment
Intent intent = new Intent(mMe, EmulationActivity.class);
intent.putExtra("SelectedGame", o);
mMe.startActivity(intent);
- mMe.finish();
}
@Override