修复PK倒计时偶尔会提前结束问题(设置倒计时默认值为100解决)

修复PK【开始/结束】不会【隐藏/显示】女神说和联系方式浮窗
This commit is contained in:
zlzw 2023-04-01 18:29:12 +08:00
parent 95c39cca9d
commit 326bb5ae7f
8 changed files with 101 additions and 31 deletions

View File

@ -4,43 +4,66 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <View
android:id="@+id/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="1dp"
android:orientation="horizontal" android:background="?android:attr/listDivider"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="14dp"
android:paddingBottom="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/divider">
<TextView <TextView
android:id="@+id/item1" android:id="@+id/item1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center"
android:text="TextView" /> android:text="TextView" />
<TextView <TextView
android:id="@+id/item2" android:id="@+id/item2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center"
android:text="TextView" /> android:text="TextView" />
<TextView <TextView
android:id="@+id/item3" android:id="@+id/item3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center"
android:text="TextView" /> android:text="TextView" />
<TextView <TextView
android:id="@+id/item4" android:id="@+id/item4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center"
android:text="TextView" /> android:text="TextView" />
</LinearLayout> </LinearLayout>
<View
android:id="@+id/divider2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,7 @@
package com.yunbao.common.bean; package com.yunbao.common.bean;
import androidx.annotation.NonNull;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -187,6 +189,7 @@ public class BannerBean {
this.mIconRes = mIconRes; this.mIconRes = mIconRes;
} }
@NonNull
@Override @Override
public String toString() { public String toString() {
return "BannerBean{" + return "BannerBean{" +
@ -197,6 +200,12 @@ public class BannerBean {
", mIntoUrl='" + mIntoUrl + '\'' + ", mIntoUrl='" + mIntoUrl + '\'' +
", type=" + type + ", type=" + type +
", name='" + name + '\'' + ", name='" + name + '\'' +
", activityId=" + activityId +
", mIconRes=" + mIconRes +
", wishlistIcon='" + wishlistIcon + '\'' +
", wishlistNum='" + wishlistNum + '\'' +
", wishlistProgress='" + wishlistProgress + '\'' +
", wishlistName='" + wishlistName + '\'' +
", model=" + model + ", model=" + model +
'}'; '}';
} }

View File

@ -301,7 +301,9 @@ public class LiveAudienceEvent extends BaseModel {
LUCKY_100_CHECK(55, "幸运百分百"), LUCKY_100_CHECK(55, "幸运百分百"),
LIVE_END(56, "主播下播"), LIVE_END(56, "主播下播"),
LIVE_HIDE_MSG_RED(57,"隐藏红点"), LIVE_HIDE_MSG_RED(57,"隐藏红点"),
LIVE_SHARE(58,"直播間分享"); LIVE_SHARE(58,"直播間分享"),
LIVE_PK_ING(59,"PK中"),
LIVE_PK_END(60,"PK结束");
private int type; private int type;
private String name; private String name;

View File

@ -1008,6 +1008,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
} }
mLiveLinkMicPkViewHolder.startAnim(); mLiveLinkMicPkViewHolder.startAnim();
mLiveLinkMicPkViewHolder.showTime(); mLiveLinkMicPkViewHolder.showTime();
mPkTimeCount = 100;
nextPkTimeCountDown(); nextPkTimeCountDown();
if (mIsAnchor) { if (mIsAnchor) {
((LiveAnchorActivity) mContext).setPkBtnVisible(false); ((LiveAnchorActivity) mContext).setPkBtnVisible(false);

View File

@ -1689,7 +1689,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show( R.string.net_error); ToastUtil.show(R.string.net_error);
} }
}); });
@ -2247,6 +2247,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
mLiveLinkMicPkViewHolder.startAnim(); mLiveLinkMicPkViewHolder.startAnim();
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid)); EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid));
mLiveLinkMicPkViewHolder.showTime(); mLiveLinkMicPkViewHolder.showTime();
mPkTimeCount = 100;
nextPkTimeCountDown(2); nextPkTimeCountDown(2);
if (mIsAnchor) { if (mIsAnchor) {
((LiveRyAnchorActivity) mContext).setPkBtnVisible(false); ((LiveRyAnchorActivity) mContext).setPkBtnVisible(false);

View File

@ -9,6 +9,8 @@ import android.graphics.Path;
import android.graphics.PathMeasure; import android.graphics.PathMeasure;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.AnimationDrawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -20,6 +22,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
@ -143,6 +146,27 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
img_pk_show_r = (ImageView) findViewById(R.id.img_pk_show_r); img_pk_show_r = (ImageView) findViewById(R.id.img_pk_show_r);
img_pk_show_l.setVisibility(View.GONE); img_pk_show_l.setVisibility(View.GONE);
img_pk_show_r.setVisibility(View.GONE); img_pk_show_r.setVisibility(View.GONE);
mTime.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
Log.i("女神说", "倒计时状态:"+s);
if (mTime.getVisibility() == View.VISIBLE) {
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_PK_ING));
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
} }
public void startAnim() { public void startAnim() {
@ -190,10 +214,10 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
public void setTime(String content) { public void setTime(String content) {
if (mTime != null) { if (mTime != null) {
Log.i("vvvs",content); Log.i("vvvs", content);
if(content.trim().equals("00:00")){ if (content.trim().equals("00:00")) {
mTime.setText("結算中"); mTime.setText("結算中");
}else { } else {
mTime.setText(content); mTime.setText(content);
} }
} }

View File

@ -1316,6 +1316,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mBannerList2.clear(); mBannerList2.clear();
mBannerList3.clear(); mBannerList3.clear();
mBannerList4.clear(); mBannerList4.clear();
mTopBannerList.clear();
sayModel = null;
updataCleanMic(); updataCleanMic();
// initStarChallengeStatus(); // initStarChallengeStatus();
enterRoomLeave.setVisibility(View.GONE); enterRoomLeave.setVisibility(View.GONE);
@ -4040,6 +4042,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
case PK_TWO_END: case PK_TWO_END:
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closePkTwo(); closePkTwo();
showAnchorSayAndCallAnchor();
break; break;
case CUSTOM_FULL_SERVICE_NOTIFY: case CUSTOM_FULL_SERVICE_NOTIFY:
customFullServiceNotify(event.getCustomFullServiceNotifyEvent()); customFullServiceNotify(event.getCustomFullServiceNotifyEvent());
@ -4054,6 +4057,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
case CHANGE_VIEW: case CHANGE_VIEW:
changeView(); changeView();
break; break;
case LIVE_PK_ING:
hideAnchorSayAndCallAnchor();
break;
case LIVE_PK_END:
showAnchorSayAndCallAnchor();
break;
} }
} }
@ -4457,21 +4466,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
public void hideAnchorSayAndCallAnchor() { public void hideAnchorSayAndCallAnchor() {
mAnchorSay.setX((float) mAnchorSayImage.getTag()); mAnchorSay.setVisibility(View.GONE);
mAnchorSayImage.setTag(null);
mAnchorSayImage.setVisibility(View.VISIBLE);
mAnchorSayText.setVisibility(View.VISIBLE);
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show);
topBanner1.setVisibility(View.GONE); topBanner1.setVisibility(View.GONE);
} }
public void showAnchorSayAndCallAnchor() { public void showAnchorSayAndCallAnchor() {
mAnchorSayImage.setTag(mAnchorSay.getX()); if (mAnchorSay.getVisibility() == View.GONE &&
mAnchorSay.setX(-DpUtil.dp2px(45)); sayModel != null && sayModel.getLivePreview() != null &&
mAnchorSayImage.setVisibility(View.INVISIBLE); sayModel.getLivePreview().getIsShow() == 1
mAnchorSayText.setVisibility(View.INVISIBLE); ) {
mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide); Log.i("女神说", "sayModel: " + sayModel);
topBanner1.setVisibility(View.VISIBLE); mAnchorSay.setVisibility(View.VISIBLE);
}
if (topBanner1.getVisibility() == View.GONE && mTopBannerList != null && !mTopBannerList.isEmpty()) {
Log.i("女神说", "mTopBannerList: " + mTopBannerList.size());
for (BannerBean bean : mTopBannerList) {
Log.i("女神说", "BannerBean: " + bean);
}
topBanner1.setVisibility(View.VISIBLE);
}
} }
public void updateTopBanner(WishModel wishListProgress) { public void updateTopBanner(WishModel wishListProgress) {

View File

@ -1032,7 +1032,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
mLiveRoomViewHolder.hideHighGrade(); if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hideHighGrade();
}
enterRoomLeaveHandler.post(enterRoomLeaveRunnable); enterRoomLeaveHandler.post(enterRoomLeaveRunnable);
} }
}, 3000); }, 3000);
@ -1376,11 +1378,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void setPkStatus(boolean isPk) { public void setPkStatus(boolean isPk) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.hotAddVisibility(isPk); mLiveRoomViewHolder.hotAddVisibility(isPk);
if (isPk) {
mLiveRoomViewHolder.hideAnchorSayAndCallAnchor();
} else {
mLiveRoomViewHolder.showAnchorSayAndCallAnchor();
}
} }
} }