导航菜单

页面标题

页面副标题

OLX India v19.42.007 - AdFeedbackActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 AdFeedbackActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package net.pubnative.lite.sdk.contentinfo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.text.TextUtils;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import net.pubnative.lite.sdk.contentinfo.AdFeedbackFormHelper;
import net.pubnative.lite.sdk.core.R;
import net.pubnative.lite.sdk.models.Ad;
import net.pubnative.lite.sdk.mraid.MRAIDInterstitial;
import net.pubnative.lite.sdk.mraid.MRAIDNativeFeature;
import net.pubnative.lite.sdk.mraid.MRAIDNativeFeatureListener;
import net.pubnative.lite.sdk.mraid.MRAIDView;
import net.pubnative.lite.sdk.mraid.MRAIDViewListener;
import net.pubnative.lite.sdk.utils.URLValidator;
import net.pubnative.lite.sdk.utils.UrlHandler;
import net.pubnative.lite.sdk.views.ProgressDialogView;
import net.pubnative.lite.sdk.vpaid.helpers.SimpleTimer;

public class AdFeedbackActivity extends Activity implements MRAIDViewListener, MRAIDNativeFeatureListener {
    public static final String EXTRA_FEEDBACK_FORM_CALLBACK = "extra_feedback_form_callback";
    public static final String EXTRA_FEEDBACK_FORM_DATA = "extra_feedback_form_data";
    public static final String EXTRA_FEEDBACK_FORM_URL = "extra_feedback_form_url";
    private ResultReceiver callback;
    private String feedbackFormUrl;
    private AdFeedbackData mAdFeedbackData;
    private SimpleTimer mFeedbackFormExpirationTimer;
    private Boolean mIsFeedbackFormLoading = Boolean.FALSE;
    private UrlHandler mUrlHandlerDelegate;
    private MRAIDInterstitial mViewContainer;
    ProgressDialogView progressDialogView;
    RelativeLayout rootLayout;

    private void cancelExistingFeedbackTimer() {
        SimpleTimer simpleTimer = this.mFeedbackFormExpirationTimer;
        if (simpleTimer != null) {
            simpleTimer.cancel();
        }
    }

    private void getDataFromIntent(Intent intent) {
        try {
            if (intent.hasExtra(EXTRA_FEEDBACK_FORM_CALLBACK)) {
                this.callback = (ResultReceiver) intent.getParcelableExtra(EXTRA_FEEDBACK_FORM_CALLBACK);
            }
            if (!intent.hasExtra(EXTRA_FEEDBACK_FORM_URL) || TextUtils.isEmpty(intent.getStringExtra(EXTRA_FEEDBACK_FORM_URL))) {
                sendError();
                finish();
            } else {
                this.feedbackFormUrl = intent.getStringExtra(EXTRA_FEEDBACK_FORM_URL);
            }
            if (intent.hasExtra(EXTRA_FEEDBACK_FORM_DATA) && intent.getSerializableExtra(EXTRA_FEEDBACK_FORM_DATA) != null) {
                this.mAdFeedbackData = (AdFeedbackData) intent.getSerializableExtra(EXTRA_FEEDBACK_FORM_DATA);
            } else {
                sendError();
                finish();
            }
        } catch (Exception unused) {
            sendError();
            finish();
        }
    }

    private void initRootView() {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
        RelativeLayout relativeLayout = new RelativeLayout(this);
        this.rootLayout = relativeLayout;
        relativeLayout.setLayoutParams(layoutParams);
        setContentView(this.rootLayout);
    }

    private void initUi() {
        getWindow().addFlags(1024);
        getWindow().clearFlags(2048);
    }

    private void initVariables() {
        this.mUrlHandlerDelegate = new UrlHandler(this);
    }

    private void initViews() {
        this.progressDialogView = new ProgressDialogView(this);
        this.rootLayout.addView(this.progressDialogView, new RelativeLayout.LayoutParams(-1, -1));
    }

    public void lambda$mraidViewLoaded$0() {
        this.mViewContainer.showDefaultContentInfoURL(Ad.CONTENT_INFO_LINK_URL);
        sendError();
    }

    private void loadFeedbackForm() {
        if (this.feedbackFormUrl == null) {
            sendError();
            finish();
        }
        String str = this.feedbackFormUrl;
        Boolean bool = Boolean.TRUE;
        MRAIDInterstitial mRAIDInterstitial = new MRAIDInterstitial(this, str, null, bool, bool, new String[]{MRAIDNativeFeature.CALENDAR, MRAIDNativeFeature.INLINE_VIDEO, "sms", MRAIDNativeFeature.STORE_PICTURE, MRAIDNativeFeature.TEL, "location"}, this, this, null);
        this.mViewContainer = mRAIDInterstitial;
        mRAIDInterstitial.markCreativeAdComingFromFeedbackForm();
        this.mViewContainer.setVisibility(4);
    }

