Expand too-small notifications to fill 64dp.

Also fix NotificationTestList so it runs again.

Change-Id: I2fb28cd9cfad25a7a1b17ccef9ccd741c3aa99b0
This commit is contained in:
Daniel Sandler
2012-04-19 01:08:15 -04:00
parent 26fbf27ad1
commit bc5559f192
3 changed files with 22 additions and 6 deletions

View File

@@ -19,7 +19,7 @@
android:background="@android:color/background_dark"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="64dp"
internal:layout_minHeight="64dp"
internal:layout_maxHeight="64dp"
>

View File

@@ -354,9 +354,10 @@ public abstract class BaseStatusBar extends SystemUI implements
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
// XXX: temporary: while testing big notifications, auto-expand all of them
ViewGroup.LayoutParams lp = row.getLayoutParams();
if (sbn.notification.bigContentView != null) {
if (large != null) {
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else {
lp.height = minHeight;
@@ -372,9 +373,16 @@ public abstract class BaseStatusBar extends SystemUI implements
// bind the click event to the content area
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
ViewGroup adaptive = (ViewGroup)row.findViewById(R.id.adaptive);
// XXX: update to allow controls within notification views
// Ensure that R.id.content is properly set to 64dp high if 1U
lp = content.getLayoutParams();
if (large == null) {
lp.height = minHeight;
}
content.setLayoutParams(lp);
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
// content.setOnFocusChangeListener(mFocusChangeListener);
PendingIntent contentIntent = sbn.notification.contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = new NotificationClicker(contentIntent,

View File

@@ -24,6 +24,7 @@ import android.content.ContentResolver;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.os.Vibrator;
import android.os.Handler;
@@ -44,10 +45,10 @@ public class NotificationTestList extends TestActivity
private final static String TAG = "NotificationTestList";
NotificationManager mNM;
Vibrator mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
Vibrator mVibrator;
Handler mHandler = new Handler();
long mActivityCreateTime = System.currentTimeMillis();
long mActivityCreateTime;
long mChronometerBase = 0;
boolean mProgressDone = true;
@@ -66,6 +67,13 @@ public class NotificationTestList extends TestActivity
};
final int kUnnumberedIconResID = R.drawable.notificationx;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
mActivityCreateTime = System.currentTimeMillis();
}
@Override
protected String tag() {
return TAG;