rename mHandler to mStatusUpdateHandler

Hopefully this will make the code a little easier to follow...
This commit is contained in:
Hans-Christoph Steiner 2015-06-09 13:36:58 -04:00
parent 4d8a9dab27
commit bfb0a80a18
1 changed files with 9 additions and 16 deletions

View File

@ -153,12 +153,12 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
long written = intent.getLongExtra("written",0); long written = intent.getLongExtra("written",0);
long read = intent.getLongExtra("read",0); long read = intent.getLongExtra("read",0);
Message msg = mHandler.obtainMessage(TorServiceConstants.MESSAGE_TRAFFIC_COUNT); Message msg = mStatusUpdateHandler.obtainMessage(TorServiceConstants.MESSAGE_TRAFFIC_COUNT);
msg.getData().putLong("download", download); msg.getData().putLong("download", download);
msg.getData().putLong("upload", upload); msg.getData().putLong("upload", upload);
msg.getData().putLong("readTotal", read); msg.getData().putLong("readTotal", read);
msg.getData().putLong("writeTotal", written); msg.getData().putLong("writeTotal", written);
mHandler.sendMessage(msg); mStatusUpdateHandler.sendMessage(msg);
} }
else if (intent.hasExtra(TorServiceConstants.EXTRA_STATUS)) else if (intent.hasExtra(TorServiceConstants.EXTRA_STATUS))
@ -977,8 +977,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
//do auto restart //do auto restart
stopTor (); stopTor ();
mHandler.postDelayed(new Runnable () { mStatusUpdateHandler.postDelayed(new Runnable () {
public void run () public void run ()
{ {
try try
@ -1027,10 +1026,8 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mBtnVPN.setChecked(false); mBtnVPN.setChecked(false);
} }
}) })
.show(); .show();
} }
@ -1075,7 +1072,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
mBtnBridges.setChecked(Prefs.bridgesEnabled()); mBtnBridges.setChecked(Prefs.bridgesEnabled());
} }
mHandler.postDelayed(new Runnable () mStatusUpdateHandler.postDelayed(new Runnable ()
{ {
public void run () public void run ()
{ {
@ -1222,9 +1219,9 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
lblStatus.setText(getString(R.string.status_starting_up)); lblStatus.setText(getString(R.string.status_starting_up));
//we send a message here to the progressDialog i believe, but we can clarify that shortly //we send a message here to the progressDialog i believe, but we can clarify that shortly
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG); Message msg = mStatusUpdateHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up)); msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up));
mHandler.sendMessage(msg); mStatusUpdateHandler.sendMessage(msg);
} }
//now we stop Tor! amazing! //now we stop Tor! amazing!
@ -1232,8 +1229,8 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
{ {
sendIntentToService (TorServiceConstants.CMD_STOP); sendIntentToService (TorServiceConstants.CMD_STOP);
torStatus = TorServiceConstants.STATUS_OFF; torStatus = TorServiceConstants.STATUS_OFF;
Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG); Message msg = mStatusUpdateHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG);
mHandler.sendMessage(msg); mStatusUpdateHandler.sendMessage(msg);
} }
/* /*
@ -1270,13 +1267,9 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
} }
// this is what takes messages or values from the callback threads or other non-mainUI threads // this is what takes messages or values from the callback threads or other non-mainUI threads
//and passes them back into the main UI thread for display to the user //and passes them back into the main UI thread for display to the user
private Handler mHandler = new Handler() { private Handler mStatusUpdateHandler = new Handler() {
private String lastServiceMsg = null; private String lastServiceMsg = null;