酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.kugou.android.svedit.publish;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.arch.lifecycle.Observer;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.media.MediaMetadataRetriever;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NotificationCompat;
import android.text.Editable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.k;
import com.kugou.android.app.KGApplication;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.crossplatform.bean.Type;
import com.kugou.android.app.home.channel.ChannelMainFragment;
import com.kugou.android.app.home.channel.submit.ContributionMusicSearchFragment;
import com.kugou.android.app.home.channel.submit.FragmentWrapperActivity;
import com.kugou.android.common.delegate.DelegateActivity;
import com.kugou.android.common.entity.KGSong;
import com.kugou.android.lite.R;
import com.kugou.android.svedit.drawable.VideoMergeProgressDrawable;
import com.kugou.android.svedit.env.SvEnvManager;
import com.kugou.common.userinfo.entity.f;
import com.kugou.common.utils.au;
import com.kugou.common.utils.bq;
import com.kugou.common.utils.br;
import com.kugou.common.widget.ViewUtils;
import com.kugou.framework.database.channel.entity.ChannelEntity;
import com.kugou.modulesv.SvEnvInnerManager;
import com.kugou.modulesv.api.session.ISvEditSessionManager;
import com.kugou.modulesv.api.session.SvEditSessionManager;
import com.kugou.modulesv.statistics.IStatisticsType;
import com.kugou.modulesv.statistics.ISvPageName;
import com.kugou.modulesv.statistics.SvStatisticEntity;
import com.kugou.modulesv.svcommon.utils.t;
import com.kugou.modulesv.upload.uploadImpl.entity.UploadProgressEntity;
import com.qq.e.comm.constants.ErrorCode;
import com.qq.e.comm.constants.TangramHippyConstants;
import com.tencent.connect.common.Constants;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import kotlin.jvm.internal.q;
import kotlin.reflect.KProperty;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import rx.android.schedulers.AndroidSchedulers;
import rx.l;
import rx.schedulers.Schedulers;

