Merge "Remove circular ref from MessagingLinearLayout" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-06-23 17:35:37 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 9 deletions

View File

@@ -197,7 +197,6 @@ public class ConversationLayout extends FrameLayout
super.onFinishInflate();
mMessagingLinearLayout = findViewById(R.id.notification_messaging);
mActions = findViewById(R.id.actions);
mMessagingLinearLayout.setMessagingLayout(this);
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
// during transitions.

View File

@@ -124,7 +124,6 @@ public class MessagingLayout extends FrameLayout
protected void onFinishInflate() {
super.onFinishInflate();
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
// during transitions.
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();

View File

@@ -24,6 +24,7 @@ import android.util.AttributeSet;
import android.view.RemotableViewMethod;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.RemoteViews;
import com.android.internal.R;
@@ -43,8 +44,6 @@ public class MessagingLinearLayout extends ViewGroup {
private int mMaxDisplayedLines = Integer.MAX_VALUE;
private IMessagingLayout mMessagingLayout;
public MessagingLinearLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@@ -292,12 +291,19 @@ public class MessagingLinearLayout extends ViewGroup {
mMaxDisplayedLines = numberLines;
}
public void setMessagingLayout(IMessagingLayout layout) {
mMessagingLayout = layout;
}
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