QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 NovelShelfBannerController.java 源代码,内容仅作参考


package com.tencent.mtt.external.novel.home;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.qq.e.comm.constants.Constants;
import com.taf.JceUtil;
import com.tencent.common.http.HttpHeader;
import com.tencent.common.task.TaskManager;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.common.utils.bitmap.BitmapUtils;
import com.tencent.common.utils.bitmap.QImageParams;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.task.PictureTask;
import com.tencent.mtt.base.task.Task;
import com.tencent.mtt.base.task.TaskObserver;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.wup.GUIDManager;
import com.tencent.mtt.external.novel.INovelContext;
import com.tencent.mtt.external.novel.INovelShelfBannerController;
import com.tencent.mtt.external.novel.base.MTT.ShelfBanner;
import com.tencent.mtt.external.novel.base.MTT.stShelfBanner;
import com.tencent.mtt.external.novel.base.MTT.stShelfBannerEx;
import com.tencent.mtt.external.novel.base.tools.NovelContext;
import com.tencent.mtt.external.novel.ui.inter.INovelShelfListView;
import com.tencent.mtt.hippy.qb.modules.offlineResource.HippyOfflineResourceZipUtils;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import qb.a.f;

public class NovelShelfBannerController implements Handler.Callback, INovelShelfBannerController {

    NovelContext f55142a;

    NovelShelfBannerDataLayer f55143b;

    HashSet<IListener> f55145d = new HashSet<>();

    Handler f55144c = new Handler(Looper.getMainLooper(), this);

    public interface IListener {
        void a(int i);
    }

    public static class NovelShelfBannerDataLayer implements Handler.Callback, TaskObserver {

        NovelContext f55156a;

        NovelShelfBannerStorage f55157b;

        Handler f55159d;
        boolean e = false;
        ShelfBanner f = null;
        String g = "";
        String h = "";
        String i = "";
        ShelfBanner j = null;
        final Bitmap[] k = {null, null};

        Handler f55158c = new Handler(BrowserExecutorSupplier.getLooperForRunLongTime(), this);

        public NovelShelfBannerDataLayer(NovelContext novelContext, Handler handler) {
            this.f55156a = novelContext;
            this.f55157b = new NovelShelfBannerStorage(novelContext);
            this.f55159d = handler;
            this.f55158c.obtainMessage(4).sendToTarget();
        }

        static stShelfBannerEx a(ShelfBanner shelfBanner, int i) {
            if (shelfBanner != null && shelfBanner.vecBanners != null) {
                Iterator<stShelfBannerEx> it = shelfBanner.vecBanners.iterator();
                while (it.hasNext()) {
                    stShelfBannerEx next = it.next();
                    if (a(next) && next.banner.eType != 5) {
                        return next;
                    }
                }
            }
            return null;
        }

        static void a(String str, TaskObserver taskObserver, int i, stShelfBanner stshelfbanner) {
            PictureTask pictureTask = new PictureTask(str, taskObserver, false, null, (byte) 0, "novel");
            pictureTask.f33219a = new Object[]{UrlUtils.prepareUrl(str), Integer.valueOf(i), stshelfbanner};
            pictureTask.getMttRequest().addHeader(HttpHeader.REQ.QGUID, GUIDManager.a().f());
            TaskManager.a().a((Task) pictureTask);
        }

        private boolean a(Message message) {
            ShelfBanner shelfBanner = (ShelfBanner) message.obj;
            if (StringUtils.a(this.g, shelfBanner.sBannerVer) && StringUtils.a(this.h, shelfBanner.sDynamicBannerVer) && StringUtils.a(this.i, shelfBanner.sEasterEggVer)) {
                return true;
            }
            this.g = shelfBanner.sBannerVer;
            this.h = shelfBanner.sDynamicBannerVer;
            this.i = shelfBanner.sEasterEggVer;
            if (a(this.j, shelfBanner)) {
                return true;
            }
            stShelfBannerEx[] stshelfbannerexArr = {a(this.j, 0)};
            synchronized (this) {
                this.j = shelfBanner;
            }
            this.f55157b.a(shelfBanner);
            for (int i : new int[]{0}) {
                stShelfBannerEx a2 = a(shelfBanner, i);
                if (!a(stshelfbannerexArr[i], a2) || this.k[i] == null) {
                    if (a2 != null) {
                        String str = a2.banner.sPicurl;
                        if (stshelfbannerexArr[i] == null || this.k[i] == null || !str.equals(stshelfbannerexArr[i].banner.sPicurl)) {
                            synchronized (this) {
                                this.k[i] = null;
                            }
                            this.f55157b.a(null, i);
                            a(str, this, i, a2.banner);
                        }
                    }
                    this.f55159d.obtainMessage(101, i, 0).sendToTarget();
                }
            }
            return true;
        }

