代码优化

This commit is contained in:
Martin 2024-09-04 14:44:46 +08:00
parent bee903d22a
commit 983bb2837a
5 changed files with 55 additions and 37 deletions

View File

@ -834,7 +834,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000); mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000);
mLiveRoomViewHolder.setVotes(obj.getString("votestotal")); mLiveRoomViewHolder.setVotes(obj.getString("votestotal"));
mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum")); mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum"));
mLiveRoomViewHolder.setShowTask(obj.getString("new_task_url"),obj.getIntValue("is_new_live")==1); //mLiveRoomViewHolder.setShowTask(obj.getString("new_task_url"),obj.getIntValue("is_new_live")==1);
mLiveRoomViewHolder.startFace(); mLiveRoomViewHolder.startFace();
UserBean u = CommonAppConfig.getInstance().getUserBean(); UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u != null) { if (u != null) {

View File

@ -800,11 +800,15 @@ public class SocketSwClient {
.setObject(WordUtil.isNewZh() ? item.getString("text") : item.getString("text_en"))); .setObject(WordUtil.isNewZh() ? item.getString("text") : item.getString("text_en")));
case Constants.SOCKET_SEND_NEW_TASK_PUSH: case Constants.SOCKET_SEND_NEW_TASK_PUSH:
item = map.getJSONObject("ct"); item = map.getJSONObject("ct");
if(CommonAppConfig.getInstance().getUid().equals(item.getString("uid"))){
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_NEW_TASK_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href"))); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_NEW_TASK_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href")));
}
break; break;
case Constants.SOCKET_SEND_NEW_TASK_IM: case Constants.SOCKET_SEND_NEW_TASK_IM:
item = map.getJSONObject("ct"); item = map.getJSONObject("ct");
if(CommonAppConfig.getInstance().getUid().equals(item.getString("uid"))){
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_GIFT_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href"))); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.LIVE_AUTHOR_GIFT_PUSH).setUid(item.getString("uid")).setHrefUrl(item.getString("href")));
}
break; break;
} }
} }

View File

@ -377,6 +377,9 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
} }
if(anchor_level!=null){ if(anchor_level!=null){
long levelExp = Long.parseLong(next_level_exp); long levelExp = Long.parseLong(next_level_exp);
if(Integer.parseInt(level_up)==0){
levelExp = 0;
}
String tips = mContext.getResources().getString(R.string.live_user_level_anchor) String tips = mContext.getResources().getString(R.string.live_user_level_anchor)
+"Lv."+level+" | "+(WordUtil.isNewZh()?""+levelExp+" 經驗升級":levelExp+" experience points to level up"); +"Lv."+level+" | "+(WordUtil.isNewZh()?""+levelExp+" 經驗升級":levelExp+" experience points to level up");
anchor_level.setText(tips); anchor_level.setText(tips);
@ -411,10 +414,15 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
@Override @Override
public void run() { public void run() {
if(level_up!=null&&votestotal!=null){ if(level_up!=null&&votestotal!=null){
if(Integer.parseInt(level_up)==0){
level_progress.setMax(1);
level_progress.setProgress(1);
}else{
level_progress.setMax(Integer.parseInt(level_up)); level_progress.setMax(Integer.parseInt(level_up));
level_progress.setProgress(Integer.parseInt(votestotal)); level_progress.setProgress(Integer.parseInt(votestotal));
} }
} }
}
}); });
} }
} }

View File

@ -1218,7 +1218,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void showH5Dialog() { public void showH5Dialog() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid="+CommonAppConfig.getInstance().getUid()+"&token="+CommonAppConfig.getInstance().getToken()); bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken());
LiveHDDialogFragment fragment = new LiveHDDialogFragment(); LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
@ -3125,7 +3125,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});*/ });*/
} }
public void showLiveRoomActivityBanner() { public void showLiveRoomActivityBanner(boolean isNewPersonAn) {
LiveNetManager.get(mContext).getLiveRoomActivityBanner(new com.yunbao.common.http.base.HttpCallback<List<LiveRoomActivityBanner>>() { LiveNetManager.get(mContext).getLiveRoomActivityBanner(new com.yunbao.common.http.base.HttpCallback<List<LiveRoomActivityBanner>>() {
@Override @Override
public void onSuccess(List<LiveRoomActivityBanner> data) { public void onSuccess(List<LiveRoomActivityBanner> data) {
@ -3142,6 +3142,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bean.setShow_type(datum.getType()); bean.setShow_type(datum.getType());
mBannerList4.add(bean); mBannerList4.add(bean);
} }
if (isNewPersonAn) {
BannerBean bean = new BannerBean();
bean.setActivityId(511);
mBannerList4.add(bean);
}
showBanner4(); showBanner4();
} }
@ -5017,7 +5022,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/ */
public void firstLook5MinLiveNotify() { public void firstLook5MinLiveNotify() {
if (mLiveRoomHandler != null) { if (mLiveRoomHandler != null) {
mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_LOOK_5_MIN_LIVE, getNextTime(1000 *60* 5)); mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_LOOK_5_MIN_LIVE, getNextTime(1000 * 60 * 5));
} }
} }
@ -5046,6 +5051,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/ */
public void setNewPersonTask() { public void setNewPersonTask() {
newPersonTask.setVisibility(View.VISIBLE); newPersonTask.setVisibility(View.VISIBLE);
} }
private long getNextTime(int time) { private long getNextTime(int time) {
@ -5530,6 +5536,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void onBannerClick(List datas, int p) { public void onBannerClick(List datas, int p) {
if (mBannerList4.get(p).getActivityId() == 511) {
showH5Dialog();
} else {
if (mBannerList4.get(p).getLink().equals("BattlePass") || mBannerList4.get(p).getType() == 888) { if (mBannerList4.get(p).getLink().equals("BattlePass") || mBannerList4.get(p).getType() == 888) {
RouteUtil.forwardBattlePass(); RouteUtil.forwardBattlePass();
return; return;
@ -5556,6 +5565,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
} }
} }
}
private void openWebDialog(String url) { private void openWebDialog(String url) {

View File

@ -2328,19 +2328,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void setNewTaskPush(String uid,String url) { public void setNewTaskPush(String uid,String url) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
if(CommonAppConfig.getInstance().getUid().equals(uid)){
mLiveRoomViewHolder.showTaskDetailsNotify1(url); mLiveRoomViewHolder.showTaskDetailsNotify1(url);
} }
} }
}
public void setNewTaskIM(String uid) { public void setNewTaskIM(String uid) {
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
if(CommonAppConfig.getInstance().getUid().equals(uid)){
mLiveRoomViewHolder.showSendGiftTaskIMMsg(); mLiveRoomViewHolder.showSendGiftTaskIMMsg();
} }
} }
}
/** /**
* 全服喇叭 * 全服喇叭