no need for asynctask - just grab the status directly
This commit is contained in:
parent
e2f4f5f1f2
commit
3a82421b63
|
@ -32,7 +32,6 @@ import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
@ -831,50 +830,14 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
aDialog.setCanceledOnTouchOutside(true);
|
aDialog.setCanceledOnTouchOutside(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private void updateStatus (String torServiceMsg)
|
||||||
* Set the state of the running/not running graphic and label
|
|
||||||
* this all needs to be looked at w/ the shift to progressDialog
|
|
||||||
*/
|
|
||||||
public void updateStatus (String torServiceMsg)
|
|
||||||
{
|
{
|
||||||
new updateStatusAsync().execute(torServiceMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class updateStatusAsync extends AsyncTask<String, Void, Integer> {
|
int newTorStatus = torStatus;
|
||||||
|
|
||||||
String mTorServiceMsg = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Integer doInBackground(String... params) {
|
|
||||||
|
|
||||||
mTorServiceMsg = params[0];
|
|
||||||
int newTorStatus = TorServiceConstants.STATUS_OFF;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (mService != null)
|
if (mService != null)
|
||||||
return new Integer(mService.getStatus());
|
try {newTorStatus = mService.getStatus();}
|
||||||
|
catch (RemoteException e){}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//error
|
|
||||||
Log.d(TAG,"error in update status",e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newTorStatus;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Integer result) {
|
|
||||||
|
|
||||||
updateUI(result.intValue());
|
|
||||||
|
|
||||||
super.onPostExecute(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateUI (int newTorStatus)
|
|
||||||
{
|
|
||||||
|
|
||||||
//now update the layout_main UI based on the status
|
//now update the layout_main UI based on the status
|
||||||
if (imgStatus != null)
|
if (imgStatus != null)
|
||||||
|
@ -892,9 +855,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
mItemOnOff.setTitle(R.string.menu_stop);
|
||||||
|
|
||||||
|
|
||||||
if (mTorServiceMsg != null && mTorServiceMsg.length() > 0)
|
if (torServiceMsg != null && torServiceMsg.length() > 0)
|
||||||
{
|
{
|
||||||
appendLogTextAndScroll(mTorServiceMsg);
|
appendLogTextAndScroll(torServiceMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
|
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
|
||||||
|
@ -929,11 +892,11 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
mItemOnOff.setTitle(R.string.menu_stop);
|
||||||
|
|
||||||
|
|
||||||
if (lblStatus != null && mTorServiceMsg != null)
|
if (lblStatus != null && torServiceMsg != null)
|
||||||
if (mTorServiceMsg.indexOf('%')!=-1)
|
if (torServiceMsg.indexOf('%')!=-1)
|
||||||
lblStatus.setText(mTorServiceMsg);
|
lblStatus.setText(torServiceMsg);
|
||||||
|
|
||||||
appendLogTextAndScroll(mTorServiceMsg);
|
appendLogTextAndScroll(torServiceMsg);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -955,7 +918,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// guess what? this start's Tor! actually no it just requests via the local ITorService to the remote TorService instance
|
// guess what? this start's Tor! actually no it just requests via the local ITorService to the remote TorService instance
|
||||||
// to start Tor
|
// to start Tor
|
||||||
|
|
Loading…
Reference in New Issue