small fixes to fix progress dialog and alert box glitches

svn:r24718
This commit is contained in:
Nathan Freitas 2011-05-03 06:49:25 +00:00
parent bc48d8f1cc
commit b636b42e12
1 changed files with 15 additions and 12 deletions

View File

@ -500,6 +500,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
.show(); .show();
} }
aDialog.setCanceledOnTouchOutside(true);
} }
/* /*
* Set the state of the running/not running graphic and label * Set the state of the running/not running graphic and label
@ -519,7 +520,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
{ {
imgStatus.setImageResource(R.drawable.toron); imgStatus.setImageResource(R.drawable.toron);
if (progressDialog != null) if (progressDialog != null)
{ {
progressDialog.dismiss(); progressDialog.dismiss();
@ -559,11 +559,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
{ {
imgStatus.setImageResource(R.drawable.torstarting); imgStatus.setImageResource(R.drawable.torstarting);
if (progressDialog == null)
{ if (progressDialog != null)
progressDialog =ProgressDialog.show(this, "", getString(R.string.status_starting_up));
}
else
progressDialog.setMessage(torServiceMsg); progressDialog.setMessage(torServiceMsg);
if (mItemOnOff != null) if (mItemOnOff != null)
@ -594,7 +591,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
progressDialog = null; progressDialog = null;
} }
imgStatus.setImageResource(R.drawable.toroff); imgStatus.setImageResource(R.drawable.toroff);
lblStatus.setText(getString(R.string.status_disabled) + "\n" + getString(R.string.press_to_start)); lblStatus.setText(getString(R.string.status_disabled) + "\n" + getString(R.string.press_to_start));
@ -725,11 +721,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
break; break;
case TorServiceConstants.ENABLE_TOR_MSG: case TorServiceConstants.ENABLE_TOR_MSG:
if (progressDialog == null) createProgressDialog(getString(R.string.status_starting_up));
{
progressDialog = ProgressDialog.show(Orbot.this, "", getString(R.string.status_starting_up));
}
updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG)); updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG));
@ -745,6 +737,17 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
} }
} }
private synchronized void createProgressDialog (String msg)
{
if (progressDialog == null)
{
progressDialog = ProgressDialog.show(Orbot.this, "", msg);
progressDialog.setCancelable(true);
}
}
}; };