Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-10-12 16:38:01 +08:00
commit fa4042bf42
8 changed files with 96 additions and 53 deletions

View File

@ -909,4 +909,9 @@ Limited ride And limited avatar frame</string>
<string name="online_audience">在線觀眾</string> <string name="online_audience">在線觀眾</string>
<string name="audience">觀眾</string> <string name="audience">觀眾</string>
<string name="cannot_yourself">無法@自己</string> <string name="cannot_yourself">無法@自己</string>
<string name="total_star_value">總星值</string>
<string name="number_of_people_assisted">助力人數</string>
<string name="star_change">%s星挑战</string>
<string name="star_success">恭喜 %s完成了%s %s星 挑戰,快去一睹主播芳容吧!</string>
<string name="star"></string>
</resources> </resources>

View File

@ -31,6 +31,7 @@ import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.KeyBoardHeightChangeListener; import com.yunbao.common.interfaces.KeyBoardHeightChangeListener;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.KeyBoardHeightUtil2; import com.yunbao.common.utils.KeyBoardHeightUtil2;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.ProcessImageUtil;
@ -67,6 +68,7 @@ import com.yunbao.live.dialog.LiveRedPackSendDialogFragment;
import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
@ -154,14 +156,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCoinName = CommonAppConfig.getInstance().getCoinName(); mCoinName = CommonAppConfig.getInstance().getCoinName();
mIsAnchor = this instanceof LiveAnchorActivity; mIsAnchor = this instanceof LiveAnchorActivity;
mPageContainer = findViewById(R.id.page_container); mPageContainer = findViewById(R.id.page_container);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
mDialogFragmentSet = new HashSet<>(); mDialogFragmentSet = new HashSet<>();
//解压 美颜模型 //解压 美颜模型
try { try {
CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径 CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径
File model = new File(CommonAppConfig.VIDEO_TIE_MODEl_PATH); File model = new File(CommonAppConfig.VIDEO_TIE_MODEl_PATH);
if(model.exists()&& Objects.requireNonNull(model.listFiles()).length>0){ if (model.exists() && Objects.requireNonNull(model.listFiles()).length > 0) {
return; return;
} }
UnzipFromAssets.unZip(LiveActivity.this, "model-all.zip", CommonAppConfig.VIDEO_TIE_MODEl_PATH, false); UnzipFromAssets.unZip(LiveActivity.this, "model-all.zip", CommonAppConfig.VIDEO_TIE_MODEl_PATH, false);
@ -181,7 +183,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
public ProcessImageUtil getProcessImageUtil() { public ProcessImageUtil getProcessImageUtil() {
if(mImageUtil==null){ if (mImageUtil == null) {
mImageUtil = new ProcessImageUtil(this); mImageUtil = new ProcessImageUtil(this);
} }
return mImageUtil; return mImageUtil;
@ -948,7 +950,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
} }
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType,atUserID,atUserName); SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType, atUserID, atUserName);
} }
/** /**

View File

@ -856,6 +856,9 @@ public class LiveAudienceActivity extends LiveActivity {
case STAR_CHALLENGE_UPGRADE_NOTIFY: case STAR_CHALLENGE_UPGRADE_NOTIFY:
manager.starChallengeUpgradeNotify(event.getMsgModel()); manager.starChallengeUpgradeNotify(event.getMsgModel());
break; break;
case MESSAGE_BOTTOM:
manager.messageBottom();
break;
} }

View File

@ -339,8 +339,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
LiveTextRender.aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel()); LiveTextRender.aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel());
} else if (bean.getType() == STAR_CHALLENGE_UPGRADE_NOTIFY) { } else if (bean.getType() == STAR_CHALLENGE_UPGRADE_NOTIFY) {
//加载.9图聊天气泡 //加载.9图聊天气泡
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1); if (!TextUtils.isEmpty(bean.getMsgModel().getSystemBubble())){
LiveTextRender.starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel()); LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1);
LiveTextRender.starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel());
}
} else { } else {
if (bean.getBubble() != null && !bean.getBubble().equals("")) { if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡 //加载.9图聊天气泡

View File

@ -147,8 +147,8 @@ public class LiveAudienceEvent extends BaseModel {
AT_MESSAGE(24, "@消息"), AT_MESSAGE(24, "@消息"),
START_MESSAGE(25, "星级消息"), START_MESSAGE(25, "星级消息"),
AI_AUTOMATIC_SPEECH(26, "机器人助手"), AI_AUTOMATIC_SPEECH(26, "机器人助手"),
STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功") STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功"),
; MESSAGE_BOTTOM(28, "聊天消息滚动到底部");
private int type; private int type;
private String name; private String name;

View File

@ -1,6 +1,8 @@
package com.yunbao.live.socket; package com.yunbao.live.socket;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.live.event.LiveAudienceEvent;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -65,6 +67,9 @@ public class SocketSendBean {
e.printStackTrace(); e.printStackTrace();
} }
L.e("发送socket-->" + mResult.toString()); L.e("发送socket-->" + mResult.toString());
//发消息
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.MESSAGE_BOTTOM));//自动滚动到底部
return mResult; return mResult;
} }

View File

@ -360,54 +360,74 @@ public class LiveTextRender {
private static void renderTMP(Context context, final TextView textView, final LiveChatBean bean) { private static void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
if (levelBean == null) {
return;
}
ImgLoader.displayDrawable(context, levelBean.getThumb(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
if (textView != null) {
SpannableStringBuilder builder = createPrefix(drawable, bean);
int color = 0;
if (bean.isAnchor()) {
color = 0xffffdd00;
} else {
color = Color.parseColor(levelBean.getColor());
}
switch (bean.getType()) {
case LiveChatBean.GIFT:
builder = renderGift(color, builder, bean);
break;
default:
builder = renderChat(color, builder, bean);
break;
}
textView.setText(builder);
}
}
@Override if (levelBean == null) {
public void onLoadFailed() { if (textView != null) {
if (textView != null) { SpannableStringBuilder builder = createPrefix(null, bean);
SpannableStringBuilder builder = createPrefix(null, bean); int color = 0xffffdd00;
int color = 0;
if (bean.isAnchor()) { switch (bean.getType()) {
color = 0xffffdd00; case LiveChatBean.GIFT:
} else { builder = renderGift(color, builder, bean);
color = Color.parseColor(levelBean.getColor()); break;
} default:
switch (bean.getType()) { builder = renderChat(color, builder, bean);
case LiveChatBean.GIFT: break;
builder = renderGift(color, builder, bean);
break;
default:
builder = renderChat(color, builder, bean);
break;
}
textView.setText(builder);
} }
textView.setText(builder);
} }
}); }else {
ImgLoader.displayDrawable(context, levelBean.getThumb(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
if (textView != null) {
SpannableStringBuilder builder = createPrefix(drawable, bean);
int color = 0;
if (bean.isAnchor()) {
color = 0xffffdd00;
} else {
try {
color = Color.parseColor(levelBean.getColor());
} catch (Exception e) {
color = Color.parseColor("#ffffff");
}
}
switch (bean.getType()) {
case LiveChatBean.GIFT:
builder = renderGift(color, builder, bean);
break;
default:
builder = renderChat(color, builder, bean);
break;
}
textView.setText(builder);
}
}
@Override
public void onLoadFailed() {
if (textView != null) {
SpannableStringBuilder builder = createPrefix(null, bean);
int color = 0;
if (bean.isAnchor()) {
color = 0xffffdd00;
} else {
color = Color.parseColor(levelBean.getColor());
}
switch (bean.getType()) {
case LiveChatBean.GIFT:
builder = renderGift(color, builder, bean);
break;
default:
builder = renderChat(color, builder, bean);
break;
}
textView.setText(builder);
}
}
});
}
} }

View File

@ -1602,4 +1602,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.starChallengeUpgradeNotify(msgModel); mLiveRoomViewHolder.starChallengeUpgradeNotify(msgModel);
} }
} }
public void messageBottom(){
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.chatScrollToBottom();
}
}
} }