        static boolean a(ShelfBanner shelfBanner, ShelfBanner shelfBanner2) {
            if (shelfBanner == null && shelfBanner2 == null) {
                return true;
            }
            if (shelfBanner == null || shelfBanner2 == null || !shelfBanner.sBannerVer.equals(shelfBanner2.sBannerVer) || shelfBanner.sDynamicBannerVer == null || shelfBanner.sEasterEggVer == null || !shelfBanner.sDynamicBannerVer.equals(shelfBanner2.sDynamicBannerVer) || !shelfBanner.sEasterEggVer.equals(shelfBanner2.sEasterEggVer)) {
                return false;
            }
            for (int i : new int[]{0}) {
                if (!a(a(shelfBanner, i), a(shelfBanner2, i))) {
                    return false;
                }
            }
            return true;
        }

        static boolean a(stShelfBannerEx stshelfbannerex) {
            stShelfBanner stshelfbanner;
            if (stshelfbannerex != null && (stshelfbanner = stshelfbannerex.banner) != null && !TextUtils.isEmpty(stshelfbanner.sPicurl) && !TextUtils.isEmpty(stshelfbanner.sRefer)) {
                if (stshelfbanner.eType == 0) {
                    return true;
                }
                if (stshelfbanner.eType == 1) {
                    return !TextUtils.isEmpty(stshelfbanner.sBrief);
                }
                if (stshelfbanner.eType == 6) {
                    if (!TextUtils.isEmpty(stshelfbanner.sPicurl) && stshelfbanner.iShowTimes > 0) {
                        return !TextUtils.isEmpty(stshelfbanner.sRefer);
                    }
                    return false;
                }
                if (stshelfbanner.eType == 5) {
                    return NovelShelfBannerController.b(stshelfbanner);
                }
            }
            return false;
        }

        static boolean a(stShelfBannerEx stshelfbannerex, stShelfBannerEx stshelfbannerex2) {
            if (stshelfbannerex == null && stshelfbannerex2 == null) {
                return true;
            }
            if (stshelfbannerex == null || stshelfbannerex2 == null || NovelShelfBannerController.d(stshelfbannerex, stshelfbannerex2)) {
                return false;
            }
            if (stshelfbannerex.banner.eType == 0) {
                return true;
            }
            if (NovelShelfBannerController.c(stshelfbannerex, stshelfbannerex2)) {
                return false;
            }
            if (stshelfbannerex.banner.eType == 4) {
                return stshelfbannerex.banner.sBrief.equals(stshelfbannerex2.banner.sBrief);
            }
            return true;
        }

        private boolean b(Message message) {
            byte[] bArr;
            Object[] objArr = (Object[]) message.obj;
            String str = (String) objArr[2];
            int intValue = ((Integer) objArr[3]).intValue();
            synchronized (this) {
                stShelfBannerEx a2 = a(this.j, intValue);
                if (a2 == null || !a2.banner.sPicurl.equals(str)) {
                    bArr = null;
                } else {
                    this.k[intValue] = (Bitmap) objArr[0];
                    bArr = JceUtil.jce2Bytes(this.j);
                }
            }
            if (bArr != null) {
                this.f55157b.a((byte[]) objArr[1], intValue);
                this.f55159d.obtainMessage(101, intValue, 0).sendToTarget();
            }
            return true;
        }

