13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846

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


package com.xbtsol.jynvrt161024;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import com.adsdk.sdk.Const;
import com.vdopia.android.preroll.VDO;
import com.xbtsol.jynvrt161024.VastXmlParser;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.util.EntityUtils;
abstract class Vpaid extends Activity {
    private static final String TAG = "AirPlayVast";
    private static Context context;
    int ERROR_CODE_100 = 100;
    int ERROR_CODE_101 = com.adsdk.sdk.mraid.MraidView.MODAL_CONTAINER_LAYOUT_ID;
    int ERROR_CODE_102 = 102;
    int ERROR_CODE_200 = 200;
    int ERROR_CODE_201 = VDO.ERROR_UNKNOWN;
    int ERROR_CODE_202 = 202;
    int ERROR_CODE_203 = VDO.ERROR_NO_AD_FOUND;
    int ERROR_CODE_300 = 300;
    int ERROR_CODE_301 = 301;
    int ERROR_CODE_302 = 302;
    int ERROR_CODE_303 = 303;
    int ERROR_CODE_400 = 400;
    int ERROR_CODE_401 = 401;
    int ERROR_CODE_402 = 402;
    int ERROR_CODE_403 = 403;
    int ERROR_CODE_405 = 405;
    int ERROR_CODE_900 = 900;
    int ERROR_CODE_901 = 901;
    private int adDuration;
    private boolean adExpanded;
    private boolean adIcons;
    private boolean adLinear;
    private int adRemainingTime;
    private boolean adSkippableState;
    private int adVolume;
    private int adWidth;
    private int adheight;
    private VastXmlParser.Creative creative;
    private VastXmlParser parser;
    Set<NameValuePair> set;
    private String userString;

    enum VpaidEnum {
        AdLoaded,
        AdStarted,
        AdStopped,
        AdSkipped,
        AdSkippableStateChange,
        AdSizeChange,
        AdLinearChange,
        AdDurationChange,
        AdExpandedChange,
        AdRemainingTimeChange,
        AdVolumeChange,
        AdImpression,
        AdVideoStart,
        AdVideoFirstQuartile,
        AdVideoMidpoint,
        AdVideoThirdQuartile,
        AdClickThru,
        AdInteraction,
        AdUserAcceptInvitation,
        AdUserMinimize,
        AdUserClose,
        AdVideoComplete,
        AdPaused,
        AdPlaying,
        AdLog
    }

    abstract void initAd(int i, int i2, String str, int i3, String str2, String str3);

    abstract void pauseAd();

    abstract void resizeAd(int i, int i2, String str);

    abstract void resumeAd();

    abstract void skipAd();

    abstract void startAd();

    abstract void stopAd(int i);

    String handshakeVersion(String playerVPAIDVersion) {
        return "2.0";
    }

    public void setUserString(String userString) {
        this.userString = userString;
    }

    boolean isAdLinear() {
        return this.adLinear;
    }

    void setAdLinear(boolean adLinear) {
        this.adLinear = adLinear;
    }

    int getAdWidth() {
        return this.adWidth;
    }

    void setAdWidth(int adWidth) {
        this.adWidth = adWidth;
    }

    int getAdheight() {
        return this.adheight;
    }

    void setAdheight(int adheight) {
        this.adheight = adheight;
    }

    boolean isAdExpanded() {
        return this.adExpanded;
    }

    void setAdExpanded(boolean adExpanded) {
        this.adExpanded = adExpanded;
    }

    boolean isAdSkippableState() {
        return this.adSkippableState;
    }

    void setAdSkippableState(boolean adSkippableState) {
        this.adSkippableState = adSkippableState;
    }

    int getAdRemainingTime() {
        return this.adRemainingTime;
    }

    public void setAdRemainingTime(int adRemainingTime) {
        this.adRemainingTime = adRemainingTime;
    }

    int getAdDuration() {
        return this.adDuration;
    }

    public void setAdDuration(int adDuration) {
        this.adDuration = adDuration;
    }

    int getAdVolume() {
        return this.adVolume;
    }

    public void setAdVolume(int adVolume) {
        this.adVolume = adVolume;
    }

    boolean isAdIcons() {
        return this.adIcons;
    }

    void setAdIcons(boolean adIcons) {
        this.adIcons = adIcons;
    }

    public void setParser(VastXmlParser parser) {
        this.parser = parser;
    }

    public void setCreative(VastXmlParser.Creative creative) {
        this.creative = creative;
    }

    public static void setContext(Context context2) {
        context = context2;
    }

