use of android.view.NotificationHeaderView in project android_frameworks_base by DirtyUnicorns.
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 android_frameworks_base by DirtyUnicorns.
the class HeaderTransformState method setVisible.
@Override
public void setVisible(boolean visible, boolean force) {
super.setVisible(visible, force);
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 (!force && headerChild.getVisibility() == View.GONE) {
continue;
}
headerChild.animate().cancel();
if (headerChild.getVisibility() != View.GONE) {
headerChild.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
if (headerChild == mExpandButton) {
headerChild.setAlpha(visible ? 1.0f : 0.0f);
}
if (headerChild == mWorkProfileIcon) {
headerChild.setTranslationX(0);
headerChild.setTranslationY(0);
}
}
}
use of android.view.NotificationHeaderView in project android_frameworks_base by DirtyUnicorns.
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 android_frameworks_base by crdroidandroid.
the class HeaderTransformState method setVisible.
@Override
public void setVisible(boolean visible, boolean force) {
super.setVisible(visible, force);
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 (!force && headerChild.getVisibility() == View.GONE) {
continue;
}
headerChild.animate().cancel();
if (headerChild.getVisibility() != View.GONE) {
headerChild.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
if (headerChild == mExpandButton) {
headerChild.setAlpha(visible ? 1.0f : 0.0f);
}
if (headerChild == mWorkProfileIcon) {
headerChild.setTranslationX(0);
headerChild.setTranslationY(0);
}
}
}
use of android.view.NotificationHeaderView in project android_frameworks_base by crdroidandroid.
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();
}
Aggregations