完成全服通知功能
This commit is contained in:
parent
28add09f32
commit
b5247df69b
@ -174,6 +174,7 @@ public class Constants {
|
||||
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
|
||||
public static final String SUPER_VISION = "supervision";//超级发言警告
|
||||
public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据
|
||||
public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
/**
|
||||
* 全服通知
|
||||
*/
|
||||
public class CustomFullServiceNotifyEvent extends BaseModel {
|
||||
|
||||
@SerializedName("_method_")
|
||||
private String method;
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("content")//内容
|
||||
private String content;
|
||||
@SerializedName("duration")//展示时长 单位秒
|
||||
private int duration;
|
||||
@SerializedName("img")//图片路径
|
||||
private String img;
|
||||
@SerializedName("msgtype")
|
||||
private String msgtype;
|
||||
@SerializedName("type")//通知类型 1 图片通知 2文字通知
|
||||
private int type;
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setMethod(String method) {
|
||||
this.method = method;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setAction(String action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsgtype() {
|
||||
return msgtype;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setMsgtype(String msgtype) {
|
||||
this.msgtype = msgtype;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public CustomFullServiceNotifyEvent setType(int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1239,6 +1239,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1466,6 +1466,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
mLivePushViewHolder.changeToBig();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
|
||||
import com.yunbao.live.bean.OpenParametersModel;
|
||||
|
||||
public class LiveAudienceEvent extends BaseModel {
|
||||
@ -27,6 +28,16 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
private JSONArray pkScores;
|
||||
private String uid;
|
||||
private int time;
|
||||
private CustomFullServiceNotifyEvent customFullServiceNotifyEvent;
|
||||
|
||||
public CustomFullServiceNotifyEvent getCustomFullServiceNotifyEvent() {
|
||||
return customFullServiceNotifyEvent;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setCustomFullServiceNotifyEvent(CustomFullServiceNotifyEvent customFullServiceNotifyEvent) {
|
||||
this.customFullServiceNotifyEvent = customFullServiceNotifyEvent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JSONArray getPkScores() {
|
||||
return pkScores;
|
||||
@ -230,7 +241,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
LEAVE_DR_ROOM(46, "结束多人PK"),
|
||||
LEAVE_PK_SCORE(47, "PK排名"),
|
||||
PK_TIME_COUNT(48, "多人PK结束"),
|
||||
DISCONNEXT_PK_TIME(50, "单人Pk结束");
|
||||
DISCONNEXT_PK_TIME(50, "单人Pk结束"),
|
||||
CUSTOM_FULL_SERVICE_NOTIFY(51, "全服通知");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -30,9 +30,11 @@ import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.SocketModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -50,7 +52,6 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.live.views.LiveEndViewHolder;
|
||||
import com.yunbao.live.views.LivePlayKsyViewHolder;
|
||||
import com.yunbao.live.views.LivePlayRyViewHolder;
|
||||
@ -559,6 +560,14 @@ public class SocketRyClient {
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_UPDATE)
|
||||
.setObject(pkRankBean));
|
||||
break;
|
||||
case Constants.CUSTOM_FULL_SERVICE_NOTIFY:
|
||||
Log.e("全服通知", map.toString());
|
||||
CustomFullServiceNotifyEvent customFullServiceNotifyEvent = GsonUtils.fromJson(map.toString(), CustomFullServiceNotifyEvent.class);
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.CUSTOM_FULL_SERVICE_NOTIFY)
|
||||
.setCustomFullServiceNotifyEvent(customFullServiceNotifyEvent));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
@ -77,6 +78,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.CustomFullServiceNotifyEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
@ -86,7 +88,6 @@ import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@ -97,7 +98,6 @@ import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.utils.formatBigNum;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
@ -327,6 +327,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private ViewFlipper flipper;
|
||||
private TextView mRandomPkTimer;
|
||||
|
||||
//全服通知
|
||||
private ImageView customFullServiceNotify;
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
@ -1064,6 +1066,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
findViewById(R.id.btn_follow).setVisibility(View.GONE);
|
||||
findViewById(R.id.live_rank_pk).setVisibility(View.GONE);
|
||||
}
|
||||
customFullServiceNotify = (ImageView) findViewById(R.id.custom_full_service_notify);
|
||||
reloadIM();
|
||||
initStarChallengeStatus();
|
||||
}
|
||||
@ -1186,6 +1189,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
showBanner2();
|
||||
}
|
||||
}
|
||||
|
||||
public void setRandomPkTimer(String timer) {
|
||||
if (timer == null) {
|
||||
mRandomPkTimer.setVisibility(View.GONE);
|
||||
@ -1194,6 +1198,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mRandomPkTimer.setVisibility(View.VISIBLE);
|
||||
mRandomPkTimer.setText(timer);
|
||||
}
|
||||
|
||||
private synchronized void showBanner2() {
|
||||
if (mBannerList2 != null && mBanner2 != null) {
|
||||
btn_event2.setVisibility(View.VISIBLE);
|
||||
@ -3783,7 +3788,69 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
case PK_TWO_END:
|
||||
closePkTwo();
|
||||
break;
|
||||
case CUSTOM_FULL_SERVICE_NOTIFY:
|
||||
customFullServiceNotify(event.getCustomFullServiceNotifyEvent());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 全服通知
|
||||
*
|
||||
* @param customFullServiceNotifyEvent
|
||||
*/
|
||||
private void customFullServiceNotify(CustomFullServiceNotifyEvent customFullServiceNotifyEvent) {
|
||||
if (customFullServiceNotifyEvent.getType() == 1) {
|
||||
int duration = customFullServiceNotifyEvent.getDuration();
|
||||
int handlerDuration = 0;
|
||||
if (duration > 2) {
|
||||
inAlphaAnimation.setDuration(1000);
|
||||
outAlphaAnimation.setDuration(1000);
|
||||
handlerDuration = duration - 2;
|
||||
} else {
|
||||
inAlphaAnimation.setDuration(500);
|
||||
outAlphaAnimation.setDuration(500);
|
||||
handlerDuration = duration - 1;
|
||||
}
|
||||
customFullServiceNotify.startAnimation(inAlphaAnimation);
|
||||
customFullServiceNotify.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext,customFullServiceNotifyEvent.getImg(),customFullServiceNotify);
|
||||
customFullHandler.postDelayed(customFullRunnable, handlerDuration * 1000);
|
||||
} else {//文字通知
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//渐出动画
|
||||
private AlphaAnimation inAlphaAnimation = new AlphaAnimation(0, 1);
|
||||
private AlphaAnimation outAlphaAnimation = new AlphaAnimation(1, 0);
|
||||
private Handler customFullHandler = new Handler();
|
||||
private Runnable customFullRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
customFullServiceNotify.startAnimation(outAlphaAnimation);
|
||||
//这个地方为什么要做动画的监听呢,因为隐藏和显示不一样,
|
||||
//必须在动画结束之后再隐藏你的控件,这样才不会显得很突兀
|
||||
outAlphaAnimation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
customFullServiceNotify.setVisibility(View.GONE);
|
||||
customFullHandler.removeCallbacks(customFullRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.MyViewPager;
|
||||
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.event.LiveFloatEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@ -1738,4 +1739,5 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.endDRGif();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -634,8 +634,8 @@
|
||||
android:gravity="center"
|
||||
android:text="@string/random_pk_info_btn_ing"
|
||||
android:textColor="#FFFFFF"
|
||||
android:visibility="gone"
|
||||
android:textSize="10sp" />
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/goto_room_view"
|
||||
@ -2296,9 +2296,16 @@
|
||||
android:id="@+id/dr_pk_end_gif"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_marginTop="160dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="false"
|
||||
android:layout_marginTop="160dp"
|
||||
android:src="@mipmap/drpkend"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/custom_full_service_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="110dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user