修复礼物弹框闪退问题
This commit is contained in:
parent
9dba41c22f
commit
b8264997f4
@ -127,10 +127,15 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
private MarqueeTextView giftDescription, namingName;
|
private MarqueeTextView giftDescription, namingName;
|
||||||
private boolean isPk;
|
private boolean isPk;
|
||||||
|
|
||||||
|
private FragmentTransaction transaction=null;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
if(transaction==null){
|
||||||
|
transaction=getChildFragmentManager().beginTransaction();
|
||||||
|
}
|
||||||
Bus.getOn(this);
|
Bus.getOn(this);
|
||||||
initView();
|
initView();
|
||||||
initDate();
|
initDate();
|
||||||
@ -234,7 +239,9 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
giftTitleAdapter.uncheck();
|
giftTitleAdapter.uncheck();
|
||||||
liveWrap.setAlpha(1.0f);
|
liveWrap.setAlpha(1.0f);
|
||||||
liveWrap.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
|
liveWrap.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
if(transaction==null){
|
||||||
|
transaction=getTransaction();
|
||||||
|
}
|
||||||
transaction.replace(R.id.context_layout_gift, LiveParcelFragment.newInstance(mStream, mLiveUid));
|
transaction.replace(R.id.context_layout_gift, LiveParcelFragment.newInstance(mStream, mLiveUid));
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
isWrap = true;
|
isWrap = true;
|
||||||
@ -470,11 +477,13 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
List<LiveGiftBean> liveGiftBeans = JSONArray.parseArray(giftJson, LiveGiftBean.class);
|
List<LiveGiftBean> liveGiftBeans = JSONArray.parseArray(giftJson, LiveGiftBean.class);
|
||||||
for (LiveGiftBean model : liveGiftBeans) {
|
for (LiveGiftBean model : liveGiftBeans) {
|
||||||
if (TextUtils.equals(model.getId() + "", mWishGiftId)) {
|
if (TextUtils.equals(model.getId() + "", mWishGiftId)) {
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
if(transaction==null){
|
||||||
|
transaction=getTransaction();
|
||||||
|
}
|
||||||
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson,
|
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson,
|
||||||
liveGiftList.getJSONObject(i).getString("name"),
|
liveGiftList.getJSONObject(i).getString("name"),
|
||||||
mStream, mLiveUid, mWishGiftId));
|
mStream, mLiveUid, mWishGiftId));
|
||||||
transaction.commit();
|
transaction.commitAllowingStateLoss();
|
||||||
giftTitleAdapter.setTitleIndex(i);
|
giftTitleAdapter.setTitleIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -484,11 +493,13 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
|
|
||||||
JSONObject obj2 = liveGiftList.getJSONObject(0);
|
JSONObject obj2 = liveGiftList.getJSONObject(0);
|
||||||
String giftJson = obj2.getString("giftlist");
|
String giftJson = obj2.getString("giftlist");
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
if(transaction==null){
|
||||||
|
transaction=getTransaction();
|
||||||
|
}
|
||||||
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson,
|
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson,
|
||||||
liveGiftList.getJSONObject(0).getString("name"),
|
liveGiftList.getJSONObject(0).getString("name"),
|
||||||
mStream, mLiveUid, mWishGiftId));
|
mStream, mLiveUid, mWishGiftId));
|
||||||
transaction.commit();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -875,8 +886,9 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
giftNumberLayout.setVisibility(View.INVISIBLE);
|
giftNumberLayout.setVisibility(View.INVISIBLE);
|
||||||
JSONObject obj2 = liveGiftList.getJSONObject(event.getmPosition());
|
JSONObject obj2 = liveGiftList.getJSONObject(event.getmPosition());
|
||||||
String giftJson = obj2.getString("giftlist");
|
String giftJson = obj2.getString("giftlist");
|
||||||
|
if(transaction==null){
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
transaction=getTransaction();
|
||||||
|
}
|
||||||
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson, event.getGiftTitle(), mStream, mLiveUid, mWishGiftId));
|
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson, event.getGiftTitle(), mStream, mLiveUid, mWishGiftId));
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
isWrap = false;
|
isWrap = false;
|
||||||
@ -1433,6 +1445,12 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private FragmentTransaction getTransaction(){
|
||||||
|
if(transaction==null){
|
||||||
|
transaction=getChildFragmentManager().beginTransaction();
|
||||||
|
}
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateOverlayVisibility() {
|
private void updateOverlayVisibility() {
|
||||||
/* if (
|
/* if (
|
||||||
|
Loading…
Reference in New Issue
Block a user