Search in sources :

Example 11 with NotificationHeaderView

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);
    }
}
Also used : NotificationHeaderView(android.view.NotificationHeaderView)

Example 12 with NotificationHeaderView

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;
        }
    }
}
Also used : TextView(android.widget.TextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) NotificationHeaderView(android.view.NotificationHeaderView)

Example 13 with NotificationHeaderView

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();
}
Also used : RemoteViews(android.widget.RemoteViews) TextView(android.widget.TextView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 14 with NotificationHeaderView

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);
        }
    }
}
Also used : NotificationHeaderView(android.view.NotificationHeaderView) View(android.view.View) NotificationHeaderView(android.view.NotificationHeaderView)

Example 15 with NotificationHeaderView

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;
}
Also used : NotificationHeaderView(android.view.NotificationHeaderView) View(android.view.View) NotificationHeaderView(android.view.NotificationHeaderView)

Aggregations

NotificationHeaderView (android.view.NotificationHeaderView)55 View (android.view.View)30 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Notification (android.app.Notification)5 StatusBarNotification (android.service.notification.StatusBarNotification)5 RemoteViews (android.widget.RemoteViews)5 HybridNotificationView (com.android.systemui.statusbar.notification.HybridNotificationView)5 NotificationPanelView (com.android.systemui.statusbar.phone.NotificationPanelView)5