新增Banner进入直播间直接唤起新人特惠
修复新人特惠URL为null时依旧打开弹框 调整新人特惠红点入口 调整用户手动下载svga如网络失败时的操作
This commit is contained in:
@@ -87,6 +87,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
@@ -323,6 +324,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk);
|
||||
//加载完页面后再后台静默下载礼物svga
|
||||
downloadAllGift();
|
||||
over();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -336,7 +338,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void over(){
|
||||
if("NEWUSER".equals(getIntent().getStringExtra("OPEN"))){
|
||||
manager.mLiveAudienceViewHolder.openNewPeopleDialog();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开礼物窗口
|
||||
@@ -897,6 +903,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
*/
|
||||
public static void forward(Context context, LiveBean liveBean, int liveType,
|
||||
int liveTypeVal, String key, int position, int liveSdk) {
|
||||
forward(context, liveBean, liveType, liveTypeVal, key, null, position, liveSdk);
|
||||
}
|
||||
|
||||
public static void forward(Context context, LiveBean liveBean, int liveType,
|
||||
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
|
||||
Intent intent = new Intent(context, LiveAudienceActivity.class);
|
||||
intent.putExtra(Constants.LIVE_BEAN, liveBean);
|
||||
intent.putExtra(Constants.LIVE_TYPE, liveType);
|
||||
@@ -905,9 +916,13 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
intent.putExtra(Constants.LIVE_POSITION, position);
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
if (map != null) {
|
||||
for (String _key : map.keySet()) {
|
||||
intent.putExtra(_key, map.get(_key));
|
||||
}
|
||||
}
|
||||
intent.putExtra("landscape", liveBean.getLandscape());
|
||||
context.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -946,9 +961,10 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
/**
|
||||
* 后台下载所有礼物
|
||||
*/
|
||||
private void downloadAllGift(){
|
||||
private void downloadAllGift() {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
List<LiveGiftBean> giftBeanList=new ArrayList<>();
|
||||
List<LiveGiftBean> giftBeanList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
@@ -958,20 +974,21 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray"));
|
||||
|
||||
for (Object o : list) {
|
||||
JSONObject item= (JSONObject) o;
|
||||
JSONObject item = (JSONObject) o;
|
||||
List<LiveGiftBean> giftlist = JSONArray.parseArray(item.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class);
|
||||
for (LiveGiftBean bean : giftlist) {
|
||||
if(!bean.getSwf().isEmpty()){
|
||||
if (!bean.getSwf().isEmpty()) {
|
||||
giftBeanList.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
GiftCacheUtil.getInstance().setDownloadList(giftBeanList);
|
||||
GiftCacheUtil.getInstance().setCallback(new CommonCallback<File>() {
|
||||
int index=0;
|
||||
int index = 0;
|
||||
|
||||
@Override
|
||||
public void callback(File bean) {
|
||||
if(bean!=null){
|
||||
if (bean != null) {
|
||||
index++;
|
||||
Bus.get().post(new GiftCacheUtil.GiftDownloadStatus(index, giftBeanList.size(), GiftCacheUtil.getIdForFileName(bean.getName())));
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.GiftCacheUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.custom.GiftMarkView;
|
||||
|
||||
@@ -199,8 +201,14 @@ public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
|
||||
GiftCacheUtil.getInstance().downloadGiftForId(bean, new CommonCallback<File>() {
|
||||
@Override
|
||||
public void callback(File bean) {
|
||||
mLoadingLayout.setVisibility(View.GONE);
|
||||
GiftCacheUtil.getInstance().restart();
|
||||
if(bean==null){
|
||||
ToastUtil.show(WordUtil.getString(R.string.load_failure_2));
|
||||
mLoading.setImageResource(R.mipmap.icon_download_gift);
|
||||
mLoading.getAnimation().cancel();
|
||||
}else {
|
||||
mLoadingLayout.setVisibility(View.GONE);
|
||||
}
|
||||
GiftCacheUtil.getInstance().restart();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,16 +53,11 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
private int showType = 0;
|
||||
private boolean isFullWindow = false;
|
||||
private String roomId;
|
||||
private WebInterface webInterface;
|
||||
|
||||
public LiveHDDialogFragment() {
|
||||
|
||||
}
|
||||
|
||||
public void setWebInterface(WebInterface webInterface) {
|
||||
this.webInterface = webInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出全屏对话框
|
||||
*
|
||||
@@ -263,19 +258,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidShowUserPreferentialRedDot() {
|
||||
if (webInterface != null) {
|
||||
webInterface.showUserPreferentialRedDot();
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidHideUserPreferentialRedDot() {
|
||||
if (webInterface != null) {
|
||||
webInterface.hideUserPreferentialRedDot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
||||
@@ -344,11 +326,4 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
mWebView.destroy();
|
||||
}
|
||||
|
||||
public abstract static class WebInterface {
|
||||
public void showUserPreferentialRedDot() {
|
||||
}
|
||||
|
||||
public void hideUserPreferentialRedDot() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
LiveRoomViewHolder.insertChat(lvBean2, 1);
|
||||
}
|
||||
}, 10000);//3秒后执行Runnable中的run方法
|
||||
getNewPeopleInfo();
|
||||
getNewPeopleInfo(false);
|
||||
}
|
||||
|
||||
public void getNewPeopleInfo() {
|
||||
public void getNewPeopleInfo(boolean show) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getNewPeopleInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -315,6 +315,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
} else {
|
||||
newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink();
|
||||
}
|
||||
setUserPreferentialRedDot(peopleInfo.getShowRed() == 1);
|
||||
if (show) {
|
||||
openNewPeopleDialog();
|
||||
}
|
||||
} else {
|
||||
liveNewPeople.setVisibility(View.GONE);
|
||||
}
|
||||
}, Throwable::printStackTrace).isDisposed();
|
||||
}
|
||||
@@ -351,7 +357,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
/**
|
||||
* 打开新人特惠对话框
|
||||
*/
|
||||
private void openNewPeopleDialog() {
|
||||
public void openNewPeopleDialog() {
|
||||
if (newPeopleUrl == null) {
|
||||
getNewPeopleInfo(true);
|
||||
return;
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
String url = newPeopleUrl + "&g=Appapi&m=Turntable&a=tricky";
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
@@ -360,19 +370,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
bundle.putInt("show_type", 0);
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
liveHDDialogFragment.setArguments(bundle);
|
||||
liveHDDialogFragment.setWebInterface(new LiveHDDialogFragment.WebInterface(){
|
||||
@Override
|
||||
public void showUserPreferentialRedDot() {
|
||||
super.showUserPreferentialRedDot();
|
||||
setUserPreferentialRedDot(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideUserPreferentialRedDot() {
|
||||
super.hideUserPreferentialRedDot();
|
||||
setUserPreferentialRedDot(false);
|
||||
}
|
||||
});
|
||||
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
|
||||
@@ -408,11 +405,13 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
|
||||
/**
|
||||
* 显示/隐藏新人特惠礼物红点
|
||||
*
|
||||
* @param show true显示 false隐藏
|
||||
*/
|
||||
private void setUserPreferentialRedDot(boolean show){
|
||||
mNewPeopleRedDot.setVisibility(show?View.VISIBLE:View.GONE);
|
||||
private void setUserPreferentialRedDot(boolean show) {
|
||||
mNewPeopleRedDot.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出直播间
|
||||
*/
|
||||
|
||||
@@ -133,7 +133,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
//头部布局
|
||||
private LiveRoomViewHolder mLiveRoomViewHolder;
|
||||
//底部布局
|
||||
private LiveAudienceViewHolder mLiveAudienceViewHolder;
|
||||
public LiveAudienceViewHolder mLiveAudienceViewHolder;
|
||||
//观众与主播连麦逻辑
|
||||
private LiveLinkMicPresenter mLiveLinkMicPresenter;
|
||||
private LiveBean mLiveBean;
|
||||
|
||||
Reference in New Issue
Block a user