    public void dispatchEvent(VpaidEnum event) {
        switch (event) {
            case AdImpression:
                this.set.add(new BasicNameValuePair("impression", "1"));
                sendImpression();
                return;
            case AdClickThru:
                this.set.add(new BasicNameValuePair("click", "1"));
                sendClickData();
                return;
            case AdVideoComplete:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_COMPLETE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_COMPLETE);
                return;
            case AdSkipped:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_SKIP, "1"));
                sendTrackingEvent(IVastConstant.EVENT_SKIP);
                return;
            case AdPaused:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_PAUSE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_PAUSE);
                return;
            case AdPlaying:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_RESUME, "1"));
                sendTrackingEvent(IVastConstant.EVENT_RESUME);
                return;
            case AdVideoStart:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_START, "1"));
                sendTrackingEvent(IVastConstant.EVENT_START);
                return;
            case AdVideoFirstQuartile:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_FIRST_QUARTILE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_FIRST_QUARTILE);
                return;
            case AdVideoMidpoint:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_MID_POINT, "1"));
                sendTrackingEvent(IVastConstant.EVENT_MID_POINT);
                return;
            case AdVideoThirdQuartile:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_THIRD_QUARTILE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_THIRD_QUARTILE);
                return;
            case AdLoaded:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_CREATIVE_VIEW, "1"));
                sendTrackingEvent(IVastConstant.EVENT_CREATIVE_VIEW);
                return;
            case AdVolumeChange:
                if (this.adVolume == 0) {
                    this.set.add(new BasicNameValuePair(IVastConstant.EVENT_MUTE, "1"));
                    sendTrackingEvent(IVastConstant.EVENT_MUTE);
                    return;
                }
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_UNMUTE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_UNMUTE);
                return;
            case AdUserClose:
                this.set.add(new BasicNameValuePair(IVastConstant.EVENT_CLOSE, "1"));
                sendTrackingEvent(IVastConstant.EVENT_CLOSE);
                return;
            default:
                return;
        }
    }

    private static synchronized void sendEventData(final String url) {
        synchronized (Vpaid.class) {
            synchronized (url) {
                if (Util.checkInternetConnection(context)) {
                    Thread thread = new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Log.i("AirPlayVast", "Sending vast event:" + url);
                                Util.printDebugLog("URL: " + url);
                                DefaultHttpClient httpclient = new DefaultHttpClient();
                                HttpGet httpget = new HttpGet(url);
                                HttpResponse response = httpclient.execute(httpget);
                                int code = response == null ? 0 : response.getStatusLine().getStatusCode();
                                Log.i("AirPlayVast", "Status code: " + code);
                                if (code == 200) {
                                    String string = EntityUtils.toString(response.getEntity());
                                    Log.i("AirPlayVast", "VAST Data: " + string);
                                    return;
                                }
                                Log.i("AirPlayVast", "Error reason: " + response.getStatusLine().getReasonPhrase());
                            } catch (Exception e) {
                                Log.e("AirPlayVast", "Exception: ", e);
                            }
                        }
                    }, "vast_event");
                    thread.start();
                }
            }
        }
    }

    private void sendImpression() {
        try {
            if (this.parser != null) {
                List<HashMap<String, String>> data = this.parser.getImpression();
                for (HashMap<String, String> hashMap : data) {
                    synchronized (hashMap) {
                        String url = hashMap.get(IVastConstant.IMPRESSION);
                        Log.i("AirPlayVast", "Sending impression data: " + hashMap.get(IVastConstant.ID));
                        if (url != null && !url.equals("")) {
                            sendEventData(url);
                        } else {
                            Log.i("AirPlayVast", "impression url not present");
                        }
                    }
                }
            }
        } catch (Exception exception) {
            Log.e("AirPlayVast", "Error occurred while sending impression data: ", exception);
        }
    }

    private void sendClickData() {
        try {
            if (this.creative != null) {
                try {
                    for (HashMap<String, String> map : this.creative.getVideoClickTracking()) {
                        String url = map.get(IVastConstant.CLICK_TRACKING);
                        Log.i("AirPlayVast", "Sending click data: " + map.get(IVastConstant.ID));
                        if (url != null && !url.equals("")) {
                            sendEventData(url);
                        } else {
                            Log.i("AirPlayVast", "url is null");
                        }
                    }
                } catch (Exception exception) {
                    Log.e("AirPlayVast", "Error occurred while sending click tracking data: ", exception);
                }
                for (HashMap<String, String> map2 : this.creative.getVideoCustomClickTracking()) {
                    Log.i("AirPlayVast", "Sending cutom click data: " + map2.get(IVastConstant.ID));
                    String url2 = map2.get(IVastConstant.CUSTOM_CLICK);
                    if (url2 != null && !url2.equals("")) {
                        sendEventData(url2);
                    } else {
                        Log.i("AirPlayVast", "url is null");
                    }
                }
            }
        } catch (Exception exception2) {
            Log.e("AirPlayVast", "Error occurred while sending click data: ", exception2);
        }
    }

    private synchronized void sendTrackingEvent(String key) {
        try {
            if (this.creative != null && key != null && !key.equalsIgnoreCase("")) {
                HashMap<String, String> map = this.creative.getTrackingEventMap();
                if (map != null && map.containsKey(key)) {
                    String url = map.get(key);
                    Log.i("AirPlayVast", "Sending tracking data: " + key);
                    if (url != null && !url.equals("")) {
                        sendEventData(url);
                    } else {
                        Log.i("AirPlayVast", "url is null");
                    }
                } else {
                    Log.i("AirPlayVast", "Tracking event key not present in vast xml " + key);
                }
            }
        } catch (Exception e) {
            Log.e("AirPlayVast", "Error occurred while sending tracking data: ", e);
        }
    }

    public void sendErrorDetails(int errorcode) {
        try {
            if (this.parser != null) {
                this.set.add(new BasicNameValuePair(IMraid.EVENT_ERROR, "1"));
                Log.i("AirPlayVast", "Sending error data: ");
                String url = this.parser.getAdErrorUri();
                if (url != null && !url.equals("")) {
                    String p = this.creative.getAdParams();
                    if (url.contains("[ERRORCODE]")) {
                        url = url.replace("[ERRORCODE]", "" + errorcode);
                    }
                    if (p != null && (p.startsWith("&") || url.endsWith("&"))) {
                        url = url + p;
                    } else if (p != null && !p.equalsIgnoreCase("")) {
                        url = url + "&" + p;
                    }
                    sendEventData(url);
                    return;
                }
                Log.i("AirPlayVast", "error url is null");
            }
        } catch (Exception e) {
            Log.e("AirPlayVast", "Error occurred while sending error data: ", e);
        }
    }

    public void sendDataToAPI() {
        try {
            try {
                if (this.creative != null) {
                    String str = this.creative.getAdParams();
                    if (str != null && !str.equals("")) {
                        String referrerString = URLDecoder.decode(str, Const.ENCODING);
                        String[] params = referrerString.split("&");
                        for (String param : params) {
                            String[] pair = param.split("=");
                            this.set.add(new BasicNameValuePair(pair[0], pair[1]));
                        }
                    } else {
                        Log.i("AirPlayVast", "Ad param is null");
                    }
                }
            } catch (Exception e) {
                Log.e("AirPlayVast", "Error occurred while sending: ", e);
            }
            this.set.add(new BasicNameValuePair("adduration", "" + this.adDuration));
            this.set.add(new BasicNameValuePair("adRemainingTime", "" + this.adRemainingTime));
            synchronized (this.set) {
                if (Util.checkInternetConnection(context)) {
                    Thread thread = new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
                                HttpPost httppost = new HttpPost("https://api.airpush.com/Vast/handle_events.php");
                                BasicHttpParams basicHttpParams = new BasicHttpParams();
                                defaultHttpClient.getParams().setParameter("http.useragent", Vpaid.this.userString);
                                List<NameValuePair> list = new ArrayList<>();
                                list.addAll(Vpaid.this.set);
                                Log.i("AirPlayVast", "Sending vast event:" + list);
                                httppost.setEntity(new UrlEncodedFormEntity(list));
                                httppost.setParams(basicHttpParams);
                                HttpConnectionParams.setConnectionTimeout(basicHttpParams, 15000);
                                HttpConnectionParams.setSoTimeout(basicHttpParams, 15000);
                                HttpResponse response = defaultHttpClient.execute(httppost);
                                int code = response == null ? 0 : response.getStatusLine().getStatusCode();
                                Log.i("AirPlayVast", "Status code: " + code);
                                if (code == 200) {
                                    String string = EntityUtils.toString(response.getEntity());
                                    Log.i("AirPlayVast", "Vast impression: " + string);
                                    return;
                                }
                                Log.i("AirPlayVast", "Error reason: " + response.getStatusLine().getReasonPhrase());
                            } catch (Exception e2) {
                                Log.e("AirPlayVast", "Exception: ", e2);
                            }
                        }
                    }, "vast_report");
                    thread.start();
                }
            }
        } catch (Exception e2) {
            Log.e("AirPlayVast", "Error occurred while sending data: ", e2);
        }
    }
}