APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Βίβλος
版本号:1.104
包名称:ru.omdevelopment.ref.biblegk.free

MD5 校验值:fb72bc490ecd1e731c5b177638b1dd73

反编译源代码说明

NativeVideoViewController.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.mopub.nativeads;

import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.VideoView;
import com.mopub.common.Constants;
import com.mopub.common.Preconditions;
import com.mopub.common.UrlAction;
import com.mopub.common.UrlHandler;
import com.mopub.common.VisibleForTesting;
import com.mopub.common.logging.MoPubLog;
import com.mopub.mobileads.BaseVideoViewController;
import com.mopub.mobileads.VastVideoConfig;
import com.mopub.nativeads.NativeFullScreenVideoView;
import com.mopub.nativeads.NativeVideoController;

public class NativeVideoViewController extends BaseVideoViewController implements AudioManager.OnAudioFocusChangeListener, TextureView.SurfaceTextureListener, NativeVideoController.Listener {
    private a a;
    private VastVideoConfig b;
    private final NativeFullScreenVideoView c;
    private final NativeVideoController d;
    private Bitmap e;
    private boolean f;
    private boolean g;
    private int h;

    public enum a {
        NONE,
        LOADING,
        BUFFERING,
        PAUSED,
        PLAYING,
        ENDED,
        FAILED_LOAD
    }

    public NativeVideoViewController(Context context, Bundle bundle, Bundle bundle2, BaseVideoViewController.BaseVideoViewControllerListener baseVideoViewControllerListener) {
        this(context, bundle, bundle2, baseVideoViewControllerListener, new NativeFullScreenVideoView(context, context.getResources().getConfiguration().orientation, ((VastVideoConfig) bundle.get(Constants.NATIVE_VAST_VIDEO_CONFIG)).getCustomCtaText()));
    }

    @VisibleForTesting
    NativeVideoViewController(Context context, Bundle bundle, Bundle bundle2, BaseVideoViewController.BaseVideoViewControllerListener baseVideoViewControllerListener, NativeFullScreenVideoView nativeFullScreenVideoView) {
        super(context, null, baseVideoViewControllerListener);
        Preconditions.checkNotNull(context);
        Preconditions.checkNotNull(bundle);
        Preconditions.checkNotNull(baseVideoViewControllerListener);
        Preconditions.checkNotNull(nativeFullScreenVideoView);
        this.a = a.NONE;
        this.b = (VastVideoConfig) bundle.get(Constants.NATIVE_VAST_VIDEO_CONFIG);
        this.c = nativeFullScreenVideoView;
        this.d = NativeVideoController.getForId(((Long) bundle.get(Constants.NATIVE_VIDEO_ID)).longValue());
        Preconditions.checkNotNull(this.b);
        Preconditions.checkNotNull(this.d);
    }

    private void i() {
        a aVar = this.a;
        if (this.g) {
            aVar = a.FAILED_LOAD;
        } else {
            if (!this.f) {
                if (this.h == 1) {
                    aVar = a.LOADING;
                } else if (this.h == 2) {
                    aVar = a.BUFFERING;
                } else if (this.h == 3) {
                    aVar = a.PLAYING;
                } else if (this.h != 4) {
                }
            }
            aVar = a.ENDED;
        }
        a(aVar);
    }

