moved API to IptablesManager; made version display dynamic

This commit is contained in:
Nathan Freitas 2011-07-25 10:51:34 -04:00
parent f74ebfc75a
commit f86897f00c
3 changed files with 24 additions and 19 deletions

View File

@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -136,16 +137,24 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
private void showAbout ()
{
LayoutInflater li = LayoutInflater.from(this);
View view = li.inflate(R.layout.layout_about, null);
LayoutInflater li = LayoutInflater.from(this);
View view = li.inflate(R.layout.layout_about, null);
TextView versionName = (TextView)view.findViewById(R.id.versionName);
versionName.setText(R.string.app_version);
String version = "";
new AlertDialog.Builder(this)
.setTitle(getString(R.string.button_about))
.setView(view)
.show();
try {
version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (NameNotFoundException e) {
version = "Version Not Found";
}
TextView versionName = (TextView)view.findViewById(R.id.versionName);
versionName.setText(version);
new AlertDialog.Builder(this)
.setTitle(getString(R.string.button_about))
.setView(view)
.show();
}
/* When a menu item is selected launch the appropriate view or activity

View File

@ -55,7 +55,7 @@ import android.widget.Toast;
* Contains shared programming interfaces.
* All iptables "communication" is handled by this class.
*/
public final class Api {
public final class IptablesManager {
/** application version string */
public static final String VERSION = "1.5.1-dev";
/** special application UID used to indicate "any application" */
@ -861,8 +861,8 @@ public final class Api {
return;
}
/* notify */
final Intent message = new Intent(Api.STATUS_CHANGED_MSG);
message.putExtra(Api.STATUS_EXTRA, enabled);
final Intent message = new Intent(IptablesManager.STATUS_CHANGED_MSG);
message.putExtra(IptablesManager.STATUS_EXTRA, enabled);
ctx.sendBroadcast(message);
}
/**

View File

@ -416,16 +416,12 @@ public class TorService extends Service implements TorServiceConstants, Runnable
private boolean checkTorBinaries () throws Exception
{
//android.os.Debug.waitForDebugger();
//check and install iptables
Api.assertBinaries(this, true);
IptablesManager.assertBinaries(this, true);
File fileInstall = getDir("",0);
String subBinPath = "bin/";
File fileInstall = getDir("bin/",0);
appHome = fileInstall.getAbsolutePath();
appBinHome = appHome + subBinPath;
appDataHome = getCacheDir().getAbsolutePath() + '/';
logNotice( "appHome=" + appHome);