Search in sources :

Example 1 with RemoteInputView

use of com.android.systemui.statusbar.policy.RemoteInputView in project android_frameworks_base by ResurrectionRemix.

the class NotificationContentView method applyRemoteInput.

private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput, PendingIntent existingPendingIntent, RemoteInputView cachedView) {
    View actionContainerCandidate = view.findViewById(com.android.internal.R.id.actions_container);
    if (actionContainerCandidate instanceof FrameLayout) {
        RemoteInputView existing = (RemoteInputView) view.findViewWithTag(RemoteInputView.VIEW_TAG);
        if (existing != null) {
            existing.onNotificationUpdateOrReset();
        }
        if (existing == null && hasRemoteInput) {
            ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
            if (cachedView == null) {
                RemoteInputView riv = RemoteInputView.inflate(mContext, actionContainer, entry, mRemoteInputController);
                riv.setVisibility(View.INVISIBLE);
                actionContainer.addView(riv, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                existing = riv;
            } else {
                actionContainer.addView(cachedView);
                cachedView.dispatchFinishTemporaryDetach();
                cachedView.requestFocus();
                existing = cachedView;
            }
        }
        if (hasRemoteInput) {
            int color = entry.notification.getNotification().color;
            if (color == Notification.COLOR_DEFAULT) {
                color = mContext.getColor(R.color.default_remote_input_background);
            }
            existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color, mContext.getColor(R.color.remote_input_text_enabled), mContext.getColor(R.color.remote_input_hint)));
            if (existingPendingIntent != null || existing.isActive()) {
                // The current action could be gone, or the pending intent no longer valid.
                // If we find a matching action in the new notification, focus, otherwise close.
                Notification.Action[] actions = entry.notification.getNotification().actions;
                if (existingPendingIntent != null) {
                    existing.setPendingIntent(existingPendingIntent);
                }
                if (existing.updatePendingIntentFromActions(actions)) {
                    if (!existing.isActive()) {
                        existing.focus();
                    }
                } else {
                    if (existing.isActive()) {
                        existing.close();
                    }
                }
            }
        }
        return existing;
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) ImageView(android.widget.ImageView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView)

Example 2 with RemoteInputView

use of com.android.systemui.statusbar.policy.RemoteInputView in project android_frameworks_base by AOSPA.

the class NotificationContentView method applyRemoteInput.

private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput, PendingIntent existingPendingIntent, RemoteInputView cachedView) {
    View actionContainerCandidate = view.findViewById(com.android.internal.R.id.actions_container);
    if (actionContainerCandidate instanceof FrameLayout) {
        RemoteInputView existing = (RemoteInputView) view.findViewWithTag(RemoteInputView.VIEW_TAG);
        if (existing != null) {
            existing.onNotificationUpdateOrReset();
        }
        if (existing == null && hasRemoteInput) {
            ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
            if (cachedView == null) {
                RemoteInputView riv = RemoteInputView.inflate(mContext, actionContainer, entry, mRemoteInputController);
                riv.setVisibility(View.INVISIBLE);
                actionContainer.addView(riv, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                existing = riv;
            } else {
                actionContainer.addView(cachedView);
                cachedView.dispatchFinishTemporaryDetach();
                cachedView.requestFocus();
                existing = cachedView;
            }
        }
        if (hasRemoteInput) {
            int color = entry.notification.getNotification().color;
            if (color == Notification.COLOR_DEFAULT) {
                color = mContext.getColor(R.color.default_remote_input_background);
            }
            existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color, mContext.getColor(R.color.remote_input_text_enabled), mContext.getColor(R.color.remote_input_hint)));
            if (existingPendingIntent != null || existing.isActive()) {
                // The current action could be gone, or the pending intent no longer valid.
                // If we find a matching action in the new notification, focus, otherwise close.
                Notification.Action[] actions = entry.notification.getNotification().actions;
                if (existingPendingIntent != null) {
                    existing.setPendingIntent(existingPendingIntent);
                }
                if (existing.updatePendingIntentFromActions(actions)) {
                    if (!existing.isActive()) {
                        existing.focus();
                    }
                } else {
                    if (existing.isActive()) {
                        existing.close();
                    }
                }
            }
        }
        return existing;
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) ImageView(android.widget.ImageView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView)

Example 3 with RemoteInputView

use of com.android.systemui.statusbar.policy.RemoteInputView in project platform_frameworks_base by android.

the class NotificationContentView method applyRemoteInput.

private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput, PendingIntent existingPendingIntent, RemoteInputView cachedView) {
    View actionContainerCandidate = view.findViewById(com.android.internal.R.id.actions_container);
    if (actionContainerCandidate instanceof FrameLayout) {
        RemoteInputView existing = (RemoteInputView) view.findViewWithTag(RemoteInputView.VIEW_TAG);
        if (existing != null) {
            existing.onNotificationUpdateOrReset();
        }
        if (existing == null && hasRemoteInput) {
            ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
            if (cachedView == null) {
                RemoteInputView riv = RemoteInputView.inflate(mContext, actionContainer, entry, mRemoteInputController);
                riv.setVisibility(View.INVISIBLE);
                actionContainer.addView(riv, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                existing = riv;
            } else {
                actionContainer.addView(cachedView);
                cachedView.dispatchFinishTemporaryDetach();
                cachedView.requestFocus();
                existing = cachedView;
            }
        }
        if (hasRemoteInput) {
            int color = entry.notification.getNotification().color;
            if (color == Notification.COLOR_DEFAULT) {
                color = mContext.getColor(R.color.default_remote_input_background);
            }
            existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color, mContext.getColor(R.color.remote_input_text_enabled), mContext.getColor(R.color.remote_input_hint)));
            if (existingPendingIntent != null || existing.isActive()) {
                // The current action could be gone, or the pending intent no longer valid.
                // If we find a matching action in the new notification, focus, otherwise close.
                Notification.Action[] actions = entry.notification.getNotification().actions;
                if (existingPendingIntent != null) {
                    existing.setPendingIntent(existingPendingIntent);
                }
                if (existing.updatePendingIntentFromActions(actions)) {
                    if (!existing.isActive()) {
                        existing.focus();
                    }
                } else {
                    if (existing.isActive()) {
                        existing.close();
                    }
                }
            }
        }
        return existing;
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) ImageView(android.widget.ImageView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView)