        private boolean b(stShelfBannerEx stshelfbannerex) {
            return (stshelfbannerex == null || stshelfbannerex.banner == null) ? false : true;
        }

        private boolean c() {
            ShelfBanner a2 = this.f55157b.a();
            if (a2 != null) {
                Bitmap[] bitmapArr = new Bitmap[2];
                bitmapArr[0] = null;
                bitmapArr[1] = null;
                for (int i : new int[]{0}) {
                    if (a(a2, i) != null) {
                        bitmapArr[i] = this.f55157b.a(i);
                    }
                }
                if (bitmapArr[0] != null || bitmapArr[1] != null) {
                    this.g = a2.sBannerVer;
                    this.h = a2.sDynamicBannerVer;
                    this.i = a2.sEasterEggVer;
                    synchronized (this) {
                        this.j = a2;
                        this.k[0] = bitmapArr[0];
                        this.k[1] = bitmapArr[1];
                        this.e = true;
                    }
                    for (int i2 : new int[]{0}) {
                        if (bitmapArr[i2] == null) {
                            this.f55157b.a(null, i2);
                        } else {
                            this.f55159d.obtainMessage(101, i2, 0).sendToTarget();
                        }
                    }
                    b(this.f);
                    return true;
                }
                this.g = a2.sBannerVer;
            }
            this.e = true;
            if (a2 != null && a2.vecBanners != null) {
                a2.vecBanners.clear();
            }
            this.f55157b.a(a2);
            this.f55157b.a(null, 0);
            b(this.f);
            return true;
        }

        private boolean c(Message message) {
            stShelfBannerEx a2;
            String str;
            boolean booleanValue = message.obj instanceof Boolean ? ((Boolean) message.obj).booleanValue() : false;
            int i = message.arg1;
            ShelfBanner shelfBanner = this.j;
            synchronized (this) {
                if (booleanValue) {
                    a2 = a(this.j, i);
                    str = b(a2) ? "next" : "";
                } else {
                    str = "clear";
                    a2 = null;
                }
                if (str.equals("clear")) {
                    if (this.j != null && this.j.vecBanners != null) {
                        this.j.vecBanners.clear();
                    }
                    this.j = null;
                    this.k[0] = null;
                } else if (str.equals("next")) {
                    if (this.j != null && this.j.vecBanners != null) {
                        this.j.vecBanners.remove(a2);
                    }
                    a2 = a(this.j, i);
                    this.k[i] = null;
                }
            }
            this.f55157b.a(shelfBanner);
            if (str.equals("clear")) {
                this.f55157b.a(null, 0);
                this.f55159d.obtainMessage(101, 0, 0).sendToTarget();
            }
            if (!str.equals("next")) {
                return true;
            }
            this.f55157b.a(null, i);
            if (b(a2)) {
                a(a2.banner.sPicurl, this, i, a2.banner);
                return true;
            }
            this.f55159d.obtainMessage(101, i, 0).sendToTarget();
            return true;
        }

        static boolean c(ShelfBanner shelfBanner) {
            if (shelfBanner != null && shelfBanner.vecBanners != null) {
                Iterator<stShelfBannerEx> it = shelfBanner.vecBanners.iterator();
                while (it.hasNext()) {
                    if (a(it.next())) {
                        return true;
                    }
                }
            }
            return false;
        }

        public stShelfBannerEx d() {
            synchronized (this) {
                if (this.j == null) {
                    return null;
                }
                Iterator<stShelfBannerEx> it = this.j.vecBanners.iterator();
                while (it.hasNext()) {
                    stShelfBannerEx next = it.next();
                    if (a(next) && next.banner.eType == 5) {
                        return next;
                    }
                }
                return null;
            }
        }

