import java.util.Locale;
public abstract class BaseStatusBar extends SystemUI implements
- CommandQueue.Callbacks {
+ CommandQueue.Callbacks, LatestItemView.OnActivatedListener {
public static final String TAG = "StatusBar";
public static final boolean DEBUG = false;
public static final boolean MULTIUSER_DEBUG = false;
protected int mZenMode;
protected boolean mOnKeyguard;
- protected View mKeyguardIconOverflowContainer;
- protected NotificationOverflowIconsView mOverflowIconsView;
+ protected NotificationOverflowContainer mKeyguardIconOverflowContainer;
public boolean isDeviceProvisioned() {
return mDeviceProvisioned;
}
- protected void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
- if (sbn.getNotification().contentView.getLayoutId() !=
- com.android.internal.R.layout.notification_template_base) {
+ protected void applyLegacyRowBackground(StatusBarNotification sbn,
+ NotificationData.Entry entry) {
+ if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) {
int version = 0;
try {
ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0);
Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
}
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
- content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
+ entry.row.setBackgroundResource(R.drawable.notification_row_legacy_bg);
+ } else if (version < Build.VERSION_CODES.L) {
+ entry.row.setBackgroundResourceIds(
+ com.android.internal.R.drawable.notification_bg,
+ com.android.internal.R.drawable.notification_bg_dim);
}
}
}
row.setDrawingCacheEnabled(true);
- applyLegacyRowBackground(sbn, content);
-
if (MULTIUSER_DEBUG) {
TextView debug = (TextView) row.findViewById(R.id.debug_info);
if (debug != null) {
}
entry.row = row;
entry.row.setHeightRange(mRowMinHeight, mRowMaxHeight);
+ entry.row.setOnActivatedListener(this);
entry.content = content;
entry.expanded = contentViewLocal;
entry.expandedPublic = publicViewLocal;
entry.setBigContentView(bigContentViewLocal);
+ applyLegacyRowBackground(sbn, entry);
+
return true;
}
*/
protected void updateRowStates() {
int maxKeyguardNotifications = getMaxKeyguardNotifications();
- mOverflowIconsView.removeAllViews();
+ mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
int n = mNotificationData.size();
int visibleNotifications = 0;
for (int i = n-1; i >= 0; i--) {
|| !showOnKeyguard)) {
entry.row.setVisibility(View.GONE);
if (showOnKeyguard) {
- mOverflowIconsView.addNotification(entry);
+ mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
}
} else {
entry.row.setVisibility(View.VISIBLE);
}
}
- if (mOnKeyguard && mOverflowIconsView.getChildCount() > 0) {
+ if (mOnKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
} else {
mKeyguardIconOverflowContainer.setVisibility(View.GONE);
}
}
+ @Override
+ public void onActivated(View view) {
+ int n = mNotificationData.size();
+ for (int i = 0; i < n; i++) {
+ NotificationData.Entry entry = mNotificationData.get(i);
+ if (entry.row.getVisibility() != View.GONE) {
+ if (view == entry.row) {
+ entry.row.getActivator().activate();
+ } else {
+ entry.row.getActivator().activateInverse();
+ }
+ }
+ }
+ if (mKeyguardIconOverflowContainer.getVisibility() != View.GONE) {
+ if (view == mKeyguardIconOverflowContainer) {
+ mKeyguardIconOverflowContainer.getActivator().activate();
+ } else {
+ mKeyguardIconOverflowContainer.getActivator().activateInverse();
+ }
+ }
+ }
+
+ @Override
+ public void onReset(View view) {
+ int n = mNotificationData.size();
+ for (int i = 0; i < n; i++) {
+ NotificationData.Entry entry = mNotificationData.get(i);
+ if (entry.row.getVisibility() != View.GONE) {
+ entry.row.getActivator().reset();
+ }
+ }
+ if (mKeyguardIconOverflowContainer.getVisibility() != View.GONE) {
+ mKeyguardIconOverflowContainer.getActivator().reset();
+ }
+ }
+
private boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
return sbn.getNotification().priority >= Notification.PRIORITY_LOW;
}