4 * Main Lxdream activity
6 * Copyright (c) 2011 Nathan Keynes.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
21 import android.app.Activity;
22 import android.content.Context;
23 import android.content.res.Resources;
24 import android.graphics.drawable.Drawable;
25 import android.os.Bundle;
26 import android.util.Log;
27 import android.view.Menu;
28 import android.view.MenuInflater;
29 import android.view.MenuItem;
30 import android.view.WindowManager;
35 public class LxdreamActivity extends Activity {
37 boolean isRunning = false;
39 Drawable runIcon, pauseIcon;
42 protected void onCreate(Bundle bundle) {
43 super.onCreate(bundle);
44 ctx = getApplication();
45 Resources res = ctx.getResources();
46 runIcon = res.getDrawable(R.drawable.tb_run);
47 pauseIcon = res.getDrawable(R.drawable.tb_pause);
49 Log.i("LxdreamActivity", "Calling Dreamcast.init");
50 Dreamcast.init( ctx.getFilesDir().toString() );
51 Log.i("LxdreamActivity", "Finished Dreamcast.init");
52 view = new LxdreamView(ctx);
57 public boolean onCreateOptionsMenu(Menu menu) {
58 MenuInflater inflater = getMenuInflater();
59 inflater.inflate(R.menu.main, menu);
65 protected void onPause() {
71 protected void onResume() {
75 public void onRunClicked( MenuItem item ) {
77 item.setIcon( runIcon );
79 item.setIcon( pauseIcon );
81 Dreamcast.toggleRun();
82 isRunning = !isRunning;
85 public void onResetClicked( MenuItem item ) {
89 public void onPreferencesClicked( MenuItem item ) {
.