得物.apk(点击下载) / PollingPayResultActivity.java


package com.shizhuang.duapp.modules.financialstagesdk.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.TextView;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import cc0.f;
import com.knightboost.weaver.api.Scope;
import com.knightboost.weaver.api.annotations.Insert;
import com.knightboost.weaver.api.annotations.TargetClass;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.base.core.BaseCoreActivity;
import com.shizhuang.duapp.common.helper.net.ParamsBuilder;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.modules.financialstagesdk.api.config.interfaces.IPayResult;
import com.shizhuang.duapp.modules.financialstagesdk.http.api.FsPayApi;
import com.shizhuang.duapp.modules.financialstagesdk.model.PayResultModel;
import dc0.d;
import fc0.s1;
import java.util.Timer;
import p4.h;
import rd.g;
import rd.l;
import td.j;

public class PollingPayResultActivity extends BaseCoreActivity {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: h  reason: collision with root package name */
    public Timer f15336h;
    public CountDownTimer i;
    public boolean j;
    public boolean k = true;
    public IPayResult l;
    public TextView m;
    public String n = "";

    public class _boostWeave {
        public static ChangeQuickRedirect changeQuickRedirect;

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onCreate")
        @Keep
        public static void ActivityMethodWeaver_onCreate(@Nullable PollingPayResultActivity pollingPayResultActivity, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{pollingPayResultActivity, bundle}, null, changeQuickRedirect, true, 149674, new Class[]{PollingPayResultActivity.class, Bundle.class}, Void.TYPE).isSupported) {
                jn.b bVar = jn.b.f34396a;
                if (!bVar.b()) {
                    bVar.d(true);
                }
                long currentTimeMillis = System.currentTimeMillis();
                PollingPayResultActivity.f(pollingPayResultActivity, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (pollingPayResultActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.financialstagesdk.ui.activity.PollingPayResultActivity")) {
                    bVar.activityOnCreateMethod(pollingPayResultActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onResume")
        @Keep
        public static void ActivityMethodWeaver_onResume(PollingPayResultActivity pollingPayResultActivity) {
            if (!PatchProxy.proxy(new Object[]{pollingPayResultActivity}, null, changeQuickRedirect, true, 149676, new Class[]{PollingPayResultActivity.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                PollingPayResultActivity.h(pollingPayResultActivity);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (pollingPayResultActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.financialstagesdk.ui.activity.PollingPayResultActivity")) {
                    jn.b.f34396a.activityOnResumeMethod(pollingPayResultActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onStart")
        @Keep
        public static void ActivityMethodWeaver_onStart(PollingPayResultActivity pollingPayResultActivity) {
            if (!PatchProxy.proxy(new Object[]{pollingPayResultActivity}, null, changeQuickRedirect, true, 149675, new Class[]{PollingPayResultActivity.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                PollingPayResultActivity.g(pollingPayResultActivity);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (pollingPayResultActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.financialstagesdk.ui.activity.PollingPayResultActivity")) {
                    jn.b.f34396a.activityOnStartMethod(pollingPayResultActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }
    }

    public class a extends CountDownTimer {
        public static ChangeQuickRedirect changeQuickRedirect;

        public a(long j, long j12) {
            super(j, j12);
        }

        public void onFinish() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149669, new Class[0], Void.TYPE).isSupported) {
                PollingPayResultActivity.this.i();
            }
        }

        public void onTick(long j) {
            if (!PatchProxy.proxy(new Object[]{new Long(j)}, this, changeQuickRedirect, false, 149668, new Class[]{Long.TYPE}, Void.TYPE).isSupported) {
                PollingPayResultActivity.this.m.setText(String.format("%d s完成支付,请不要重复支付", Long.valueOf(j / 1000)));
            }
        }
    }

    public class b extends d<PayResultModel> {
        public static ChangeQuickRedirect changeQuickRedirect;

        public b(Context context) {
            super(context);
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, dc0.d
        public void onBzError(l<PayResultModel> lVar) {
            if (!PatchProxy.proxy(new Object[]{lVar}, this, changeQuickRedirect, false, 149672, new Class[]{l.class}, Void.TYPE).isSupported) {
                super.onBzError(lVar);
                PollingPayResultActivity.this.i();
                PollingPayResultActivity.this.k = true;
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, dc0.d
        public void onStart() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149670, new Class[0], Void.TYPE).isSupported) {
                super.onStart();
                PollingPayResultActivity.this.k = false;
            }
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, dc0.d
        public void onSuccess(PayResultModel payResultModel) {
            PayResultModel payResultModel2 = payResultModel;
            if (!PatchProxy.proxy(new Object[]{payResultModel2}, this, changeQuickRedirect, false, 149671, new Class[]{PayResultModel.class}, Void.TYPE).isSupported) {
                super.onSuccess(payResultModel2);
                PollingPayResultActivity.this.k = true;
                int tradeStatus = payResultModel2.getTradeStatus();
                if (tradeStatus == 1) {
                    PollingPayResultActivity pollingPayResultActivity = PollingPayResultActivity.this;
                    if (!pollingPayResultActivity.j && !PatchProxy.proxy(new Object[0], pollingPayResultActivity, PollingPayResultActivity.changeQuickRedirect, false, 149657, new Class[0], Void.TYPE).isSupported) {
                        pollingPayResultActivity.j = true;
                        if (pollingPayResultActivity.f15336h == null) {
                            pollingPayResultActivity.f15336h = new h("​com.shizhuang.duapp.modules.financialstagesdk.ui.activity.PollingPayResultActivity");
                        }
                        pollingPayResultActivity.f15336h.schedule(new s1(pollingPayResultActivity), 0, 1000);
                    }
                } else if (tradeStatus == 2) {
                    IPayResult iPayResult = PollingPayResultActivity.this.l;
                    if (iPayResult != null) {
                        iPayResult.onPaySuccess();
                    }
                    PollingPayResultActivity.this.finish();
                    PollingPayResultActivity.this.j();
                } else if (tradeStatus == 10) {
                    PollingPayResultActivity.this.i();
                }
            }
        }
    }

    public static void f(PollingPayResultActivity pollingPayResultActivity, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, pollingPayResultActivity, changeQuickRedirect, false, 149663, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.onCreate(bundle);
        }
    }

    public static void g(PollingPayResultActivity pollingPayResultActivity) {
        if (!PatchProxy.proxy(new Object[0], pollingPayResultActivity, changeQuickRedirect, false, 149665, new Class[0], Void.TYPE).isSupported) {
            super.onStart();
        }
    }

    public static void h(PollingPayResultActivity pollingPayResultActivity) {
        if (!PatchProxy.proxy(new Object[0], pollingPayResultActivity, changeQuickRedirect, false, 149667, new Class[0], Void.TYPE).isSupported) {
            super.onResume();
        }
    }

    @Override // com.shizhuang.duapp.common.base.core.IViewController2, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public int getLayout() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149652, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.activity_fs_polling_pay_result;
    }

    public void i() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149655, new Class[0], Void.TYPE).isSupported) {
            j();
            finish();
            IPayResult iPayResult = this.l;
            if (iPayResult != null) {
                iPayResult.onPayFailed(10999, "支付失败,请更换其他支付方式");
            }
        }
    }

    @Override // com.shizhuang.duapp.common.base.core.IViewController2, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void initData() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149654, new Class[0], Void.TYPE).isSupported) {
            k(this.n);
            this.i = new a(15000, 1000).start();
        }
    }

    @Override // com.shizhuang.duapp.common.base.core.IViewController2, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void initView(Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 149653, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            Intent intent = getIntent();
            if (intent != null) {
                this.n = intent.getStringExtra("payLogNum");
            }
            this.l = vb0.d.f39233c.d();
            this.m = (TextView) findViewById(R.id.tv_count_down_tips);
            ((DuImageLoaderView) findViewById(R.id.img_polling)).i("https://cdn.poizon.com/node-common/5abf914d8316761d7556da6384193365.gif").x();
        }
    }

    public void j() {
        Timer timer;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149660, new Class[0], Void.TYPE).isSupported) {
            this.i.cancel();
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149658, new Class[0], Void.TYPE).isSupported && (timer = this.f15336h) != null) {
                timer.cancel();
                this.f15336h = null;
            }
        }
    }

    public void k(String str) {
        if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 149656, new Class[]{String.class}, Void.TYPE).isSupported && this.k) {
            f fVar = f.f2462a;
            d c5 = new b(getContext()).c();
            if (!PatchProxy.proxy(new Object[]{str, c5}, fVar, f.changeQuickRedirect, false, 146749, new Class[]{String.class, d.class}, Void.TYPE).isSupported) {
                j.doRequest(((FsPayApi) j.getJavaGoApi(FsPayApi.class)).pollPayResult(g.a(androidx.appcompat.widget.a.e("payLogNum", str, ParamsBuilder.newParams()))), c5);
            }
        }
    }

    @Override // androidx.activity.ComponentActivity, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void onBackPressed() {
        boolean z = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149661, new Class[0], Void.TYPE).isSupported;
    }

    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void onCreate(Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 149662, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onCreate(this, bundle);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void onDestroy() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149659, new Class[0], Void.TYPE).isSupported) {
            super.onDestroy();
            j();
        }
    }

    @Override // androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149666, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onResume(this);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.base.core.BaseCoreActivity
    public void onStart() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 149664, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onStart(this);
        }
    }
}