Search in sources :

Example 51 with NotificationHeaderView

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

Example 52 with NotificationHeaderView

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

Example 53 with NotificationHeaderView

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

Example 54 with NotificationHeaderView

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

Example 55 with NotificationHeaderView

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

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