package com.tencent.mm.plugin.story.ui.view.editor;

import a.f.a.a;
import a.f.b.j;
import a.l;
import a.y;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.google.android.exoplayer2.v;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.api.k;
import com.tencent.mm.api.t;
import com.tencent.mm.api.u;
import com.tencent.mm.plugin.story.c.a.a$a;
import com.tencent.mm.plugin.story.d.b;
import com.tencent.mm.plugin.story.d.b$b;
import com.tencent.mm.plugin.story.g.h;
import com.tencent.mm.plugin.story.model.audio.AudioCacheInfo;
import com.tencent.mm.plugin.story.model.audio.b$a;
import com.tencent.mm.plugin.story.ui.view.editor.item.EditorItemContainer;
import com.tencent.mm.pluginsdk.ui.tools.VideoPlayerTextureView;
import com.tencent.mm.pluginsdk.ui.tools.e;
import com.tencent.mm.protocal.protobuf.cei;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.emotion.EmojiInfo;
import com.tencent.mm.ui.ah;
import com.tencent.mm.ui.ak;
import java.util.ArrayList;

@l(dWo = {1, 1, 13}, dWp = {"\u0000Ù\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\b\u0003\n\u0002\u0010\u0006\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\r\n\u0002\b\u0005*\u0001C\u0018\u0000 y2\u00020\u00012\u00020\u0002:\u0002yzB\u0019\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006¢\u0006\u0002\u0010\u0007B\u000f\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\bB\u001f\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006\u0012\u0006\u0010\t\u001a\u00020\n¢\u0006\u0002\u0010\u000bJ\b\u0010M\u001a\u00020(H\u0016J\b\u0010N\u001a\u00020LH\u0002J\b\u0010O\u001a\u00020LH\u0016J\b\u0010P\u001a\u00020LH\u0002J\b\u0010Q\u001a\u00020LH\u0016J\b\u0010R\u001a\u00020+H\u0016J\b\u0010S\u001a\u00020AH\u0016J\u0012\u0010T\u001a\u00020L2\b\u0010U\u001a\u0004\u0018\u00010VH\u0002J\b\u0010W\u001a\u00020\rH\u0016J\b\u0010X\u001a\u00020IH\u0016J\b\u0010Y\u001a\u00020LH\u0002J\b\u0010Z\u001a\u00020LH\u0002J\b\u0010[\u001a\u00020LH\u0002J\b\u0010\\\u001a\u00020(H\u0016J\b\u0010]\u001a\u00020(H\u0002J\b\u0010^\u001a\u00020(H\u0016J\b\u0010_\u001a\u00020(H\u0016J\"\u0010`\u001a\u00020L2\u0006\u0010a\u001a\u00020\n2\u0006\u0010b\u001a\u00020\n2\b\u0010U\u001a\u0004\u0018\u00010VH\u0016J\u0012\u0010c\u001a\u00020L2\b\u0010d\u001a\u0004\u0018\u00010AH\u0002J\b\u0010e\u001a\u00020LH\u0016J\b\u0010f\u001a\u00020LH\u0002J\u0010\u0010g\u001a\u00020L2\u0006\u0010h\u001a\u00020iH\u0016J\b\u0010j\u001a\u00020LH\u0002J\u0010\u0010k\u001a\u00020L2\u0006\u0010l\u001a\u00020\nH\u0016J0\u0010m\u001a\u00020L2\u0006\u0010n\u001a\u00020\u00102\u0006\u0010o\u001a\u00020\r2\u0006\u0010p\u001a\u00020\r2\u000e\u0010J\u001a\n\u0012\u0004\u0012\u00020L\u0018\u00010KH\u0016J\u0010\u0010q\u001a\u00020L2\u0006\u0010r\u001a\u00020(H\u0002J\u0010\u0010s\u001a\u00020L2\u0006\u0010r\u001a\u00020(H\u0016J*\u0010t\u001a\u00020L2\u0006\u0010r\u001a\u00020(2\b\u0010u\u001a\u0004\u0018\u00010v2\u0006\u0010w\u001a\u00020\n2\u0006\u0010x\u001a\u00020\nH\u0016R\u000e\u0010\f\u001a\u00020\rXD¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\rXD¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010XD¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0019X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u001a\u001a\u0004\u0018\u00010\u001bX\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\nX\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\rX\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001e\u001a\u00020\u001fX\u0004¢\u0006\u0002\n\u0000R\u000e\u0010 \u001a\u00020!X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\"\u001a\u00020#X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010$\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010%\u001a\u00020&X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010'\u001a\u00020(X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010)\u001a\u00020(X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010*\u001a\u00020+X\u0004¢\u0006\u0002\n\u0000R\u0010\u0010,\u001a\u0004\u0018\u00010-X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010.\u001a\u00020/X\u0004¢\u0006\u0002\n\u0000R\u000e\u00100\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u00101\u001a\u00020\nX\u000e¢\u0006\u0002\n\u0000R\u0010\u00102\u001a\u0004\u0018\u000103X\u000e¢\u0006\u0002\n\u0000R\u0010\u00104\u001a\u0004\u0018\u000105X\u000e¢\u0006\u0002\n\u0000R\u001a\u00106\u001a\u000207X.¢\u0006\u000e\n\u0000\u001a\u0004\b8\u00109\"\u0004\b:\u0010;R\u0014\u0010<\u001a\b\u0018\u00010=R\u00020\u0000X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010>\u001a\u00020(X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010?\u001a\u00020\u0012X\u0004¢\u0006\u0002\n\u0000R\u000e\u0010@\u001a\u00020AX\u0004¢\u0006\u0002\n\u0000R\u0010\u0010B\u001a\u00020CX\u0004¢\u0006\u0004\n\u0002\u0010DR\u000e\u0010E\u001a\u00020FX\u000e¢\u0006\u0002\n\u0000R\u000e\u0010G\u001a\u00020FX\u000e¢\u0006\u0002\n\u0000R\u000e\u0010H\u001a\u00020IX\u0004¢\u0006\u0002\n\u0000R\u0016\u0010J\u001a\n\u0012\u0004\u0012\u00020L\u0018\u00010KX\u000e¢\u0006\u0002\n\u0000¨\u0006{"}, dWq = {"Lcom/tencent/mm/plugin/story/ui/view/editor/EditorView;", "Landroid/widget/RelativeLayout;", "Lcom/tencent/mm/plugin/story/contract/EditorContract$IView;", "context", "Landroid/content/Context;", "attrs", "Landroid/util/AttributeSet;", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "(Landroid/content/Context;)V", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "DEFAULT_CLICK_LIMIT_TIME", "", "DEFAULT_NOTIFY_MOMENT_DURATION", "TAG", "", "addAudioCheckView", "Landroid/widget/ImageView;", "addAudioView", "addEmojiView", "addLocation", "addLocationCheckView", "addTextView", "audioPanel", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorAudioView;", "blueCheckDrawable", "Landroid/graphics/drawable/Drawable;", "blueColor", "clickTime", "controlGroupPanel", "Landroid/view/ViewGroup;", "controlPanel", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorControlPanel;", "emojiPanel", "Lcom/tencent/mm/media/editor/panel/EditorEmojiPanel;", "favoriteTip", "inputPanel", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorInputView;", "isNotifyMoment", "", "isSetFavorite", "itemContainer", "Lcom/tencent/mm/plugin/story/ui/view/editor/item/EditorItemContainer;", "menuDialog", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorMoreDialog;", "mixView", "Landroid/view/View;", "moreBtn", "navigationBarHeight", "pendingTextItem", "Lcom/tencent/mm/plugin/story/ui/view/editor/item/TextItemView;", "poiService", "Lcom/tencent/mm/plugin/story/api/ICheckLifePoi;", "presenter", "Lcom/tencent/mm/plugin/story/contract/EditorContract$IPresenter;", "getPresenter", "()Lcom/tencent/mm/plugin/story/contract/EditorContract$IPresenter;", "setPresenter", "(Lcom/tencent/mm/plugin/story/contract/EditorContract$IPresenter;)V", "reportArg", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorView$ReportInfo;", "showLocation", "snsTip", "storyLocation", "Lcom/tencent/mm/protocal/protobuf/StoryLocation;", "videoCallBack", "com/tencent/mm/plugin/story/ui/view/editor/EditorView$videoCallBack$1", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorView$videoCallBack$1;", "videoLoopEndTime", "", "videoLoopStartTime", "videoPlayView", "Lcom/tencent/mm/pluginsdk/ui/tools/VideoPlayerTextureView;", "videoPreparedCallback", "Lkotlin/Function0;", "", "back", "checkFavorite", "checkLocation", "checkMoment", "destroy", "getItemContainer", "getLocation", "getLocationResult", "data", "Landroid/content/Intent;", "getMusicRequestId", "getVideoPlayView", "initAudioPanel", "initSafeArea", "initSmileyPanel", "isShow", "isShowAudioPanel", "isShowSmileyPanel", "isShowTextEditor", "onActivityResult", "requestCode", "resultCode", "reportDirectly", "location", "reset", "setFavStory", "setMusicPlayer", "player", "Lcom/google/android/exoplayer2/SimpleExoPlayer;", "setNotifySns", "setVisibility", "visibility", "setup", "videoPath", "startTime", "endTime", "toggleAudioPanel", "show", "toggleSmileyPanel", "toggleTextEditor", "text", "", "textColor", "textBgColor", "Companion", "ReportInfo", "plugin-story_release"})
public final class EditorView extends RelativeLayout implements b$b {
    public static final a smv = new a((byte) 0);
    public final String TAG;
    private boolean hNp;
    private long iBO;
    private a<y> lnp;
    private final VideoPlayerTextureView oxL;
    private boolean rYq;
    private final ImageView rnO;
    public b.a slS;
    private final View slT;
    private final ImageView slU;
    private final ImageView slV;
    private final ImageView slW;
    private final ImageView slX;
    private final ViewGroup slY;
    private final ImageView slZ;
    private final ImageView sma;
    private final EditorControlPanel smb;
    public final EditorItemContainer smc;
    private final EditorInputView smd;
    private final com.tencent.mm.media.editor.b.a sme;
    private final EditorAudioView smf;
    private final ImageView smg;
    private final ImageView smh;
    private double smi;
    private double smj;
    public final cei smk;
    private final int sml;
    private final Drawable smm;
    private final long smn;
    private final long smo;
    private com.tencent.mm.plugin.story.ui.view.editor.item.f smp;
    private boolean smq;
    private int smr;
    private c sms;
    public b smt;
    private final i smu;

