From 5db43960a5e7ca0db6d83fa5647c52368968010c Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Mon, 1 Mar 2010 05:52:44 +0000 Subject: [PATCH] removed home, browse menu options; added beter non-root operation svn:r21776 --- src/org/torproject/android/Orbot.java | 36 +++++++++++++------ .../android/SettingsPreferences.java | 5 +++ .../android/service/TorServiceUtils.java | 1 + 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java index d017078d..7ce41753 100644 --- a/src/org/torproject/android/Orbot.java +++ b/src/org/torproject/android/Orbot.java @@ -87,26 +87,35 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On MenuItem mItem = null; + /* + mItem = menu.add(0, 1, Menu.NONE, getString(R.string.menu_home)); mItem.setIcon(R.drawable.ic_menu_home); mItem = menu.add(0, 2, Menu.NONE, getString(R.string.menu_browse)); mItem.setIcon(R.drawable.ic_menu_goto); + */ - mItem = menu.add(0, 3, Menu.NONE, getString(R.string.menu_info)); - mItem.setIcon(R.drawable.ic_menu_about); mItem = menu.add(0, 4, Menu.NONE, getString(R.string.menu_settings)); mItem.setIcon(R.drawable.ic_menu_register); - mItem = menu.add(0, 5, Menu.NONE, getString(R.string.menu_apps)); - mItem.setIcon(R.drawable.ic_menu_register); - - if (!TorServiceUtils.hasRoot()) - mItem.setEnabled(false); - + + mItem = menu.add(0, 5, Menu.NONE, getString(R.string.menu_apps)); + mItem.setIcon(R.drawable.ic_menu_goto); + + if (!TorServiceUtils.hasRoot()) + { + mItem.setEnabled(false); + + } + mItem = menu.add(0,6, Menu.NONE, getString(R.string.menu_log)); mItem.setIcon(R.drawable.ic_menu_reports); + + mItem = menu.add(0, 3, Menu.NONE, getString(R.string.menu_info)); + mItem.setIcon(R.drawable.ic_menu_about); + return true; @@ -628,8 +637,12 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On } else if (mService.getStatus() == STATUS_READY) { + mService.setProfile(PROFILE_ON); //this means turn on + + updateStatus(""); + processSettings(); - mService.setProfile(PROFILE_ON); + if (hasRoot && enableTransparentProxy) { @@ -641,8 +654,9 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On else { - mService.setProfile(PROFILE_ONDEMAND); - + mService.setProfile(PROFILE_ONDEMAND); //these means turn off + updateStatus(""); + if (hasRoot && enableTransparentProxy) { TorTransProxy.purgeNatIptables(); diff --git a/src/org/torproject/android/SettingsPreferences.java b/src/org/torproject/android/SettingsPreferences.java index f101cfa8..8137548b 100644 --- a/src/org/torproject/android/SettingsPreferences.java +++ b/src/org/torproject/android/SettingsPreferences.java @@ -3,6 +3,8 @@ package org.torproject.android; +import org.torproject.android.service.TorServiceUtils; + import android.os.Bundle; import android.preference.PreferenceActivity; import android.util.Log; @@ -13,6 +15,9 @@ public class SettingsPreferences protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); + + if (!TorServiceUtils.hasRoot()) + getPreferenceScreen().getPreference(3).setEnabled(false); } /* (non-Javadoc) diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java index 3e549ccb..7f43d017 100644 --- a/src/org/torproject/android/service/TorServiceUtils.java +++ b/src/org/torproject/android/service/TorServiceUtils.java @@ -86,6 +86,7 @@ public class TorServiceUtils implements TorServiceConstants { while (itAppInfo.hasNext()) { aInfo = itAppInfo.next(); + apps[appIdx] = new TorifiedApp(); apps[appIdx].setEnabled(aInfo.enabled);