礼物和座驾新增VAP动画支持

This commit is contained in:
huangjian
2022-03-15 14:20:54 +08:00
parent d4b595d188
commit fe87442d0d
12 changed files with 221 additions and 272 deletions

View File

@@ -25,11 +25,11 @@ import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.tencent.qgame.animplayer.AnimView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.common.widget.CircleImageView;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftEffectInfo;
@@ -52,6 +52,7 @@ import javax.annotation.Nullable;
public class GiftEffectView extends RelativeLayout implements SVGACallback {
private RelativeLayout container;
private SVGAImageView svgaImageView;
private AnimView vapAnimView;
private View svgaBg;
private ImageView giftLightBg;
private CircleImageView giftImg;
@@ -108,6 +109,7 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
svgaImageView.setClearsAfterStop(true);
svgaImageView.setLoops(1);
svgaBg = findViewById(R.id.svga_imageview_bg);
vapAnimView = findViewById(R.id.vap_anim_view);
}
public void startGiftEffect(GiftEffectInfo giftEffectInfo) {
@@ -171,8 +173,9 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
}
}
effectHandler.sendEmptyMessageDelayed(0, 6000);
if (giftInfo.isHasVggPic() && !StringUtil.isEmpty(giftInfo.getVggUrl())) {
if (giftInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(giftInfo.getViewUrl())) {
drawVAPEffect(giftInfo.getViewUrl());
} else if (giftInfo.isHasVggPic() && !StringUtil.isEmpty(giftInfo.getVggUrl())) {
try {
drawSvgaEffect(giftInfo.getVggUrl());
} catch (MalformedURLException e) {
@@ -207,6 +210,13 @@ public class GiftEffectView extends RelativeLayout implements SVGACallback {
}
private void drawVAPEffect(String url) {
if (!AvRoomDataManager.get().mIsNeedGiftEffect || AvRoomDataManager.get().isSelfGamePlaying()) {
return;
}
ImageLoadUtils.loadVAP(vapAnimView, url);
}
private void deleteAnim() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(container, "translationX", container.getX(), ResolutionUtils.getScreenWidth(getContext())).setDuration(500);
objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());

View File

@@ -1,193 +0,0 @@
package com.yizhuan.erban.avroom.widget;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.RelativeLayout;
import com.netease.nim.uikit.common.util.string.StringUtil;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.gift.widget.CustormAnim;
import com.yizhuan.erban.ui.gift.widget.GiftControl;
import com.yizhuan.erban.ui.gift.widget.GiftFrameLayout;
import com.yizhuan.erban.ui.gift.widget.GiftDataInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
/**
* @author chenran
* @date 2017/7/29
*/
public class GiftView extends RelativeLayout implements SVGACallback {
public static final int TYPE_ROOM = 0;
public static final int TYPE_PERSONAL = 1;
private GiftFrameLayout giftFrameLayout1;
private GiftFrameLayout giftFrameLayout2;
private GiftControl giftControl;
private GiftDataInfo giftDataInfo;
private int type;
private SVGAImageView svgaImageView;
private List<GiftInfo> giftInfos;
private boolean isSvgaAnimate;
private View svgaBg;
public GiftView(Context context) {
super(context);
init();
}
public GiftView(Context context, AttributeSet attr) {
super(context, attr);
init();
}
public GiftView(Context context, AttributeSet attr, int i) {
super(context, attr, i);
init();
}
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.layout_gift_view, this, true);
findView();
}
private void findView() {
giftFrameLayout1 = (GiftFrameLayout) findViewById(R.id.gift_layout_1);
giftFrameLayout2 = (GiftFrameLayout) findViewById(R.id.gift_layout_2);
giftControl = new GiftControl();
giftInfos = new ArrayList<>();
SparseArray<GiftFrameLayout> giftLayoutList = new SparseArray<>();
giftLayoutList.append(0, giftFrameLayout1);
giftLayoutList.append(1, giftFrameLayout2);
giftControl.setGiftLayout(false, giftLayoutList)
.setCustormAnim(new CustormAnim());
svgaImageView = (SVGAImageView) findViewById(R.id.svga_imageview);
svgaImageView.setCallback(this);
svgaImageView.setClearsAfterStop(true);
svgaImageView.setLoops(1);
svgaBg = findViewById(R.id.svga_imageview_bg);
}
public void onReceivePersonalGift(GiftReceiveInfo giftRecieveInfo) {
if (type != TYPE_PERSONAL) {
return;
}
showGift(giftRecieveInfo);
}
public void onReceiveGiftMsg(GiftReceiveInfo giftReceiveInfo) {
if (type != TYPE_ROOM) {
return;
}
showGift(giftReceiveInfo);
}
private void showGift(GiftReceiveInfo giftReceiveInfo) {
GiftInfo giftInfo = com.yizhuan.xchat_android_core.gift.GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId());
if (giftInfo != null) {
giftDataInfo = new GiftDataInfo();
giftDataInfo.setGiftId(giftInfo.getGiftId() + "").setGiftName("送出" + giftInfo.getGiftName()).setGiftCount(1).setGiftPic(giftInfo.getGiftUrl())
.setSendUserId(giftReceiveInfo.getUid() + "").setSendUserName(giftReceiveInfo.getNick()).setSendUserPic(giftReceiveInfo.getAvatar()).setSendGiftTime(System.currentTimeMillis())
.setCurrentStart(false).setGiftGroup(giftReceiveInfo.getGiftNum());
giftControl.loadGift(giftDataInfo);
if (giftInfo.isHasEffect() && !StringUtil.isEmpty(giftInfo.getVggUrl())) {
addGiftEffectToList(giftInfo);
}
}
}
public void setType(int type) {
this.type = type;
}
private void addGiftEffectToList(GiftInfo giftInfo) {
giftInfos.add(giftInfo);
if (!isSvgaAnimate) {
try {
drawSvgaEffect(giftInfo.getVggUrl());
} catch (MalformedURLException e) {
e.printStackTrace();
}
giftInfos.remove(0);
}
}
private void drawNext() {
if (giftInfos != null && giftInfos.size() > 0) {
try {
drawSvgaEffect(giftInfos.get(0).getVggUrl());
} catch (MalformedURLException e) {
e.printStackTrace();
}
giftInfos.remove(0);
}
}
private void drawSvgaEffect(String url) throws MalformedURLException {
isSvgaAnimate = true;
SVGAParser.Companion.shareParser().decodeFromURL(new URL(url), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@Nullable SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svgaImageView.setImageDrawable(drawable);
svgaImageView.startAnimation();
svgaBg.setVisibility(VISIBLE);
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(svgaBg, "alpha", 0.0F, 2.0F).setDuration(800);
objectAnimator1.setInterpolator(new AccelerateDecelerateInterpolator());
objectAnimator1.start();
}
@Override
public void onError() {
isSvgaAnimate = false;
}
},null);
}
public void release() {
}
@Override
public void onPause() {
}
@Override
public void onFinished() {
svgaBg.setVisibility(GONE);
isSvgaAnimate = false;
drawNext();
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int i, double v) {
}
}