@com.kugou.common.base.e.c(a = 675651261)
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000Ç\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0011*\u0001*\b\u0007\u0018\u00002\u00020\u00012\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010<\u001a\u00020=H\u0002J\b\u0010>\u001a\u00020?H\u0002J\b\u0010@\u001a\u00020=H\u0002J\b\u0010A\u001a\u00020=H\u0003J \u0010B\u001a\u00020=2\u0006\u0010C\u001a\u00020D2\u0006\u0010E\u001a\u00020D2\u0006\u0010F\u001a\u00020GH\u0014J\b\u0010H\u001a\u00020=H\u0002J\u0010\u0010I\u001a\u00020=2\u0006\u0010J\u001a\u00020\rH\u0016J\u0012\u0010K\u001a\u00020=2\b\u0010L\u001a\u0004\u0018\u00010MH\u0014J\b\u0010N\u001a\u00020=H\u0014J\b\u0010O\u001a\u00020=H\u0002J\u000e\u0010P\u001a\u00020=2\u0006\u0010Q\u001a\u00020RJ\u000e\u0010P\u001a\u00020=2\u0006\u0010Q\u001a\u00020SJ\u000e\u0010P\u001a\u00020=2\u0006\u0010Q\u001a\u00020TJ\u0010\u0010P\u001a\u00020=2\b\u0010Q\u001a\u0004\u0018\u00010UJ\u001a\u0010V\u001a\u0002052\u0006\u0010W\u001a\u00020D2\b\u0010X\u001a\u0004\u0018\u00010YH\u0016J\b\u0010Z\u001a\u00020=H\u0014J\b\u0010[\u001a\u00020=H\u0002J\b\u0010\\\u001a\u00020=H\u0002J\b\u0010]\u001a\u00020=H\u0014J\b\u0010^\u001a\u00020=H\u0002J\b\u0010_\u001a\u00020=H\u0002J\b\u0010`\u001a\u00020=H\u0002J\u0010\u0010a\u001a\u00020=2\u0006\u0010b\u001a\u00020/H\u0002J\u0018\u0010c\u001a\u00020=2\u0006\u0010d\u001a\u0002072\u0006\u0010e\u001a\u000205H\u0002J\b\u0010f\u001a\u000205H\u0014J\b\u0010g\u001a\u00020=H\u0002J\u0010\u0010h\u001a\u00020=2\u0006\u0010i\u001a\u000205H\u0002R\u001b\u0010\u0004\u001a\u00020\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0010\u001a\u00020\u00118BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0014\u0010\t\u001a\u0004\b\u0012\u0010\u0013R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0017\u001a\u00020\u00188BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001b\u0010\t\u001a\u0004\b\u0019\u0010\u001aR\u0010\u0010\u001c\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u001d\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u001e\u001a\u0004\u0018\u00010\u001fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010 \u001a\u0004\u0018\u00010!X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\"\u001a\u0004\u0018\u00010#X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010$\u001a\u0004\u0018\u00010%X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010&\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010'\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010(\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010)\u001a\u00020*X\u0082\u0004¢\u0006\u0004\n\u0002\u0010+R\u0010\u0010,\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010-\u001a\b\u0012\u0004\u0012\u00020/0.X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u00100\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00101\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00102\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00103\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u00104\u001a\u000205X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u00106\u001a\u000207X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00108\u001a\u0004\u0018\u000109X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010:\u001a\u0004\u0018\u00010;X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006j"}, d2 = {"Lcom/kugou/android/svedit/publish/ChannelVideoPublishActivity;", "Lcom/kugou/android/common/delegate/DelegateActivity;", "Landroid/view/View$OnClickListener;", "()V", "backTipDialog", "Lcom/kugou/common/dialog8/popdialogs/MessageDialog;", "getBackTipDialog", "()Lcom/kugou/common/dialog8/popdialogs/MessageDialog;", "backTipDialog$delegate", "Lkotlin/Lazy;", "channelNameTextView", "Landroid/widget/TextView;", "channelTabBgView", "Landroid/view/View;", "checkSubscription", "Lrx/Subscription;", "metadataRetriever", "Landroid/media/MediaMetadataRetriever;", "getMetadataRetriever", "()Landroid/media/MediaMetadataRetriever;", "metadataRetriever$delegate", "pageBackButton", "Landroid/widget/ImageView;", "pageTimeImpl", "Lcom/kugou/modulesv/svcommon/PageTimeImpl;", "getPageTimeImpl", "()Lcom/kugou/modulesv/svcommon/PageTimeImpl;", "pageTimeImpl$delegate", "pageTitleTextView", "protocolComplete", "publishButton", "Landroid/widget/Button;", "publishDescEdit", "Landroid/widget/EditText;", "relativeChannel", "Lcom/kugou/framework/database/channel/entity/ChannelEntity;", "relativeSong", "Lcom/kugou/android/common/entity/KGSong;", "songNameIntroTextView", "songNameTextView", "songTabBgView", "textChangedWatcher", "com/kugou/android/svedit/publish/ChannelVideoPublishActivity$textChangedWatcher$1", "Lcom/kugou/android/svedit/publish/ChannelVideoPublishActivity$textChangedWatcher$1;", "touchHideSoftInputView", "uploadSetupObserver", "Landroid/arch/lifecycle/Observer;", "Lcom/kugou/modulesv/upload/uploadImpl/entity/UploadProgressEntity;", "videoCoverImageView", "videoCoverImageViewLayout", "videoCoverSetButton", "videoMergeProgressTextView", "videoMerged", "", "videoMergedStartTime", "", "videoPublishHelper", "Lcom/kugou/modulesv/publish/IKGSVPublishHelper;", "videoSaveCheckBox", "Landroid/widget/CheckBox;", "checkPublishButtonEnable", "", "createRoundDrawable", "Landroid/graphics/drawable/GradientDrawable;", "initArgs", "initView", "onActivityResult", "requestCode", "", "resultCode", "data", "Landroid/content/Intent;", "onBackButtonClicked", "onClick", "v", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onEditCoverClicked", "onEventMainThread", NotificationCompat.CATEGORY_EVENT, "Lcom/kugou/android/app/home/channel/event/ChannelSelectedEvent;", "Lcom/kugou/android/app/home/contribution/entity/SelectEvent;", "Lcom/kugou/modulesv/publish/evnet/RealPublishSvEvent;", "Lcom/kugou/modulesv/upload/uploadImpl/event/MakeFirstFrameSuccessEvent;", "onKeyDown", "paramInt", "paramKeyEvent", "Landroid/view/KeyEvent;", "onPause", "onProtocolCompleteClicked", "onPublishClicked", "onResume", "onSelectChannelClicked", "onSelectSongClicked", "resizeCoverView", "setVideoMergeProgress", "it", "showDurationLimitToast", "selectMinDuration", "min", "statusBarLightMode", "tracePageExpose", "updateCoverImage", "isInit", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
public final class ChannelVideoPublishActivity extends DelegateActivity implements View.OnClickListener {

    static final KProperty[] f42162a = {q.a(new o(q.a(ChannelVideoPublishActivity.class), "metadataRetriever", "getMetadataRetriever()Landroid/media/MediaMetadataRetriever;")), q.a(new o(q.a(ChannelVideoPublishActivity.class), "pageTimeImpl", "getPageTimeImpl()Lcom/kugou/modulesv/svcommon/PageTimeImpl;")), q.a(new o(q.a(ChannelVideoPublishActivity.class), "backTipDialog", "getBackTipDialog()Lcom/kugou/common/dialog8/popdialogs/MessageDialog;"))};

    private View f42163b;

    private ImageView f42164c;

    private TextView f42165d;

    private EditText f42166e;
    private CheckBox f;
    private Button g;
    private ImageView h;
    private View i;
    private TextView j;
    private TextView k;
    private View l;
    private TextView m;
    private TextView n;
    private TextView o;
    private TextView p;
    private View q;
    private com.kugou.modulesv.publish.a s;
    private l t;
    private KGSong u;
    private ChannelEntity v;
    private long w;
    private boolean x;
    private final Lazy r = kotlin.d.a(c.f42170a);
    private final Lazy y = kotlin.d.a(g.f42179a);
    private final Observer<UploadProgressEntity> z = new j();
    private final Lazy A = kotlin.d.a(new a());
    private final i B = new i();

    private final MediaMetadataRetriever a() {
        Lazy lazy = this.r;
        KProperty kProperty = f42162a[0];
        return (MediaMetadataRetriever) lazy.a();
    }

    private final com.kugou.modulesv.svcommon.a b() {
        Lazy lazy = this.y;
        KProperty kProperty = f42162a[1];
        return (com.kugou.modulesv.svcommon.a) lazy.a();
    }

    private final com.kugou.common.dialog8.popdialogs.b h() {
        Lazy lazy = this.A;
        KProperty kProperty = f42162a[2];
        return (com.kugou.common.dialog8.popdialogs.b) lazy.a();
    }

    @Override
    protected boolean statusBarLightMode() {
        return true;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "Landroid/media/MediaMetadataRetriever;", "invoke"}, k = 3, mv = {1, 1, 15})
    static final class c extends Lambda implements Function0<MediaMetadataRetriever> {

        public static final c f42170a = new c();

        c() {
            super(0);
        }

        @Override
        @NotNull
        public final MediaMetadataRetriever a() {
            return new MediaMetadataRetriever();
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "Lcom/kugou/modulesv/svcommon/PageTimeImpl;", "invoke"}, k = 3, mv = {1, 1, 15})
    static final class g extends Lambda implements Function0<com.kugou.modulesv.svcommon.a> {

        public static final g f42179a = new g();

        g() {
            super(0);
        }

        @Override
        @NotNull
        public final com.kugou.modulesv.svcommon.a a() {
            return new com.kugou.modulesv.svcommon.a();
        }
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bw);
        d();
        e();
        SvEnvInnerManager.getInstance().trace(new SvStatisticEntity(IStatisticsType.TYPE_EXPOSURE, getIntent().getStringExtra("business_type"), ISvPageName.SvPublish));
        this.s = ChannelVideoPublishImpl.f42184a.a().f();
        com.kugou.modulesv.publish.a aVar = this.s;
        if (aVar != null) {
            aVar.startPreEncode(getIntent().getStringExtra("business_type"));
        }
        SvEnvInnerManager.getInstance().eventBusRegister(this);
        com.kugou.modulesv.upload.uploadImpl.c a2 = com.kugou.modulesv.upload.uploadImpl.c.a();
        kotlin.jvm.internal.i.a((Object) a2, "UploadProgressLiveData.getInstance()");
        a2.b().observe(this, this.z);
        a(true);
        c();
    }

    private final void c() {
        p.d dVar = new p.d();
        ISvEditSessionManager svEditSessionManager = SvEditSessionManager.getInstance();
        kotlin.jvm.internal.i.a((Object) svEditSessionManager, "SvEditSessionManager.getInstance()");
        int[] outVideoSize = svEditSessionManager.getOutVideoSize();
        T t = outVideoSize;
        if (outVideoSize == null) {
            t = new int[]{16, 9};
        }
        dVar.f72556a = t;
        if (((int[]) dVar.f72556a)[0] == 0 || ((int[]) dVar.f72556a)[1] == 0) {
            dVar.f72556a = new int[]{16, 9};
        }
        ImageView imageView = this.f42164c;
        if (imageView != null) {
            imageView.post(new h(dVar));
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 15})
    public static final class h implements Runnable {

        final p.d f42181b;

        h(p.d dVar) {
            this.f42181b = dVar;
        }

        @Override
        public final void run() {
            ViewGroup.LayoutParams layoutParams;
            ImageView imageView = ChannelVideoPublishActivity.this.f42164c;
            if (imageView != null && (layoutParams = imageView.getLayoutParams()) != null) {
                View view = ChannelVideoPublishActivity.this.f42163b;
                layoutParams.height = view != null ? view.getHeight() : 0;
                layoutParams.width = (layoutParams.height * ((int[]) this.f42181b.f72556a)[0]) / ((int[]) this.f42181b.f72556a)[1];
            }
            ImageView imageView2 = ChannelVideoPublishActivity.this.f42164c;
            if (imageView2 != null) {
                imageView2.requestLayout();
            }
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "progressEntity", "Lcom/kugou/modulesv/upload/uploadImpl/entity/UploadProgressEntity;", "onChanged"}, k = 3, mv = {1, 1, 15})
    static final class j<T> implements Observer<UploadProgressEntity> {
        j() {
        }

        @Override
        public final void onChanged(@Nullable UploadProgressEntity uploadProgressEntity) {
            if ((uploadProgressEntity != null ? uploadProgressEntity.mStep : 0) < 2) {
                TextView textView = ChannelVideoPublishActivity.this.o;
                if (textView != null) {
                    textView.setVisibility(8);
                }
                TextView textView2 = ChannelVideoPublishActivity.this.f42165d;
                if (textView2 != null) {
                    textView2.setVisibility(4);
                }
                ChannelVideoPublishActivity.this.x = false;
                ChannelVideoPublishActivity.this.w = 0L;
            } else if (uploadProgressEntity == null || uploadProgressEntity.mStep != 2) {
                TextView textView3 = ChannelVideoPublishActivity.this.o;
                if (textView3 != null) {
                    textView3.setVisibility(8);
                }
                TextView textView4 = ChannelVideoPublishActivity.this.f42165d;
                if (textView4 != null) {
                    textView4.setVisibility(0);
                }
                ChannelVideoPublishActivity.this.x = true;
                if (ChannelVideoPublishActivity.this.w > 0) {
                    com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20471, "statistics").a("duration", String.valueOf(SystemClock.elapsedRealtime() - ChannelVideoPublishActivity.this.w)));
                    ChannelVideoPublishActivity.this.w = 0L;
                }
            } else {
                TextView textView5 = ChannelVideoPublishActivity.this.o;
                if (textView5 != null) {
                    textView5.setVisibility(0);
                }
                TextView textView6 = ChannelVideoPublishActivity.this.f42165d;
                if (textView6 != null) {
                    textView6.setVisibility(4);
                }
                ChannelVideoPublishActivity.this.a(uploadProgressEntity);
                ChannelVideoPublishActivity.this.x = false;
                if (ChannelVideoPublishActivity.this.w == 0) {
                    ChannelVideoPublishActivity.this.w = SystemClock.elapsedRealtime();
                }
            }
            ChannelVideoPublishActivity.this.p();
        }
    }

    public final void a(UploadProgressEntity uploadProgressEntity) {
        int i2 = (int) ((uploadProgressEntity.mStepProgress / 40.0f) * 100.0f);
        TextView textView = this.o;
        Drawable background = textView != null ? textView.getBackground() : null;
        if (background instanceof VideoMergeProgressDrawable) {
            ((VideoMergeProgressDrawable) background).c(i2);
        }
        SpannableString spannableString = new SpannableString(i2 + "%\n视频生成中...");
        spannableString.setSpan(new StyleSpan(1), 0, spannableString.length() + (-8), 17);
        spannableString.setSpan(new AbsoluteSizeSpan(12, true), spannableString.length() + (-8), spannableString.length(), 17);
        spannableString.setSpan(new ForegroundColorSpan((int) 3439329279L), spannableString.length() + (-8), spannableString.length(), 17);
        TextView textView2 = this.o;
        if (textView2 != null) {
            textView2.setText(spannableString);
        }
    }

    private final void a(boolean z) {
        com.kugou.modulesv.publish.a aVar = this.s;
        String firstFramePath = aVar != null ? aVar.getFirstFramePath() : null;
        if (!TextUtils.isEmpty(firstFramePath)) {
            com.bumptech.glide.g.a((FragmentActivity) this).a(firstFramePath).a(this.f42164c);
            return;
        }
        if (z) {
            com.kugou.modulesv.publish.a aVar2 = this.s;
            Pair<Boolean, String> firstFrameBitmap = aVar2 != null ? aVar2.getFirstFrameBitmap() : null;
            if (firstFrameBitmap != null) {
                Object obj = firstFrameBitmap.first;
                kotlin.jvm.internal.i.a(obj, "pair.first");
                if (((Boolean) obj).booleanValue()) {
                    com.bumptech.glide.g.a((FragmentActivity) this).a((String) firstFrameBitmap.second).a(this.f42164c);
                    return;
                }
                a().setDataSource((String) firstFrameBitmap.second);
                Bitmap frameAtTime = a().getFrameAtTime();
                ImageView imageView = this.f42164c;
                if (imageView != null) {
                    imageView.setImageBitmap(frameAtTime);
                }
            }
        }
    }

    private final void d() {
        this.v = ChannelVideoPublishImpl.f42184a.a().getG();
    }

    @SuppressLint({"ClickableViewAccessibility"})
    private final void e() {
        String str;
        TextView textView;
        String str2;
        ChannelVideoPublishActivity channelVideoPublishActivity = this;
        t.a((Activity) channelVideoPublishActivity);
        t.a((Activity) channelVideoPublishActivity, true);
        this.f42163b = findViewById(R.id.cp7);
        this.f42164c = (ImageView) findViewById(R.id.cp8);
        this.f42165d = (TextView) findViewById(R.id.cou);
        this.n = (TextView) findViewById(R.id.gic);
        this.f42166e = (EditText) findViewById(R.id.cp9);
        this.i = findViewById(R.id.csw);
        this.j = (TextView) findViewById(R.id.csy);
        this.k = (TextView) findViewById(R.id.csx);
        this.l = findViewById(R.id.csz);
        this.m = (TextView) findViewById(R.id.ct0);
        this.f = (CheckBox) findViewById(R.id.cpa);
        this.g = (Button) findViewById(R.id.cpb);
        this.o = (TextView) findViewById(R.id.csv);
        this.p = (TextView) findViewById(R.id.ct2);
        this.q = findViewById(R.id.ct3);
        Button button = this.g;
        if (button != null) {
            button.setBackground(com.kugou.modulesv.common.b.b.a(this));
        }
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setCornerRadius(com.kugou.android.kotlinextend.b.a(4.0f));
        gradientDrawable.setColor(2130706432);
        TextView textView2 = this.f42165d;
        if (textView2 != null) {
            textView2.setBackground(gradientDrawable);
        }
        VideoMergeProgressDrawable videoMergeProgressDrawable = new VideoMergeProgressDrawable();
        videoMergeProgressDrawable.a(1711276032);
        videoMergeProgressDrawable.b(-1);
        TextView textView3 = this.o;
        if (textView3 != null) {
            textView3.setBackground(videoMergeProgressDrawable);
        }
        EditText editText = this.f42166e;
        if (editText != null) {
            editText.setBackground(f());
        }
        View view = this.i;
        if (view != null) {
            view.setBackground(f());
        }
        View view2 = this.l;
        if (view2 != null) {
            view2.setBackground(f());
        }
        this.h = (ImageView) findViewById(R.id.ggr);
        TextView textView4 = this.n;
        if (textView4 != null) {
            textView4.setText("发布视频");
        }
        TextView textView5 = this.m;
        if (textView5 != null) {
            ChannelEntity channelEntity = this.v;
            if (channelEntity == null || (str2 = channelEntity.f57741d) == null) {
                str2 = "";
            }
            textView5.setText(str2);
        }
        if (this.v != null && (textView = this.m) != null) {
            textView.setCompoundDrawables(null, null, null, null);
        }
        EditText editText2 = this.f42166e;
        if (editText2 != null) {
            editText2.addTextChangedListener(this.B);
        }
        if (!TextUtils.isEmpty(ChannelVideoPublishImpl.f42184a.a().getI())) {
            String str3 = '#' + ChannelVideoPublishImpl.f42184a.a().getI() + "# ";
            EditText editText3 = this.f42166e;
            if (editText3 != null) {
                editText3.setText(str3);
            }
        }
        View view3 = this.q;
        if (view3 != null) {
            view3.setOnTouchListener(new b());
        }
        TextView textView6 = this.k;
        if (textView6 != null) {
            if (!com.kugou.common.config.c.a().a(com.kugou.android.app.a.a.wq, true)) {
            }
            textView6.setText(str);
        }
        ViewUtils.a(this, this.h, this.g, this.f42165d, this.j, this.m, this.p);
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u00032\u000e\u0010\u0005\u001a\n \u0004*\u0004\u0018\u00010\u00060\u0006H\n¢\u0006\u0002\b\u0007"}, d2 = {"<anonymous>", "", "<anonymous parameter 0>", "Landroid/view/View;", "kotlin.jvm.PlatformType", "<anonymous parameter 1>", "Landroid/view/MotionEvent;", "onTouch"}, k = 3, mv = {1, 1, 15})
    public static final class b implements View.OnTouchListener {
        b() {
        }

        @Override
        public final boolean onTouch(View view, MotionEvent motionEvent) {
            ChannelVideoPublishActivity.this.z_();
            return false;
        }
    }

    private final GradientDrawable f() {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setCornerRadius(com.kugou.android.kotlinextend.b.a(8.0f));
        gradientDrawable.setColor(-13750219);
        return gradientDrawable;
    }

    public final void onEventMainThread(@Nullable com.kugou.modulesv.upload.uploadImpl.a.a aVar) {
        if (aVar == null) {
            return;
        }
        a(false);
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "Lcom/kugou/common/dialog8/popdialogs/MessageDialog;", "invoke"}, k = 3, mv = {1, 1, 15})
    static final class a extends Lambda implements Function0<com.kugou.common.dialog8.popdialogs.b> {
        a() {
            super(0);
        }

        @Override
        @NotNull
        public final com.kugou.common.dialog8.popdialogs.b a() {
            com.kugou.common.dialog8.popdialogs.b bVar = new com.kugou.common.dialog8.popdialogs.b(ChannelVideoPublishActivity.this);
            bVar.setTitleVisible(false);
            bVar.setButtonMode(2);
            bVar.a(com.kugou.android.kotlinextend.b.a(16.0f));
            bVar.setMessage("要返回编辑吗?");
            bVar.setNegativeHint("返回编辑");
            bVar.setPositiveHint("退出");
            bVar.setOnDialogClickListener(new com.kugou.common.dialog8.e() {
                @Override
                public void onOptionClick(@Nullable com.kugou.common.dialog8.i iVar) {
                }

                @Override
                public void onNegativeClick() {
                    com.kugou.modulesv.publish.a aVar = ChannelVideoPublishActivity.this.s;
                    if (aVar != null) {
                        aVar.cleanUpload();
                    }
                    ChannelVideoPublishActivity.this.finish();
                }

                @Override
                public void onPositiveClick() {
                    com.kugou.modulesv.publish.a aVar = ChannelVideoPublishActivity.this.s;
                    if (aVar != null) {
                        aVar.saveToDraft();
                    }
                    com.kugou.modulesv.publish.a aVar2 = ChannelVideoPublishActivity.this.s;
                    if (aVar2 != null) {
                        aVar2.clearSession(true, true);
                    }
                    ChannelVideoPublishActivity.this.finish();
                }
            });
            bVar.setCanceledOnTouchOutside(true);
            return bVar;
        }
    }

    @Override
    public void onClick(@NotNull View v) {
        kotlin.jvm.internal.i.b(v, "v");
        switch (v.getId()) {
            case R.id.cou:
                l();
                return;
            case R.id.cpb:
                n();
                return;
            case R.id.csy:
                k();
                return;
            case R.id.ct0:
                j();
                return;
            case R.id.ct2:
                i();
                return;
            case R.id.ggr:
                m();
                return;
            default:
                return;
        }
    }

    private final void i() {
        if (br.aj(KGApplication.getContext()) && !com.kugou.fanxing.ums.util.a.a(ErrorCode.OtherError.CONTENT_FORCE_EXPOSURE)) {
            com.kugou.common.privacy.h.b(this, "用户自制内容上传协议", "https://activity.kugou.com/text2html/v-1be4db00/index.html");
            com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20296, "click"));
        }
    }

    private final void j() {
        if (ChannelVideoPublishImpl.f42184a.a().getG() == null && br.aj(KGApplication.getContext())) {
            Intent intent = new Intent();
            intent.putExtra("fragment_class_name", ChannelMainFragment.class.getName());
            ChannelEntity channelEntity = this.v;
            intent.putExtra("fragment_bundle", ChannelMainFragment.b(null, channelEntity != null ? channelEntity.f57740c : null, Constants.VIA_REPORT_TYPE_JOININ_GROUP, null, true, null));
            intent.setClass(this, FragmentWrapperActivity.class);
            startActivity(intent);
        }
    }

    private final void k() {
        if (br.aj(KGApplication.getContext())) {
            Intent intent = new Intent();
            intent.putExtra("fragment_class_name", ContributionMusicSearchFragment.class.getName());
            intent.putExtra("fragment_bundle", new Bundle());
            intent.setClass(this, FragmentWrapperActivity.class);
            startActivity(intent);
        }
    }

    private final void l() {
        Class<?> coverEditCls;
        com.kugou.modulesv.publish.a aVar = this.s;
        if (aVar == null || (coverEditCls = aVar.getCoverEditCls()) == null) {
            return;
        }
        Intent intent = new Intent();
        intent.setClass(this, coverEditCls);
        startActivityForResult(intent, 0);
    }

    private final void m() {
        com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20472, "click").a("type", "3").a(Type.state, this.x ? "1" : "0"));
        if (h().isShowing()) {
            return;
        }
        h().show();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, @NotNull Intent data) {
        kotlin.jvm.internal.i.b(data, "data");
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 0 && resultCode == -1) {
            k a2 = com.bumptech.glide.g.a((FragmentActivity) this);
            com.kugou.modulesv.publish.a aVar = this.s;
            a2.a(aVar != null ? aVar.getVideoCoverPath() : null).a(this.f42164c);
        }
    }

    @Override
    public boolean onKeyDown(int paramInt, @Nullable KeyEvent paramKeyEvent) {
        if (paramKeyEvent != null && paramKeyEvent.getKeyCode() == 4) {
            m();
            return true;
        }
        return super.onKeyDown(paramInt, paramKeyEvent);
    }

    private final void n() {
        String str;
        String str2;
        String str3;
        Editable text;
        if (br.aj(KGApplication.getContext())) {
            ISvEditSessionManager svEditSessionManager = SvEditSessionManager.getInstance();
            kotlin.jvm.internal.i.a((Object) svEditSessionManager, "SvEditSessionManager.getInstance()");
            long videoTotalTime = svEditSessionManager.getVideoTotalTime();
            if (videoTotalTime < SvEnvManager.f42146a.a().getF42148c()) {
                a(SvEnvManager.f42146a.a().getF42148c(), true);
                return;
            }
            if (videoTotalTime > SvEnvManager.f42146a.a().getF42149d()) {
                a(SvEnvManager.f42146a.a().getF42149d(), false);
                return;
            }
            com.kugou.common.statistics.easytrace.task.b bVar = new com.kugou.common.statistics.easytrace.task.b(20473, "click");
            ChannelEntity channelEntity = this.v;
            if (channelEntity == null || (str = channelEntity.f57740c) == null) {
                str = "";
            }
            com.kugou.common.statistics.easytrace.task.b a2 = bVar.a("pdid", str);
            KGSong kGSong = this.u;
            if (kGSong == null || (str2 = String.valueOf(kGSong.Q())) == null) {
                str2 = "";
            }
            com.kugou.common.statistics.easytrace.task.b a3 = a2.a("mixsongid", str2).a("ivar2", this.u != null ? "1" : "0");
            CheckBox checkBox = this.f;
            com.kugou.common.statistics.e.a.a(a3.a("ivar1", (checkBox == null || !checkBox.isChecked()) ? "0" : "1"));
            EditText editText = this.f42166e;
            if (editText == null || (text = editText.getText()) == null || (str3 = text.toString()) == null) {
                str3 = "";
            }
            NavigationUtils.a(this, f.a.f54242a, new e(str3, new f(str3)));
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 15})
    public static final class f implements Runnable {

        final String f42178b;

        f(String str) {
            this.f42178b = str;
        }

        @Override
        public final void run() {
            ChannelVideoPublishImpl a2 = ChannelVideoPublishImpl.f42184a.a();
            String str = this.f42178b;
            KGSong kGSong = ChannelVideoPublishActivity.this.u;
            ChannelEntity channelEntity = ChannelVideoPublishActivity.this.v;
            CheckBox checkBox = ChannelVideoPublishActivity.this.f;
            a2.a(str, kGSong, channelEntity, checkBox != null ? checkBox.isChecked() : false);
            SvEnvInnerManager.getInstance().eventBusPost(new com.kugou.modulesv.publish.a.a());
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 15})
    public static final class e implements Runnable {

        final String f42173b;

        final Runnable f42174c;

        e(String str, Runnable runnable) {
            this.f42173b = str;
            this.f42174c = runnable;
        }

        @Override
        public final void run() {
            ChannelVideoPublishActivity.this.showProgressDialog();
            com.kugou.android.a.b.a(ChannelVideoPublishActivity.this.t);
            ChannelVideoPublishActivity.this.t = com.kugou.android.svedit.c.a.a(this.f42173b).b(Schedulers.io()).a(AndroidSchedulers.mainThread()).a(new rx.b.b<com.kugou.android.app.home.channel.entity.h<Boolean>>() {
                @Override
                public final void call(com.kugou.android.app.home.channel.entity.h<Boolean> hVar) {
                    ChannelVideoPublishActivity.this.dismissProgressDialog();
                    kotlin.jvm.internal.i.a((Object) hVar, "it");
                    if (hVar.c() == 1) {
                        e.this.f42174c.run();
                    } else if (!TextUtils.isEmpty(hVar.f())) {
                        ChannelVideoPublishActivity.this.showToast(hVar.f());
                    } else {
                        ChannelVideoPublishActivity.this.showToast("文字存在敏感信息,请修改后提交");
                    }
                }
            }, new rx.b.b<Throwable>() {
                @Override
                public final void call(Throwable th) {
                    ChannelVideoPublishActivity.this.dismissProgressDialog();
                    e.this.f42174c.run();
                }
            });
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        b().a();
        o();
    }

    @Override
    public void onPause() {
        super.onPause();
        b().b();
    }

    private final void o() {
        Intent intent = getIntent();
        long longExtra = intent != null ? intent.getLongExtra("page_time", 0L) : 0L;
        Intent intent2 = getIntent();
        int intExtra = intent2 != null ? intent2.getIntExtra("video_time", 0) : 0;
        com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20469, "exposure").a("spt", intExtra > 0 ? String.valueOf(intExtra) : "").a("duration", longExtra > 0 ? String.valueOf(longExtra) : ""));
    }

    private final void a(long j2, boolean z) {
        String sb;
        long j3 = 60000;
        if (j2 % j3 == 0) {
            sb = (j2 / j3) + "分钟";
        } else {
            StringBuilder sb2 = new StringBuilder();
            sb2.append(j2 / 1000);
            sb2.append((char) 31186);
            sb = sb2.toString();
        }
        StringBuilder sb3 = new StringBuilder();
        sb3.append("视频时长不能");
        sb3.append(z ? "小于" : "大于");
        sb3.append(sb);
        showToast(sb3.toString());
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EditText editText = this.f42166e;
        if (editText != null) {
            editText.removeTextChangedListener(this.B);
        }
        a().release();
        SvEnvInnerManager.getInstance().eventBusUnregister(this);
        if (this.x) {
            return;
        }
        com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20470, "statistics").a("duration", String.valueOf(b().c())));
    }

    public final void onEventMainThread(@NotNull com.kugou.android.app.home.contribution.entity.a aVar) {
        String str;
        kotlin.jvm.internal.i.b(aVar, NotificationCompat.CATEGORY_EVENT);
        if (aVar.f12320a == 3) {
            this.u = aVar.c();
            TextView textView = this.j;
            if (textView != null) {
                KGSong kGSong = this.u;
                if (kGSong == null || (str = kGSong.v()) == null) {
                    str = "";
                }
                textView.setText(str);
            }
            p();
            au.a().a(new d());
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 15})
    static final class d implements Runnable {
        d() {
        }

        @Override
        public final void run() {
            String str;
            KGSong kGSong = ChannelVideoPublishActivity.this.u;
            if (kGSong == null || (str = kGSong.v()) == null) {
                str = "";
            }
            String[] c2 = com.kugou.framework.service.ipc.a.a.a.c(str);
            if (c2 != null) {
                if (!((c2.length != 2 || TextUtils.isEmpty(c2[0]) || TextUtils.isEmpty(c2[1])) ? false : true)) {
                    c2 = null;
                }
                if (c2 != null) {
                    KGSong kGSong2 = ChannelVideoPublishActivity.this.u;
                    if (kGSong2 != null) {
                        kGSong2.j(c2[0]);
                    }
                    KGSong kGSong3 = ChannelVideoPublishActivity.this.u;
                    if (kGSong3 != null) {
                        kGSong3.h(c2[1]);
                    }
                }
            }
        }
    }

    public final void onEventMainThread(@NotNull com.kugou.android.app.home.channel.event.o oVar) {
        String str;
        kotlin.jvm.internal.i.b(oVar, NotificationCompat.CATEGORY_EVENT);
        this.v = oVar.b();
        TextView textView = this.m;
        if (textView != null) {
            ChannelEntity channelEntity = this.v;
            if (channelEntity == null || (str = channelEntity.f57741d) == null) {
                str = "";
            }
            textView.setText(str);
        }
    }

    public final void onEventMainThread(@NotNull com.kugou.modulesv.publish.a.a aVar) {
        kotlin.jvm.internal.i.b(aVar, NotificationCompat.CATEGORY_EVENT);
        finish();
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000%\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\r\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0002\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005H\u0016J*\u0010\u0006\u001a\u00020\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00072\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\u000b\u001a\u00020\tH\u0016J*\u0010\f\u001a\u00020\u00032\b\u0010\r\u001a\u0004\u0018\u00010\u00072\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\u000e\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\tH\u0016¨\u0006\u000f"}, d2 = {"com/kugou/android/svedit/publish/ChannelVideoPublishActivity$textChangedWatcher$1", "Landroid/text/TextWatcher;", "afterTextChanged", "", "s", "Landroid/text/Editable;", "beforeTextChanged", "", "start", "", TangramHippyConstants.COUNT, "after", "onTextChanged", "sequence", "before", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
    public static final class i implements TextWatcher {
        @Override
        public void afterTextChanged(@Nullable Editable s) {
        }

        @Override
        public void beforeTextChanged(@Nullable CharSequence s, int start, int count, int after) {
        }

        i() {
        }

        @Override
        public void onTextChanged(@Nullable CharSequence sequence, int start, int before, int count) {
            String str;
            ChannelVideoPublishActivity.this.p();
            if ((sequence != null ? sequence.length() : 0) > 999) {
                ChannelVideoPublishActivity.this.showToast("最多输入1000字");
            }
            if ((sequence != null ? sequence.length() : 0) > 0) {
                if (sequence == null || (str = sequence.toString()) == null) {
                    str = "";
                }
                String z = bq.z(str);
                if (z.equals(str)) {
                    return;
                }
                EditText editText = ChannelVideoPublishActivity.this.f42166e;
                if (editText != null) {
                    editText.setText(z);
                }
                EditText editText2 = ChannelVideoPublishActivity.this.f42166e;
                if (editText2 != null) {
                    editText2.setSelection(Math.max(0, Math.min(start, z.length())));
                }
            }
        }
    }

    public final void p() {
        String str;
        Editable text;
        boolean z = (com.kugou.common.config.c.a().a(com.kugou.android.app.a.a.wq, true) && this.u == null) ? false : true;
        if (this.x && z) {
            EditText editText = this.f42166e;
            if (editText == null || (text = editText.getText()) == null || (str = text.toString()) == null) {
                str = "";
            }
            if (TextUtils.getTrimmedLength(str) > 0) {
                Button button = this.g;
                if (button != null) {
                    button.setEnabled(true);
                }
                Button button2 = this.g;
                if (button2 != null) {
                    button2.setAlpha(1.0f);
                    return;
                }
                return;
            }
        }
        Button button3 = this.g;
        if (button3 != null) {
            button3.setEnabled(false);
        }
        Button button4 = this.g;
        if (button4 != null) {
            button4.setAlpha(0.6f);
        }
    }
}