埋点配置
This commit is contained in:
@@ -66,4 +66,14 @@ public class FrameGiftAdapter extends RecyclerView.Adapter {
|
||||
public int getItemCount() {
|
||||
return giftJson.size();
|
||||
}
|
||||
|
||||
public void refreshWrapListAfterSend(LiveGiftBean model) {
|
||||
for (int i = 0; i < giftJson.size(); i++) {
|
||||
if (giftJson.get(i).getId() == model.getId()) {
|
||||
int giftNum = giftJson.get(i).getBlindBoxTicket();
|
||||
giftJson.get(i).setBlindBoxTicket(giftNum - 1);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,15 +34,20 @@ public class CoinModel extends BaseModel {
|
||||
|
||||
public String getCoin() {
|
||||
long coinMoney = Long.parseLong(coin);
|
||||
String coinStr = coin;
|
||||
if (999999999 < coinMoney && coinMoney <= 999999999999L) {
|
||||
coin = coin.substring(0, coin.length() - 3);
|
||||
coin = coin + "k";
|
||||
coinStr = coinStr.substring(0, coinStr.length() - 3);
|
||||
coinStr = coinStr + "k";
|
||||
}
|
||||
if (999999999999L < coinMoney && coinMoney <= 999999999999999L) {
|
||||
coin = coin.substring(0, coin.length() - 6);
|
||||
coin = coin + "M";
|
||||
coinStr = coinStr.substring(0, coinStr.length() - 6);
|
||||
coinStr = coinStr + "M";
|
||||
}
|
||||
return coin;
|
||||
return coinStr;
|
||||
}
|
||||
|
||||
public Long getCoinLong() {
|
||||
return Long.parseLong(coin);
|
||||
}
|
||||
|
||||
public CoinModel setCoin(String coin) {
|
||||
|
||||
@@ -230,7 +230,36 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
MobclickAgent.onEvent(mContext, "gif_list_seed_gif", "用户送礼物");
|
||||
sendGiftHandler.post(sendGiftRunnble);
|
||||
|
||||
if (liveGiftModel != null && liveGiftModel.getBlindBoxTicket() > 0) {
|
||||
BigDecimal needcoin = new BigDecimal(liveGiftModel.getPrice()).multiply(new BigDecimal(mCount));
|
||||
|
||||
if (needcoin.longValue() > diamond) {
|
||||
|
||||
sendBlindBoxTicket();
|
||||
} else {
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setView(R.layout.dialog_live_unfollow)
|
||||
.setConfirmString(mContext.getString(R.string.aristocrat_determine))
|
||||
.setCancelString(mContext.getString(R.string.use_diamonds))
|
||||
.setContent(mContext.getString(R.string.trial_coupon))
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
sendGiftHandler.post(sendGiftRunnble);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
sendBlindBoxTicket();
|
||||
}
|
||||
}).setCancelable(true).build().show();
|
||||
}
|
||||
|
||||
} else {
|
||||
sendGiftHandler.post(sendGiftRunnble);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
@@ -453,6 +482,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
/**
|
||||
* 获取砖石和金豆余额
|
||||
*/
|
||||
long diamond = 0;
|
||||
|
||||
private void getCoin() {
|
||||
LiveHttpUtil.getCoin(new HttpCallback() {
|
||||
@Override
|
||||
@@ -462,6 +493,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
CoinModel coinModel = GsonUtils.fromJson(info[0], CoinModel.class);
|
||||
goldText.setText(coinModel.getGold());
|
||||
diamondText.setText(coinModel.getCoin());
|
||||
diamond = coinModel.getCoinLong();
|
||||
lvStr.setText("Lv." + coinModel.getUserLevel());
|
||||
|
||||
findViewById(R.id.red_point).setVisibility((!TextUtils.isEmpty(coinModel.getUsersPackRedDot())) &&
|
||||
@@ -528,10 +560,66 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
private Runnable sendGiftRunnble = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendGift();
|
||||
if (isWrap && liveGiftModel.getType() == 7) {
|
||||
sendBlindBoxTicket();
|
||||
} else {
|
||||
sendGift();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//使用优惠券
|
||||
public void sendBlindBoxTicket() {
|
||||
if (TextUtils.isEmpty(mLiveUid) ||
|
||||
TextUtils.isEmpty(mStream) ||
|
||||
liveGiftModel == null)
|
||||
return;
|
||||
|
||||
LiveHttpUtil.sendBlindBoxTicket((by != null ? "1" : "0"),
|
||||
mLiveUid,
|
||||
mStream,
|
||||
isWrap ? liveGiftModel.getId() : liveGiftModel.getBlindBoxTicketId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (liveGiftModel.getSwf().contains("svga")) {
|
||||
dismiss();
|
||||
}
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String coin = obj.getString("coin");
|
||||
String goldCoin = obj.getString("gold");
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setLevel(obj.getIntValue("level"));
|
||||
//送礼物后更新粉丝徽章等级
|
||||
u.setMedalLevel(obj.getIntValue("medal_level"));
|
||||
u.setMedalName(obj.getString("medal_name"));
|
||||
u.setCoin(coin);
|
||||
}
|
||||
if (diamondText != null) {
|
||||
diamondText.setText(coin);
|
||||
}
|
||||
if (goldText != null) {
|
||||
goldText.setText(goldCoin);
|
||||
}
|
||||
if (!isWrap) {
|
||||
liveGiftModel.setBlindBoxTicket(liveGiftModel.getBlindBoxTicket() - 1);
|
||||
}
|
||||
isGetNewWrap = true;
|
||||
if (isWrap) {
|
||||
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送礼物
|
||||
*/
|
||||
@@ -655,39 +743,45 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
lianSongHandler.removeCallbacks(lianSongRunnable);
|
||||
mShowLianBtn = false;
|
||||
getCoin();
|
||||
|
||||
LiveNetManager.get(mContext)
|
||||
.getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback<GiftNamingInfoModel>() {
|
||||
@Override
|
||||
public void onSuccess(GiftNamingInfoModel data) {
|
||||
liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class);
|
||||
if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) &&
|
||||
!TextUtils.isEmpty(liveGiftModel.getNamingUid()) &&
|
||||
!TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") &&
|
||||
!TextUtils.equals(liveGiftModel.getNamingUid(), "0")) {
|
||||
namingLayout.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar);
|
||||
StringBuffer namingNameText = new StringBuffer();
|
||||
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
namingNameText.append("获取冠名:")
|
||||
.append(liveGiftModel.getNamingUserCoin())
|
||||
.append(" ");
|
||||
if (TextUtils.equals(data.getNamingStatus(), "1")) {
|
||||
liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class);
|
||||
if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) &&
|
||||
!TextUtils.isEmpty(liveGiftModel.getNamingUid()) &&
|
||||
!TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") &&
|
||||
!TextUtils.equals(liveGiftModel.getNamingUid(), "0")) {
|
||||
namingLayout.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar);
|
||||
StringBuffer namingNameText = new StringBuffer();
|
||||
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
namingNameText.append("获取冠名:")
|
||||
.append(liveGiftModel.getNamingUserCoin())
|
||||
.append(" ");
|
||||
|
||||
} else {
|
||||
namingNameText.append("Get title: ")
|
||||
.append(liveGiftModel.getNamingUserCoin())
|
||||
.append(" ");
|
||||
}
|
||||
namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor))
|
||||
.append(liveGiftModel.getNamingLiveName())
|
||||
.append(" ")
|
||||
.append(mContext.getText(com.yunbao.live.R.string.the_title_financier))
|
||||
.append(" ")
|
||||
.append(liveGiftModel.getNamingUserName());
|
||||
namingName.setText(namingNameText.toString());
|
||||
} else {
|
||||
namingNameText.append("Get title: ")
|
||||
.append(liveGiftModel.getNamingUserCoin())
|
||||
.append(" ");
|
||||
namingLayout.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor))
|
||||
.append(liveGiftModel.getNamingLiveName())
|
||||
.append(" ")
|
||||
.append(mContext.getText(com.yunbao.live.R.string.the_title_financier))
|
||||
.append(" ")
|
||||
.append(liveGiftModel.getNamingUserName());
|
||||
namingName.setText(namingNameText.toString());
|
||||
} else {
|
||||
namingLayout.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -800,7 +894,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
if (!TextUtils.isEmpty(liveGiftModel.getOperateImage())) {
|
||||
operateImage.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage);
|
||||
}else {
|
||||
} else {
|
||||
operateImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -1185,12 +1279,15 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
if (goldText != null) {
|
||||
goldText.setText(goldCoin);
|
||||
}
|
||||
|
||||
if (!mGiftBean.getSwf().contains("svga")) {
|
||||
showLianBtn();
|
||||
}
|
||||
if (mGiftBean.getType() == 7) {
|
||||
showLianBtn();
|
||||
|
||||
}
|
||||
|
||||
// //刷新包裹列表wrap_gift_num -1:表示数量没有变化
|
||||
// mObjGiftSendback = obj;
|
||||
isGetNewWrap = true;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunbao.live.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
|
||||
public class LiveGiftItemRefreshEvent extends BaseModel {
|
||||
private LiveGiftBean liveGiftModel;
|
||||
|
||||
public LiveGiftBean getLiveGiftModel() {
|
||||
return liveGiftModel;
|
||||
}
|
||||
|
||||
public LiveGiftItemRefreshEvent setLiveGiftModel(LiveGiftBean liveGiftModel) {
|
||||
this.liveGiftModel = liveGiftModel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,11 @@ import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.fragment.BaseFragment;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveGiftFragmentPagerAdapter;
|
||||
import com.yunbao.live.event.LiveGiftItemRefreshEvent;
|
||||
import com.yunbao.live.event.LiveParcelItemRefreshEvent;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -148,4 +153,6 @@ public class LiveGiftFragment extends BaseFragment {
|
||||
liveGiftFragment.setArguments(bundle);
|
||||
return liveGiftFragment;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.FrameGiftAdapter;
|
||||
import com.yunbao.live.event.LiveGiftItemEvent;
|
||||
import com.yunbao.live.event.LiveGiftItemRefreshEvent;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
@@ -79,4 +80,8 @@ public class LiveGiftItemFragment extends BaseFragment {
|
||||
public void onLiveGiftItemEvent(LiveGiftItemEvent event) {
|
||||
frameGiftAdapter.giftSelect(event.getLiveGiftModel());
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveGiftItemRefreshEvent(LiveGiftItemRefreshEvent event) {
|
||||
frameGiftAdapter.refreshWrapListAfterSend(event.getLiveGiftModel());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user