package de.cwde.freeshisen;
-import android.app.AlertDialog;
import android.app.Application;
-import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
public boolean timeCounter=true;
public void newPlay() {
+ loadOptions();
board = new Board();
board.buildRandomBoard(boardSize[0],boardSize[1],difficulty,gravity);
}
}
if (needsReset && (view != null) && (activity != null)) {
- new AlertDialog.Builder(this)
- .setTitle("Preferences changed!") // FIXME: hardcoded string
- .setCancelable(true)
- .setIcon(R.drawable.icon)
- .setPositiveButton(android.R.string.yes,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- // User clicked OK button - reset game
- ((ShisenSho) ((AlertDialog) dialog).getContext()).view.reset();
- }
- })
- .setNegativeButton(android.R.string.no, null)
- .setMessage("Changes in Preferences will only have an effect if" +
- " a new game is started. Abort current game and start" +
- " a new one?").create() // FIXME: hardcoded string
- .show();
+ activity.onOptionsChanged();
} else {
Log.d("ShisenSho", "Preferences changed, but no view or activity online - huh?");
}
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
e.printStackTrace();
}
}
+
+ public void onOptionsChanged()
+ {
+ new AlertDialog.Builder(this)
+ .setTitle("Preferences changed!") // FIXME: hardcoded string
+ .setCancelable(true)
+ .setIcon(R.drawable.icon)
+ .setPositiveButton(android.R.string.yes,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ // User clicked OK button - reset game
+ view.reset();
+ }
+ })
+ .setNegativeButton(android.R.string.no, null)
+ .setMessage("Changes in Preferences will only have an effect if" +
+ " a new game is started. Abort current game and start" +
+ " a new one?") // FIXME: hardcoded string
+ .create()
+ .show();
+ }
}
try {
if (canvas == null) canvas = surfaceHolder.lockCanvas(null);
if (canvas == null) return;
- if (cstate==StatePlay.UNINITIALIZED) initializeGame();
+ if (cstate == StatePlay.UNINITIALIZED) initializeGame();
synchronized (surfaceHolder) {
doDraw(canvas);
}