fix for bug 63

This commit is contained in:
arrase 2016-12-08 16:12:29 +01:00
parent 54e2e5e372
commit ad68947dd4
1 changed files with 9 additions and 7 deletions

View File

@ -103,9 +103,8 @@ public class OrbotMainActivity extends AppCompatActivity
private ActionBarDrawerToggle mDrawerToggle; private ActionBarDrawerToggle mDrawerToggle;
/* Some tracking bits */ /* Some tracking bits */
private String torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service private String torStatus = null; //latest status reported from the tor service
private Intent lastStatusIntent; // the last ACTION_STATUS Intent received private Intent lastStatusIntent; // the last ACTION_STATUS Intent received
private Boolean isFirstRun = true;
private SharedPreferences mPrefs = null; private SharedPreferences mPrefs = null;
@ -1199,8 +1198,12 @@ public class OrbotMainActivity extends AppCompatActivity
if (resultIntent == null) if (resultIntent == null)
resultIntent = new Intent(TorServiceConstants.ACTION_START); resultIntent = new Intent(TorServiceConstants.ACTION_START);
resultIntent.putExtra(TorServiceConstants.EXTRA_STATUS, torStatus); resultIntent.putExtra(
setResult(RESULT_OK, resultIntent); TorServiceConstants.EXTRA_STATUS,
torStatus == null?TorServiceConstants.STATUS_OFF:torStatus
);
setResult(RESULT_OK, resultIntent);
finish(); finish();
Log.d(TAG, "autoStartFromIntent finish"); Log.d(TAG, "autoStartFromIntent finish");
} }
@ -1302,9 +1305,8 @@ public class OrbotMainActivity extends AppCompatActivity
String newTorStatus = msg.getData().getString("status"); String newTorStatus = msg.getData().getString("status");
String log = (String)msg.obj; String log = (String)msg.obj;
if (isFirstRun && newTorStatus != null) //first time status if (torStatus == null && newTorStatus != null) //first time status
{ {
isFirstRun = false;
torStatus = newTorStatus; torStatus = newTorStatus;
findViewById(R.id.frameMain).setVisibility(View.VISIBLE); findViewById(R.id.frameMain).setVisibility(View.VISIBLE);
updateStatus(log); updateStatus(log);