From 493d6e22cdcd7f4836589c696b5c1f2aeb534847 Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Wed, 25 Jan 2012 20:09:33 -0500 Subject: [PATCH] cleaned up binding and logging --- src/org/torproject/android/Orbot.java | 29 +++++++++++---------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java index 94807e43..b54c05e2 100644 --- a/src/org/torproject/android/Orbot.java +++ b/src/org/torproject/android/Orbot.java @@ -284,7 +284,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - @Override public void onClick(DialogInterface dialog, int which) { switch (which){ case DialogInterface.BUTTON_POSITIVE: @@ -340,9 +339,9 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants protected void onResume() { super.onResume(); - bindService(); + if (!mIsBound) + bindService(); - if (getIntent() == null) return; @@ -355,7 +354,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - @Override + public void onClick(DialogInterface dialog, int which) { switch (which){ case DialogInterface.BUTTON_POSITIVE: @@ -401,11 +400,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants } else { - - //setTitle(getString(R.string.app_name) + ' ' + getString(R.string.app_version)); - - NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - mNotificationManager.cancelAll(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); @@ -722,14 +717,14 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants mHandler.sendMessage(msg); } - @Override //this was when we displayed the log in the main Activity; can prob take this out now - public void logMessage(String value) throws RemoteException { - - Message msg = mHandler.obtainMessage(TorServiceConstants.LOG_MSG); - msg.getData().putString(HANDLER_TOR_MSG, value); - mHandler.sendMessage(msg); - - } + + public void logMessage(String value) throws RemoteException { + + Message msg = mHandler.obtainMessage(TorServiceConstants.LOG_MSG); + msg.getData().putString(HANDLER_TOR_MSG, value); + mHandler.sendMessage(msg); + + } };