    private void sendCloseAction() {
        ResultReceiver resultReceiver = this.callback;
        if (resultReceiver != null) {
            resultReceiver.send(AdFeedbackFormHelper.FeedbackFormAction.CLOSE.code, null);
        }
    }

    private void sendError() {
        ResultReceiver resultReceiver = this.callback;
        if (resultReceiver != null) {
            resultReceiver.send(AdFeedbackFormHelper.FeedbackFormAction.ERROR.code, null);
        }
    }

    private void sendOpenAction() {
        ResultReceiver resultReceiver = this.callback;
        if (resultReceiver != null) {
            resultReceiver.send(AdFeedbackFormHelper.FeedbackFormAction.OPEN.code, null);
        }
    }

    private void startProgress() {
        this.mIsFeedbackFormLoading = Boolean.TRUE;
        cancelExistingFeedbackTimer();
        showProgressDialog(null, getString(R.string.loading));
        SimpleTimer simpleTimer = new SimpleTimer(10000L, new SimpleTimer.Listener() {
            @Override
            public void onFinish() {
                if (AdFeedbackActivity.this.mIsFeedbackFormLoading.booleanValue()) {
                    AdFeedbackActivity.this.finish();
                }
            }

            @Override
            public void onTick(long j) {
            }
        });
        this.mFeedbackFormExpirationTimer = simpleTimer;
        simpleTimer.start();
    }

    public void hideProgressDialog() {
        this.progressDialogView.hide();
        getWindow().clearFlags(16);
    }

    @Override
    public void mraidNativeFeatureCallTel(String str) {
    }

    @Override
    public void mraidNativeFeatureCreateCalendarEvent(String str) {
    }

    @Override
    public void mraidNativeFeatureOpenBrowser(String str) {
        this.mUrlHandlerDelegate.handleUrl(str);
    }

    @Override
    public void mraidNativeFeaturePlayVideo(String str) {
    }

    @Override
    public void mraidNativeFeatureSendSms(String str) {
    }

    @Override
    public void mraidNativeFeatureStorePicture(String str) {
    }

    @Override
    public void mraidShowCloseButton() {
    }

    @Override
    public void mraidViewClose(MRAIDView mRAIDView) {
        finish();
    }

    @Override
    public void mraidViewError(MRAIDView mRAIDView) {
        sendError();
        finish();
    }

    @Override
    public void mraidViewExpand(MRAIDView mRAIDView) {
    }

    @Override
    public void mraidViewLoaded(MRAIDView mRAIDView) {
        this.mIsFeedbackFormLoading = Boolean.FALSE;
        new FeedbackJSInterface().submitData(this.mAdFeedbackData, mRAIDView);
        hideProgressDialog();
        sendOpenAction();
        if (URLValidator.isValidURL(this.feedbackFormUrl)) {
            this.mViewContainer.show(this, new MRAIDView.OnExpandCreativeFailListener() {
                @Override
                public final void onExpandFailed() {
                    AdFeedbackActivity.this.lambda$mraidViewLoaded$0();
                }
            }, this.feedbackFormUrl);
        } else {
            sendError();
            finish();
        }
    }

    @Override
    public boolean mraidViewResize(MRAIDView mRAIDView, int i, int i2, int i3, int i4) {
        return false;
    }

    @Override
    public void onBackPressed() {
        finish();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        if (getResources().getConfiguration().orientation == 2) {
            setRequestedOrientation(0);
        }
        if (getResources().getConfiguration().orientation == 1) {
            setRequestedOrientation(1);
        }
        super.onCreate(bundle);
        Intent intent = getIntent();
        initVariables();
        getDataFromIntent(intent);
        loadFeedbackForm();
        initUi();
        initRootView();
        initViews();
        startProgress();
    }

    @Override
    protected void onDestroy() {
        sendCloseAction();
        super.onDestroy();
    }

    @Override
    public void onExpandedAdClosed() {
    }

    @Override
    protected void onRestoreInstanceState(Bundle bundle) {
        this.callback = (ResultReceiver) bundle.getParcelable(EXTRA_FEEDBACK_FORM_CALLBACK);
        this.feedbackFormUrl = bundle.getString(EXTRA_FEEDBACK_FORM_URL);
        this.mAdFeedbackData = (AdFeedbackData) bundle.getSerializable(EXTRA_FEEDBACK_FORM_DATA);
        super.onRestoreInstanceState(bundle);
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        bundle.putString(EXTRA_FEEDBACK_FORM_URL, this.feedbackFormUrl);
        bundle.putParcelable(EXTRA_FEEDBACK_FORM_CALLBACK, this.callback);
        bundle.putSerializable(EXTRA_FEEDBACK_FORM_DATA, this.mAdFeedbackData);
        super.onSaveInstanceState(bundle);
    }

    public void showProgressDialog(String str, String str2) {
        this.progressDialogView.show(str, str2);
        getWindow().setFlags(16, 16);
    }
}