[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.
This commit is contained in:
Lioncash 2013-08-29 22:52:09 -04:00
parent 0df64775ea
commit cf96bfc2be
5 changed files with 48 additions and 1 deletions

View File

@ -42,4 +42,10 @@
android:title="@string/overlay_slot5"/>
</menu>
</item>
<item
android:id="@+id/exitEmulation"
android:showAsAction="always"
android:title="@string/overlay_exit_emulation">
</item>
</menu>

View File

@ -33,6 +33,7 @@
<!-- Emulation Window Overlay -->
<string name="overlay_savestate">ステートセーブ</string>
<string name="overlay_loadstate">ステートロード</string>
<string name="overlay_exit_emulation">終了</string>
<string name="overlay_slot1">スロット 1</string>
<string name="overlay_slot2">スロット 2</string>
<string name="overlay_slot3">スロット 3</string>

View File

@ -33,6 +33,8 @@
<!-- Emulation Overlay -->
<string name="overlay_savestate">Save State</string>
<string name="overlay_loadstate">Load State</string>
<string name="overlay_exit_emulation">Exit</string>
<string name="overlay_exit_emulation_confirm">Are you sure you wish to exit this game?</string>
<string name="overlay_slot1">Slot 1</string>
<string name="overlay_slot2">Slot 2</string>
<string name="overlay_slot3">Slot 3</string>

View File

@ -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,10 +98,23 @@ 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)
{
@ -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 );
}

View File

@ -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