Merge "Remove circular ref from MessagingLinearLayout" into rvc-dev am: f33516115a am: 8b4a786347

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11971391

Change-Id: Ieed8117e61fdfbb309e0ec40b0fc65f3e03f291e
This commit is contained in:
TreeHugger Robot
2020-06-23 18:09:12 +00:00
committed by Automerger Merge Worker
3 changed files with 13 additions and 9 deletions

View File

@@ -197,7 +197,6 @@ public class ConversationLayout extends FrameLayout
super.onFinishInflate(); super.onFinishInflate();
mMessagingLinearLayout = findViewById(R.id.notification_messaging); mMessagingLinearLayout = findViewById(R.id.notification_messaging);
mActions = findViewById(R.id.actions); mActions = findViewById(R.id.actions);
mMessagingLinearLayout.setMessagingLayout(this);
mImageMessageContainer = findViewById(R.id.conversation_image_message_container); mImageMessageContainer = findViewById(R.id.conversation_image_message_container);
// We still want to clip, but only on the top, since views can temporarily out of bounds // We still want to clip, but only on the top, since views can temporarily out of bounds
// during transitions. // during transitions.

View File

@@ -124,7 +124,6 @@ public class MessagingLayout extends FrameLayout
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
mMessagingLinearLayout = findViewById(R.id.notification_messaging); mMessagingLinearLayout = findViewById(R.id.notification_messaging);
mMessagingLinearLayout.setMessagingLayout(this);
// We still want to clip, but only on the top, since views can temporarily out of bounds // We still want to clip, but only on the top, since views can temporarily out of bounds
// during transitions. // during transitions.
DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics();

View File

@@ -24,6 +24,7 @@ import android.util.AttributeSet;
import android.view.RemotableViewMethod; import android.view.RemotableViewMethod;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.android.internal.R; import com.android.internal.R;
@@ -43,8 +44,6 @@ public class MessagingLinearLayout extends ViewGroup {
private int mMaxDisplayedLines = Integer.MAX_VALUE; private int mMaxDisplayedLines = Integer.MAX_VALUE;
private IMessagingLayout mMessagingLayout;
public MessagingLinearLayout(Context context, @Nullable AttributeSet attrs) { public MessagingLinearLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@@ -292,12 +291,19 @@ public class MessagingLinearLayout extends ViewGroup {
mMaxDisplayedLines = numberLines; mMaxDisplayedLines = numberLines;
} }
public void setMessagingLayout(IMessagingLayout layout) {
mMessagingLayout = layout;
}
public IMessagingLayout getMessagingLayout() { public IMessagingLayout getMessagingLayout() {
return mMessagingLayout; View view = this;
while (true) {
ViewParent p = view.getParent();
if (p instanceof View) {
view = (View) p;
if (view instanceof IMessagingLayout) {
return (IMessagingLayout) view;
}
} else {
return null;
}
}
} }
@Override @Override