import android.os.Bundle;
import android.os.Handler;
import android.os.Messenger;
+import android.preference.PreferenceManager;
import android.text.Html;
import android.text.method.ScrollingMovementMethod;
import android.text.format.DateFormat;
.putExtra("Command", Task.DISCONNECT));
}
- private void exit()
+ private void quit()
{
stopService(new Intent(this, Task.class));
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_HOME);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
}
/* Widget callback functions */
super.onCreate(savedInstanceState);
Os.debug("Main: onCreate");
+ // Setup preferences
+ PreferenceManager.setDefaultValues(this, R.xml.prefs, false);
+
// Setup main layout
this.setContentView(R.layout.main);
.setContent(R.id.debug));
// Setup Spades game and cards view
- this.game = new Spades();
+ this.game = new Spades(PreferenceManager
+ .getDefaultSharedPreferences(this)
+ .getString("pref_referee", "rhawk"));
this.cards = new Cards(this);
this.game.cards = this.cards;
this.cards.game = this.game;
this.spades.addView(cards);
-
+
// Attach to background service
this.register();
case R.id.settings:
this.startActivity(new Intent(this, Prefs.class));
return true;
- case R.id.exit:
- this.exit();
- this.finish();
+ case R.id.quit:
+ this.quit();
return true;
default:
return false;