package com.tencent.mm.plugin.setting.ui.setting;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.bp;
import com.tencent.mm.plugin.messenger.foundation.a.a.j.b;
import com.tencent.mm.pluginsdk.ui.e.j;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.base.p;
import com.tencent.mm.ui.q;
import com.tencent.mm.ui.tools.f;
import com.tencent.mm.ui.widget.MMEditText;

public class EditSignatureUI extends MMActivity {
    private p eir = null;
    private c ekk = new 1(this);
    private MMEditText qkH;
    private b qkI;
    final bp qkJ = bp.aao();
    private boolean qkK = false;
    private TextView qkx;

    class a implements TextWatcher {
        private int qkM;

        private a() {
            this.qkM = 60;
        }

        /* synthetic */ a(EditSignatureUI editSignatureUI, byte b) {
            this();
        }

        public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            AppMethodBeat.i(126947);
            EditSignatureUI.this.enableOptionMenu(true);
            AppMethodBeat.o(126947);
        }

        public final void afterTextChanged(Editable editable) {
            AppMethodBeat.i(126948);
            this.qkM = f.bP(60, editable.toString());
            if (this.qkM < 0) {
                this.qkM = 0;
            }
            if (EditSignatureUI.this.qkx != null) {
                EditSignatureUI.this.qkx.setText(this.qkM);
            }
            AppMethodBeat.o(126948);
        }
    }

    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        AppMethodBeat.at(this, z);
    }

    public EditSignatureUI() {
        AppMethodBeat.i(126949);
        AppMethodBeat.o(126949);
    }

    public final int getLayoutId() {
        return 2130969318;
    }

    public void onCreate(Bundle bundle) {
        AppMethodBeat.i(126950);
        super.onCreate(bundle);
        com.tencent.mm.sdk.b.a.xxA.c(this.ekk);
        initView();
        AppMethodBeat.o(126950);
    }

    public void onDestroy() {
        AppMethodBeat.i(126951);
        super.onDestroy();
        com.tencent.mm.sdk.b.a.xxA.d(this.ekk);
        AppMethodBeat.o(126951);
    }

    public final void initView() {
        AppMethodBeat.i(126952);
        setMMTitle(2131303259);
        this.qkH = (MMEditText) findViewById(2131821019);
        this.qkx = (TextView) findViewById(2131823129);
        this.qkH.setText(j.b(this, bo.nullAsNil((String) g.RP().Ry().get(12291, null)), this.qkH.getTextSize()));
        this.qkH.setSelection(this.qkH.getText().length());
        this.qkx.setText(f.bP(60, this.qkH.getEditableText().toString()));
        com.tencent.mm.ui.tools.b.c.d(this.qkH).hz(0, 60).a(null);
        this.qkH.addTextChangedListener(new a(this, (byte) 0));
        setBackBtn(new 2(this));
        a(0, getString(2131297038), new 3(this), q.b.ymu);
        enableOptionMenu(false);
        AppMethodBeat.o(126952);
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        AppMethodBeat.i(126953);
        if (i == 4) {
            finish();
        }
        boolean onKeyDown = super.onKeyDown(i, keyEvent);
        AppMethodBeat.o(126953);
        return onKeyDown;
    }
}