        stShelfBannerEx a() {
            if (this.f55156a.f54692a == 1) {
                return null;
            }
            stShelfBanner stshelfbanner = new stShelfBanner();
            stshelfbanner.iId = 0;
            stshelfbanner.sPicurl = "https://res.imtt.qq.com/bookshelf/images/shelfbanner/bookshelfIcon_180_180_adr_default_banner.png";
            stshelfbanner.sBrief = MttResources.l(R.string.am9);
            stshelfbanner.sRefer = "https://bookshelf.html5.qq.com/activity.html?ch=#!/jinpin";
            stshelfbanner.eType = 1;
            stshelfbanner.eOpenType = 1;
            stShelfBannerEx stshelfbannerex = new stShelfBannerEx();
            stshelfbannerex.banner = stshelfbanner;
            stshelfbannerex.iCanClose = 0;
            return stshelfbannerex;
        }

        public void a(ShelfBanner shelfBanner) {
            stShelfBannerEx a2 = a();
            if (TextUtils.isEmpty(shelfBanner.sBannerVer)) {
                if (a2 == null) {
                    return;
                } else {
                    shelfBanner.sBannerVer = "default_store";
                }
            }
            if (a2 != null) {
                if (shelfBanner.vecBanners == null) {
                    shelfBanner.vecBanners = new ArrayList<>();
                }
                shelfBanner.vecBanners.add(a2);
            }
            if (c(shelfBanner)) {
                if (!this.e) {
                    this.f = shelfBanner;
                    return;
                }
                if (shelfBanner.vecBanners != null) {
                    long currentTimeMillis = System.currentTimeMillis();
                    int size = shelfBanner.vecBanners.size();
                    for (int i = 0; i < size; i++) {
                        stShelfBannerEx stshelfbannerex = shelfBanner.vecBanners.get(i);
                        if (stshelfbannerex != null && (stshelfbannerex.banner.eType == 5 || stshelfbannerex.banner.eType == 6)) {
                            stshelfbannerex.banner.lExpireTime = (stshelfbannerex.banner.lExpireTime * 1000) + currentTimeMillis;
                        }
                    }
                }
                b(shelfBanner);
            }
        }

        public boolean a(int i) {
            synchronized (this) {
                return (a(this.j, i) == null || this.k[i] == null) ? false : true;
            }
        }

        void b() {
            this.f55158c.obtainMessage(6).sendToTarget();
        }

        void b(ShelfBanner shelfBanner) {
            if (shelfBanner == null) {
                return;
            }
            this.f = null;
            this.f55158c.obtainMessage(2, shelfBanner).sendToTarget();
            StatManager.b().c(new String[]{"AKH71", "AKP78"}[this.f55156a.f54692a]);
        }

        @Override
        public boolean handleMessage(Message message) {
            int i = message.what;
            if (i == 1) {
                return b(message);
            }
            if (i == 2) {
                return a(message);
            }
            if (i == 4) {
                return c();
            }
            if (i == 5) {
                return c(message);
            }
            if (i != 6) {
                return false;
            }
            this.f55157b.a(this.j);
            return true;
        }

        @Override
        public void onTaskCompleted(Task task) {
            if (task instanceof PictureTask) {
                PictureTask pictureTask = (PictureTask) task;
                Object[] objArr = (Object[]) pictureTask.f33219a;
                String str = (String) objArr[0];
                int intValue = ((Integer) objArr[1]).intValue();
                byte[] a2 = pictureTask.a();
                if (a2 != null && a2.length > 0) {
                    try {
                        Bitmap a3 = BitmapUtils.a(a2, (QImageParams) null);
                        if (a3 != null) {
                            this.f55158c.obtainMessage(1, new Object[]{a3, a2, str, Integer.valueOf(intValue)}).sendToTarget();
                        }
                    } catch (OutOfMemoryError unused) {
                    }
                }
            }
            TaskManager.a().b(task);
        }

        @Override
        public void onTaskCreated(Task task) {
        }

        @Override
        public void onTaskExtEvent(Task task) {
        }

        @Override
        public void onTaskFailed(Task task) {
            TaskManager.a().b(task);
            if (task instanceof PictureTask) {
                Object[] objArr = (Object[]) ((PictureTask) task).f33219a;
            }
        }

        @Override
        public void onTaskProgress(Task task) {
        }

        @Override
        public void onTaskStarted(Task task) {
        }
    }

    public static class NovelShelfBannerStorage {

        NovelContext f55160a;

