Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hupei committed May 19, 2020
1 parent 56ebf3c commit 93d45b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.LinearLayout;

import androidx.cardview.widget.CardView;

import com.mylhyl.circledialog.internal.BuildView;
import com.mylhyl.circledialog.internal.CircleParams;
import com.mylhyl.circledialog.internal.Controller;
import com.mylhyl.circledialog.params.CloseParams;
import com.mylhyl.circledialog.view.listener.ButtonView;
import com.mylhyl.circledialog.view.listener.CloseView;

import androidx.cardview.widget.CardView;

/**
* view的层次结构
* <pre>
Expand Down Expand Up @@ -48,6 +49,10 @@ protected final View layoutInflaterFrom(int resource) {
}

protected final void addViewByBody(View child) {
ViewParent parent = child.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(child);
}
mRootCardViewByLinearLayout.addView(child);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ public void buildBodyView() {
buildRootView();
buildTitleView();

if (mCustomBodyView == null) {
if (mParams.bodyViewId != 0) {
mCustomBodyView = layoutInflaterFrom(mParams.bodyViewId);
} else {
mCustomBodyView = mParams.bodyView;
}
if (mCustomBodyView != null) {
addViewByBody(mCustomBodyView);
}
if (mCustomBodyView != null) {
return;
}
if (mParams.bodyViewId != 0) {
mCustomBodyView = layoutInflaterFrom(mParams.bodyViewId);
} else {
mCustomBodyView = mParams.bodyView;
}
if (mCustomBodyView != null) {
addViewByBody(mCustomBodyView);
}
}

Expand Down

0 comments on commit 93d45b7

Please sign in to comment.