use of android.view.NotificationHeaderView in project android_frameworks_base by AOSPA.
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 android_frameworks_base by AOSPA.
the class HeaderTransformState method transformViewTo.
@Override
public boolean transformViewTo(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 false;
}
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;
}
if (headerChild != mExpandButton) {
headerChild.setVisibility(View.INVISIBLE);
} else {
CrossFadeHelper.fadeOut(mExpandButton, transformationAmount);
}
}
return true;
}
use of android.view.NotificationHeaderView in project android_frameworks_base by AOSPA.
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 AOSPA.
the class NotificationContentView method updateContractedHeaderWidth.
private boolean updateContractedHeaderWidth() {
// We need to update the expanded and the collapsed header to have exactly the same with to
// have the expand buttons laid out at the same location.
NotificationHeaderView contractedHeader = mContractedWrapper.getNotificationHeader();
if (contractedHeader != null) {
if (mExpandedChild != null && mExpandedWrapper.getNotificationHeader() != null) {
NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader();
int expandedSize = expandedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd();
int collapsedSize = contractedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd();
if (expandedSize != collapsedSize) {
int paddingEnd = contractedHeader.getMeasuredWidth() - expandedSize;
contractedHeader.setPadding(contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom());
contractedHeader.setShowWorkBadgeAtEnd(true);
return true;
}
} else {
int paddingEnd = mNotificationContentMarginEnd;
if (contractedHeader.getPaddingEnd() != paddingEnd) {
contractedHeader.setPadding(contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom());
contractedHeader.setShowWorkBadgeAtEnd(false);
return true;
}
}
}
return false;
}
use of android.view.NotificationHeaderView in project android_frameworks_base by ResurrectionRemix.
the class NotificationContentView method updateContractedHeaderWidth.
private boolean updateContractedHeaderWidth() {
// We need to update the expanded and the collapsed header to have exactly the same with to
// have the expand buttons laid out at the same location.
NotificationHeaderView contractedHeader = mContractedWrapper.getNotificationHeader();
if (contractedHeader != null) {
if (mExpandedChild != null && mExpandedWrapper.getNotificationHeader() != null) {
NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader();
int expandedSize = expandedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd();
int collapsedSize = contractedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd();
if (expandedSize != collapsedSize) {
int paddingEnd = contractedHeader.getMeasuredWidth() - expandedSize;
contractedHeader.setPadding(contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom());
contractedHeader.setShowWorkBadgeAtEnd(true);
return true;
}
} else {
int paddingEnd = mNotificationContentMarginEnd;
if (contractedHeader.getPaddingEnd() != paddingEnd) {
contractedHeader.setPadding(contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom());
contractedHeader.setShowWorkBadgeAtEnd(false);
return true;
}
}
}
return false;
}
Aggregations