    @Override
    public void a() {
        this.c.setSurfaceTextureListener(this);
        this.c.setMode(NativeFullScreenVideoView.Mode.LOADING);
        this.c.setPlayControlClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (NativeVideoViewController.this.f) {
                    NativeVideoViewController.this.f = false;
                    NativeVideoViewController.this.c.resetProgress();
                    NativeVideoViewController.this.d.seekTo(0L);
                }
                NativeVideoViewController.this.a(a.PLAYING);
            }
        });
        this.c.setCloseControlListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NativeVideoViewController.this.a(a.PAUSED, true);
                NativeVideoViewController.this.g().onFinish();
            }
        });
        this.c.setCtaClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NativeVideoViewController.this.d.setPlayWhenReady(false);
                NativeVideoViewController.this.e = NativeVideoViewController.this.c.getTextureView().getBitmap();
                NativeVideoViewController.this.d.handleCtaClick((Activity) NativeVideoViewController.this.h());
            }
        });
        this.c.setPrivacyInformationClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NativeVideoViewController.this.d.setPlayWhenReady(false);
                NativeVideoViewController.this.e = NativeVideoViewController.this.c.getTextureView().getBitmap();
                String privacyInformationIconClickthroughUrl = NativeVideoViewController.this.b.getPrivacyInformationIconClickthroughUrl();
                if (TextUtils.isEmpty(privacyInformationIconClickthroughUrl)) {
                    privacyInformationIconClickthroughUrl = "https://www.mopub.com/optout/";
                }
                new UrlHandler.Builder().withSupportedUrlActions(UrlAction.OPEN_IN_APP_BROWSER, new UrlAction[0]).build().handleUrl(NativeVideoViewController.this.h(), privacyInformationIconClickthroughUrl);
            }
        });
        this.c.setPrivacyInformationIconImageUrl(this.b.getPrivacyInformationIconImageUrl());
        this.c.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        g().onSetContentView(this.c);
        this.d.setProgressListener(new NativeVideoController.NativeVideoProgressRunnable.ProgressListener() {
            @Override
            public void updateProgress(int i) {
                NativeVideoViewController.this.c.updateProgress(i);
            }
        });
    }

    @Override
    public void a(Configuration configuration) {
        this.c.setOrientation(configuration.orientation);
    }

    @Override
    public void a(Bundle bundle) {
    }

    @VisibleForTesting
    void a(a aVar) {
        a(aVar, false);
    }

    @VisibleForTesting
    void a(a aVar, boolean z) {
        NativeFullScreenVideoView nativeFullScreenVideoView;
        NativeFullScreenVideoView.Mode mode;
        Preconditions.checkNotNull(aVar);
        if (this.a == aVar) {
            return;
        }
        switch (aVar) {
            case FAILED_LOAD:
                this.d.setPlayWhenReady(false);
                this.d.setAudioEnabled(false);
                this.d.setAppAudioEnabled(false);
                this.c.setMode(NativeFullScreenVideoView.Mode.LOADING);
                this.b.handleError(h(), null, 0);
                break;
            case LOADING:
            case BUFFERING:
                this.d.setPlayWhenReady(true);
                nativeFullScreenVideoView = this.c;
                mode = NativeFullScreenVideoView.Mode.LOADING;
                nativeFullScreenVideoView.setMode(mode);
                break;
            case PLAYING:
                this.d.setPlayWhenReady(true);
                this.d.setAudioEnabled(true);
                this.d.setAppAudioEnabled(true);
                nativeFullScreenVideoView = this.c;
                mode = NativeFullScreenVideoView.Mode.PLAYING;
                nativeFullScreenVideoView.setMode(mode);
                break;
            case PAUSED:
                if (!z) {
                    this.d.setAppAudioEnabled(false);
                }
                this.d.setPlayWhenReady(false);
                nativeFullScreenVideoView = this.c;
                mode = NativeFullScreenVideoView.Mode.PAUSED;
                nativeFullScreenVideoView.setMode(mode);
                break;
            case ENDED:
                this.f = true;
                this.d.setAppAudioEnabled(false);
                this.c.updateProgress(1000);
                this.c.setMode(NativeFullScreenVideoView.Mode.FINISHED);
                this.b.handleComplete(h(), 0);
                break;
        }
        this.a = aVar;
    }

    @Override
    protected VideoView b() {
        return null;
    }

    @Override
    public void c() {
    }

    @Override
    public void d() {
        if (this.e != null) {
            this.c.setCachedVideoFrame(this.e);
        }
        this.d.prepare(this);
        this.d.setListener(this);
        this.d.setOnAudioFocusChangeListener(this);
    }

    @Override
    public void e() {
    }

    @Override
    public void f() {
        a(a.PAUSED, true);
    }

    @Override
    public void onAudioFocusChange(int i) {
        if (i == -1 || i == -2) {
            a(a.PAUSED);
            return;
        }
        if (i == -3) {
            this.d.setAudioVolume(0.3f);
        } else if (i == 1) {
            this.d.setAudioVolume(1.0f);
            i();
        }
    }

    @Override
    public void onError(Exception exc) {
        MoPubLog.log(MoPubLog.SdkLogEvent.ERROR, "Error playing back video.", exc);
        this.g = true;
        i();
    }

    @Override
    public void onStateChanged(boolean z, int i) {
        this.h = i;
        i();
    }

    @Override
    public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
        this.d.setTextureView(this.c.getTextureView());
        if (!this.f) {
            this.d.seekTo(this.d.getCurrentPosition());
        }
        this.d.setPlayWhenReady(!this.f);
        if (this.d.getDuration() - this.d.getCurrentPosition() < 750) {
            this.f = true;
            i();
        }
    }

    @Override
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
        this.d.release(this);
        a(a.PAUSED);
        return true;
    }

    @Override
    public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
    }

    @Override
    public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
    }
}