From 39699e69c6b6abae01ded698bb35ffa9c88710b9 Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Thu, 9 Jan 2014 22:01:02 -0500 Subject: [PATCH] add new icons showing different status --- res/drawable-hdpi-v11/ic_stat_tor_off.png | Bin 0 -> 744 bytes res/drawable-hdpi-v11/ic_stat_tor_xfer.png | Bin 0 -> 712 bytes res/drawable/ic_stat_tor_off.png | Bin 0 -> 744 bytes res/drawable/ic_stat_tor_xfer.png | Bin 0 -> 712 bytes .../android/service/TorService.java | 98 +++++++++--------- 5 files changed, 48 insertions(+), 50 deletions(-) create mode 100644 res/drawable-hdpi-v11/ic_stat_tor_off.png create mode 100644 res/drawable-hdpi-v11/ic_stat_tor_xfer.png create mode 100644 res/drawable/ic_stat_tor_off.png create mode 100644 res/drawable/ic_stat_tor_xfer.png diff --git a/res/drawable-hdpi-v11/ic_stat_tor_off.png b/res/drawable-hdpi-v11/ic_stat_tor_off.png new file mode 100644 index 0000000000000000000000000000000000000000..6df646eb46d61aaa8a6b4bd6e00c0f6b1eb508ca GIT binary patch literal 744 zcmVP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^e+ z0yi8nzcxMq00L-9L_t(o!|j*5Yg9oLhks`!NV0*TQDPz_#6nwRu!-@}hzLocV5g0u zO~695Qd})W3n5mT_$b68plQ@UV8tlntFSS!AgDz|5ey;GLN=exERMsyyDN9^UIc$I zusbuH`8ba`bEW^vSip8*q~86O0ziwI{RBECjY;Z~bV||&No6yeZ8p$=q;Hb0N%|pa zO443Qt&&cd*{5cPX9zd~JObVUcYt}|0nnF4zFY*J@mtHlRiG`awLt@EO>a#AYsuhsfGd25wX(V4hA?QdXK0k56GSHMwVI5@Bi7>EGzfh*AcNr4Wz zcTK2541m0FM&;Paq(FD8B9>*?vmJt>Wtxen-u6uP_}~s%(S<*F$i6hmu@zqcYSrn zjt5@Y9O1ocURnZ1lLF;{3(nwb@34-TN=8`V1Uzzx?LkdV=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@34-TN=8`V1Uzzx?LkdV=f$CWG&=D18C$JFnLL^soeAJ(5NwZIZObTPnHn(9BBu a*YyhrQL-tOFUuML0000Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^e+ z0yzUBG!{hw00Kx!L_t(o!|j+&NEJ~O$A3pKFq068NdK%0TDz%}3pFaR6? zYJigwF}{@3vrRp&K33nUchzs|1GS|R@p4fe_K#-OtLpMf1@B}I%#?bzQZS+3@^5ul za%nfJ?{i@8l+`n8%wb=Zv_m;CFVv<=CcT%*s#2X$w`Uo%DvO6A;wkVE*p--Of!4AE zMTGNQewNc;1MDa}&;n}CJ8w}}R4RrJCb?%aZ^`$lRZE?B4yzw5tSR-9x^^jG+SLK| zy9;YHsckjof;pjnF`Z`A>uPPOr>Lt)ugs+zCClDwr#fwRotrDCrGcqeM{)+eqOM#d z&?mJuE6}lIU!&Tcz;tBr(&5$SO#oL?EUk> zq)Cpo>dh3%@3vZ}ZdH2|+mn)hy(UnXi!89G^0N6owYgkdko{_3-gj6beOB+QN7HOQ uA_G_>&;e`!w&YwIOWIIGjQ#UJxPAkn(y}u$QhtH}0000 0 || written > 0) + iconId = R.drawable.ic_stat_tor_xfer; + + if (mConnectivity && prefPersistNotifications) + showToolbarNotification(sb.toString(), NOTIFY_ID, iconId, -1, prefPersistNotifications); + mTotalTrafficWritten += written; mTotalTrafficRead += read; @@ -1578,13 +1575,14 @@ public class TorService extends Service implements TorServiceConstants, TorConst if (!mConnectivity) { logNotice("No network connectivity. Putting Tor to sleep..."); - startNotification(getString(R.string.no_internet_connection_tor),prefPersistNotifications); + showToolbarNotification(getString(R.string.no_internet_connection_tor),NOTIFY_ID,R.drawable.ic_stat_tor_off,-1,prefPersistNotifications); } else { logNotice("Network connectivity is good. Waking Tor up..."); - startNotification(getString(R.string.status_activated),prefPersistNotifications); + showToolbarNotification(getString(R.string.status_activated),NOTIFY_ID,R.drawable.ic_stat_tor,-1,prefPersistNotifications); + } } catch (RemoteException e) { logException ("error applying mPrefs",e); @@ -1664,7 +1662,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst } catch (Exception e) { - showToolbarNotification (getString(R.string.error_installing_binares),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT); + showToolbarNotification (getString(R.string.error_installing_binares),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT, false); return false; } @@ -1683,7 +1681,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst { String msgBridge = getString(R.string.bridge_requires_ip) + getString(R.string.send_email_for_bridges); - showToolbarNotification(msgBridge, ERROR_NOTIFY_ID, R.drawable.ic_stat_tor, -1); + showToolbarNotification(msgBridge, ERROR_NOTIFY_ID, R.drawable.ic_stat_tor, -1, false); return false; @@ -1698,7 +1696,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst bridgeDelim = ","; } - showToolbarNotification(getString(R.string.notification_using_bridges) + ": " + bridgeList, TRANSPROXY_NOTIFY_ID, R.drawable.ic_stat_tor, -1); + showToolbarNotification(getString(R.string.notification_using_bridges) + ": " + bridgeList, TRANSPROXY_NOTIFY_ID, R.drawable.ic_stat_tor, -1, false); boolean obfsBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_OBFUSCATED, false); String bridgeCfgKey = "bridge"; @@ -1746,7 +1744,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst } catch (Exception e) { - showToolbarNotification (getString(R.string.your_reachableaddresses_settings_caused_an_exception_),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT); + showToolbarNotification (getString(R.string.your_reachableaddresses_settings_caused_an_exception_),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT, false); return false; } @@ -1775,7 +1773,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst } catch (Exception e) { - showToolbarNotification (getString(R.string.your_relay_settings_caused_an_exception_),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT); + showToolbarNotification (getString(R.string.your_relay_settings_caused_an_exception_),ERROR_NOTIFY_ID,R.drawable.ic_stat_notifyerr, Notification.FLAG_ONGOING_EVENT, false); return false;