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

import android.text.Editable;
import android.text.TextWatcher;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.aa.a.d;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.bo;

class LaunchAAUI$4 implements TextWatcher {
    final /* synthetic */ LaunchAAUI gpj;

    LaunchAAUI$4(LaunchAAUI launchAAUI) {
        this.gpj = launchAAUI;
    }

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

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

    public final void afterTextChanged(Editable editable) {
        AppMethodBeat.i(40826);
        if (editable.toString().startsWith(".")) {
            editable.insert(0, "0");
        }
        String obj = editable.toString();
        int indexOf = obj.indexOf(".");
        int length = obj.length();
        if (indexOf >= 0 && length - indexOf > 3) {
            editable.delete(indexOf + 3, length);
        } else if (indexOf > 6) {
            editable.delete(6, indexOf);
        } else if (indexOf == -1 && length > 6) {
            editable.delete(6, length);
        }
        double d = bo.getDouble(editable.toString(), 0.0d);
        if (LaunchAAUI.f(this.gpj) != null && LaunchAAUI.f(this.gpj).size() > 0) {
            d = (d * 100.0d) / ((double) LaunchAAUI.f(this.gpj).size());
            LaunchAAUI.d(this.gpj);
            if (d > ((double) d.aoj())) {
                LaunchAAUI.a(this.gpj, true);
                h.pYm.e(13722, new Object[]{Integer.valueOf(2)});
                LaunchAAUI.c(this.gpj);
                LaunchAAUI.g(this.gpj);
                LaunchAAUI.h(this.gpj);
                AppMethodBeat.o(40826);
            }
        }
        LaunchAAUI.a(this.gpj, false);
        LaunchAAUI.c(this.gpj);
        LaunchAAUI.g(this.gpj);
        LaunchAAUI.h(this.gpj);
        AppMethodBeat.o(40826);
    }
}
