admin
2022-01-28 760aee20870a34e6130a1c12237c5b747e2b00bd
library-search/src/main/java/com/yeshi/ec/search/ui/SearchResultActivity.java
@@ -37,12 +37,15 @@
import com.qq.e.ads.nativ.NativeUnifiedAD;
import com.qq.e.ads.nativ.NativeUnifiedADData;
import com.qq.e.comm.util.AdError;
import com.yeshi.base.entity.ad.AdPositionEnum;
import com.yeshi.base.entity.ad.ExpressAdContainer;
import com.yeshi.base.entity.video.VideoContent;
import com.yeshi.base.entity.video.VideoInfo;
import com.yeshi.base.entity.video.VideoType;
import com.yeshi.base.ui.BaseActivity;
import com.yeshi.base.utils.JsonUtil;
import com.yeshi.base.utils.RouteConstant;
import com.yeshi.base.utils.ad.AdUtil;
import com.yeshi.base.utils.ad.ExpressAdManager;
import com.yeshi.base.utils.ad.GDTConstant;
import com.yeshi.base.utils.http.BasicTextHttpResponseHandler;
@@ -417,15 +420,23 @@
        if (albumCount >= 1) {
            VideoContent videoContent = VideoContent.createAdContent(adList.get(0));
            mVideoInfos.add(1, videoContent);
            adapter.notifyItemInserted(1);
            mVideoInfos.add(0, videoContent);
            adapter.notifyDataSetChanged();
            rl_search_result.post(new Runnable() {
                @Override
                public void run() {
                    rl_search_result.scrollTo(0,0);
                }
            });
        }
    }
    //拉取2.0的自渲染广告
    private void loadAd() {
        //TODO 填充广告ID
        if (AdUtil.getAdType(getApplicationContext(), AdPositionEnum.other) == null)
            return;
        String pid = GDTConstant.PID_2_SEARCH_RESULT_ALBUM;
        NativeUnifiedAD mAdManager = new NativeUnifiedAD(this, pid, new NativeADUnifiedListener() {
@@ -483,11 +494,8 @@
                            throws Exception {
                        if (jsonObject.getBoolean("IsPost")) {
                            Gson gson = new GsonBuilder().setFieldNamingPolicy(
                                    FieldNamingPolicy.UPPER_CAMEL_CASE)
                                    .create();
                            JSONObject rootData = jsonObject.getJSONObject("Data");
                            List<VideoInfo> videoInfos = gson.fromJson(
                            List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson(
                                    rootData.getJSONArray("data").toString(),
                                    new TypeToken<List<VideoInfo>>() {
@@ -496,7 +504,7 @@
                            //设置导航栏
                            if (rootData.opt("typeList") != null) {
                                if (typeList == null) {
                                    typeList = gson.fromJson(
                                    typeList = JsonUtil.videoGson.fromJson(
                                            rootData
                                                    .getJSONArray("typeList").toString(),
                                            new TypeToken<List<VideoType>>() {