commit 99dfdd711d5be21b308dd2b2da748c91347362c3
Author: Amogh Pradeep <[email protected]>
Date:   Thu May 29 04:56:06 2014 +0530

    added styles to build the custom notification, minor tweaks to old code
---
 res/layout/layout_notification_expanded.xml        |    8 +++++---
 res/values/styles.xml                              |    5 +++++
 src/org/torproject/android/service/TorService.java |   17 ++++++++---------
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/res/layout/layout_notification_expanded.xml 
b/res/layout/layout_notification_expanded.xml
index 8bf0a9d..3eceb5e 100644
--- a/res/layout/layout_notification_expanded.xml
+++ b/res/layout/layout_notification_expanded.xml
@@ -12,7 +12,7 @@
                android:id="@+id/img"
                android:layout_height="64dp"
                android:layout_width="64dp"
-               android:src="@drawable/torerror"/>
+               android:src="@drawable/tor"/>
            
            <TextView 
                android:id="@+id/orb"
@@ -22,7 +22,8 @@
                android:paddingLeft="10dp"
                android:paddingTop="5dp"
                android:layout_toRightOf="@+id/img"
-               android:text="Orbot"/>
+               android:text="Orbot"
+               style="@style/NotificationTitle"/>
            
        <TextView
                android:id="@+id/tv"
@@ -31,7 +32,8 @@
                android:paddingLeft="15dp"
                android:textSize="10sp"
             android:layout_width="fill_parent"
-            android:layout_height="wrap_content"/>
+            android:layout_height="wrap_content"
+            style="@style/NotificationText"/>
 
                <Button
                    android:id="@+id/but"
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..b3fe8af
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="NotificationText" 
parent="android:TextAppearance.StatusBar.EventContent" />
+    <style name="NotificationTitle" 
parent="android:TextAppearance.StatusBar.EventContent.Title" />
+</resources>
diff --git a/src/org/torproject/android/service/TorService.java 
b/src/org/torproject/android/service/TorService.java
index 5d52cde..df6443a 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -227,22 +227,21 @@ public class TorService extends Service implements 
TorServiceConstants, TorConst
        @SuppressLint("NewApi")
        private void showToolbarNotification (String notifyMsg, int notifyId, 
int icon, boolean isOngoing)
        {           
-                
-               PendingIntent pendingIntent = 
PendingIntent.getActivity(TorService.this, 0, new Intent(TorService.this , 
Orbot.class), 0);
-               // Create remote view that needs to be set as bigContentView 
for the notification.
+               
+               //Reusable code.
+               Intent intent = new Intent(TorService.this, Orbot.class);
+               PendingIntent pendIntent = 
PendingIntent.getActivity(TorService.this, 0, intent, 0);
+ 
+               // Create remote view that needs to be set as bigContentView 
for the notification.
                RemoteViews expandedView = new 
RemoteViews(this.getPackageName(), 
                        R.layout.layout_notification_expanded);
                expandedView.setTextViewText(R.id.tv, notifyMsg);
-               expandedView.setOnClickPendingIntent(R.id.but, pendingIntent);
+               expandedView.setOnClickPendingIntent(R.id.but, pendIntent);
                expandedView.setImageViewResource(R.id.img, icon);
                
                if (mNotifyBuilder == null)
                {
                        
-                       //Reusable code.
-                       Intent intent = new Intent(TorService.this, 
Orbot.class);
-                       PendingIntent pendIntent = 
PendingIntent.getActivity(TorService.this, 0, intent, 0);
-                       
                        mNotificationManager = (NotificationManager) 
getSystemService(Context.NOTIFICATION_SERVICE);
                                
                        if (mNotifyBuilder == null)
@@ -270,7 +269,7 @@ public class TorService extends Service implements 
TorServiceConstants, TorConst
                }
                
                mNotification = mNotifyBuilder.build();
-               mNotification.bigContentView = expandedView;
+               //mNotification.bigContentView = expandedView;
                
                if (isOngoing)
                {



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to