Skip to content

Commit 3dfc82b

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Expand too-small notifications to fill 64dp."
2 parents f66bc73 + bc5559f commit 3dfc82b

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

core/res/res/layout/notification_template_base.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
android:background="@android:color/background_dark"
2020
android:id="@+id/status_bar_latest_event_content"
2121
android:layout_width="match_parent"
22-
android:layout_height="wrap_content"
22+
android:layout_height="64dp"
2323
internal:layout_minHeight="64dp"
2424
internal:layout_maxHeight="64dp"
2525
>

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,10 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
354354
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
355355
Context.LAYOUT_INFLATER_SERVICE);
356356
View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
357+
357358
// XXX: temporary: while testing big notifications, auto-expand all of them
358359
ViewGroup.LayoutParams lp = row.getLayoutParams();
359-
if (sbn.notification.bigContentView != null) {
360+
if (large != null) {
360361
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
361362
} else {
362363
lp.height = minHeight;
@@ -372,9 +373,16 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
372373
// bind the click event to the content area
373374
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
374375
ViewGroup adaptive = (ViewGroup)row.findViewById(R.id.adaptive);
375-
// XXX: update to allow controls within notification views
376+
377+
// Ensure that R.id.content is properly set to 64dp high if 1U
378+
lp = content.getLayoutParams();
379+
if (large == null) {
380+
lp.height = minHeight;
381+
}
382+
content.setLayoutParams(lp);
383+
376384
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
377-
// content.setOnFocusChangeListener(mFocusChangeListener);
385+
378386
PendingIntent contentIntent = sbn.notification.contentIntent;
379387
if (contentIntent != null) {
380388
final View.OnClickListener listener = new NotificationClicker(contentIntent,

tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.content.Intent;
2525
import android.graphics.Bitmap;
2626
import android.graphics.drawable.BitmapDrawable;
27+
import android.os.Bundle;
2728
import android.os.Environment;
2829
import android.os.Vibrator;
2930
import android.os.Handler;
@@ -44,10 +45,10 @@ public class NotificationTestList extends TestActivity
4445
private final static String TAG = "NotificationTestList";
4546

4647
NotificationManager mNM;
47-
Vibrator mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
48+
Vibrator mVibrator;
4849
Handler mHandler = new Handler();
4950

50-
long mActivityCreateTime = System.currentTimeMillis();
51+
long mActivityCreateTime;
5152
long mChronometerBase = 0;
5253

5354
boolean mProgressDone = true;
@@ -66,6 +67,13 @@ public class NotificationTestList extends TestActivity
6667
};
6768
final int kUnnumberedIconResID = R.drawable.notificationx;
6869

70+
@Override
71+
public void onCreate(Bundle icicle) {
72+
super.onCreate(icicle);
73+
mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
74+
mActivityCreateTime = System.currentTimeMillis();
75+
}
76+
6977
@Override
7078
protected String tag() {
7179
return TAG;

0 commit comments

Comments
 (0)