OSDN Git Service

Clean up autoredaction text.
authorDan Sandler <dsandler@android.com>
Mon, 14 Jul 2014 20:48:27 +0000 (16:48 -0400)
committerDan Sandler <dsandler@android.com>
Wed, 16 Jul 2014 16:04:05 +0000 (12:04 -0400)
Also show the timestamp if the original notification does.

Bug: 16289371
Change-Id: I6898990629c036dc7c1a129609449e556f8afa72

packages/SystemUI/res/values/strings.xml
packages/SystemUI/res/values/styles.xml
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

index d4feccd..751c889 100644 (file)
 
     <!-- Battery level for expanded quick settings [CHAR LIMIT=2] -->
     <string name="battery_level_template"><xliff:g id="level" example="45">%d</xliff:g>%%</string>
+
+    <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen -->
+    <string name="notification_hidden_text">Contents hidden</string>
 </resources>
index 7da6c22..708d3e8 100644 (file)
         <item name="android:windowEnterAnimation">@*android:anim/dock_top_enter</item>
         <item name="android:windowExitAnimation">@*android:anim/dock_top_exit</item>
     </style>
+
+    <style name="TextAppearance.StatusBar.Material.EventContent.Parenthetical"
+           parent="@*android:style/TextAppearance.StatusBar.Material.EventContent">
+        <item name="android:textStyle">italic</item>
+        <item name="android:textColor">#60000000</item>
+    </style>
 </resources>
index 9101c8d..c667980 100644 (file)
@@ -62,8 +62,10 @@ import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
+import android.view.ViewStub;
 import android.view.WindowManager;
 import android.view.WindowManagerGlobal;
+import android.widget.DateTimeView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupMenu;
@@ -1075,12 +1077,24 @@ public abstract class BaseStatusBar extends SystemUI implements
                 }
             }
 
+            final View privateTime = contentViewLocal.findViewById(com.android.internal.R.id.time);
+            if (privateTime != null && privateTime.getVisibility() == View.VISIBLE) {
+                final View timeStub = publicViewLocal.findViewById(com.android.internal.R.id.time);
+                timeStub.setVisibility(View.VISIBLE);
+                final DateTimeView dateTimeView = (DateTimeView)
+                        publicViewLocal.findViewById(com.android.internal.R.id.time);
+                dateTimeView.setTime(entry.notification.getNotification().when);
+            }
+
             final TextView text = (TextView) publicViewLocal.findViewById(
-                    com.android.internal.R.id.text);
-            text.setText("Unlock your device to see this notification.");
+                com.android.internal.R.id.text);
+            if (text != null) {
+                text.setText(R.string.notification_hidden_text);
+                text.setTextAppearance(mContext,
+                        R.style.TextAppearance_StatusBar_Material_EventContent_Parenthetical);
+            }
 
             entry.autoRedacted = true;
-            // TODO: fill out "time" as well
         }
 
         row.setDrawingCacheEnabled(true);