Example 4 with RemoteInputView

use of com.android.systemui.statusbar.policy.RemoteInputView in project android_frameworks_base by DirtyUnicorns.

the class NotificationContentView method applyRemoteInput.

private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput, PendingIntent existingPendingIntent, RemoteInputView cachedView) {
    View actionContainerCandidate = view.findViewById(com.android.internal.R.id.actions_container);
    if (actionContainerCandidate instanceof FrameLayout) {
        RemoteInputView existing = (RemoteInputView) view.findViewWithTag(RemoteInputView.VIEW_TAG);
        if (existing != null) {
            existing.onNotificationUpdateOrReset();
        }
        if (existing == null && hasRemoteInput) {
            ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
            if (cachedView == null) {
                RemoteInputView riv = RemoteInputView.inflate(mContext, actionContainer, entry, mRemoteInputController);
                riv.setVisibility(View.INVISIBLE);
                actionContainer.addView(riv, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                existing = riv;
            } else {
                actionContainer.addView(cachedView);
                cachedView.dispatchFinishTemporaryDetach();
                cachedView.requestFocus();
                existing = cachedView;
            }
        }
        if (hasRemoteInput) {
            int color = entry.notification.getNotification().color;
            if (color == Notification.COLOR_DEFAULT) {
                color = mContext.getColor(R.color.default_remote_input_background);
            }
            existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color, mContext.getColor(R.color.remote_input_text_enabled), mContext.getColor(R.color.remote_input_hint)));
            if (existingPendingIntent != null || existing.isActive()) {
                // The current action could be gone, or the pending intent no longer valid.
                // If we find a matching action in the new notification, focus, otherwise close.
                Notification.Action[] actions = entry.notification.getNotification().actions;
                if (existingPendingIntent != null) {
                    existing.setPendingIntent(existingPendingIntent);
                }
                if (existing.updatePendingIntentFromActions(actions)) {
                    if (!existing.isActive()) {
                        existing.focus();
                    }
                } else {
                    if (existing.isActive()) {
                        existing.close();
                    }
                }
            }
        }
        return existing;
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) ImageView(android.widget.ImageView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView)

Example 5 with RemoteInputView

use of com.android.systemui.statusbar.policy.RemoteInputView in project android_frameworks_base by crdroidandroid.

the class NotificationContentView method applyRemoteInput.

private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput, PendingIntent existingPendingIntent, RemoteInputView cachedView) {
    View actionContainerCandidate = view.findViewById(com.android.internal.R.id.actions_container);
    if (actionContainerCandidate instanceof FrameLayout) {
        RemoteInputView existing = (RemoteInputView) view.findViewWithTag(RemoteInputView.VIEW_TAG);
        if (existing != null) {
            existing.onNotificationUpdateOrReset();
        }
        if (existing == null && hasRemoteInput) {
            ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
            if (cachedView == null) {
                RemoteInputView riv = RemoteInputView.inflate(mContext, actionContainer, entry, mRemoteInputController);
                riv.setVisibility(View.INVISIBLE);
                actionContainer.addView(riv, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                existing = riv;
            } else {
                actionContainer.addView(cachedView);
                cachedView.dispatchFinishTemporaryDetach();
                cachedView.requestFocus();
                existing = cachedView;
            }
        }
        if (hasRemoteInput) {
            int color = entry.notification.getNotification().color;
            if (color == Notification.COLOR_DEFAULT) {
                color = mContext.getColor(R.color.default_remote_input_background);
            }
            existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color, mContext.getColor(R.color.remote_input_text_enabled), mContext.getColor(R.color.remote_input_hint)));
            if (existingPendingIntent != null || existing.isActive()) {
                // The current action could be gone, or the pending intent no longer valid.
                // If we find a matching action in the new notification, focus, otherwise close.
                Notification.Action[] actions = entry.notification.getNotification().actions;
                if (existingPendingIntent != null) {
                    existing.setPendingIntent(existingPendingIntent);
                }
                if (existing.updatePendingIntentFromActions(actions)) {
                    if (!existing.isActive()) {
                        existing.focus();
                    }
                } else {
                    if (existing.isActive()) {
                        existing.close();
                    }
                }
            }
        }
        return existing;
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) ImageView(android.widget.ImageView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView)

Aggregations

NotificationHeaderView (android.view.NotificationHeaderView)5 View (android.view.View)5 ViewGroup (android.view.ViewGroup)5 FrameLayout (android.widget.FrameLayout)5 ImageView (android.widget.ImageView)5 HybridNotificationView (com.android.systemui.statusbar.notification.HybridNotificationView)5 RemoteInputView (com.android.systemui.statusbar.policy.RemoteInputView)5