From 5060d647fb4b0d32991fb8a3af8460cab774c8e6 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 10 Oct 2022 11:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=96=87=E6=A1=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B0=E7=A4=BC=E7=89=A9UI=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=B8=BB=E7=95=8C=E9=9D=A2=E9=A2=84=E4=B8=8B=E8=BD=BD=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=A4=BC=E7=89=A9svga=E5=85=A5=E5=8F=A3=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9B=B4=E6=92=AD=E9=97=B4=E7=8A=B6=E6=80=81=E5=90=8E?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E4=B8=8B=E8=BD=BD=E6=89=80=E6=9C=89=E7=A4=BC?= =?UTF-8?q?=E7=89=A9svga=20GiftCacheUtil=E6=94=B9=E4=B8=BA=E5=8D=95?= =?UTF-8?q?=E4=BE=8B=E5=B9=B6=E6=94=AF=E6=8C=81=E9=A1=BA=E5=BA=8F=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=89=80=E6=9C=89=E7=A4=BC=E7=89=A9=E5=8F=8A=E6=8F=92?= =?UTF-8?q?=E9=98=9F=E4=B8=8B=E8=BD=BD=20=E9=A2=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=B0=E4=BA=BA=E7=89=B9=E6=83=A0=E7=BA=A2=E7=82=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA/=E9=9A=90=E8=97=8F=E6=8E=A5=E5=8F=A3=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96svga=E6=92=AD=E6=94=BE=E6=97=B6=E9=97=B4=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E7=94=B1SVGAViewUtils=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/manager/IMLoginManager.java | 1 + .../com/yunbao/common/utils/GifCacheUtil.java | 52 -- .../yunbao/common/utils/GiftCacheUtil.java | 285 ++++++++++ .../com/yunbao/common/utils/NobleUtil.java | 25 + .../yunbao/common/utils/SVGAViewUtils.java | 20 + .../weight/FullServiceNotificationView.java | 11 +- .../common/views/weight/NobleNoticeView.java | 11 +- .../live/activity/LiveAudienceActivity.java | 51 ++ .../yunbao/live/adapter/GiftTopAdapter.java | 4 + .../yunbao/live/adapter/LiveGiftAdapter.java | 99 ++-- .../live/adapter/LiveGiftPagerAdapter.java | 35 +- .../live/dialog/LiveGiftDialogFragment.java | 172 +++--- .../live/dialog/LiveHDDialogFragment.java | 31 +- .../presenter/LiveEnterRoomAnimPresenter.java | 4 +- .../live/presenter/LiveGiftAnimPresenter.java | 4 +- .../live/views/LiveAudienceViewHolder.java | 22 + .../yunbao/live/views/LiveRoomViewHolder.java | 2 +- live/src/main/res/anim/anim_loading_gift.xml | 11 + live/src/main/res/drawable/bg_live_gift.xml | 10 + .../main/res/drawable/bg_live_gift_buy.xml | 11 + .../drawable/bg_live_gift_download_all.xml | 9 + .../main/res/drawable/bg_live_gift_items.xml | 7 + .../drawable/bg_live_gift_package_line.xml | 9 + .../main/res/drawable/bg_live_vip_gold.xml | 10 + .../main/res/layout/dialog_live_gift_wrap.xml | 520 ++++++++++-------- live/src/main/res/layout/item_live_gift.xml | 20 +- .../main/res/layout/view_live_audience.xml | 29 +- .../res/mipmap-xxxhdpi/icon_download_gift.png | Bin 0 -> 6180 bytes .../res/mipmap-xxxhdpi/icon_loading_gift.png | Bin 0 -> 5319 bytes .../mipmap-xxxhdpi/icon_small_download.png | Bin 0 -> 2706 bytes .../main/res/mipmap-xxxhdpi/icon_vip_gold.png | Bin 0 -> 3536 bytes .../yunbao/main/activity/MainActivity.java | 13 +- .../yunbao/main/activity/RewardActivity.java | 4 +- .../main/activity/ZhuangBanActivity.java | 4 +- .../com/yunbao/main/http/MainHttpUtil.java | 1 + 35 files changed, 1066 insertions(+), 421 deletions(-) delete mode 100644 common/src/main/java/com/yunbao/common/utils/GifCacheUtil.java create mode 100644 common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java create mode 100644 common/src/main/java/com/yunbao/common/utils/NobleUtil.java create mode 100644 live/src/main/res/anim/anim_loading_gift.xml create mode 100644 live/src/main/res/drawable/bg_live_gift.xml create mode 100644 live/src/main/res/drawable/bg_live_gift_buy.xml create mode 100644 live/src/main/res/drawable/bg_live_gift_download_all.xml create mode 100644 live/src/main/res/drawable/bg_live_gift_items.xml create mode 100644 live/src/main/res/drawable/bg_live_gift_package_line.xml create mode 100644 live/src/main/res/drawable/bg_live_vip_gold.xml create mode 100644 live/src/main/res/mipmap-xxxhdpi/icon_download_gift.png create mode 100644 live/src/main/res/mipmap-xxxhdpi/icon_loading_gift.png create mode 100644 live/src/main/res/mipmap-xxxhdpi/icon_small_download.png create mode 100644 live/src/main/res/mipmap-xxxhdpi/icon_vip_gold.png diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 62a343db3..bbe9a4e77 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -291,6 +291,7 @@ public class IMLoginManager extends BaseCacheManager { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { + SpUtil.setStringValue("userData",info[0]); userInfo = new Gson().fromJson(info[0], IMLoginModel.class); if (!TextUtils.isEmpty(uidAndToken[1])) { userInfo.setToken(uidAndToken[1]); diff --git a/common/src/main/java/com/yunbao/common/utils/GifCacheUtil.java b/common/src/main/java/com/yunbao/common/utils/GifCacheUtil.java deleted file mode 100644 index b3d5f64c5..000000000 --- a/common/src/main/java/com/yunbao/common/utils/GifCacheUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.yunbao.common.utils; - -import android.util.Log; - -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.http.CommonHttpConsts; -import com.yunbao.common.interfaces.CommonCallback; - -import java.io.File; - -/** - * Created by cxf on 2018/10/17. - */ - -public class GifCacheUtil { - - public static void getFile(String fileName, String url,String forwhat, final CommonCallback commonCallback) { - if (commonCallback == null) { - return; - } - File dir = new File(CommonAppConfig.GIF_PATH); - if (!dir.exists()) { - dir.mkdirs(); - } - File file1 = new File(dir, fileName+".svga"); - if (file1.exists()) { - commonCallback.callback(file1); - } else { - DownloadUtil downloadUtil = new DownloadUtil(); - if(forwhat.equals("1")){ - ToastUtil.show("礼物正在获取中..."); - } - downloadUtil.download(CommonHttpConsts.DOWNLOAD_GIF, dir, fileName, url, new DownloadUtil.Callback() { - @Override - public void onSuccess(File file) { - commonCallback.callback(file); - } - - @Override - public void onProgress(int progress) { - - } - - @Override - public void onError(Throwable e) { - commonCallback.callback(null); - } - }); - } - } - -} diff --git a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java new file mode 100644 index 000000000..18312f81b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java @@ -0,0 +1,285 @@ +package com.yunbao.common.utils; + +import android.os.Handler; +import android.os.Looper; + +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.bean.LiveGiftBean; +import com.yunbao.common.http.CommonHttpConsts; +import com.yunbao.common.interfaces.CommonCallback; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.List; + +/** + * svga礼物缓存工具 + * Created by cxf on 2018/10/17. + */ + +public class GiftCacheUtil { + private static GiftCacheUtil manager; + private LinkedHashMap downloadCache = new LinkedHashMap<>(); + private CommonCallback commonCallback; + private Handler handler = new Handler(Looper.getMainLooper()); + private boolean pause = false; + private boolean downloading = false; + private int clickId = 0; + + private GiftCacheUtil() { + } + + public static GiftCacheUtil getInstance() { + if (manager == null) { + manager = new GiftCacheUtil(); + } + return manager; + } + + /** + * 单独下载 + */ + public static void getFile(String fileName, String url, String forwhat, final CommonCallback commonCallback) { + if (commonCallback == null) { + return; + } + File dir = new File(CommonAppConfig.GIF_PATH); + if (!dir.exists()) { + dir.mkdirs(); + } + File file1 = new File(dir, fileName + ".svga"); + if (file1.exists()) { + commonCallback.callback(file1); + } else { + DownloadUtil downloadUtil = new DownloadUtil(); + if (forwhat.equals("1")) { + ToastUtil.show("礼物正在获取中..."); + } + downloadUtil.download(CommonHttpConsts.DOWNLOAD_GIF, dir, fileName, url, new DownloadUtil.Callback() { + @Override + public void onSuccess(File file) { + commonCallback.callback(file); + } + + @Override + public void onProgress(int progress) { + + } + + @Override + public void onError(Throwable e) { + commonCallback.callback(null); + } + }); + } + } + + /** + * 通过id获取保存的文件名 + */ + public static String getDownloadSaveName(int id) { + return Constants.GIF_GIFT_PREFIX + id; + } + + /** + * 检测礼物是否已经下载完毕 + */ + public static boolean checkGiftIsDownload(int id) { + return new File(CommonAppConfig.GIF_PATH, getDownloadSaveName(id) + ".svga").exists(); + } + + /** + * 根据文件名返回id + */ + public static int getIdForFileName(String name) { + return Integer.parseInt(name + .replace(Constants.GIF_GIFT_PREFIX, "") + .replace(".svga", "")); + } + + /** + * 设置下载列表 + */ + public void setDownloadList(List list) { + for (LiveGiftBean bean : list) { + downloadCache.put(bean.getId(), bean); + } + } + + /** + * 设置监听回调 + */ + public void setCallback(CommonCallback commonCallback) { + this.commonCallback = commonCallback; + } + + /** + * 插队优先下载指定id礼物 + */ + public void downloadGiftForId(LiveGiftBean bean, CommonCallback mDownloadGifCallback) { + if(checkGiftIsDownload(bean.getId())){ + mDownloadGifCallback.callback(null); + return; + } + this.clickId = bean.getId(); + getFile(getDownloadSaveName(bean.getId()), bean.getSwf(), "0", new CommonCallback() { + @Override + public void callback(File bean) { + GiftCacheUtil.this.clickId = -1; + downloadCache.remove(getIdForFileName(bean.getName())); + mDownloadGifCallback.callback(bean); + } + }); + } + + /** + * 暂停下载 + */ + public void pause() { + pause = true; + } + + /** + * 恢复下载 + */ + public void restart(){ + pause = false; + startDownload(); + } + + /** + * 重置下载状态 + */ + public void resetStatus() { + downloading = false; + pause=false; + } + + /** + * 是否下载中 + */ + public boolean isDownloading() { + return downloading; + } + + /** + * 下载列表中所有文件 + */ + public void downloadAllGift() { + File dir = new File(CommonAppConfig.GIF_PATH); + if (!dir.exists()) { + dir.mkdirs(); + } + if (commonCallback == null) { + return; + } + if (downloading) { + commonCallback.callback(null); + return; + } + downloading = true; + 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; + if (pause) { + return; + } + File file = new File(dir, Constants.GIF_GIFT_PREFIX + id + ".svga"); + if (file.exists()) { + handler.post(() -> commonCallback.callback(file)); + downloadCache.remove(id); + continue; + } + LiveGiftBean bean = downloadCache.get(id); + if (bean == null) { + continue; + } + if (clickId == id) { + continue; + } + if (bean.getSwf().isEmpty()) { + handler.post(() -> commonCallback.callback(null)); + continue; + } + downloadUtil.download(CommonHttpConsts.DOWNLOAD_GIF, dir, Constants.GIF_GIFT_PREFIX + bean.getId(), bean.getSwf(), new DownloadUtil.Callback() { + @Override + public void onSuccess(File file) { + downloadCache.remove(getIdForFileName(file.getName())); + if (downloadCache.isEmpty()) { + downloading = false; + }else{ + //单线程下载,以便插队下载和及时停止下载 + startDownload(); + } + handler.post(() -> commonCallback.callback(file)); + } + + @Override + public void onProgress(int progress) { + + } + + @Override + public void onError(Throwable e) { + handler.post(() -> commonCallback.callback(null)); + e.printStackTrace(); + } + }); + break; + } + if(downloadCache.isEmpty()){ + downloading = false; + } + }).start(); + } + + /** + * 下载状态 + */ + public static class GiftDownloadStatus { + private int download = 0; + private int size = 0; + private int id; + + public GiftDownloadStatus(int download, int size, int id) { + this.download = download; + this.size = size; + this.id = id; + } + + public int getDownload() { + return download; + } + + public int getSize() { + return size; + } + + + public int getId() { + return id; + } + + @Override + public String toString() { + return "GiftDownloadStatus{" + + "download=" + download + + ", size=" + size + + ", id=" + id + + '}'; + } + } + +} diff --git a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java new file mode 100644 index 000000000..e03d24ccd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -0,0 +1,25 @@ +package com.yunbao.common.utils; + +import com.yunbao.common.R; + + +public class NobleUtil { + /** + * 来自User.getBaseInfos接口 + * 根据noble_id返回对应的图片资源 + * id来自 + * @see com.yunbao.common.views.weight.NobleNoticeView.RoleType + */ + public static int nobleIdToImageResId(int id){ + switch (id){ + case 1:return R.mipmap.icon_open_nanjue; + case 2:return R.mipmap.icon_open_zijue; + case 3:return R.mipmap.icon_open_houjue; + case 4:return R.mipmap.icon_open_gongjue; + case 5:return R.mipmap.icon_open_guowang; + case 6:return R.mipmap.icon_open_huangdi; + case 7:return R.mipmap.icon_open_chaohuang; + } + return -1; + } +} diff --git a/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java b/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java index 87b7b7391..daa47b0f6 100644 --- a/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/SVGAViewUtils.java @@ -1,8 +1,11 @@ package com.yunbao.common.utils; +import android.animation.ValueAnimator; + import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGAImageView; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -58,4 +61,21 @@ public class SVGAViewUtils { public static void playEndClear(SVGAImageView svga) { playEndClear(svga, true); } + + /** + * 获取svga动画播放时间 + */ + public static long getPlayTimer(SVGAImageView svga){ + try { + Field mAnimator = svga.getClass().getDeclaredField("mAnimator"); + mAnimator.setAccessible(true); + ValueAnimator animator = (ValueAnimator) mAnimator.get(svga); + if(animator!=null) { + return animator.getDuration(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } } diff --git a/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java b/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java index e83e8060f..3513d1d4e 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/FullServiceNotificationView.java @@ -24,6 +24,7 @@ import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.R; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.SVGAViewUtils; import org.jetbrains.annotations.NotNull; @@ -127,15 +128,7 @@ public class FullServiceNotificationView extends FrameLayout { svagaBc.setVisibility(VISIBLE); SVGADrawable imageView = new SVGADrawable(svgaVideoEntity); svagaBc.setImageDrawable(imageView); - try { - Field mAnimator = svagaBc.getClass().getDeclaredField("mAnimator"); - mAnimator.setAccessible(true); - ValueAnimator animator = (ValueAnimator) mAnimator.get(svagaBc); - animationTime = animator.getDuration(); - System.out.println("播放时间 = " + animator.getDuration()); - } catch (Exception e) { - e.printStackTrace(); - } + animationTime= SVGAViewUtils.getPlayTimer(svagaBc); svagaBc.setLoops(1); svagaBc.startAnimation(); } diff --git a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java index 3a231da57..371e892b0 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java @@ -28,6 +28,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.R; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.BitmapUtil; +import com.yunbao.common.utils.SVGAViewUtils; import org.jetbrains.annotations.NotNull; @@ -204,15 +205,7 @@ public class NobleNoticeView extends FrameLayout { dynamicEntity.setDynamicImage(bitmap, "psd_31"); SVGADrawable imageView = new SVGADrawable(svgaVideoEntity, dynamicEntity); svagaBc.setImageDrawable(imageView); - try { - Field mAnimator = svagaBc.getClass().getDeclaredField("mAnimator"); - mAnimator.setAccessible(true); - ValueAnimator animator = (ValueAnimator) mAnimator.get(svagaBc); - animationTime = animator.getDuration(); - System.out.println("播放时间 = " + animator.getDuration()); - } catch (Exception e) { - e.printStackTrace(); - } + animationTime= SVGAViewUtils.getPlayTimer(svagaBc); svagaBc.setLoops(1); svagaBc.startAnimation(); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 9897a0683..a09e91e4f 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -22,6 +22,7 @@ import androidx.viewpager.widget.ViewPager; import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.facebook.appevents.AppEventsLogger; @@ -33,6 +34,7 @@ import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; @@ -45,11 +47,13 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.main.MainNetManager; +import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.pay.PayCallback; import com.yunbao.common.pay.PayPresenter; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ToastUtil; @@ -79,6 +83,7 @@ import com.yunbao.live.views.PortraitLiveManager; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -316,6 +321,8 @@ public class LiveAudienceActivity extends LiveActivity { mViewGroup.addView(manager.getRootView()); manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk); + //加载完页面后再后台静默下载礼物svga + downloadAllGift(); } }); @@ -484,6 +491,7 @@ public class LiveAudienceActivity extends LiveActivity { protected void onPause() { super.onPause(); manager.onPause(); + GiftCacheUtil.getInstance().pause(); } /** @@ -608,6 +616,7 @@ public class LiveAudienceActivity extends LiveActivity { protected void onResume() { super.onResume(); manager.onResume(); + GiftCacheUtil.getInstance().restart(); } @@ -930,4 +939,46 @@ public class LiveAudienceActivity extends LiveActivity { public void onFollowEvent(FollowEvent e) { manager.onFollowEvent(e); } + + /** + * 后台下载所有礼物 + */ + private void downloadAllGift(){ + LiveHttpUtil.getNewGiftList(new HttpCallback() { + List giftBeanList=new ArrayList<>(); + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + JSONArray list = obj.getJSONArray("listarray"); + Log.i("tttts", obj.getString("listarray") + ""); + CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); + + for (Object o : list) { + JSONObject item= (JSONObject) o; + List giftlist = JSONArray.parseArray(item.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class); + for (LiveGiftBean bean : giftlist) { + if(!bean.getSwf().isEmpty()){ + giftBeanList.add(bean); + } + } + } + GiftCacheUtil.getInstance().setDownloadList(giftBeanList); + GiftCacheUtil.getInstance().setCallback(new CommonCallback() { + int index=0; + @Override + public void callback(File bean) { + if(bean!=null){ + index++; + Bus.get().post(new GiftCacheUtil.GiftDownloadStatus(index, giftBeanList.size(), GiftCacheUtil.getIdForFileName(bean.getName()))); + } + } + }); + GiftCacheUtil.getInstance().resetStatus(); + GiftCacheUtil.getInstance().downloadAllGift(); + } + } + + }); + } } diff --git a/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java b/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java index 1b9d740f2..268d52c36 100644 --- a/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java @@ -62,6 +62,10 @@ public class GiftTopAdapter extends RecyclerView.Adapter { } } + public void setChoice(int choice) { + this.choice = choice; + } + @NonNull @Override public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java index c3ea818a6..3303cd246 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java @@ -12,8 +12,11 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.view.animation.LinearInterpolator; import android.view.animation.ScaleAnimation; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import com.yunbao.common.CommonAppConfig; @@ -22,10 +25,13 @@ import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean2; import com.yunbao.common.custom.MyRadioButton; 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.live.R; import com.yunbao.live.custom.GiftMarkView; +import java.io.File; import java.util.List; /** @@ -43,10 +49,10 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { private int mCheckedPosition = -1; private ScaleAnimation mAnimation; private View mAnimView; - private String mName1,mName2; + private String mName1, mName2; - public LiveGiftAdapter(Context context,LayoutInflater inflater, List list, String coinName) { - mContext=context; + public LiveGiftAdapter(Context context, LayoutInflater inflater, List list, String coinName) { + mContext = context; mInflater = inflater; mList = list; mCoinName = coinName; @@ -65,6 +71,7 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { mActionListener.onCancel(); } } + bean.setChecked(true); notifyItemChanged(position, Constants.PAYLOAD); View view = bean.getView(); @@ -109,6 +116,10 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { return mList.size(); } + public List getList() { + return mList; + } + /** * 取消选中 */ @@ -160,6 +171,9 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { TextView tvRedpoint; ImageView mPayico; TextView expire; + ImageView mLoading; + LinearLayout mLoadingLayout; + public Vh(View itemView) { super(itemView); mMark = (GiftMarkView) itemView.findViewById(R.id.mark); @@ -169,65 +183,81 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { mRadioButton = (MyRadioButton) itemView.findViewById(R.id.radioButton); tvRedpoint = (TextView) itemView.findViewById(R.id.tvRedpoint); mPayico = (ImageView) itemView.findViewById(R.id.pay_ico); - expire = (TextView)itemView.findViewById(R.id.expire); + expire = (TextView) itemView.findViewById(R.id.expire); mRadioButton.setOnClickListener(mOnClickListener); + mLoading = itemView.findViewById(R.id.gift_loading); + mLoadingLayout = itemView.findViewById(R.id.gift_loading_layout); + mLoadingLayout.setOnClickListener(v -> { + mLoading.setImageResource(R.mipmap.icon_loading_gift); + Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_loading_gift); + animation.setRepeatMode(Animation.RESTART); + animation.setRepeatCount(Animation.INFINITE); + animation.setInterpolator(new LinearInterpolator()); + mLoading.startAnimation(animation); + LiveGiftBean bean = mList.get((Integer) v.getTag()); + GiftCacheUtil.getInstance().pause(); + GiftCacheUtil.getInstance().downloadGiftForId(bean, new CommonCallback() { + @Override + public void callback(File bean) { + mLoadingLayout.setVisibility(View.GONE); + GiftCacheUtil.getInstance().restart(); + } + }); + }); } void setData(LiveGiftBean bean, int position, Object payload) { - if( IMLoginManager.get(mContext).isNewUserGif()== true) { - if (position == 0 && bean.getTag()!=null) { + if (IMLoginManager.get(mContext).isNewUserGif()) { + if (position == 0 && bean.getTag() != null) { mRadioButton.setBackgroundResource(R.mipmap.live_gift_light_bg); } } if (payload == null) { - ImgLoader.display(mContext,bean.getIcon(), mIcon); + ImgLoader.display(mContext, bean.getIcon(), mIcon); bean.setView(mIcon); mName.setText(bean.getName()); - if (bean.getSendType() != null && bean.getSendType().equals("1")) - { + if (bean.getSendType() != null && bean.getSendType().equals("1")) { // mCoinName = mName2; mPayico.setImageResource(R.mipmap.gold_coin); - }else { + } else { // mCoinName = mName1; mPayico.setImageResource(R.mipmap.diamond); } mPrice.setText(bean.getPrice()); - if (IMLoginManager.get(mContext).isNewUserGif() == true && position == 0 && bean.getTag() != null) { + if (IMLoginManager.get(mContext).isNewUserGif() && position == 0 && bean.getTag() != null) { mPayico.setVisibility(View.GONE); mPrice.setText(R.string.free); mPrice.setTextColor(Color.parseColor("#FFF269")); } expire.setVisibility(View.GONE); - if(bean.getEnd_time()!=null){ + if (bean.getEnd_time() != null) { expire.setVisibility(View.VISIBLE); expire.setText(bean.getEnd_time()); } //包裹数量 - if (!TextUtils.isEmpty(bean.getGiftNum())){ + if (!TextUtils.isEmpty(bean.getGiftNum())) { try { tvRedpoint.setVisibility(View.VISIBLE); tvRedpoint.setText(bean.getGiftNum()); - }catch (Exception e){e.printStackTrace();} + } catch (Exception e) { + e.printStackTrace(); + } } - int mark=bean.getMark(); + int mark = bean.getMark(); - if (bean.getSwf()!=null&&!bean.getSwf().contains("svga")) { - if (mark== LiveGiftBean2.MARK_HOT) { + if (bean.getSwf() != null && !bean.getSwf().contains("svga")) { + if (mark == LiveGiftBean2.MARK_HOT) { mMark.setIconRes(R.mipmap.icon_live_gift_hot, 0); - } - else if (mark == LiveGiftBean2.MARK_GUARD) { + } else if (mark == LiveGiftBean2.MARK_GUARD) { mMark.setIconRes(R.mipmap.icon_live_gift_guard, 0); - } - else if (mark == LiveGiftBean2.MARK_LUCK) { + } else if (mark == LiveGiftBean2.MARK_LUCK) { mMark.setIconRes(R.mipmap.icon_live_gift_luck, 0); - } - else if (bean.getIsweek()!=null&&bean.getIsweek().equals("1")) { - mMark.setIconRes(0,R.mipmap.icon_live_gift_weekstar); - } - else { + } else if (bean.getIsweek() != null && bean.getIsweek().equals("1")) { + mMark.setIconRes(0, R.mipmap.icon_live_gift_weekstar); + } else { mMark.setIconRes(0, 0); } } else { @@ -235,14 +265,11 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { mMark.setIconRes(R.mipmap.icon_live_gift_hot, R.mipmap.icon_live_gift_hao); } else if (mark == LiveGiftBean2.MARK_GUARD) { mMark.setIconRes(R.mipmap.icon_live_gift_guard, R.mipmap.icon_live_gift_hao); - } - else if (mark == LiveGiftBean2.MARK_LUCK) { + } else if (mark == LiveGiftBean2.MARK_LUCK) { mMark.setIconRes(R.mipmap.icon_live_gift_luck, R.mipmap.icon_live_gift_hao); - } - else if (bean.getIsweek()!=null && bean.getIsweek().equals("1")) { - mMark.setIconRes(0,R.mipmap.icon_live_gift_weekstar); - } - else { + } else if (bean.getIsweek() != null && bean.getIsweek().equals("1")) { + mMark.setIconRes(0, R.mipmap.icon_live_gift_weekstar); + } else { mMark.setIconRes(0, R.mipmap.icon_live_gift_hao); } @@ -250,6 +277,12 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { } mRadioButton.setTag(position); mRadioButton.doChecked(bean.isChecked()); + if (bean.getSwf().isEmpty()) { + mLoadingLayout.setVisibility(View.GONE); + return; + } + mLoadingLayout.setVisibility(GiftCacheUtil.checkGiftIsDownload(bean.getId()) ? View.GONE : View.VISIBLE); + mLoadingLayout.setTag(position); } } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveGiftPagerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveGiftPagerAdapter.java index 7990d971f..062e6889a 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveGiftPagerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveGiftPagerAdapter.java @@ -1,9 +1,11 @@ package com.yunbao.live.adapter; import android.content.Context; + import androidx.viewpager.widget.PagerAdapter; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; + import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -23,12 +25,12 @@ public class LiveGiftPagerAdapter extends PagerAdapter { private Context mContext; private List mViewList; - private static final int GIFT_COUNT = 10;//每页10个礼物 + private static final int GIFT_COUNT = 8;//每页8个礼物 private int mPage = -1; private ActionListener mActionListener; public LiveGiftPagerAdapter(Context context, List giftList) { - mContext=context; + mContext = context; mViewList = new ArrayList<>(); int fromIndex = 0; int size = giftList.size(); @@ -60,7 +62,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter { for (int i = 0; i < pageCount; i++) { RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.view_gift_page, null, false); recyclerView.setHasFixedSize(true); - recyclerView.setLayoutManager(new GridLayoutManager(context, 5, GridLayoutManager.VERTICAL, false)); + recyclerView.setLayoutManager(new GridLayoutManager(context, 4, GridLayoutManager.VERTICAL, false)); int endIndex = fromIndex + GIFT_COUNT; if (endIndex > size) { endIndex = size; @@ -71,7 +73,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter { bean.setPage(i); list.add(bean); } - LiveGiftAdapter adapter = new LiveGiftAdapter(mContext,inflater, list, coinName); + LiveGiftAdapter adapter = new LiveGiftAdapter(mContext, inflater, list, coinName); adapter.setActionListener(actionListener); recyclerView.setAdapter(adapter); mViewList.add(recyclerView); @@ -79,7 +81,26 @@ public class LiveGiftPagerAdapter extends PagerAdapter { } } - public void notifyRefresh(){ + /** + * 刷新指定礼物id的item 界面 + * @param giftId + */ + public void refreshId(int giftId) { + for (RecyclerView recyclerView : mViewList) { + RecyclerView.Adapter adapter = recyclerView.getAdapter(); + if (adapter instanceof LiveGiftAdapter) { + for (int i = 0; i < ((LiveGiftAdapter) adapter).getList().size(); i++) { + if(((LiveGiftAdapter) adapter).getList().get(i).getId()==giftId){ + adapter.notifyItemChanged(i); + return; + } + } + } + } + } + + + public void notifyRefresh() { if (mViewList != null) { for (RecyclerView recyclerView : mViewList) { LiveGiftAdapter adapter = (LiveGiftAdapter) recyclerView.getAdapter(); @@ -89,7 +110,8 @@ public class LiveGiftPagerAdapter extends PagerAdapter { } } } - public void notifyRefresh(int position){ + + public void notifyRefresh(int position) { if (mViewList != null) { for (RecyclerView recyclerView : mViewList) { LiveGiftAdapter adapter = (LiveGiftAdapter) recyclerView.getAdapter(); @@ -100,6 +122,7 @@ public class LiveGiftPagerAdapter extends PagerAdapter { } } + @Override public int getCount() { return mViewList.size(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index 08b8fa9ae..de0fd975b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -1,5 +1,6 @@ package com.yunbao.live.dialog; +import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -13,6 +14,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.RadioButton; import android.widget.RadioGroup; @@ -38,9 +41,12 @@ import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.GiftCacheUtil; +import com.yunbao.common.utils.NobleUtil; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.adapter.GiftTopAdapter; @@ -51,9 +57,10 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.ToolsButton; -import com.yunbao.live.views.LiveRoomViewHolder; import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.List; @@ -110,10 +117,16 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On private LiveGiftBean mBeanFromWish; private RecyclerView items; + private LinearLayout mVipGold; private GiftTopAdapter giftTopAdapter; public int type = 0; private static String type_name = "熱門"; - JSONArray lsit; + JSONArray list; + private ImageView mVipGoldIcon; + private TextView mVipGoldTitle; + private TextView mVipGoldDesc; + private TextView mGiftPackage; + @Override protected int getLayoutId() { @@ -172,32 +185,16 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On giftTopAdapter.notifyDataSetChanged(); type = position; type_name = bean.getName(); - if (!bean.getName().equals(WordUtil.getString(R.string.live_wrap))) { - upData(); - //点击礼物,展示礼物列表 - mCurrentId = 0; - if (mViewPager != null) { - mViewPager.setVisibility(View.VISIBLE); - mRadioGroup.setVisibility(View.VISIBLE); - } - if (mVPWrapList != null) { - mVPWrapList.setVisibility(View.GONE); - mRGroupWrap.setVisibility(View.GONE); - } - - } else { - - //点击包裹,展示包裹列表 - mCurrentId = 1; - loadWrapListData(); - if (mViewPager != null) { - mViewPager.setVisibility(View.GONE); - mRadioGroup.setVisibility(View.GONE); - } - if (mVPWrapList != null) { - mVPWrapList.setVisibility(View.VISIBLE); - mRGroupWrap.setVisibility(View.VISIBLE); - } + upData(); + //点击礼物,展示礼物列表 + mCurrentId = 0; + if (mViewPager != null) { + mViewPager.setVisibility(View.VISIBLE); + mRadioGroup.setVisibility(View.VISIBLE); + } + if (mVPWrapList != null) { + mVPWrapList.setVisibility(View.GONE); + mRGroupWrap.setVisibility(View.GONE); } }); mViewPager.setOffscreenPageLimit(5); @@ -249,7 +246,14 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mCoin.setOnClickListener(this); mTvGoCharge.setOnClickListener(this); mTvGoldCoin.setOnClickListener(this); - mRootView.findViewById(R.id.btn_luck_gift_tip).setOnClickListener(this); + mVipGold = mRootView.findViewById(R.id.btn_luck_gift_tip); + mVipGoldIcon = mRootView.findViewById(R.id.vipGoldIcon); + mVipGoldTitle = mRootView.findViewById(R.id.vipGoldTitle); + mVipGoldDesc = mRootView.findViewById(R.id.vipGoldDesc); + mVipGold.setOnClickListener(this); + mGiftPackage= mRootView.findViewById(R.id.btn_gift_package); + mGiftPackage.setOnClickListener(this); + mRootView.findViewById(R.id.live_gift_download_all).setOnClickListener(this); mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -274,7 +278,25 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On by = bundle.getString("by"); } loadGiftListData(); + loadUserVip(); + } + /** + * 设置贵族状态 + */ + private void loadUserVip() { + String userData = SpUtil.getStringValue("userData"); + if (userData != null && !userData.isEmpty()) { + JSONObject user = JSONObject.parseObject(userData); + int nobleId = user.getIntValue("noble_id"); + int resId = NobleUtil.nobleIdToImageResId(nobleId); + if(resId!=-1){ + mVipGoldIcon.setImageResource(resId); + mVipGoldTitle.setText(user.getString("noble_name")); + mVipGoldDesc.setText("前往貴族中心"); + } + + } } private void loadGiftListData() { @@ -285,25 +307,27 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On String giftListJson = CommonAppConfig.getInstance().getGiftListJson(); if (!TextUtils.isEmpty(giftListJson)) { try { - lsit = JSON.parseArray(giftListJson); + list = JSON.parseArray(giftListJson); + Bus.getOn(this); } catch (Exception e) { e.printStackTrace(); } } } - if (lsit == null) { + if (list == null) { LiveHttpUtil.getNewGiftList(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { JSONObject obj = JSON.parseObject(info[0]); - lsit = obj.getJSONArray("listarray"); + list = obj.getJSONArray("listarray"); Log.i("tttts", obj.getString("listarray") + ""); CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); upData(); mCoin.setText(obj.getString("coin")); mTvGoldCoin.setText(obj.getString("gold")); + Bus.getOn(LiveGiftDialogFragment.this); } } @@ -331,56 +355,50 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On public void upData() { List name = new ArrayList<>(); - for (int i = 0; i < lsit.size(); i++) { - JSONObject data = lsit.getJSONObject(i); + for (int i = 0; i < list.size(); i++) { + JSONObject data = list.getJSONObject(i); GiftTopBean giftTopBean = new GiftTopBean(); giftTopBean.setName(data.getString("name")); name.add(giftTopBean); } - GiftTopBean data = new GiftTopBean(); - data.setName(WordUtil.getString(R.string.live_wrap)); - name.add(data); giftTopAdapter.setList(name); - JSONObject obj2 = lsit.getJSONObject(type); + JSONObject obj2 = list.getJSONObject(type); String giftJson = obj2.getString("giftlist"); List list = JSON.parseArray(giftJson, LiveGiftBean.class); showGiftList(list); + mGiftPackage.setTextColor(Color.parseColor("#FFFFFF")); } private void loadWrapListData() { - List wrapList = null; - if (wrapList == null) { - LiveHttpUtil.getWrapList(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - String giftJson = obj.getString("giftlist"); - List list = JSON.parseArray(giftJson, LiveGiftBean.class); - int size = list.size(); - if (size <= 0) { - mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.wrap_empty)); - } else { - mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.bg_gift_list)); - } - showWrapList(list); + LiveHttpUtil.getWrapList(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + String giftJson = obj.getString("giftlist"); + List list = JSON.parseArray(giftJson, LiveGiftBean.class); + int size = list.size(); + if (size <= 0) { + mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.wrap_empty)); + } else { + mVPWrapList.setBackground(getResources().getDrawable(R.mipmap.bg_gift_list)); } + showWrapList(list); } + } - @Override - public void onFinish() { - if (mLoading != null) { - mLoading.setVisibility(View.INVISIBLE); - } + @Override + public void onFinish() { + if (mLoading != null) { + mLoading.setVisibility(View.INVISIBLE); } - }); - } else { - } + } + }); } private void showGiftList(List list) { - if (IMLoginManager.get(mContext).isNewUserGif() == true && type_name.equals("熱門") || type_name.equals("Hot")) { + if (IMLoginManager.get(mContext).isNewUserGif() && type_name.equals("熱門") || type_name.equals("Hot")) { list.add(0, bean1); if (mWishGiftId == null) { mWishGiftId = "" + bean1.getId(); @@ -438,10 +456,14 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } mRGroupWrap.addView(radioButton); } + mGiftPackage.setTextColor(Color.parseColor("#FFBE41")); + giftTopAdapter.setChoice(-1); + giftTopAdapter.notifyDataSetChanged(); } @Override public void onDestroy() { + Bus.getOff(this); if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); } @@ -482,11 +504,21 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } else if (i == R.id.btn_luck_gift_tip) { dismiss(); ((LiveActivity) mContext).openLuckGiftTip(); - + } else if (i == R.id.btn_gift_package) { + //点击包裹,展示包裹列表 + mCurrentId = 1; + loadWrapListData(); + if (mViewPager != null) { + mViewPager.setVisibility(View.GONE); + mRadioGroup.setVisibility(View.GONE); + } + if (mVPWrapList != null) { + mVPWrapList.setVisibility(View.VISIBLE); + mRGroupWrap.setVisibility(View.VISIBLE); + } } } - //包裹列表局部刷新 private void refreshWrapListAfterSend() { if (mObjGiftSendback != null) { @@ -668,6 +700,14 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } } + /** + * 收到礼物下载完成的通知 + * @param status + */ + @Subscribe(threadMode = ThreadMode.MAIN) + public void updateDownload(GiftCacheUtil.GiftDownloadStatus status) { + mLiveGiftPagerAdapter.refreshId(status.getId()); + } private class SendGiftCallback extends HttpCallback { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index b4dfb8738..341571bac 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -53,11 +53,16 @@ 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; + } + /** * 弹出全屏对话框 * @@ -195,7 +200,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment { @JavascriptInterface public String androidMethodClickUser(String userId, String liveId) { - if(mContext instanceof LiveRyAnchorActivity){ + if (mContext instanceof LiveRyAnchorActivity) { return ""; } //点击用户头像 @@ -226,7 +231,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment { @JavascriptInterface public void androidMethodLookToLive(String liveId) { - if(mContext instanceof LiveRyAnchorActivity){ + if (mContext instanceof LiveRyAnchorActivity) { return; } mWebView.post(new Runnable() { @@ -257,6 +262,20 @@ public class LiveHDDialogFragment extends AbsDialogFragment { mContext.startActivity(intent); } + + @JavascriptInterface + public void androidShowUserPreferentialRedDot() { + if (webInterface != null) { + webInterface.showUserPreferentialRedDot(); + } + } + + @JavascriptInterface + public void androidHideUserPreferentialRedDot() { + if (webInterface != null) { + webInterface.hideUserPreferentialRedDot(); + } + } } private LiveRoomCheckLivePresenter mCheckLivePresenter; @@ -324,4 +343,12 @@ public class LiveHDDialogFragment extends AbsDialogFragment { //结束webview的加载 mWebView.destroy(); } + + public abstract static class WebInterface { + public void showUserPreferentialRedDot() { + } + + public void hideUserPreferentialRedDot() { + } + } } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java index 023586bed..3649807e9 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java @@ -38,7 +38,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; -import com.yunbao.common.utils.GifCacheUtil; +import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.live.R; @@ -442,7 +442,7 @@ public class LiveEnterRoomAnimPresenter { playText = car.getUser_nicename() + mContext.getResources().getString(R.string.enter_room); } if (IMLoginManager.get(mContext).isMountEffect()) { - GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", mDownloadGifCallback); + GiftCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", mDownloadGifCallback); } else { mIsAnimating = false; } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index 252bebc1d..91ece6f48 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -43,7 +43,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; -import com.yunbao.common.utils.GifCacheUtil; +import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; @@ -1132,7 +1132,7 @@ public class LiveGiftAnimPresenter { } }); } else { - GifCacheUtil.getFile(Constants.GIF_GIFT_PREFIX + bean.getGiftId(), url, "1", mDownloadGifCallback); + GiftCacheUtil.getFile(Constants.GIF_GIFT_PREFIX + bean.getGiftId(), url, "1", mDownloadGifCallback); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index a157b1f6f..9ecb96a00 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -78,6 +78,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private String nobleName, nobleTtext; private ImageView giftImage, liveNewPeople; private String newPeopleUrl = null; + private View mNewPeopleRedDot; public LiveAudienceViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -194,6 +195,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { svga_new_user_follow = (SVGAImageView) findViewById(R.id.svga_new_user_follow); viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner); stationHornBanner = findViewById(R.id.station_horn_banner); + mNewPeopleRedDot = findViewById(R.id.live_new_people_red_dot); liveNewPeople.setOnClickListener(this); svga_new_user_double.setOnClickListener(new View.OnClickListener() { @Override @@ -358,6 +360,19 @@ 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"); } @@ -391,6 +406,13 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } } + /** + * 显示/隐藏新人特惠礼物红点 + * @param show true显示 false隐藏 + */ + private void setUserPreferentialRedDot(boolean show){ + mNewPeopleRedDot.setVisibility(show?View.VISIBLE:View.GONE); + } /** * 退出直播间 */ diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index eff91cd4e..a22e75200 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1548,7 +1548,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } - //右上角显示对方主播头像及昵称 + //左上角显示对方主播头像及昵称 public void setOtherInfo(String touids, String url, String name) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { diff --git a/live/src/main/res/anim/anim_loading_gift.xml b/live/src/main/res/anim/anim_loading_gift.xml new file mode 100644 index 000000000..f66388842 --- /dev/null +++ b/live/src/main/res/anim/anim_loading_gift.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift.xml b/live/src/main/res/drawable/bg_live_gift.xml new file mode 100644 index 000000000..0f713fa4a --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_buy.xml b/live/src/main/res/drawable/bg_live_gift_buy.xml new file mode 100644 index 000000000..a4e416086 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift_buy.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_download_all.xml b/live/src/main/res/drawable/bg_live_gift_download_all.xml new file mode 100644 index 000000000..5a263ed01 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift_download_all.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_items.xml b/live/src/main/res/drawable/bg_live_gift_items.xml new file mode 100644 index 000000000..ab8df02fd --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift_items.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_package_line.xml b/live/src/main/res/drawable/bg_live_gift_package_line.xml new file mode 100644 index 000000000..662427256 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift_package_line.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_vip_gold.xml b/live/src/main/res/drawable/bg_live_vip_gold.xml new file mode 100644 index 000000000..3ac1e0560 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_vip_gold.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index 77e4ce720..2d9d4abe3 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -1,239 +1,315 @@ - - - - + - - - - - - - - - - + android:id="@+id/live_gift_download_all" + android:layout_width="155dp" + android:layout_height="32dp" + android:layout_marginStart="12dp" + android:layout_alignParentStart="true" + android:background="@drawable/bg_live_gift_download_all" + android:gravity="center" + android:visibility="invisible" + android:orientation="horizontal"> - + - - - + + + + + + - - - - - - - - - - - - - + - - - - + android:layout_height="match_parent" + android:layout_gravity="center" + android:textColor="#FFFFFF" + android:text="開通貴族" + android:textSize="11.52sp" /> + + - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_live_gift.xml b/live/src/main/res/layout/item_live_gift.xml index 01c6b3863..741e89bb1 100644 --- a/live/src/main/res/layout/item_live_gift.xml +++ b/live/src/main/res/layout/item_live_gift.xml @@ -3,8 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent" - app:mfl_ratio="1.25" + android:layout_height="wrap_content" + android:background="@drawable/bg_live_gift_items" > + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 2cbe474d2..2c0fa5c85 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -348,14 +348,39 @@ android:src="@mipmap/live_lw" /> + android:visibility="gone" /> + + + + + + + diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_download_gift.png b/live/src/main/res/mipmap-xxxhdpi/icon_download_gift.png new file mode 100644 index 0000000000000000000000000000000000000000..bd09b6126198efd0465e844736c3d206b54b017b GIT binary patch literal 6180 zcmV+<7~AKGP)Py1-bqA3RCr$PT?=>=RhB-tsyi_;1O*`oLekyUO^mNum{GwO>-hQ<9CTG2AK$V( z714op(N%OrMx0Uct@y$hqo9D|+f`9fS6u~177-!+AVL6nD6asWPIsOC{<1oogid!= zcXg+l^!>hkL369>-t*sc?z!i61sxzwQIuj?mW%f7+vn)grAzmH`}X-{S@uSwQMan9 zWe$f!5<)nLNMdGL2q6;@GqWm$h!T;?%&|x$5-Tby`h|!BMC8ZsrlzKbva+(Kl9H0f zZ@&4aDc?yZ@^}JLb#-;WXf#?yL>?hTH8b}kqMk%lLPSMG~m+&CC-1&CCE8Kf8(OCn8#_s_JSnkHumiu3fwKJFF9nzL(Y4*dFwn znwp|WB+^%wb#sg^@_)^}4z`ELdAKTYx@r;6UfkKmXjv z;cyHWLJVc*3L1%)yj1n7H^5MnhEEfhk0P+MEOorq$Yy*9I_I~;Vk+wGGi>2e{& zU>$7j_>|eSZ1*&dh&V#5W#*4$S)Ny0Tf42JM%j^|3q?_`BBG0ls630BcSq4S(RV>_ z93eLm(L;W}e{n|)t|LH~tE#Gwk!5+35aKsPWLqsai-3Ucum${=s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+YbhVgM%GXEJj0t$Y?!7PyJF-EWIRY8!NBl6Z1VG z&$iNpGqj|mT~6m#j}!r{v2Y!Ytb5*EOT2B?qsXLhM~m18&_Bl>Zu_co8%-Kc4|Mm=%^h3$ zqVuXtM}DfTu#zr$ZYKY$W+DP?DN(7(S1M)dNVbhtUSEd;$7i~|S_-$%ev^DUU#g4P zJF2B*txG>~Y)U(qx(SlGdjj$IVOp_K8JY6%!^`NR=eF_gnyFwsjkI?v3QpH7d8JsK zTneaf`91vNEj04Q!|o8`9XE;^ET>JR&$-IQ1#3YjD#bR^h8w2cQpPYwccSAn5=_~H zbkhYiZq+f~^S$9Hrk0>*=5kTfqNrOE;u_I15$Yx%90%iOWRI_>Gh27tiFeH2iIhJ^ z7NN#p65?5lP`Q6wng6-kYrfo1slZtd!#jF}^a2to;1e4EloqDt zPO1$Lka1+kt$mO#RG~T3(G", list.get(j).getGiftname() + list.get(j).getSwf()); - GifCacheUtil.getFile(Constants.GIF_GIFT_PREFIX + list.get(j).getId(), list.get(j).getSwf(), "0", new CommonCallback() { + GiftCacheUtil.getFile(Constants.GIF_GIFT_PREFIX + list.get(j).getId(), list.get(j).getSwf(), "0", new CommonCallback() { @Override public void callback(File bean) { @@ -793,7 +788,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene Log.e("tx", id); - GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { + GiftCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { @Override public void callback(File bean) { // Log.e("111",bean.getPath()+"是"); @@ -871,7 +866,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public void onViewPagerScroll(String str) { if ("oneUesrOver".equals(str)) { if (IMLoginManager.get(mContext).isisNewUserOne() == false) { - getD(); + //getD(); //取消在首页下载礼物svga操作 } } } diff --git a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java index 77fed05c4..bce0b84e1 100644 --- a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java @@ -42,7 +42,7 @@ import com.yunbao.common.interfaces.ActivityResultCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.ImageResultCallback; import com.yunbao.common.utils.DpUtil; -import com.yunbao.common.utils.GifCacheUtil; +import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.RouteUtil; @@ -204,7 +204,7 @@ public class RewardActivity extends AbsActivity { } else { url1 = svg; } - GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { + GiftCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { @Override public void callback(File bean) { diff --git a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java index 841d7ea18..29e8e3a96 100644 --- a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java @@ -37,7 +37,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; -import com.yunbao.common.utils.GifCacheUtil; +import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; @@ -196,7 +196,7 @@ public class ZhuangBanActivity extends AbsActivity { } else { url1 = svg; } - GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { + GiftCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback() { @Override public void callback(File bean) { diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 9e49a4473..d4917458d 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -237,6 +237,7 @@ public class MainHttpUtil { if (code == 0 && info.length > 0) { IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).upDataUserInfo(info[0]); JSONObject obj = JSON.parseObject(info[0]); + SpUtil.setStringValue("userData",info[0]); UserBean bean = JSON.toJavaObject(obj, UserBean.class); bean.setMedalName(obj.getString("medal_name")); bean.setMedalLevel(obj.getIntValue("medal_level"));