APKPure.apk(点击下载) / d.java


package e.g.a.c.k.i;

import com.apkpure.aegon.db.table.PopupRecord;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.io.StringWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class d implements Serializable {
    private static final long serialVersionUID = 4318368258447283733L;
    public transient Document b;
    private String pickedMediaFileURL = null;

    public enum a {
        creativeView,
        start,
        firstQuartile,
        midpoint,
        thirdQuartile,
        complete,
        mute,
        unmute,
        pause,
        rewind,
        resume,
        fullscreen,
        expand,
        collapse,
        acceptInvitation,
        close
    }

    public d(Document document) {
        this.b = document;
    }

    private void readObject(ObjectInputStream objectInputStream) throws ClassNotFoundException, IOException {
        e.f.a.g.a.a("VASTModel", "readObject: about to read", new Object[0]);
        objectInputStream.defaultReadObject();
        String str = (String) objectInputStream.readObject();
        e.f.a.g.a.a("VASTModel", e.d.a.a.a.J("vastString data is:\n", str, "\n"), new Object[0]);
        this.b = e.g.a.c.k.l.d.b(str);
        e.f.a.g.a.a("VASTModel", "done reading", new Object[0]);
    }

    private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
        String str;
        e.f.a.g.a.a("VASTModel", "writeObject: about to write", new Object[0]);
        objectOutputStream.defaultWriteObject();
        Document document = this.b;
        e.f.a.g.a.a("XmlTools", "xmlDocumentToString", new Object[0]);
        try {
            Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
            newTransformer.setOutputProperty("omit-xml-declaration", "no");
            newTransformer.setOutputProperty("method", "xml");
            newTransformer.setOutputProperty("indent", "yes");
            newTransformer.setOutputProperty("encoding", "UTF-8");
            newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
            StringWriter stringWriter = new StringWriter();
            newTransformer.transform(new DOMSource(document), new StreamResult(stringWriter));
            str = stringWriter.toString();
        } catch (Exception e2) {
            e.f.a.g.a.b("XmlTools", e2.getMessage(), e2);
            str = null;
        }
        objectOutputStream.writeObject(str);
        e.f.a.g.a.a("VASTModel", "done writing", new Object[0]);
    }

    public final List<String> a(String str) {
        e.f.a.g.a.c("VASTModel", "getListFromXPath", new Object[0]);
        ArrayList arrayList = new ArrayList();
        try {
            NodeList nodeList = (NodeList) XPathFactory.newInstance().newXPath().evaluate(str, this.b, XPathConstants.NODESET);
            if (nodeList != null) {
                for (int i2 = 0; i2 < nodeList.getLength(); i2++) {
                    arrayList.add(e.g.a.c.k.l.d.a(nodeList.item(i2)));
                }
            }
            return arrayList;
        } catch (Exception e2) {
            e.f.a.g.a.b("VASTModel", e2.getMessage(), e2);
            return null;
        }
    }

    public List<c> b() {
        e.f.a.g.a.c("VASTModel", "getMediaFiles", new Object[0]);
        ArrayList arrayList = new ArrayList();
        try {
            NodeList nodeList = (NodeList) XPathFactory.newInstance().newXPath().evaluate("//MediaFile", this.b, XPathConstants.NODESET);
            if (nodeList != null) {
                for (int i2 = 0; i2 < nodeList.getLength(); i2++) {
                    c cVar = new c();
                    Node item = nodeList.item(i2);
                    NamedNodeMap attributes = item.getAttributes();
                    Node namedItem = attributes.getNamedItem("apiFramework");
                    cVar.f4964j = namedItem == null ? null : namedItem.getNodeValue();
                    Node namedItem2 = attributes.getNamedItem("bitrate");
                    cVar.f4959e = namedItem2 == null ? null : new BigInteger(namedItem2.getNodeValue());
                    Node namedItem3 = attributes.getNamedItem("delivery");
                    cVar.c = namedItem3 == null ? null : namedItem3.getNodeValue();
                    Node namedItem4 = attributes.getNamedItem("height");
                    cVar.f4961g = namedItem4 == null ? null : new BigInteger(namedItem4.getNodeValue());
                    Node namedItem5 = attributes.getNamedItem("id");
                    cVar.b = namedItem5 == null ? null : namedItem5.getNodeValue();
                    Node namedItem6 = attributes.getNamedItem("maintainAspectRatio");
                    cVar.f4963i = namedItem6 == null ? null : Boolean.valueOf(namedItem6.getNodeValue());
                    Node namedItem7 = attributes.getNamedItem("scalable");
                    cVar.f4962h = namedItem7 == null ? null : Boolean.valueOf(namedItem7.getNodeValue());
                    Node namedItem8 = attributes.getNamedItem(PopupRecord.TYPE_COLUMN_NAME);
                    cVar.d = namedItem8 == null ? null : namedItem8.getNodeValue();
                    Node namedItem9 = attributes.getNamedItem("width");
                    cVar.f4960f = namedItem9 == null ? null : new BigInteger(namedItem9.getNodeValue());
                    cVar.f4958a = e.g.a.c.k.l.d.a(item);
                    arrayList.add(cVar);
                }
            }
            return arrayList;
        } catch (Exception e2) {
            e.f.a.g.a.b("VASTModel", e2.getMessage(), e2);
            return null;
        }
    }

    public String d() {
        return this.pickedMediaFileURL;
    }

    public e e() {
        String a2;
        List<String> list;
        e.f.a.g.a.c("VASTModel", "getVideoClicks", new Object[0]);
        e eVar = new e();
        try {
            NodeList nodeList = (NodeList) XPathFactory.newInstance().newXPath().evaluate("//VideoClicks", this.b, XPathConstants.NODESET);
            if (nodeList != null) {
                for (int i2 = 0; i2 < nodeList.getLength(); i2++) {
                    NodeList childNodes = nodeList.item(i2).getChildNodes();
                    for (int i3 = 0; i3 < childNodes.getLength(); i3++) {
                        Node item = childNodes.item(i3);
                        String nodeName = item.getNodeName();
                        if (nodeName.equalsIgnoreCase("ClickTracking")) {
                            a2 = e.g.a.c.k.l.d.a(item);
                            list = eVar.a();
                        } else {
                            if (nodeName.equalsIgnoreCase("ClickThrough")) {
                                eVar.f4979a = e.g.a.c.k.l.d.a(item);
                            } else if (nodeName.equalsIgnoreCase("CustomClick")) {
                                a2 = e.g.a.c.k.l.d.a(item);
                                if (eVar.c == null) {
                                    eVar.c = new ArrayList();
                                }
                                list = eVar.c;
                            }
                        }
                        list.add(a2);
                    }
                }
            }
            return eVar;
        } catch (Exception e2) {
            e.f.a.g.a.b("VASTModel", e2.getMessage(), e2);
            return null;
        }
    }

    public void f(String str) {
        this.pickedMediaFileURL = str;
    }
}