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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations