From b9b1531cc3daca83a3342b7253f8adc3b57d9956 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Fri, 13 Dec 2013 03:26:36 +0530 Subject: [PATCH 01/10] notification bug fix --- project.properties | 2 +- src/org/torproject/android/service/TorService.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 0629393..0a52332 100644 --- a/project.properties +++ b/project.properties @@ -8,5 +8,5 @@ # project structure. # Project target. -target=android-17 +target=android-18 android.library.reference.1=external/ActionBarSherlock/actionbarsherlock diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 69b46fd..9273005 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -100,6 +100,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst private long lastRead = -1; private long lastWritten = -1; + private static int notificationCounter = 0; private NotificationManager mNotificationManager = null; @@ -1180,6 +1181,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst mTotalTrafficRead += read; sendCallbackStatusMessage(written, read, mTotalTrafficWritten, mTotalTrafficRead); + + if (++notificationCounter%10==0) + startService(new Intent(INTENT_TOR_SERVICE)); } lastWritten = written; -- 1.8.3.2 From e27cd3f0317f4f5246ab70858c559e107bc31bf0 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Fri, 13 Dec 2013 03:35:14 +0530 Subject: [PATCH 02/10] undo previous commit --- src/org/torproject/android/service/TorService.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 9273005..69b46fd 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -100,7 +100,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst private long lastRead = -1; private long lastWritten = -1; - private static int notificationCounter = 0; private NotificationManager mNotificationManager = null; @@ -1181,9 +1180,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst mTotalTrafficRead += read; sendCallbackStatusMessage(written, read, mTotalTrafficWritten, mTotalTrafficRead); - - if (++notificationCounter%10==0) - startService(new Intent(INTENT_TOR_SERVICE)); } lastWritten = written; -- 1.8.3.2 From 285f0f3a16b94dcba7980e0079048f015a56b2a0 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Fri, 13 Dec 2013 03:45:05 +0530 Subject: [PATCH 03/10] notification patch added to ./patch directory for any further reference --- patches/amoghbl1_notification_updater.patch | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 patches/amoghbl1_notification_updater.patch diff --git a/patches/amoghbl1_notification_updater.patch b/patches/amoghbl1_notification_updater.patch new file mode 100644 index 0000000..dc1467f --- /dev/null +++ b/patches/amoghbl1_notification_updater.patch @@ -0,0 +1,40 @@ +From bf4b17acd6beb6d7e5e85c46a4d290a3e3080f5c Mon Sep 17 00:00:00 2001 +From: amoghbl1 +Date: Fri, 13 Dec 2013 03:41:05 +0530 +Subject: [PATCH] notification bug fix + +--- + src/org/torproject/android/service/TorService.java | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java +index 69b46fd..90bebb6 100644 +--- a/src/org/torproject/android/service/TorService.java ++++ b/src/org/torproject/android/service/TorService.java +@@ -99,8 +99,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst + + private long lastRead = -1; + private long lastWritten = -1; +- +- ++ ++ ++ private static int notificationCounter = 0; ++ + private NotificationManager mNotificationManager = null; + + public void logMessage(String msg) +@@ -1180,6 +1182,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst + mTotalTrafficRead += read; + + sendCallbackStatusMessage(written, read, mTotalTrafficWritten, mTotalTrafficRead); ++ ++ if(++notificationCounter%10==0) ++ startService(new Intent(INTENT_TOR_SERVICE)); ++ + } + + lastWritten = written; +-- +1.8.3.2 + -- 1.8.3.2 From 12ed0867eb200d72e2a1c9ebc581ebeae1ed8024 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 05:27:45 +0530 Subject: [PATCH 04/10] New notification (with builder) implemented --- src/org/torproject/android/service/TorService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 69b46fd..6067ca1 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -33,6 +33,7 @@ import org.torproject.android.settings.AppManager; import org.torproject.android.share.ShareItem; import org.torproject.android.share.ShareService; +import android.annotation.SuppressLint; import android.app.Application; import android.app.Notification; import android.app.NotificationManager; @@ -201,6 +202,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst } + @SuppressLint("NewApi") private void showToolbarNotification (String notifyMsg, int notifyId, int icon, int flags) { @@ -209,6 +211,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst CharSequence tickerText = notifyMsg; long when = System.currentTimeMillis(); + /* Notification notification = new Notification(icon, tickerText, when); if (prefPersistNotifications && flags != -1) @@ -222,6 +225,17 @@ public class TorService extends Service implements TorServiceConstants, TorConst PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); + */ + Intent notificationIntent = new Intent(this, Orbot.class); + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); + + Notification notification = new Notification.Builder(this) + .setContentTitle(getString(R.string.app_name)) + .setContentText(notifyMsg) + .setContentIntent(contentIntent) + .build(); + if (prefPersistNotifications && flags != -1) + notification.flags |= flags; mNotificationManager.notify(notifyId, notification); -- 1.8.3.2 From 7abf0eb9f52bd2ebed71bca794f121e190fec4d9 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 05:30:58 +0530 Subject: [PATCH 05/10] Undo previous changes (forgot to switch branch :/ ) --- src/org/torproject/android/service/TorService.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 6067ca1..69b46fd 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -33,7 +33,6 @@ import org.torproject.android.settings.AppManager; import org.torproject.android.share.ShareItem; import org.torproject.android.share.ShareService; -import android.annotation.SuppressLint; import android.app.Application; import android.app.Notification; import android.app.NotificationManager; @@ -202,7 +201,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst } - @SuppressLint("NewApi") private void showToolbarNotification (String notifyMsg, int notifyId, int icon, int flags) { @@ -211,7 +209,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst CharSequence tickerText = notifyMsg; long when = System.currentTimeMillis(); - /* Notification notification = new Notification(icon, tickerText, when); if (prefPersistNotifications && flags != -1) @@ -225,17 +222,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); - */ - Intent notificationIntent = new Intent(this, Orbot.class); - PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); - - Notification notification = new Notification.Builder(this) - .setContentTitle(getString(R.string.app_name)) - .setContentText(notifyMsg) - .setContentIntent(contentIntent) - .build(); - if (prefPersistNotifications && flags != -1) - notification.flags |= flags; mNotificationManager.notify(notifyId, notification); -- 1.8.3.2 From 7e53da531e161e7da0eaa1e215d6866332856e77 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 20:28:45 +0530 Subject: [PATCH 06/10] notification button action fixed --- .settings/org.eclipse.jdt.core.prefs | 4 ++ res/drawable/button_stop.png | Bin 0 -> 1462 bytes src/org/torproject/android/Orbot.java | 15 +++++++- src/org/torproject/android/service/TorService.java | 41 +++++++++++++++++---- this.patch | 0 5 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 res/drawable/button_stop.png create mode 100644 this.patch diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b080d2d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/res/drawable/button_stop.png b/res/drawable/button_stop.png new file mode 100644 index 0000000000000000000000000000000000000000..d97a3a8edc3806086df0b9c54e3d3233ed72918c GIT binary patch literal 1462 zcmV;n1xfmeP)+|D3;>~N|IV|7zk>*z-JP;KaRLOy2@nt`KtP-T0dWEZ{3YNqYi_-56j1=4U9Y|C z?s|O-#sMNHjve2UA~jrI5K!?{cmUyCg#hITz+dP){DQppfi|HHLV~s+(Y%y5-l!8_ zOVfg=6t%UzyK!vCyPWYlqpamYD74j_WVIV>Z{IgFXU-&9S;?PUUS0TdX*K`B($bRm z{{rB9EUqkGSX{|}f$z;hFew0FqpP1RJ`g1FRyaKNm3+o`nHSJq0C?l{GC!W>1+FB^ zXEw&d;jaacw7tB#_-Fpp{5Vqr0Mg?U&`*&_G@8p~{Sy*!ve9n5%Z>nxd%^1^!`<=1KGla(sWe3b z9X^>#s2~tSJ2o7WBysS}C`&n@aoA~F$MC}vRFIHKXFvkykU)b^rITtf5F81Q_lJjv zCTDVWW(0hDW$Svo(|*vXH!$#M34Rr2vsog62A|HP)L<|~g|9d2sNL@TwYhoidu9Y! z5Jx@p^LzLAG)>p368s=xHkTt3hT${0v>FQ0;dR46_wMa!M^^7M3xcU>@apBOznNY1 zezjWtcL@PMnwy&=68i8iVLLaQg@hNT!-Lpzxvb%5;Ab&e2yJd|-o_H}i)u}cDj@(8 zUOjuZF9E~P&gIl_m=3RL8Y-4beR%u~mMcLbp;#*G&4z|(i7^-oqWSrGW&Yebbu2uF zc%B~#-)uC|?ruqUz_ToXNI0@C>=ui9v+0oFIL0{v4+#v9V;H^x@H@Lj9p8(1119j+-9b{z1G3!qCVfQ0&!`tgiG_Cp)_yk4)P!kq#Io?!v>oB$FE zI|fc>rfH&1r-O?bn9tj&+wD3e=y1-R-wQ^sOW>br2X`pQwk-lS!!S^(ST^v7sZ>%? zd_Dp|&KpFt*~Ai9FNF#Gjj8D=*#|(w)g8~<#|H!Wp4D0CLCY3P707!!7DIBvNg0Zw zphP0!Oc^h7VZf{R_mPPh<*h|{t0DkkEt((Wi5(v??rsk*#;97FM zBFktxKHZl9&w7oiApou7g%_(%#$qq|{eB|Fxd5`^E9DBncl+?ey$5IgnIs+#@^H22 zD3SN}?*HLe0;%=&^)3@VfaA=!y^>cRf_FgJ>-iJ#l(HEoyy2d3G6EpjD@ozUjmIA` zGXzYIn-nEcqzQtS2l%RC4#CqTRBBbNIgl_aM9JfVou3&2yk(Z5%iG<&?IFtsp_a(Rd^QB9djHhtV524TdIFow>E&t=i zix Date: Sat, 14 Dec 2013 20:29:27 +0530 Subject: [PATCH 07/10] remove temp file --- this.patch | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 this.patch diff --git a/this.patch b/this.patch deleted file mode 100644 index e69de29..0000000 -- 1.8.3.2 From 75a0f0e410056954e35aa436786deb814b8b2f1c Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 20:37:54 +0530 Subject: [PATCH 08/10] added the stop button --- my | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 my diff --git a/my b/my new file mode 100644 index 0000000..e69de29 -- 1.8.3.2 From 5ca2a1a6ffaf3125f1a7798145322b64986d42c7 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 20:38:10 +0530 Subject: [PATCH 09/10] remove temp file --- my | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 my diff --git a/my b/my deleted file mode 100644 index e69de29..0000000 -- 1.8.3.2 From 3a3d2f3d05f4dff31281b95fc03bf0537ce6e670 Mon Sep 17 00:00:00 2001 From: amoghbl1 Date: Sat, 14 Dec 2013 20:45:46 +0530 Subject: [PATCH 10/10] notification button final --- src/org/torproject/android/service/TorService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 0bbed06..4b5bf22 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -1088,7 +1088,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst .setContentTitle(getString(R.string.app_name)) .setContentText( getString(R.string.status_activated)) .setSmallIcon(R.drawable.ic_stat_tor) - .addAction(R.drawable.icon, "STOP", stopTorIntent); + .addAction(R.drawable.button_stop, "STOP", stopTorIntent); Intent intent = new Intent(TorService.this, Orbot.class); PendingIntent pendIntent = PendingIntent.getActivity(TorService.this, 0, intent, 0); -- 1.8.3.2