removed home, browse menu options; added beter non-root operation

svn:r21776
This commit is contained in:
Nathan Freitas 2010-03-01 05:52:44 +00:00
parent 70c9fd59b1
commit 72432c3091
3 changed files with 31 additions and 11 deletions

View File

@ -87,27 +87,36 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On
MenuItem mItem = null; MenuItem mItem = null;
/*
mItem = menu.add(0, 1, Menu.NONE, getString(R.string.menu_home)); mItem = menu.add(0, 1, Menu.NONE, getString(R.string.menu_home));
mItem.setIcon(R.drawable.ic_menu_home); mItem.setIcon(R.drawable.ic_menu_home);
mItem = menu.add(0, 2, Menu.NONE, getString(R.string.menu_browse)); mItem = menu.add(0, 2, Menu.NONE, getString(R.string.menu_browse));
mItem.setIcon(R.drawable.ic_menu_goto); 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 = menu.add(0, 4, Menu.NONE, getString(R.string.menu_settings));
mItem.setIcon(R.drawable.ic_menu_register); mItem.setIcon(R.drawable.ic_menu_register);
mItem = menu.add(0, 5, Menu.NONE, getString(R.string.menu_apps)); mItem = menu.add(0, 5, Menu.NONE, getString(R.string.menu_apps));
mItem.setIcon(R.drawable.ic_menu_register); mItem.setIcon(R.drawable.ic_menu_goto);
if (!TorServiceUtils.hasRoot()) if (!TorServiceUtils.hasRoot())
{
mItem.setEnabled(false); mItem.setEnabled(false);
}
mItem = menu.add(0,6, Menu.NONE, getString(R.string.menu_log)); mItem = menu.add(0,6, Menu.NONE, getString(R.string.menu_log));
mItem.setIcon(R.drawable.ic_menu_reports); 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; return true;
} }
@ -628,8 +637,12 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On
} }
else if (mService.getStatus() == STATUS_READY) else if (mService.getStatus() == STATUS_READY)
{ {
mService.setProfile(PROFILE_ON); //this means turn on
updateStatus("");
processSettings(); processSettings();
mService.setProfile(PROFILE_ON);
if (hasRoot && enableTransparentProxy) if (hasRoot && enableTransparentProxy)
{ {
@ -641,7 +654,8 @@ public class Orbot extends Activity implements OnClickListener, TorConstants, On
else else
{ {
mService.setProfile(PROFILE_ONDEMAND); mService.setProfile(PROFILE_ONDEMAND); //these means turn off
updateStatus("");
if (hasRoot && enableTransparentProxy) if (hasRoot && enableTransparentProxy)
{ {

View File

@ -3,6 +3,8 @@
package org.torproject.android; package org.torproject.android;
import org.torproject.android.service.TorServiceUtils;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.util.Log; import android.util.Log;
@ -13,6 +15,9 @@ public class SettingsPreferences
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
if (!TorServiceUtils.hasRoot())
getPreferenceScreen().getPreference(3).setEnabled(false);
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -86,6 +86,7 @@ public class TorServiceUtils implements TorServiceConstants {
while (itAppInfo.hasNext()) while (itAppInfo.hasNext())
{ {
aInfo = itAppInfo.next(); aInfo = itAppInfo.next();
apps[appIdx] = new TorifiedApp(); apps[appIdx] = new TorifiedApp();
apps[appIdx].setEnabled(aInfo.enabled); apps[appIdx].setEnabled(aInfo.enabled);