fixes issue with progress dialog display and crashes

This commit is contained in:
Nathan Freitas 2012-01-15 10:43:13 -05:00
parent edcaeee231
commit 675afee9d2
1 changed files with 15 additions and 14 deletions

View File

@ -514,7 +514,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
if (button)
{
aDialog = new AlertDialog.Builder(this)
aDialog = new AlertDialog.Builder(Orbot.this)
.setIcon(R.drawable.icon)
.setTitle(title)
.setMessage(msg)
@ -523,7 +523,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
}
else
{
aDialog = new AlertDialog.Builder(this)
aDialog = new AlertDialog.Builder(Orbot.this)
.setIcon(R.drawable.icon)
.setTitle(title)
.setMessage(msg)
@ -639,13 +639,11 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
imgStatus.setImageResource(R.drawable.torstarting);
lblStatus.setText(getString(R.string.status_starting_up));
//we send a message here to the progressDialog i believe, but we can clarify that shortly
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up));
mHandler.sendMessage(msg);
}
//now we stop Tor! amazing!
@ -883,11 +881,14 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
private void createProgressDialog (String msg)
{
if (progressDialog != null && progressDialog.isShowing())
return;
{
progressDialog.setMessage(msg);
}
else
{
progressDialog = ProgressDialog.show(Orbot.this, "", msg);
progressDialog.setCancelable(true);
}
}
private void hideProgressDialog ()
@ -896,7 +897,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
if (progressDialog != null && progressDialog.isShowing())
{
progressDialog.dismiss();
progressDialog = null;
}