Merge "DirectReply: Show historic messages"
This commit is contained in:
committed by
Android (Google) Code Review
commit
feaac67227
@@ -992,7 +992,6 @@ public class NotificationContentView extends FrameLayout {
|
||||
mStatusBarNotification = entry.notification;
|
||||
mBeforeN = entry.targetSdk < Build.VERSION_CODES.N;
|
||||
updateSingleLineView();
|
||||
applyRemoteInput(entry);
|
||||
if (mContractedChild != null) {
|
||||
mContractedWrapper.notifyContentUpdated(entry.notification, mIsLowPriority);
|
||||
}
|
||||
@@ -1005,6 +1004,7 @@ public class NotificationContentView extends FrameLayout {
|
||||
if (mAmbientChild != null) {
|
||||
mAmbientWrapper.notifyContentUpdated(entry.notification, mIsLowPriority);
|
||||
}
|
||||
applyRemoteInput(entry);
|
||||
updateShowingLegacyBackground();
|
||||
mForceSelectNextLayout = true;
|
||||
setDark(mDark, false /* animate */, 0 /* delay */);
|
||||
@@ -1046,7 +1046,8 @@ public class NotificationContentView extends FrameLayout {
|
||||
View bigContentView = mExpandedChild;
|
||||
if (bigContentView != null) {
|
||||
mExpandedRemoteInput = applyRemoteInput(bigContentView, entry, hasRemoteInput,
|
||||
mPreviousExpandedRemoteInputIntent, mCachedExpandedRemoteInput);
|
||||
mPreviousExpandedRemoteInputIntent, mCachedExpandedRemoteInput,
|
||||
mExpandedWrapper);
|
||||
} else {
|
||||
mExpandedRemoteInput = null;
|
||||
}
|
||||
@@ -1060,7 +1061,7 @@ public class NotificationContentView extends FrameLayout {
|
||||
View headsUpContentView = mHeadsUpChild;
|
||||
if (headsUpContentView != null) {
|
||||
mHeadsUpRemoteInput = applyRemoteInput(headsUpContentView, entry, hasRemoteInput,
|
||||
mPreviousHeadsUpRemoteInputIntent, mCachedHeadsUpRemoteInput);
|
||||
mPreviousHeadsUpRemoteInputIntent, mCachedHeadsUpRemoteInput, mHeadsUpWrapper);
|
||||
} else {
|
||||
mHeadsUpRemoteInput = null;
|
||||
}
|
||||
@@ -1074,7 +1075,7 @@ public class NotificationContentView extends FrameLayout {
|
||||
|
||||
private RemoteInputView applyRemoteInput(View view, NotificationData.Entry entry,
|
||||
boolean hasRemoteInput, PendingIntent existingPendingIntent,
|
||||
RemoteInputView cachedView) {
|
||||
RemoteInputView cachedView, NotificationViewWrapper wrapper) {
|
||||
View actionContainerCandidate = view.findViewById(
|
||||
com.android.internal.R.id.actions_container);
|
||||
if (actionContainerCandidate instanceof FrameLayout) {
|
||||
@@ -1113,6 +1114,8 @@ public class NotificationContentView extends FrameLayout {
|
||||
mContext.getColor(R.color.remote_input_text_enabled),
|
||||
mContext.getColor(R.color.remote_input_hint)));
|
||||
|
||||
existing.setWrapper(wrapper);
|
||||
|
||||
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.
|
||||
|
||||
@@ -22,7 +22,11 @@ import com.android.systemui.statusbar.TransformableView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Wraps a notification containing a messaging template
|
||||
@@ -30,6 +34,7 @@ import android.view.View;
|
||||
public class NotificationMessagingTemplateViewWrapper extends NotificationTemplateViewWrapper {
|
||||
|
||||
private View mContractedMessage;
|
||||
private ArrayList<View> mHistoricMessages = new ArrayList<View>();
|
||||
|
||||
protected NotificationMessagingTemplateViewWrapper(Context ctx, View view,
|
||||
ExpandableNotificationRow row) {
|
||||
@@ -44,11 +49,18 @@ public class NotificationMessagingTemplateViewWrapper extends NotificationTempla
|
||||
&& ((MessagingLinearLayout) container).getChildCount() > 0) {
|
||||
MessagingLinearLayout messagingContainer = (MessagingLinearLayout) container;
|
||||
|
||||
// Only consider the first visible child - transforming to a position other than the
|
||||
// first looks bad because we have to move across other messages that are fading in.
|
||||
int childCount = messagingContainer.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = messagingContainer.getChildAt(i);
|
||||
|
||||
if (child.getVisibility() == View.GONE
|
||||
&& child instanceof TextView
|
||||
&& !TextUtils.isEmpty(((TextView) child).getText())) {
|
||||
mHistoricMessages.add(child);
|
||||
}
|
||||
|
||||
// Only consider the first visible child - transforming to a position other than the
|
||||
// first looks bad because we have to move across other messages that are fading in.
|
||||
if (child.getId() == messagingContainer.getContractedChildId()) {
|
||||
mContractedMessage = child;
|
||||
} else if (child.getVisibility() == View.VISIBLE) {
|
||||
@@ -75,4 +87,11 @@ public class NotificationMessagingTemplateViewWrapper extends NotificationTempla
|
||||
mContractedMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoteInputVisible(boolean visible) {
|
||||
for (int i = 0; i < mHistoricMessages.size(); i++) {
|
||||
mHistoricMessages.get(i).setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,4 +164,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
|
||||
public void setContentHeight(int contentHeight, int minHeightHint) {
|
||||
}
|
||||
|
||||
public void setRemoteInputVisible(boolean visible) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.ExpandableView;
|
||||
import com.android.systemui.statusbar.NotificationData;
|
||||
import com.android.systemui.statusbar.RemoteInputController;
|
||||
import com.android.systemui.statusbar.notification.NotificationViewWrapper;
|
||||
import com.android.systemui.statusbar.stack.ScrollContainer;
|
||||
import com.android.systemui.statusbar.stack.StackStateAnimator;
|
||||
|
||||
@@ -90,6 +91,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
private int mRevealR;
|
||||
|
||||
private boolean mResetting;
|
||||
private NotificationViewWrapper mWrapper;
|
||||
|
||||
public RemoteInputView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -210,11 +212,17 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setVisibility(INVISIBLE);
|
||||
if (mWrapper != null) {
|
||||
mWrapper.setRemoteInputVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
reveal.start();
|
||||
} else {
|
||||
setVisibility(INVISIBLE);
|
||||
if (mWrapper != null) {
|
||||
mWrapper.setRemoteInputVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_REMOTE_INPUT_CLOSE,
|
||||
@@ -267,6 +275,9 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
mEntry.notification.getPackageName());
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
if (mWrapper != null) {
|
||||
mWrapper.setRemoteInputVisible(true);
|
||||
}
|
||||
mController.addRemoteInput(mEntry, mToken);
|
||||
mEditText.setInnerFocusable(true);
|
||||
mEditText.mShowImeOnInputConnection = true;
|
||||
@@ -283,6 +294,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
// Update came in after we sent the reply, time to reset.
|
||||
reset();
|
||||
}
|
||||
|
||||
if (isActive() && mWrapper != null) {
|
||||
mWrapper.setRemoteInputVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
@@ -452,6 +467,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
super.dispatchFinishTemporaryDetach();
|
||||
}
|
||||
|
||||
public void setWrapper(NotificationViewWrapper wrapper) {
|
||||
mWrapper = wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* An EditText that changes appearance based on whether it's focusable and becomes
|
||||
* un-focusable whenever the user navigates away from it or it becomes invisible.
|
||||
|
||||
Reference in New Issue
Block a user