diff --git a/common/src/main/java/com/yunbao/common/event/CoinChangeEvent.java b/common/src/main/java/com/yunbao/common/event/CoinChangeEvent.java index 9deb4296f..972546e24 100644 --- a/common/src/main/java/com/yunbao/common/event/CoinChangeEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CoinChangeEvent.java @@ -10,6 +10,20 @@ public class CoinChangeEvent { private String coin; private String goldCoinNum; private boolean chargeSuccess; + //重置头像 + private boolean resetProfilePicture = false; + + public boolean isResetProfilePicture() { + return resetProfilePicture; + } + + public CoinChangeEvent() { + } + + public CoinChangeEvent setResetProfilePicture(boolean resetProfilePicture) { + this.resetProfilePicture = resetProfilePicture; + return this; + } public CoinChangeEvent(String coin) { this.coin = coin; @@ -19,7 +33,8 @@ public class CoinChangeEvent { this.coin = coin; this.chargeSuccess = chargeSuccess; } - public CoinChangeEvent(String coin,String goldCoinNum, boolean chargeSuccess) { + + public CoinChangeEvent(String coin, String goldCoinNum, boolean chargeSuccess) { this.coin = coin; this.goldCoinNum = goldCoinNum; this.chargeSuccess = chargeSuccess; diff --git a/live/src/main/assets/free_gift_tip.svga b/live/src/main/assets/free_gift_tip.svga index aa1b18515..179b7f793 100644 Binary files a/live/src/main/assets/free_gift_tip.svga and b/live/src/main/assets/free_gift_tip.svga differ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 1ad584cfa..7821ec567 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -152,6 +152,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL protected TreeMap mMicQueueList = new TreeMap<>(); protected List mAudienceList = new ArrayList<>(); protected LiveMicAnchorDialogFragment.OnMicListener micListener = null; + @Override protected void main() { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); @@ -160,18 +161,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL mPageContainer = findViewById(R.id.page_container); EventBus.getDefault().register(this); mDialogFragmentSet = new HashSet<>(); - //解压 美颜模型 - /*try { - CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径 - File model = new File(CommonAppConfig.VIDEO_TIE_MODEl_PATH); - if (model.exists() && Objects.requireNonNull(model.listFiles()).length > 0) { - return; - } - UnzipFromAssets.unZip(LiveActivity.this, "model-all.zip", CommonAppConfig.VIDEO_TIE_MODEl_PATH, false); - } catch (Exception e) { - e.printStackTrace(); - Log.i("log", "beauty e=" + e); - }*/ } @Override @@ -222,17 +211,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL if (!mFirstConnectSocket) { mFirstConnectSocket = true; if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { -// if (isRy == false) { -// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); -// } else { SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); -// } } -// if (isRy == false) { -// SocketChatUtil.getFakeFans(mLiveUid); -// } else { SocketRyChatUtil.getFakeFans(mLiveUid); -// } } } } @@ -633,23 +614,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL */ @Override public void onLinkMicAnchorClose() { -// if (isRy == false) { -// if (mLiveLinkMicAnchorPresenter != null) { -// mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose(); -// } -// if (mLiveLinkMicPkPresenter != null) { -// mLiveLinkMicPkPresenter.onLinkMicPkClose(1); -// } -// } else { + if (mLiveLinkMicAnchorPresenter != null) { mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose(); } if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1); } -// } - - if (this instanceof LiveAudienceActivity) { ((LiveAudienceActivity) this).onLinkMicTxAnchor(false); } @@ -703,25 +674,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL /** * 主播与主播PK 所有人收到PK开始的回调 */ + private String mPkUid, mPkhead, mPkname, mIsLadders; + private Handler linkMicPkStartHandler = new Handler(); + + private Runnable linkMicPkStartRunnable = new Runnable() { + + @Override + public void run() { + if (mLiveRoomViewHolder != null) { + Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid()); + if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { + mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname); + mLiveRoomViewHolder.initPkRank(mIsLadders); + } + } + } + }; + @Override public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) { Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders); + mPkUid = pkUid; + mPkhead = pkhead; + mPkname = pkname; + mIsLadders = isLadders; if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); - Handler handler = new Handler(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - if (mLiveRoomViewHolder != null) { - Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid()); - if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { - mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); - mLiveRoomViewHolder.initPkRank(isLadders); - } - } - } - }, 4000);//3秒后执行Runnable中的run方法 - + linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法 } } @@ -844,13 +823,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 打开聊天输入框 */ public void openChatWindow() { -// if (mKeyBoardHeightUtil == null) { -// mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this); -// mKeyBoardHeightUtil.start(); -// } -// if (mLiveRoomViewHolder != null) { -// mLiveRoomViewHolder.chatScrollToBottom(); -// } LiveInputDialogFragment fragment = new LiveInputDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice); @@ -1175,10 +1147,19 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL */ @Subscribe(threadMode = ThreadMode.MAIN) public void onCoinChangeEvent(CoinChangeEvent e) { - onCoinChanged(e.getCoin()); - if (e.isChargeSuccess() && this instanceof LiveAudienceActivity) { - ((LiveAudienceActivity) this).onChargeSuccess(); + if (e.isResetProfilePicture()) { + mPkUid = null; + mPkhead = null; + mPkname = null; + mIsLadders = null; + linkMicPkStartHandler.removeCallbacks(linkMicPkStartRunnable); + } else { + onCoinChanged(e.getCoin()); + if (e.isChargeSuccess() && this instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) this).onChargeSuccess(); + } } + } public void onCoinChanged(String coin) { @@ -1576,7 +1557,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL /** * 获取连麦列表 */ - public void showMicList(String uid,LiveRoomViewHolder mLiveRoomViewHolder) { + public void showMicList(String uid, LiveRoomViewHolder mLiveRoomViewHolder) { LiveNetManager.get(mContext) .getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback>() { @Override @@ -1592,6 +1573,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } }); } + @Override protected void onDestroy() { release(); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 9695bbaa2..276b1a5a4 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -79,6 +79,7 @@ import com.yunbao.common.bean.RewardAllModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; +import com.yunbao.common.event.CoinChangeEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -1102,6 +1103,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 重置该隐藏的view */ public void resetViewGone() { + EventBus.getDefault().post(new CoinChangeEvent().setResetProfilePicture(true)); goto_room_view.setVisibility(View.GONE); mPkRankTopIcon.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE);