新增Banner进入直播间直接唤起新人特惠

修复新人特惠URL为null时依旧打开弹框
调整新人特惠红点入口
调整用户手动下载svga如网络失败时的操作
This commit is contained in:
2022-10-11 14:11:12 +08:00
parent 127490ca91
commit f2a3f55e52
10 changed files with 107 additions and 72 deletions

View File

@@ -13,6 +13,7 @@ public class BannerBean {
private String mLink;
private String show_type;
private String mIntoUrl;
private int type;
private StarChallengeStatusModel model;
@@ -71,4 +72,13 @@ public class BannerBean {
public void setmIntoUrl(String intoUrl) {
mIntoUrl = intoUrl;
}
@JSONField(name = "type")
public int getType() {
return type;
}
@JSONField(name = "type")
public void setType(int type) {
this.type = type;
}
}

View File

@@ -16,6 +16,8 @@ public class NewPeopleInfo extends BaseModel{
private int isShow;//是否展示入口
@SerializedName("link")
private String link;//入口地址
@SerializedName("red_show")
private int showRed=0;
public boolean getChargeHidden() {
return chargeHidden==1;
@@ -49,6 +51,14 @@ public class NewPeopleInfo extends BaseModel{
this.link = link;
}
public int getShowRed() {
return showRed;
}
public void setShowRed(int showRed) {
this.showRed = showRed;
}
@NonNull
@Override
public String toString() {

View File

@@ -10,6 +10,7 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.interfaces.CommonCallback;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -25,7 +26,7 @@ public class GiftCacheUtil {
private Handler handler = new Handler(Looper.getMainLooper());
private boolean pause = false;
private boolean downloading = false;
private int clickId = 0;
private List<String> clickId = new ArrayList<>();
private GiftCacheUtil() {
}
@@ -107,9 +108,10 @@ public class GiftCacheUtil {
downloadCache.put(bean.getId(), bean);
}
}
public void addDownloadList(List<LiveGiftBean> list){
public void addDownloadList(List<LiveGiftBean> list) {
for (LiveGiftBean bean : list) {
downloadCache.put(bean.getId(),bean);
downloadCache.put(bean.getId(), bean);
}
}
@@ -124,16 +126,18 @@ public class GiftCacheUtil {
* 插队优先下载指定id礼物
*/
public void downloadGiftForId(LiveGiftBean bean, CommonCallback<File> mDownloadGifCallback) {
if(checkGiftIsDownload(bean.getId())){
if (checkGiftIsDownload(bean.getId())) {
mDownloadGifCallback.callback(null);
return;
}
this.clickId = bean.getId();
clickId.add(bean.getId()+"");
getFile(getDownloadSaveName(bean.getId()), bean.getSwf(), "0", new CommonCallback<File>() {
@Override
public void callback(File bean) {
GiftCacheUtil.this.clickId = -1;
downloadCache.remove(getIdForFileName(bean.getName()));
if(bean!=null) {
clickId.remove(getIdForFileName(bean.getName())+"");
downloadCache.remove(getIdForFileName(bean.getName()));
}
mDownloadGifCallback.callback(bean);
}
});
@@ -149,7 +153,7 @@ public class GiftCacheUtil {
/**
* 恢复下载
*/
public void restart(){
public void restart() {
pause = false;
startDownload();
}
@@ -159,7 +163,9 @@ public class GiftCacheUtil {
*/
public void resetStatus() {
downloading = false;
pause=false;
pause = false;
clickId.clear();
downloadCache.clear();
}
/**
@@ -192,13 +198,13 @@ public class GiftCacheUtil {
/**
* 开始下载
*/
private void startDownload(){
private void startDownload() {
new Thread(() -> {
File dir = new File(CommonAppConfig.GIF_PATH);
DownloadUtil downloadUtil = new DownloadUtil();
Object[] ids = downloadCache.keySet().toArray();
for (Object _id :ids) {
int id= (int) _id;
for (Object _id : ids) {
int id = (int) _id;
if (pause) {
return;
}
@@ -212,7 +218,7 @@ public class GiftCacheUtil {
if (bean == null) {
continue;
}
if (clickId == id) {
if (clickId.contains(id+"")) {
continue;
}
if (bean.getSwf().isEmpty()) {
@@ -225,11 +231,11 @@ public class GiftCacheUtil {
downloadCache.remove(getIdForFileName(file.getName()));
if (downloadCache.isEmpty()) {
downloading = false;
}else{
} else {
//单线程下载,以便插队下载和及时停止下载
startDownload();
}
// handler.post(() -> commonCallback.callback(file));
// handler.post(() -> commonCallback.callback(file));
commonCallback.callback(file);
}
@@ -246,7 +252,7 @@ public class GiftCacheUtil {
});
break;
}
if(downloadCache.isEmpty()){
if (downloadCache.isEmpty()) {
resetStatus();
}
}).start();