        public NovelShelfBannerStorage(NovelContext novelContext) {
            this.f55160a = novelContext;
        }

        public Bitmap a(int i) {
            try {
                File a2 = this.f55160a.f54693b.a("shelfbanner");
                if (a2 != null && a2.exists() && a2.isDirectory()) {
                    File file = new File(a2, Constants.PORTRAIT + i);
                    if (file.exists() && file.isFile()) {
                        return BitmapUtils.a(file, (QImageParams) null);
                    }
                }
            } catch (Exception | OutOfMemoryError unused) {
            }
            return null;
        }

        public ShelfBanner a() {
            ByteBuffer h;
            try {
                File a2 = this.f55160a.f54693b.a("shelfbanner");
                if (a2 != null && a2.exists() && a2.isDirectory()) {
                    File file = new File(a2, HippyOfflineResourceZipUtils.FILE_CONFIG_NAME);
                    if (file.exists() && file.isFile() && (h = FileUtils.h(file)) != null && h.position() > 0) {
                        ShelfBanner shelfBanner = (ShelfBanner) JceUtil.parseRawData(ShelfBanner.class, h);
                        FileUtils.h().a(h);
                        return shelfBanner;
                    }
                }
                return null;
            } catch (OutOfMemoryError unused) {
                return null;
            }
        }

        public void a(ShelfBanner shelfBanner) {
            FileOutputStream fileOutputStream;
            if (shelfBanner == null) {
                shelfBanner = new ShelfBanner();
            }
            File a2 = this.f55160a.f54693b.a("shelfbanner");
            if (a2 == null) {
                return;
            }
            File file = new File(a2, HippyOfflineResourceZipUtils.FILE_CONFIG_NAME);
            FileOutputStream fileOutputStream2 = null;
            try {
                try {
                    try {
                        a2.mkdir();
                        file.createNewFile();
                        byte[] jce2Bytes = JceUtil.jce2Bytes(shelfBanner);
                        if (jce2Bytes == null || jce2Bytes.length <= 0) {
                            fileOutputStream = null;
                        } else {
                            fileOutputStream = new FileOutputStream(file);
                            try {
                                fileOutputStream.write(jce2Bytes);
                                fileOutputStream.flush();
                            } catch (IOException unused) {
                                fileOutputStream2 = fileOutputStream;
                                file.delete();
                                if (fileOutputStream2 == null) {
                                    return;
                                }
                                fileOutputStream2.close();
                            } catch (OutOfMemoryError unused2) {
                                fileOutputStream2 = fileOutputStream;
                                file.delete();
                                if (fileOutputStream2 == null) {
                                    return;
                                }
                                fileOutputStream2.close();
                            } catch (Throwable th) {
                                th = th;
                                fileOutputStream2 = fileOutputStream;
                                if (fileOutputStream2 != null) {
                                    try {
                                        fileOutputStream2.close();
                                    } catch (IOException unused3) {
                                    }
                                }
                                throw th;
                            }
                        }
                        if (fileOutputStream != null) {
                            fileOutputStream.close();
                        }
                    } catch (IOException unused4) {
                    }
                } catch (IOException unused5) {
                } catch (OutOfMemoryError unused6) {
                }
            } catch (Throwable th2) {
                th = th2;
            }
        }

        public void a(byte[] bArr, int i) {
            FileOutputStream fileOutputStream;
            File a2 = this.f55160a.f54693b.a("shelfbanner");
            if (bArr == null) {
                if (a2 != null) {
                    new File(a2, Constants.PORTRAIT + i).delete();
                    return;
                }
                return;
            }
            if (a2 == null) {
                return;
            }
            File file = new File(a2, Constants.PORTRAIT + i);
            FileOutputStream fileOutputStream2 = null;
            try {
                try {
                    try {
                        a2.mkdir();
                        file.createNewFile();
                        fileOutputStream = new FileOutputStream(file);
                    } catch (IOException unused) {
                        return;
                    }
                } catch (IOException unused2) {
                } catch (OutOfMemoryError unused3) {
                }
            } catch (Throwable th) {
                th = th;
            }
            try {
                fileOutputStream.write(bArr);
                fileOutputStream.flush();
                fileOutputStream.close();
            } catch (IOException unused4) {
                fileOutputStream2 = fileOutputStream;
                file.delete();
            } catch (OutOfMemoryError unused5) {
                fileOutputStream2 = fileOutputStream;
                file.delete();
            } catch (Throwable th2) {
                th = th2;
                fileOutputStream2 = fileOutputStream;
                if (fileOutputStream2 != null) {
                    try {
                        fileOutputStream2.close();
                    } catch (IOException unused6) {
                    }
                }
                throw th;
            }
        }
    }

