more string work, this time on service notifications

This commit is contained in:
Nathan Freitas 2011-11-14 04:18:33 -05:00
parent 2b8eef305c
commit 76fc2cd014
2 changed files with 13 additions and 8 deletions

View File

@ -242,4 +242,9 @@
<string name="privoxy_version">Privoxy v3.0.12: http://www.privoxy.org</string> <string name="privoxy_version">Privoxy v3.0.12: http://www.privoxy.org</string>
<string name="iptables_version">Iptables v1.4.7: http://www.netfilter.org</string> <string name="iptables_version">Iptables v1.4.7: http://www.netfilter.org</string>
<string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string> <string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string>
<string name="found_existing_tor_process">found existing Tor process...</string>
<string name="something_bad_happened">Something bad happened. Check the log</string>
<string name="hidden_service_on">hidden service on:</string>
<string name="unable_to_read_hidden_service_name">unable to read hidden service name</string>
<string name="unable_to_start_tor">Unable to start Tor:</string>
</resources> </resources>

View File

@ -96,7 +96,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{ {
logNotice("Found existing Tor process"); logNotice("Found existing Tor process");
sendCallbackLogMessage ("found existing Tor process..."); sendCallbackLogMessage (getString(R.string.found_existing_tor_process));
try { try {
currentStatus = STATUS_CONNECTING; currentStatus = STATUS_CONNECTING;
@ -281,7 +281,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{ {
Log.d(TAG, "An error occured stopping Tor",e); Log.d(TAG, "An error occured stopping Tor",e);
logNotice("An error occured stopping Tor: " + e.getMessage()); logNotice("An error occured stopping Tor: " + e.getMessage());
sendCallbackStatusMessage("Something bad happened. Check the log"); sendCallbackStatusMessage(getString(R.string.something_bad_happened));
} }
} }
@ -326,7 +326,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{ {
try { try {
String onionHostname = Utils.readString(new FileInputStream(file)); String onionHostname = Utils.readString(new FileInputStream(file));
showToolbarNotification("hidden service on: " + onionHostname, NOTIFY_ID, R.drawable.tornotification); showToolbarNotification(getString(R.string.hidden_service_on) + ' ' + onionHostname, NOTIFY_ID, R.drawable.tornotification);
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();
pEdit.putString("pref_hs_hostname",onionHostname); pEdit.putString("pref_hs_hostname",onionHostname);
pEdit.commit(); pEdit.commit();
@ -334,13 +334,13 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logException("unable to read onion hostname file",e); logException("unable to read onion hostname file",e);
showToolbarNotification("unable to read hidden service name", NOTIFY_ID, R.drawable.tornotificationerr); showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), NOTIFY_ID, R.drawable.tornotificationerr);
return; return;
} }
} }
else else
{ {
showToolbarNotification("unable to read hidden service name", NOTIFY_ID, R.drawable.tornotificationerr); showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), NOTIFY_ID, R.drawable.tornotificationerr);
} }
@ -501,7 +501,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} catch (Exception e) { } catch (Exception e) {
logException("Unable to start Tor: " + e.getMessage(),e); logException("Unable to start Tor: " + e.getMessage(),e);
sendCallbackStatusMessage("Unable to start Tor: " + e.getMessage()); sendCallbackStatusMessage(getString(R.string.unable_to_start_tor) + ' ' + e.getMessage());
} }
@ -889,7 +889,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (profile == PROFILE_ON) if (profile == PROFILE_ON)
{ {
currentStatus = STATUS_CONNECTING; currentStatus = STATUS_CONNECTING;
sendCallbackStatusMessage ("starting..."); sendCallbackStatusMessage (getString(R.string.status_starting_up));
Thread thread = new Thread(this); Thread thread = new Thread(this);
thread.start(); thread.start();
@ -898,7 +898,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
else if (profile == PROFILE_OFF) else if (profile == PROFILE_OFF)
{ {
currentStatus = STATUS_OFF; currentStatus = STATUS_OFF;
sendCallbackStatusMessage ("shutting down..."); sendCallbackStatusMessage (getString(R.string.status_shutting_down));
_torInstance.stopTor(); _torInstance.stopTor();