update
This commit is contained in:
parent
b35d5d242e
commit
0c7ae4e4f7
@ -27,6 +27,8 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -128,6 +130,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
private boolean isPk;
|
private boolean isPk;
|
||||||
|
|
||||||
private FragmentTransaction transaction=null;
|
private FragmentTransaction transaction=null;
|
||||||
|
private FragmentManager fragmentManager;
|
||||||
|
private Fragment contentFragment;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -239,11 +243,10 @@ 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);
|
||||||
if(transaction==null){
|
transaction=getTransaction();
|
||||||
transaction=getTransaction();
|
contentFragment=LiveParcelFragment.newInstance(mStream, mLiveUid);
|
||||||
}
|
transaction.replace(R.id.context_layout_gift, contentFragment);
|
||||||
transaction.replace(R.id.context_layout_gift, LiveParcelFragment.newInstance(mStream, mLiveUid));
|
transaction.commitAllowingStateLoss();
|
||||||
transaction.commit();
|
|
||||||
isWrap = true;
|
isWrap = true;
|
||||||
findViewById(R.id.red_point).setVisibility(View.GONE);
|
findViewById(R.id.red_point).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -477,12 +480,11 @@ 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)) {
|
||||||
if(transaction==null){
|
transaction=getTransaction();
|
||||||
transaction=getTransaction();
|
contentFragment=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.replace(R.id.context_layout_gift, contentFragment);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
giftTitleAdapter.setTitleIndex(i);
|
giftTitleAdapter.setTitleIndex(i);
|
||||||
break;
|
break;
|
||||||
@ -493,12 +495,11 @@ 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");
|
||||||
if(transaction==null){
|
transaction=getTransaction();
|
||||||
transaction=getTransaction();
|
contentFragment= 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.replace(R.id.context_layout_gift,contentFragment);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,17 +881,17 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
*/
|
*/
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onGiftTitleEvent(GiftTitleEvent event) {
|
public void onGiftTitleEvent(GiftTitleEvent event) {
|
||||||
|
|
||||||
liveWrap.setAlpha(0.5f);
|
liveWrap.setAlpha(0.5f);
|
||||||
liveWrap.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
|
liveWrap.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
|
||||||
liveGiftSend.setEnabled(false);
|
liveGiftSend.setEnabled(false);
|
||||||
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){
|
transaction=getTransaction();
|
||||||
transaction=getTransaction();
|
contentFragment=LiveGiftFragment.newInstance(giftJson, event.getGiftTitle(), mStream, mLiveUid, mWishGiftId);
|
||||||
}
|
transaction.replace(R.id.context_layout_gift, contentFragment);
|
||||||
transaction.replace(R.id.context_layout_gift, LiveGiftFragment.newInstance(giftJson, event.getGiftTitle(), mStream, mLiveUid, mWishGiftId));
|
transaction.commitAllowingStateLoss();
|
||||||
transaction.commit();
|
|
||||||
isWrap = false;
|
isWrap = false;
|
||||||
if (giftSendLayout.getVisibility() == View.INVISIBLE) {
|
if (giftSendLayout.getVisibility() == View.INVISIBLE) {
|
||||||
hideLianBtn();
|
hideLianBtn();
|
||||||
@ -1446,9 +1447,14 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private FragmentTransaction getTransaction(){
|
private FragmentTransaction getTransaction(){
|
||||||
if(transaction==null){
|
if(contentFragment!=null && transaction!=null){
|
||||||
transaction=getChildFragmentManager().beginTransaction();
|
transaction.remove(contentFragment);
|
||||||
|
contentFragment=null;
|
||||||
}
|
}
|
||||||
|
if(fragmentManager==null){
|
||||||
|
fragmentManager=getChildFragmentManager();
|
||||||
|
}
|
||||||
|
transaction=fragmentManager.beginTransaction();
|
||||||
return transaction;
|
return transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user