    public NovelShelfBannerController(INovelContext iNovelContext) {
        this.f55142a = (NovelContext) iNovelContext;
        this.f55143b = new NovelShelfBannerDataLayer(this.f55142a, this.f55144c);
    }

    public static boolean b(stShelfBanner stshelfbanner) {
        return stshelfbanner.iShowTimes > 0 && stshelfbanner.iClickTimes > 0 && stshelfbanner.lExpireTime > System.currentTimeMillis();
    }

    public static boolean c(stShelfBannerEx stshelfbannerex, stShelfBannerEx stshelfbannerex2) {
        return stshelfbannerex.banner.eType == 1 && !(stshelfbannerex.banner.sBrief.equals(stshelfbannerex2.banner.sBrief) && stshelfbannerex.banner.sDesc.equals(stshelfbannerex2.banner.sDesc));
    }

    public static boolean d(stShelfBannerEx stshelfbannerex, stShelfBannerEx stshelfbannerex2) {
        return (stshelfbannerex.iCanClose == stshelfbannerex2.iCanClose && stshelfbannerex.banner.eType == stshelfbannerex2.banner.eType && stshelfbannerex.banner.sPicurl.equals(stshelfbannerex2.banner.sPicurl) && stshelfbannerex.banner.sRefer.equals(stshelfbannerex2.banner.sRefer)) ? false : true;
    }

    public View a(INovelShelfListView iNovelShelfListView, int i, View view, int i2) {
        stShelfBannerEx d2 = this.f55143b.d();
        if (d2 != null && i == 0) {
            return a(iNovelShelfListView, d2, view, i2);
        }
        return null;
    }

