Exemple #1
0
 void showProgress(int msgId) {
   progress = new ProgressDialog(this);
   progress.setMessage(getString(msgId));
   progress.setIndeterminate(true);
   progress.setCancelable(true);
   progress.setOnCancelListener(abortListener);
   final int msgId2 = msgId;
   progress.setButton(
       DialogInterface.BUTTON_POSITIVE,
       getString(R.string.background),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface d, int which) {
           // Cheat slightly: just launch home screen
           startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
           // Argh, can't prevent a dismiss at this point, so re-show it
           showProgress(msgId2);
           Toast.makeText(SGTPuzzles.this, R.string.bg_unreliable_warn, Toast.LENGTH_LONG).show();
         }
       });
   progress.setButton(
       DialogInterface.BUTTON_NEGATIVE,
       getString(android.R.string.cancel),
       handler.obtainMessage(MsgType.ABORT.ordinal()));
   progress.show();
 }
Exemple #2
0
 void abort(String why) {
   gameRunning = false;
   handler.obtainMessage(MsgType.ABORT.ordinal(), why).sendToTarget();
 }