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 IDreamManager mDreamManager;
PowerManager mPowerManager;
- protected int mRowHeight;
+ protected int mRowMinHeight;
+ protected int mRowMaxHeight;
// public mode, private notifications, etc
private boolean mLockscreenPublicMode = 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.setRowHeight(mRowHeight);
+ 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--) {
NotificationData.Entry entry = mNotificationData.get(i);
if (mOnKeyguard) {
- entry.row.setExpanded(false);
+ entry.row.setSystemExpanded(false);
} else {
if (!entry.row.isUserLocked()) {
boolean top = (i == n-1);
- entry.row.setExpanded(top || entry.row.isUserExpanded());
+ entry.row.setSystemExpanded(top || entry.row.isUserExpanded());
}
}
entry.row.setDimmed(mOnKeyguard);
|| !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;
}
if (DEBUG) Log.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed"));
if (DEBUG) Log.d(TAG, "order was " + (orderUnchanged ? "unchanged" : "changed"));
if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top"));
- final boolean wasExpanded = oldEntry.row.isUserExpanded();
removeNotificationViews(key);
addNotificationViews(key, notification); // will also replace the heads up
- if (wasExpanded) {
- final NotificationData.Entry newEntry = mNotificationData.findByKey(key);
- newEntry.row.setExpanded(true);
- newEntry.row.setUserExpanded(true);
+ final NotificationData.Entry newEntry = mNotificationData.findByKey(key);
+ final boolean userChangedExpansion = oldEntry.row.hasUserChangedExpansion();
+ if (userChangedExpansion) {
+ boolean userExpanded = oldEntry.row.isUserExpanded();
+ newEntry.row.applyExpansionToLayout(userExpanded);
+ newEntry.row.setUserExpanded(userExpanded);
}
}