    View a(final INovelShelfListView iNovelShelfListView, final stShelfBannerEx stshelfbannerex, final View view, int i) {
        QBWebImageView qBWebImageView;
        FrameLayout.LayoutParams layoutParams;
        View.OnClickListener onClickListener;
        Context appContext = ContextHolder.getAppContext();
        if (stshelfbannerex == null || stshelfbannerex.banner == null || stshelfbannerex.banner.eType != 5) {
            return null;
        }
        if (stshelfbannerex.banner.sPicurl.endsWith("gif")) {
            qBWebImageView = new QBWebImageView(appContext) {
                @Override
                public void onGetImageSuccess(String str, Bitmap bitmap) {
                    View view2 = view;
                    if (view2 != null) {
                        view2.setVisibility(0);
                    }
                    super.onGetImageSuccess(str, bitmap);
                }
            };
            QBWebImageView qBWebImageView2 = qBWebImageView;
            qBWebImageView2.setUrl(stshelfbannerex.banner.sPicurl);
            qBWebImageView2.setUseMaskForNightMode(true);
            SimpleSkinBuilder.a((ImageView) qBWebImageView2).i(R.color.novel_shelf_banner_focus_color).f();
            layoutParams = new FrameLayout.LayoutParams(-1, MttResources.h(f.ao));
            layoutParams.topMargin = MttResources.h(f.r);
            layoutParams.leftMargin = MttResources.h(f.v);
            layoutParams.rightMargin = MttResources.h(f.v);
            qBWebImageView2.setScaleType(ImageView.ScaleType.FIT_XY);
            qBWebImageView2.e();
            onClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    EventCollector.getInstance().onViewClickedBefore(view2);
                    stShelfBannerEx stshelfbannerex2 = stshelfbannerex;
                    if (stshelfbannerex2 != null && stshelfbannerex2.banner != null) {
                        StatManager.b().c("AKH135");
                        HashMap hashMap = new HashMap();
                        hashMap.put("key", "AKH135");
                        hashMap.put("url", stshelfbannerex.banner.sRefer);
                        hashMap.put("slotid", stshelfbannerex.banner.sSlotId);
                        StatManager.b().b("novel_operation_data", hashMap);
                        stShelfBanner stshelfbanner = stshelfbannerex.banner;
                        stshelfbanner.iClickTimes--;
                        iNovelShelfListView.a(stshelfbannerex.banner.sRefer, 0, null);
                        NovelShelfBannerController.this.f55143b.b();
                    }
                    EventCollector.getInstance().onViewClicked(view2);
                }
            };
        } else {
            qBWebImageView = new QBWebImageView(appContext) {
                @Override
                public void onGetImageSuccess(String str, Bitmap bitmap) {
                    View view2 = view;
                    if (view2 != null) {
                        view2.setVisibility(0);
                    }
                    super.onGetImageSuccess(str, bitmap);
                }
            };
            QBWebImageView qBWebImageView3 = qBWebImageView;
            qBWebImageView3.setUrl(stshelfbannerex.banner.sPicurl);
            qBWebImageView3.setUseMaskForNightMode(true);
            SimpleSkinBuilder.a((ImageView) qBWebImageView3).i(R.color.novel_shelf_banner_focus_color).f();
            layoutParams = new FrameLayout.LayoutParams(-1, MttResources.h(f.ao));
            layoutParams.topMargin = MttResources.h(f.r);
            layoutParams.leftMargin = MttResources.h(f.v);
            layoutParams.rightMargin = MttResources.h(f.v);
            qBWebImageView3.setScaleType(ImageView.ScaleType.FIT_XY);
            onClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    EventCollector.getInstance().onViewClickedBefore(view2);
                    stShelfBannerEx stshelfbannerex2 = stshelfbannerex;
                    if (stshelfbannerex2 != null && stshelfbannerex2.banner != null) {
                        StatManager.b().c("AKH135");
                        HashMap hashMap = new HashMap();
                        hashMap.put("key", "AKH135");
                        hashMap.put("url", stshelfbannerex.banner.sRefer);
                        hashMap.put("slotid", stshelfbannerex.banner.sSlotId);
                        StatManager.b().b("novel_operation_data", hashMap);
                        stShelfBanner stshelfbanner = stshelfbannerex.banner;
                        stshelfbanner.iClickTimes--;
                        iNovelShelfListView.a(stshelfbannerex.banner.sRefer, 0, null);
                        NovelShelfBannerController.this.f55143b.b();
                    }
                    EventCollector.getInstance().onViewClicked(view2);
                }
            };
        }
        qBWebImageView.setOnClickListener(onClickListener);
        qBWebImageView.setLayoutParams(layoutParams);
        StatManager.b().c("AKH136");
        HashMap hashMap = new HashMap();
        hashMap.put("key", "AKH136");
        hashMap.put("url", stshelfbannerex.banner.sRefer);
        hashMap.put("slotid", stshelfbannerex.banner.sSlotId);
        StatManager.b().b("novel_operation_data", hashMap);
        if (i == 1) {
            stshelfbannerex.banner.iShowTimes--;
        }
        this.f55143b.b();
        return qBWebImageView;
    }

    @Override
    public String a() {
        return this.f55143b.g;
    }

    @Override
    public void a(ShelfBanner shelfBanner) {
        this.f55143b.a(shelfBanner);
    }

    public void a(IListener iListener) {
        this.f55145d.add(iListener);
    }

    public boolean a(int i) {
        return this.f55143b.a(i);
    }

    public void b(IListener iListener) {
        this.f55145d.remove(iListener);
    }

    @Override
    public boolean handleMessage(Message message) {
        if (message.what != 101) {
            return false;
        }
        Iterator<IListener> it = this.f55145d.iterator();
        while (it.hasNext()) {
            it.next().a(message.arg1);
        }
        return true;
    }
}