    @l(dWo = {1, 1, 13}, dWp = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0005"}, dWq = {"<anonymous>", "", "it", "Landroid/view/View;", "kotlin.jvm.PlatformType", "onClick"})
    /* renamed from: com.tencent.mm.plugin.story.ui.view.editor.EditorView$9 */
    static final class AnonymousClass9 implements OnClickListener {
        final /* synthetic */ EditorView smw;

        AnonymousClass9(EditorView editorView) {
            this.smw = editorView;
        }

        public final void onClick(View view) {
            AppMethodBeat.i(110578);
            this.smw.cCA();
            h hVar = h.scu;
            h.EU(10);
            AppMethodBeat.o(110578);
        }
    }

    @l(dWo = {1, 1, 13}, dWp = {"\u0000!\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H\u0016J\b\u0010\u0004\u001a\u00020\u0003H\u0016J\u0012\u0010\u0005\u001a\u00020\u00032\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0016J\b\u0010\b\u001a\u00020\u0003H\u0016J\u0010\u0010\t\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\u000bH\u0016¨\u0006\f"}, dWq = {"com/tencent/mm/plugin/story/ui/view/editor/EditorView$initAudioPanel$2", "Lcom/tencent/mm/plugin/story/ui/view/editor/EditorAudioView$AudioCallback;", "cancel", "", "confirm", "onAudioSelected", "info", "Lcom/tencent/mm/plugin/story/model/audio/AudioCacheInfo;", "pauseAudio", "toggleOrigin", "remove", "", "plugin-story_release"})
    public static final class d implements EditorAudioView.a {
        final /* synthetic */ EditorView smw;

        d(EditorView editorView) {
            this.smw = editorView;
        }

        public final void pauseAudio() {
            AppMethodBeat.i(110583);
            this.smw.getPresenter().pauseAudio();
            AppMethodBeat.o(110583);
        }

        public final void d(AudioCacheInfo audioCacheInfo) {
            AppMethodBeat.i(110584);
            if (audioCacheInfo != null) {
                int i = audioCacheInfo.type;
                AudioCacheInfo.a aVar = AudioCacheInfo.rUj;
                if (i == AudioCacheInfo.cyK()) {
                    this.smw.getPresenter().pauseAudio();
                    AppMethodBeat.o(110584);
                    return;
                }
            }
            this.smw.getPresenter().a(audioCacheInfo);
            AppMethodBeat.o(110584);
        }

        public final void lO(boolean z) {
            AppMethodBeat.i(110585);
            this.smw.getPresenter().lt(z);
            AppMethodBeat.o(110585);
        }
    }

    @l(dWo = {1, 1, 13}, dWp = {"\u0000\u0019\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H\u0016J\u0010\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u0006H\u0016¨\u0006\u0007"}, dWq = {"com/tencent/mm/plugin/story/ui/view/editor/EditorView$initSmileyPanel$2", "Lcom/tencent/mm/api/SmileyPanelCallbackWrapper$Callback;", "onHide", "", "onSelectedEmoji", "emojiInfo", "Lcom/tencent/mm/api/IEmojiInfo;", "plugin-story_release"})
    public static final class f implements t.a {
        final /* synthetic */ EditorView smw;

        f(EditorView editorView) {
            this.smw = editorView;
        }

        public final void a(k kVar) {
            AppMethodBeat.i(110587);
            j.p(kVar, "emojiInfo");
            ab.i(this.smw.TAG, "[onSelectedEmoji] emojiInfo:%s", new Object[]{kVar});
            EditorItemContainer c = this.smw.smc;
            EmojiInfo emojiInfo = (EmojiInfo) kVar;
            j.p(emojiInfo, "emojiInfo");
            com.tencent.mm.plugin.story.ui.view.editor.item.b bVar = new com.tencent.mm.plugin.story.ui.view.editor.item.b(c.getContext(), false);
            c.lnI.addView((View) bVar, new LayoutParams(-1, -1));
            com.tencent.mm.plugin.story.f.l lVar = com.tencent.mm.plugin.story.f.l.sac;
            bVar.setSafeArea(com.tencent.mm.plugin.story.f.l.czI());
            bVar.setValidArea(c.smH);
            bVar.setStateResolve((EditorItemContainer.b) c.smU);
            bVar.setEmojiInfo(emojiInfo);
            bVar.resume();
            c.r((View) bVar, true);
            c.removeCallbacks(c.lnN);
            c.postDelayed(c.lnN, 1500);
            onHide();
            AppMethodBeat.o(110587);
        }

        public final void onHide() {
            AppMethodBeat.i(110588);
            this.smw.gC(false);
            AppMethodBeat.o(110588);
        }
    }

    @l(dWo = {1, 1, 13}, dWp = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, dWq = {"<anonymous>", "", "invoke"})
    static final class g extends a.f.b.k implements a<y> {
        public static final g smy = new g();

        static {
            AppMethodBeat.i(110589);
            AppMethodBeat.o(110589);
        }

        g() {
            super(0);
        }

        public final /* bridge */ /* synthetic */ Object invoke() {
            return y.AUy;
        }
    }

    static {
        AppMethodBeat.i(110612);
        AppMethodBeat.o(110612);
    }

    public EditorView(Context context, AttributeSet attributeSet, int i) {
        int i2;
        j.p(context, "context");
        super(context, attributeSet, i);
        AppMethodBeat.i(110610);
        this.TAG = "MicroMsg.EditorView";
        this.smk = new cei();
        this.hNp = true;
        this.smn = 2000;
        this.smo = 3000;
        this.rYq = true;
        View.inflate(context, 2130970880, this);
        this.sml = getResources().getColor(2131689505);
        this.smm = context.getResources().getDrawable(2131231813);
        View findViewById = findViewById(2131828139);
        j.o(findViewById, "findViewById(R.id.editor_video_play_view)");
        this.oxL = (VideoPlayerTextureView) findViewById;
        findViewById = findViewById(2131828140);
        j.o(findViewById, "findViewById(R.id.story_editor_control_panel)");
        this.smb = (EditorControlPanel) findViewById;
        findViewById = findViewById(2131828127);
        j.o(findViewById, "findViewById(R.id.story_editor_add_emoji)");
        this.slU = (ImageView) findViewById;
        findViewById = findViewById(2131828128);
        j.o(findViewById, "findViewById(R.id.story_editor_add_text)");
        this.slV = (ImageView) findViewById;
        findViewById = findViewById(2131828129);
        j.o(findViewById, "findViewById(R.id.story_editor_add_audio)");
        this.slW = (ImageView) findViewById;
        findViewById = findViewById(2131828131);
        j.o(findViewById, "findViewById(R.id.story_editor_add_location)");
        this.slX = (ImageView) findViewById;
        findViewById = findViewById(2131828130);
        j.o(findViewById, "findViewById(R.id.story_editor_add_audio_check)");
        this.slZ = (ImageView) findViewById;
        findViewById = findViewById(2131828132);
        j.o(findViewById, "findViewById(R.id.story_editor_add_location_check)");
        this.sma = (ImageView) findViewById;
        findViewById = findViewById(2131828124);
        j.o(findViewById, "findViewById(R.id.story_editor_control_layout)");
        this.slY = (ViewGroup) findViewById;
        findViewById = findViewById(2131828125);
        j.o(findViewById, "findViewById(R.id.editor_mix)");
        this.slT = findViewById;
        findViewById = findViewById(2131823456);
        j.o(findViewById, "findViewById(R.id.editor_item_container)");
        this.smc = (EditorItemContainer) findViewById;
        findViewById = findViewById(2131823403);
        j.o(findViewById, "findViewById(R.id.change_text_root)");
        this.smd = (EditorInputView) findViewById;
        findViewById = findViewById(2131828141);
        j.o(findViewById, "findViewById(R.id.story_editor_audio_panel)");
        this.smf = (EditorAudioView) findViewById;
        findViewById = findViewById(2131828120);
        j.o(findViewById, "findViewById(R.id.story_editor_more)");
        this.rnO = (ImageView) findViewById;
        findViewById = findViewById(2131828121);
        j.o(findViewById, "findViewById(R.id.story_editor_fav_tip)");
        this.smg = (ImageView) findViewById;
        findViewById = findViewById(2131828122);
        j.o(findViewById, "findViewById(R.id.story_editor_sns_tip)");
        this.smh = (ImageView) findViewById;
        this.smg.setImageDrawable(ah.f(context, 2131231432, -1));
        this.smh.setImageDrawable(ah.f(context, 2131231420, -1));
        this.rnO.setImageDrawable(ah.f(context, 2131231421, -1));
        if (com.tencent.mm.plugin.story.c.a.a.rQZ.cxh() || com.tencent.mm.plugin.story.c.a.a.rQZ.cwU()) {
            this.rnO.setVisibility(0);
        } else {
            this.rnO.setVisibility(8);
        }
        ImageView imageView = this.slW;
        if (((a$a) com.tencent.mm.plugin.story.c.a.a.rQZ.Uw()).rRg) {
            i2 = 0;
        } else {
            i2 = 8;
        }
        imageView.setVisibility(i2);
        this.slU.setOnClickListener((OnClickListener) new 1(this));
        this.slV.setOnClickListener((OnClickListener) new 5(this));
        this.slW.setOnClickListener((OnClickListener) new 6(this));
        this.smc.setOnLocationClick((OnClickListener) new 7(this));
        this.smc.setOnTextClick((OnClickListener) new 8(this));
        this.slX.setOnClickListener(new AnonymousClass9(this));
        this.slT.setOnClickListener((OnClickListener) new 10(this));
        ImageView imageView2 = (ImageView) findViewById(2131828119);
        imageView2.setOnClickListener((OnClickListener) new 11(this));
        this.rnO.setOnClickListener((OnClickListener) new 12(this, context));
        this.smc.setDeleteStateListener((a.f.a.b) new 2(this));
        this.smd.setOnVisibleChangeCallback((a.f.a.b) new 3(this));
        this.smd.setCallback((EditorInputView.a) new 4(this));
        this.sme = new com.tencent.mm.media.editor.b.a(context, this);
        this.sme.eUw = (a.f.a.b) new e(this);
        com.tencent.mm.media.editor.b.a aVar = this.sme;
        t.a aVar2 = (t.a) new f(this);
        j.p(aVar2, "callback");
        t AH = u.AH();
        j.o(AH, "callbackWrapper");
        AH.a(aVar2);
        aVar.eAk.setCallback((com.tencent.mm.pluginsdk.ui.chat.f) AH);
        this.smf.setOnVisibleChangeCallback((a.f.a.b) new c(this));
        this.smf.setCallback((EditorAudioView.a) new d(this));
        this.slU.setImageDrawable(ah.f(context, 2131231433, -1));
        this.slV.setImageDrawable(ah.f(context, 2131231434, -1));
        this.slW.setImageDrawable(ah.f(context, 2131231422, -1));
        this.slX.setImageDrawable(ah.f(context, 2131231416, -1));
        imageView2.setImageDrawable(ah.f(context, 2131231428, -1));
        this.sma.setImageDrawable(this.smm);
        this.slZ.setImageDrawable(this.smm);
        this.sma.setVisibility(8);
        this.slZ.setVisibility(8);
        this.smr = ak.fr(context);
        Point hy = ak.hy(getContext());
        int i3 = hy.y;
        i2 = hy.x;
        float f = ((float) i3) / ((float) i2);
        float f2 = (float) i3;
        com.tencent.mm.plugin.story.h.a.a aVar3 = com.tencent.mm.plugin.story.h.a.sdm;
        f2 /= com.tencent.mm.plugin.story.h.a.cBp();
        float f3 = (((float) i2) - f2) / 2.0f;
        float f4 = (float) i2;
        com.tencent.mm.plugin.story.h.a.a aVar4 = com.tencent.mm.plugin.story.h.a.sdm;
        f4 *= com.tencent.mm.plugin.story.h.a.cBo();
        float f5 = (((float) i3) - f4) / 2.0f;
        aVar4 = com.tencent.mm.plugin.story.h.a.sdm;
        if (f <= com.tencent.mm.plugin.story.h.a.cBo()) {
            this.smd.bd(f3);
            this.smc.ac(f2, f3);
        } else {
            aVar4 = com.tencent.mm.plugin.story.h.a.sdm;
            if (f >= com.tencent.mm.plugin.story.h.a.cBp()) {
                this.smc.ad(f4, f5);
            } else {
                this.smd.bd(f3);
                this.smc.ac(f2, f3);
                this.smc.ad(f4, f5);
            }
        }
        this.smu = new i(this);
        AppMethodBeat.o(110610);
    }

    public EditorView(Context context, AttributeSet attributeSet) {
        j.p(context, "context");
        this(context, attributeSet, 0);
        AppMethodBeat.i(110611);
        AppMethodBeat.o(110611);
    }

    public final b.a getPresenter() {
        AppMethodBeat.i(110595);
        b.a aVar = this.slS;
        if (aVar == null) {
            j.avw("presenter");
        }
        AppMethodBeat.o(110595);
        return aVar;
    }

    public final void setPresenter(b.a aVar) {
        AppMethodBeat.i(110596);
        j.p(aVar, "<set-?>");
        this.slS = aVar;
        AppMethodBeat.o(110596);
    }

    public final void setMusicPlayer(v vVar) {
        AppMethodBeat.i(110597);
        j.p(vVar, "player");
        this.smf.setMusicPlayer(vVar);
        AppMethodBeat.o(110597);
    }

    public final void cCA() {
        AppMethodBeat.i(110598);
        Intent intent = new Intent();
        if (this.smc.cCB()) {
            intent.putExtra("get_poi_classify_id", this.smk.wCC);
        }
        intent.putExtra("get_poi_from_scene", "story");
        intent.putExtra("poi_show_none", false);
        intent.putExtra("select_radio_icon_color", "#0E9CE6");
        com.tencent.mm.bp.d.b(getContext(), "nearlife", "com.tencent.mm.plugin.nearlife.ui.CheckInLifeUI", intent, 1003);
        AppMethodBeat.o(110598);
    }

    public final cei getLocation() {
        AppMethodBeat.i(110599);
        cei cei;
        if (this.hNp) {
            cei = this.smk;
            AppMethodBeat.o(110599);
            return cei;
        }
        cei = new cei();
        AppMethodBeat.o(110599);
        return cei;
    }

    public final void a(String str, long j, long j2, a<y> aVar) {
        AppMethodBeat.i(110600);
        j.p(str, "videoPath");
        this.oxL.setVideoCallback((e.a) this.smu);
        this.oxL.setVideoPath(str);
        this.oxL.setAlpha(0.0f);
        this.lnp = aVar;
        this.smi = ((double) j) / 1000.0d;
        this.smj = ((double) j2) / 1000.0d;
        EditorAudioView editorAudioView = this.smf;
        j.p(str, "videoPath");
        editorAudioView.sle = false;
        editorAudioView.sld = new com.tencent.mm.plugin.story.model.audio.f(str, j, j2);
        com.tencent.mm.plugin.story.model.audio.f fVar = editorAudioView.sld;
        if (fVar != null) {
            fVar.exD = (a.f.a.b) new com.tencent.mm.plugin.story.ui.view.editor.EditorAudioView.g(editorAudioView);
        }
        editorAudioView.slb.setSelection(Integer.valueOf(-1));
        ArrayList arrayList = new ArrayList();
        if (editorAudioView.slb.llU != 0) {
            editorAudioView.slb.setSelection(Integer.valueOf(-1));
        }
        AudioCacheInfo.a aVar2 = AudioCacheInfo.rUj;
        AudioCacheInfo audioCacheInfo = new AudioCacheInfo();
        audioCacheInfo.type = AudioCacheInfo.cyM();
        arrayList.add(audioCacheInfo);
        editorAudioView.slb.dG(arrayList);
        this.hNp = false;
        this.smc.f((a) h.smz);
        AppMethodBeat.o(110600);
    }

    public final VideoPlayerTextureView getVideoPlayView() {
        return this.oxL;
    }

    public final EditorItemContainer getItemContainer() {
        return this.smc;
    }

    public final boolean aFF() {
        AppMethodBeat.i(110601);
        if (getVisibility() == 0) {
            AppMethodBeat.o(110601);
            return true;
        }
        AppMethodBeat.o(110601);
        return false;
    }

    public final void a(boolean z, CharSequence charSequence, int i, int i2) {
        boolean z2 = true;
        AppMethodBeat.i(110602);
        if (z) {
            this.smd.setShow(true);
            EditorInputView editorInputView = this.smd;
            editorInputView.slx.setText(charSequence);
            if (charSequence != null) {
                editorInputView.slx.setSelection(charSequence.length());
            }
            if (i2 == 0) {
                z2 = false;
            }
            editorInputView.slB = z2;
            if (editorInputView.slB) {
                i = i2 | (EditorInputView.slD ^ -1);
            }
            editorInputView.setSelectedIndex(a.a.e.k(EditorInputView.sjN, i));
            editorInputView.lnw.setSelected(editorInputView.biG);
            editorInputView.lnD = false;
            editorInputView.slz.setActivated(editorInputView.slB);
            editorInputView.cCx();
            AppMethodBeat.o(110602);
            return;
        }
        this.smd.setShow(false);
        AppMethodBeat.o(110602);
    }

    public final boolean bmC() {
        AppMethodBeat.i(110603);
        if (this.sme.eAj.getVisibility() == 0) {
            AppMethodBeat.o(110603);
            return true;
        }
        AppMethodBeat.o(110603);
        return false;
    }

    public final void gC(boolean z) {
        AppMethodBeat.i(110604);
        if (z) {
            this.sme.setShow(true);
            AppMethodBeat.o(110604);
            return;
        }
        this.sme.setShow(false);
        AppMethodBeat.o(110604);
    }

    public final void reset() {
        AppMethodBeat.i(110606);
        this.rYq = true;
        this.smq = false;
        EditorItemContainer editorItemContainer = this.smc;
        editorItemContainer.lnI.removeAllViews();
        editorItemContainer.gI(false);
        EditorAudioView editorAudioView = this.smf;
        editorAudioView.rYp = false;
        editorAudioView.slf = true;
        editorAudioView.skW.setImageDrawable(ah.f(editorAudioView.getContext(), 2131232080, -1));
        editorAudioView.skX.setImageDrawable(ah.f(editorAudioView.getContext(), 2131232080, -1));
        editorAudioView.sla.reset();
        this.hNp = false;
        this.sma.setVisibility(8);
        this.slZ.setVisibility(8);
        this.smh.setVisibility(8);
        this.smg.setVisibility(8);
        this.smc.f((a) g.smy);
        AppMethodBeat.o(110606);
    }

    public final void destroy() {
        AppMethodBeat.i(110607);
        this.oxL.stop();
        this.sme.eAk.destroy();
        AppMethodBeat.o(110607);
    }

    public final void setVisibility(int i) {
        AppMethodBeat.i(110608);
        super.setVisibility(i);
        this.oxL.setVisibility(i);
        AppMethodBeat.o(110608);
    }

    public final long getMusicRequestId() {
        AppMethodBeat.i(110609);
        long musicRequestId = this.smf.getMusicRequestId();
        AppMethodBeat.o(110609);
        return musicRequestId;
    }

    public final boolean cxq() {
        int i;
        CharSequence charSequence = null;
        AppMethodBeat.i(110605);
        if (this.smd.getVisibility() == 0) {
            i = 1;
        } else {
            i = 0;
        }
        if (i != 0) {
            a(false, null, 0, 0);
            AppMethodBeat.o(110605);
            return true;
        } else if (bmC()) {
            gC(false);
            AppMethodBeat.o(110605);
            return true;
        } else if (this.smf.aFF()) {
            int i2;
            EditorAudioView editorAudioView = this.smf;
            EditorAudioSearchView editorAudioSearchView = editorAudioView.sla;
            if (editorAudioSearchView.getVisibility() == 0) {
                EditText editText = editorAudioSearchView.skC;
                if (editText != null) {
                    charSequence = editText.getText();
                }
                if (bo.ac(charSequence)) {
                    editorAudioSearchView.cCr();
                } else {
                    editorAudioSearchView.cCu();
                    b$a b_a = com.tencent.mm.plugin.story.model.audio.b.rUx;
                    com.tencent.mm.plugin.story.model.audio.b.cyT().cH(1);
                    b_a = com.tencent.mm.plugin.story.model.audio.b.rUx;
                    b$a.cyU();
                    editorAudioSearchView.reset();
                    EditorAudioSearchView.a aVar = editorAudioSearchView.skP;
                    if (aVar != null) {
                        aVar.cCv();
                    }
                }
                i2 = 1;
            } else {
                i2 = 0;
            }
            if (i2 == 0) {
                editorAudioView.setShow(false);
            }
            AppMethodBeat.o(110605);
            return true;
        } else {
            AppMethodBeat.o(110605);
            return false;
        }
    }

    public static final /* synthetic */ void d(EditorView editorView) {
        AppMethodBeat.i(110613);
        editorView.smf.setShow(true);
        AppMethodBeat.o(110613);
    }

    public static final /* synthetic */ void l(EditorView editorView) {
        boolean z;
        AppMethodBeat.i(138933);
        if (editorView.smq) {
            z = false;
        } else {
            z = true;
        }
        editorView.smq = z;
        b.a aVar = editorView.slS;
        if (aVar == null) {
            j.avw("presenter");
        }
        aVar.lv(editorView.smq);
        if (editorView.smq) {
            editorView.smg.setVisibility(0);
            AppMethodBeat.o(138933);
            return;
        }
        editorView.smg.setVisibility(8);
        AppMethodBeat.o(138933);
    }

    public static final /* synthetic */ void m(EditorView editorView) {
        boolean z;
        AppMethodBeat.i(138934);
        h hVar = h.scu;
        h.EU(16);
        if (editorView.rYq) {
            z = false;
        } else {
            z = true;
        }
        editorView.rYq = z;
        b.a aVar = editorView.slS;
        if (aVar == null) {
            j.avw("presenter");
        }
        aVar.lu(editorView.rYq);
        if (editorView.rYq) {
            editorView.smh.setVisibility(8);
            AppMethodBeat.o(138934);
            return;
        }
        editorView.smh.setVisibility(0);
        AppMethodBeat.o(138934);
    }
}