View File

@@ -1,5 +1,7 @@
package com.yizhuan.erban.avroom.widget;
import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DURATION;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
@@ -31,12 +33,15 @@ import com.opensource.svgaplayer.SVGADynamicEntity;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.tencent.qgame.animplayer.AnimConfig;
import com.tencent.qgame.animplayer.inter.IAnimListener;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.helper.AnimHelper;
import com.yizhuan.erban.common.svga.SimpleSvgaCallback;
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.SimpleAnimListener;
import com.yizhuan.erban.utils.SpannableBuilder;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
@@ -55,6 +60,7 @@ import com.yizhuan.xchat_android_core.room.bean.DatingAllNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.DatingNotifyInfo;
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.utils.LogUtils;
import com.yizhuan.xchat_android_core.utils.StringExtensionKt;
import com.yizhuan.xchat_android_library.utils.ListUtils;
@@ -73,14 +79,12 @@ import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DURATION;
/**
* 房间特效View(座驾,心动场景,飘屏等)
*/
public class RoomEffectView extends FrameLayout {
private final List<String> mCarEffectList = new ArrayList<>();
private final List<CarInfo> mCarEffectList = new ArrayList<>();
//顶部飘屏总展示时间
private final int SHOW_TIME = 3500;
//顶部飘屏周期
@@ -163,7 +167,11 @@ public class RoomEffectView extends FrameLayout {
break;
case RoomEvent.CAR_MEMBER_IN:
if (roomEvent.mRoomCarMsgAttachment != null) {
playCarSvga(null, roomEvent.mRoomCarMsgAttachment.effect, false);
playCarSvga(null,
new CarInfo(roomEvent.mRoomCarMsgAttachment.effect,
roomEvent.mRoomCarMsgAttachment.viewUrl,
roomEvent.mRoomCarMsgAttachment.otherViewType),
false);
}
break;
case RoomEvent.ROOM_PK_NOTIFY:
@@ -179,18 +187,30 @@ public class RoomEffectView extends FrameLayout {
@Override
public void onFinished() {
isSvgaPlaying = false;
if (ListUtils.isListEmpty(mCarEffectList)) {
binding.roomCarSvga.setVisibility(View.GONE);
return;
}
mCarEffectList.remove(0);
if (!ListUtils.isListEmpty(mCarEffectList)) {
playCarSvagEnterRoom(mCarEffectList.get(0));
}
loopCarAnim();
}
});
binding.vapAnimView.setAnimListener(new SimpleAnimListener(){
@Override
public void onVideoComplete() {
loopCarAnim();
}
});
}
private void loopCarAnim() {
isSvgaPlaying = false;
if (ListUtils.isListEmpty(mCarEffectList)) {
binding.roomCarSvga.setVisibility(View.GONE);
binding.vapAnimView.setVisibility(View.GONE);
return;
}
mCarEffectList.remove(0);
if (!ListUtils.isListEmpty(mCarEffectList)) {
playCarAnim(mCarEffectList.get(0));
}
}
/**
@@ -664,7 +684,7 @@ public class RoomEffectView extends FrameLayout {
}
@SuppressLint("CheckResult")
private void playCarSvga(String account, String effect, boolean isSendMsg) {
private void playCarSvga(String account, @Nullable CarInfo carInfo, boolean isSendMsg) {
if (isSendMsg) {
UserModel.get().getUserInfoFromServer(Long.valueOf(account))
.subscribe(userInfo -> {
@@ -675,13 +695,13 @@ public class RoomEffectView extends FrameLayout {
&& userInfo.getCarInfo().getStatus() == CarInfo.STATUS_USER_CAN_USE) {
if (AvRoomDataManager.get().mIsNeedGiftEffect &&
!AvRoomDataManager.get().isSelfGamePlaying()) {
mCarEffectList.add(userInfo.getCarInfo().getEffect());
mCarEffectList.add(userInfo.getCarInfo());
}
// 非贵族人员,进来后要播放座驾动画
if (userInfo.getNobleInfo() == null) {
if (!binding.roomCarSvga.isAnimating() && !isSvgaPlaying) {
// 播放座驾动画
playCarSvagEnterRoom(userInfo.getCarInfo().getEffect());
playCarAnim(userInfo.getCarInfo());
}
// 公屏进入房间的提示语
IMNetEaseManager.get()
@@ -692,7 +712,7 @@ public class RoomEffectView extends FrameLayout {
if (userInfo.getNobleInfo() != null && !userInfo.getNobleInfo().isNobleEnterHide()) {
if (!binding.roomCarSvga.isAnimating() && !isSvgaPlaying) {
// 播放座驾动画
playCarSvagEnterRoom(userInfo.getCarInfo().getEffect());
playCarAnim(userInfo.getCarInfo());
}
// 公屏进入房间的提示语
IMNetEaseManager.get()
@@ -702,18 +722,26 @@ public class RoomEffectView extends FrameLayout {
}
});
} else {
if (TextUtils.isEmpty(effect)) return;
if (carInfo == null) return;
if (AvRoomDataManager.get().mIsNeedGiftEffect &&
!AvRoomDataManager.get().isSelfGamePlaying()) {
mCarEffectList.add(effect);
mCarEffectList.add(carInfo);
}
if (!binding.roomCarSvga.isAnimating() && !isSvgaPlaying) {
playCarSvagEnterRoom(effect);
playCarAnim(carInfo);
}
}
}
private void playCarAnim(CarInfo carInfo) {
if (carInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(carInfo.getViewUrl())) {
playCarVAPEnterRoom(carInfo.getViewUrl());
} else {
playCarSvagEnterRoom(carInfo.getEffect());
}
}
/**
* 真实播放svga
*
@@ -750,6 +778,23 @@ public class RoomEffectView extends FrameLayout {
}
}
/**
* 真实播放vap
*
* @param viewUrl
*/
private void playCarVAPEnterRoom(String viewUrl) {
if (TextUtils.isEmpty(viewUrl)) return;
if (!AvRoomDataManager.get().mIsNeedGiftEffect ||
AvRoomDataManager.get().isSelfGamePlaying()) {
return;
}
isSvgaPlaying = true;
binding.vapAnimView.setVisibility(View.VISIBLE);
ImageLoadUtils.loadVAP(binding.vapAnimView, viewUrl);
}
/**
* 跨房PK飘屏
*

View File

@@ -4,9 +4,11 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
@@ -14,6 +16,7 @@ import android.view.View;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.tencent.qgame.animplayer.util.ScaleType;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseBindingActivity;
import com.yizhuan.erban.databinding.ActivityDecorationStoreBinding;
@@ -49,7 +52,7 @@ public class DecorationStoreActivity extends BaseBindingActivity<ActivityDecorat
public final static int TAB_HEAD_WEAR = 0;
public final static int TAB_CAR = 1;
public final static int TAB_NAMEPLATE = 2;
private final static String IS_CHECK_MY_DECORATION = "IS_CHECK_MY_DECORATION";
private SVGAParser mSVGAParser;
private long userId;
private boolean isCar;
@@ -60,8 +63,6 @@ public class DecorationStoreActivity extends BaseBindingActivity<ActivityDecorat
private CarShopFragment shopFragment;
private boolean isBuy;
private final static String IS_CHECK_MY_DECORATION = "IS_CHECK_MY_DECORATION";
public static void start(Context context, long userId) {
Intent intent = new Intent(context, DecorationStoreActivity.class);
intent.putExtra("userId", userId);
@@ -435,11 +436,21 @@ public class DecorationStoreActivity extends BaseBindingActivity<ActivityDecorat
mBinding.rlCarDetail.setVisibility(View.VISIBLE);
showSvgaAnimation(carInfo.getEffect());
if (carInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(carInfo.getViewUrl())) {
showVAPAnimation(carInfo.getViewUrl());
} else {
showSvgaAnimation(carInfo.getEffect());
}
mBinding.tvBuyCancel.setOnClickListener(v -> dismissCarDetail());
}
private void showVAPAnimation(String url) {
mBinding.vapAnimView.setLoop(99999);
mBinding.vapAnimView.setScaleType(ScaleType.FIT_CENTER);
ImageLoadUtils.loadVAP(mBinding.vapAnimView, url);
}
private void showSvgaAnimation(String effect) {
//effect = TextUtils.isEmpty(effect) && BuildConfig.DEBUG ? "https://image.zhongjialx.com/svga/Noble_OpenEffect_7_1.svga" : effect;
try {
@@ -471,6 +482,7 @@ public class DecorationStoreActivity extends BaseBindingActivity<ActivityDecorat
mBinding.svgaCarPlay.stopAnimation(true);
mBinding.svgaCarPlay.setImageDrawable(null);
mBinding.rlCarDetail.setVisibility(View.GONE);
mBinding.vapAnimView.stopPlay();
}
}

View File

@@ -0,0 +1,39 @@
package com.yizhuan.erban.ui.widget;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.qgame.animplayer.AnimConfig;
import com.tencent.qgame.animplayer.inter.IAnimListener;
public class SimpleAnimListener implements IAnimListener {
@Override
public void onFailed(int i, @Nullable String s) {
}
@Override
public void onVideoComplete() {
}
@Override
public boolean onVideoConfigReady(@NonNull AnimConfig animConfig) {
return true;
}
@Override
public void onVideoDestroy() {
}
@Override
public void onVideoRender(int i, @Nullable AnimConfig animConfig) {
}
@Override
public void onVideoStart() {
}
}

View File

@@ -277,6 +277,12 @@
android:layout_height="match_parent"
android:layout_above="@+id/tv_buy_cancel"/>
<com.tencent.qgame.animplayer.AnimView
android:id="@+id/vap_anim_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tv_buy_cancel"/>
<ImageView
android:id="@+id/tv_buy_cancel"
android:layout_width="wrap_content"

View File

@@ -160,4 +160,11 @@
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:autoPlay="true" />
<com.tencent.qgame.animplayer.AnimView
android:id="@+id/vap_anim_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</merge>

View File

@@ -18,6 +18,12 @@
android:visibility="gone"
app:autoPlay="true" />
<com.tencent.qgame.animplayer.AnimView
android:id="@+id/vap_anim_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/room_menber_in_svga"
android:layout_width="match_parent"

View File

@@ -2596,6 +2596,8 @@ public final class IMNetEaseManager {
carAttachment.uid = uid;
carAttachment.nick = nick;
carAttachment.effect = carInfo.getEffect();
carAttachment.viewUrl = carInfo.getViewUrl();
carAttachment.otherViewType = carInfo.getOtherViewType();
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
String.valueOf(roomInfo.getRoomId()), carAttachment);

View File

@@ -26,52 +26,6 @@ public class CarInfo extends BaseDecoration implements Serializable {
public final static int TAG_TYPE_DISCOUNT = 2;//折扣
public final static int TAG_TYPE_LIMIT = 3;//限定
public final static int TAG_TYPE_EXCLUSIVE = 4;//专属
@SerializedName("id")
private int carId;
/**
* 座驾的封面
*/
private String pic;
/**
* 座驾特效的url
*/
@SerializedName(value = "effect")
private String effect;
private boolean isGive;
/**
* 是否使用中
*/
private int using;
/**
* 还有多少天过期
* 如果还剩下几个小时显示的0天
*/
@SerializedName("expireDate")
private int remainingDay = -1;
/**
* 购买一次最多的有效天数
*/
private int days = -1;
private int nobleId;
public int expireDays;
public int limitType;
/**
* 标签类型(0、无 1、新品 2、折扣 3、限定 4、专属)
*/
private int labelType;
private String limitDesc;//限定描述
private String redirectLink;//跳转链接
/**
* 该状态状态
*/
public int status = STATUS_INVALID;
/**
* 不合法状态
*/
@@ -88,9 +42,57 @@ public class CarInfo extends BaseDecoration implements Serializable {
* 有效状态
*/
public static final int STATUS_USER_CAN_USE = 3;
//public static final String EFFECT = "effect";
public static final String CAR_NAME = "carName";
public int expireDays;
public int limitType;
/**
* 该状态状态
*/
public int status = STATUS_INVALID;
@SerializedName("id")
private int carId;
/**
* 座驾的封面
*/
private String pic;
/**
* 座驾特效的url
*/
@SerializedName(value = "effect")
private String effect;
private int otherViewType;
private String viewUrl;
private boolean isGive;
/**
* 是否使用中
*/
private int using;
/**
* 还有多少天过期
* 如果还剩下几个小时显示的0天
*/
@SerializedName("expireDate")
private int remainingDay = -1;
/**
* 购买一次最多的有效天数
*/
private int days = -1;
private int nobleId;
/**
* 标签类型(0、无 1、新品 2、折扣 3、限定 4、专属)
*/
private int labelType;
private String limitDesc;//限定描述
private String redirectLink;//跳转链接
public CarInfo(String effect, String viewUrl, int otherViewType) {
this.effect = effect;
this.otherViewType = otherViewType;
this.viewUrl = viewUrl;
}
public boolean isUsing(){
public boolean isUsing() {
return using == 1;
}
@@ -109,9 +111,6 @@ public class CarInfo extends BaseDecoration implements Serializable {
return carId;
}
//public static final String EFFECT = "effect";
public static final String CAR_NAME = "carName";
public Map<String, Object> toMap(Map<String, Object> valueMap, CarInfo carInfo) {
if (valueMap == null)
valueMap = new HashMap<>();

View File

@@ -80,4 +80,8 @@ public class GiftInfo implements Serializable {
private SimpleVipInfo giftVipInfo;
}
private int otherViewType;
private String viewUrl;
}

View File

@@ -16,6 +16,10 @@ public class CarAttachment extends CustomAttachment {
public long uid;
public String effect;
public int otherViewType;
public String viewUrl;
public CarAttachment(int first, int second) {
super(first, second);
mSecond = second;
@@ -37,6 +41,12 @@ public class CarAttachment extends CustomAttachment {
if (data.containsKey("effect")) {
effect = data.getString("effect");
}
if (data.containsKey("otherViewType")) {
otherViewType = data.getIntValue("otherViewType");
}
if (data.containsKey("viewUrl")) {
viewUrl = data.getString("viewUrl");
}
}
}
@@ -46,6 +56,8 @@ public class CarAttachment extends CustomAttachment {
jsonObject.put("effect", effect);
jsonObject.put("nick", nick);
jsonObject.put("uid", uid);
jsonObject.put("otherViewType", otherViewType);
jsonObject.put("viewUrl", viewUrl);
return jsonObject;
}
}