admin
2021-12-22 0a1336cd2b95126d66d6f3126cb48a446cdbfad1
app/src/com/hanju/video/app/ui/recommend/RecommendNewAdapter.java
@@ -36,6 +36,7 @@
import com.hanju.video.app.ui.media.VideoDetailActivity;
import com.hanju.video.app.ui.video.VideoAlbumAdapter;
import com.hanju.video.app.ui.video.VideoColumn2Adapter;
import com.hanju.video.app.util.JsonUtil;
import com.hanju.video.app.util.ad.AdUtil;
import com.hanju.video.app.util.ad.ExpressAdManager;
import com.hanju.video.app.util.video.VideoUtil;
@@ -247,10 +248,8 @@
                                intent = new Intent(v.getContext(), StarsActivity.class);
                                v.getContext().startActivity(intent);
                            } else {
                                Gson gson = new GsonBuilder()
                                        .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
                                        .create();
                                VideoType type = gson.fromJson(homeType.getParams().replace(
                                VideoType type =  JsonUtil.videoGson.fromJson(homeType.getParams().replace(
                                        "\\" + "\"", "\""), VideoType.class);
                                try {
                                    intent = new Intent(v.getContext(), Class.forName(homeType.getActivity()));
@@ -386,19 +385,26 @@
            if (needAd) {
                if (expressAdManager == null)
                    expressAdManager = new ExpressAdManager(AdUtil.getSmallExpressAdType(), mContext);
                expressAdManager.loadRecommendSmallAd(new ExpressAdManager.IAdLoadListener() {
                    @Override
                    public void onSuccess(List<ExpressAdContainer> adList) {
                        if (adList != null && adList.size() > 0) {
                            if (contentList != null && contentList.size() > 0 && contentList.get(0).getType() == HomeTypeContent.TYPE_CONTENT) {
                                contentList.add(0, new HomeTypeContent(HomeTypeContent.TYPE_AD, adList.get(0)));
                                notifyDataSetChanged();
                if (expressAdManager == null) {
                    try {
                        expressAdManager = new ExpressAdManager(AdUtil.getSmallExpressAdType(), mContext);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (expressAdManager != null)
                    expressAdManager.loadRecommendSmallAd(new ExpressAdManager.IAdLoadListener() {
                        @Override
                        public void onSuccess(List<ExpressAdContainer> adList) {
                            if (adList != null && adList.size() > 0) {
                                if (contentList != null && contentList.size() > 0 && contentList.get(0).getType() == HomeTypeContent.TYPE_CONTENT) {
                                    contentList.add(0, new HomeTypeContent(HomeTypeContent.TYPE_AD, adList.get(0)));
                                    notifyDataSetChanged();
                                }
                            }
                        }
                    }
                });
                    });
            }