修复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_height="match_parent">
<LinearLayout
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:gravity="center"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="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
android:id="@+id/item1"
android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView" />
<TextView
android:id="@+id/item2"
android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView" />
<TextView
android:id="@+id/item3"
android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView" />
<TextView
android:id="@+id/item4"
android:layout_width="wrap_content"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView" />
</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>

View File

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

View File

@ -301,7 +301,9 @@ public class LiveAudienceEvent extends BaseModel {
LUCKY_100_CHECK(55, "幸运百分百"),
LIVE_END(56, "主播下播"),
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 String name;

View File

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

View File

@ -1689,7 +1689,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override
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();
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_START).setObject(pkUid));
mLiveLinkMicPkViewHolder.showTime();
mPkTimeCount = 100;
nextPkTimeCountDown(2);
if (mIsAnchor) {
((LiveRyAnchorActivity) mContext).setPkBtnVisible(false);

View File

@ -9,6 +9,8 @@ import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import android.graphics.drawable.AnimationDrawable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@ -20,6 +22,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil;
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_l.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() {
@ -190,10 +214,10 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
public void setTime(String content) {
if (mTime != null) {
Log.i("vvvs",content);
if(content.trim().equals("00:00")){
Log.i("vvvs", content);
if (content.trim().equals("00:00")) {
mTime.setText("結算中");
}else {
} else {
mTime.setText(content);
}
}

View File

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

View File

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