use of android.view.NotificationHeaderView in project android_frameworks_base by AOSPA.
the class NotificationHeaderUtil method sanitizeChild.
private void sanitizeChild(View child) {
if (child != null) {
NotificationHeaderView header = (NotificationHeaderView) child.findViewById(com.android.internal.R.id.notification_header);
sanitizeHeader(header);
}
}
use of android.view.NotificationHeaderView in project platform_frameworks_base by android.
the class NotificationHeaderUtil method sanitizeHeader.
private void sanitizeHeader(NotificationHeaderView rowHeader) {
if (rowHeader == null) {
return;
}
final int childCount = rowHeader.getChildCount();
View time = rowHeader.findViewById(com.android.internal.R.id.time);
boolean hasVisibleText = false;
for (int i = 1; i < childCount - 1; i++) {
View child = rowHeader.getChildAt(i);
if (child instanceof TextView && child.getVisibility() != View.GONE && !mDividers.contains(Integer.valueOf(child.getId())) && child != time) {
hasVisibleText = true;
break;
}
}
// in case no view is visible we make sure the time is visible
int timeVisibility = !hasVisibleText || mRow.getStatusBarNotification().getNotification().showsTime() ? View.VISIBLE : View.GONE;
time.setVisibility(timeVisibility);
View left = null;
View right;
for (int i = 1; i < childCount - 1; i++) {
View child = rowHeader.getChildAt(i);
if (mDividers.contains(Integer.valueOf(child.getId()))) {
boolean visible = false;
// Lets find the item to the right
for (i++; i < childCount - 1; i++) {
right = rowHeader.getChildAt(i);
if (mDividers.contains(Integer.valueOf(right.getId()))) {
// A divider was found, this needs to be hidden
i--;
break;
} else if (right.getVisibility() != View.GONE && right instanceof TextView) {
visible = left != null;
left = right;
break;
}
}
child.setVisibility(visible ? View.VISIBLE : View.GONE);
} else if (child.getVisibility() != View.GONE && child instanceof TextView) {
left = child;
}
}
}
use of android.view.NotificationHeaderView in project platform_frameworks_base by android.
the class NotificationChildrenContainer method recreateNotificationHeader.
public void recreateNotificationHeader(OnClickListener listener, StatusBarNotification notification) {
final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(), mNotificationParent.getStatusBarNotification().getNotification());
final RemoteViews header = builder.makeNotificationHeader();
if (mNotificationHeader == null) {
mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this);
final View expandButton = mNotificationHeader.findViewById(com.android.internal.R.id.expand_button);
expandButton.setVisibility(VISIBLE);
mNotificationHeader.setOnClickListener(listener);
mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(), mNotificationHeader, mNotificationParent);
addView(mNotificationHeader, 0);
invalidate();
} else {
header.reapply(getContext(), mNotificationHeader);
mNotificationHeaderWrapper.notifyContentUpdated(notification);
}
updateChildrenHeaderAppearance();
}
use of android.view.NotificationHeaderView in project platform_frameworks_base by android.
the class HeaderTransformState method prepareFadeIn.
@Override
public void prepareFadeIn() {
super.prepareFadeIn();
if (!(mTransformedView instanceof NotificationHeaderView)) {
return;
}
NotificationHeaderView header = (NotificationHeaderView) mTransformedView;
int childCount = header.getChildCount();
for (int i = 0; i < childCount; i++) {
View headerChild = header.getChildAt(i);
if (headerChild.getVisibility() == View.GONE) {
continue;
}
headerChild.animate().cancel();
headerChild.setVisibility(View.VISIBLE);
headerChild.setAlpha(1.0f);
if (headerChild == mWorkProfileIcon) {
headerChild.setTranslationX(0);
headerChild.setTranslationY(0);
}
}
}
use of android.view.NotificationHeaderView in project platform_frameworks_base by android.
the class HeaderTransformState method transformViewFrom.
@Override
public void transformViewFrom(TransformState otherState, float transformationAmount) {
// but the expand button, so lets fade just that one and transform the work profile icon.
if (!(mTransformedView instanceof NotificationHeaderView)) {
return;
}
NotificationHeaderView header = (NotificationHeaderView) mTransformedView;
header.setVisibility(View.VISIBLE);
header.setAlpha(1.0f);
int childCount = header.getChildCount();
for (int i = 0; i < childCount; i++) {
View headerChild = header.getChildAt(i);
if (headerChild.getVisibility() == View.GONE) {
continue;
}
if (headerChild == mExpandButton) {
CrossFadeHelper.fadeIn(mExpandButton, transformationAmount);
} else {
headerChild.setVisibility(View.VISIBLE);
if (headerChild == mWorkProfileIcon) {
mWorkProfileState.transformViewFullyFrom(((HeaderTransformState) otherState).mWorkProfileState, transformationAmount);
}
}
}
return;
}
Aggregations