导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - OtpActivity.java 源代码

正在查看: Clash Legends v0.0.1 应用的 OtpActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package co.paystack.android.ui;

import android.app.Activity;
import android.os.Bundle;
import co.paystack.android.R;
import co.paystack.android.design.widget.PinPadView;

public class OtpActivity extends Activity {
    private PinPadView pinpadView;
    final OtpSingleton si = OtpSingleton.getInstance();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.co_paystack_android____activity_otp);
        setTitle("ENTER OTP");
        getWindow().addFlags(128);
        this.pinpadView = (PinPadView) findViewById(R.id.pinpadView);
        setup();
    }

    protected void setup() {
        this.pinpadView.setPromptText(this.si.getOtpMessage());
        this.pinpadView.setVibrateOnIncompleteSubmit(false);
        this.pinpadView.setAutoSubmit(false);
        this.pinpadView.setOnPinChangedListener(new PinPadView.OnPinChangedListener() {
            @Override
            public void onPinChanged(String oldPin, String newPin) {
                if (newPin.length() >= OtpActivity.this.pinpadView.getPinLength()) {
                    OtpActivity.this.pinpadView.setPinLength(OtpActivity.this.pinpadView.getPinLength() + 1);
                }
            }
        });
        this.pinpadView.setOnSubmitListener(new PinPadView.OnSubmitListener() {
            @Override
            public void onCompleted(String otp) {
                OtpActivity.this.handleSubmit(otp);
            }

            @Override
            public void onIncompleteSubmit(String otp) {
                OtpActivity.this.handleSubmit(otp);
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        handleSubmit("");
    }

    public void handleSubmit(String otp) {
        synchronized (this.si) {
            this.si.setOtp(otp);
            this.si.notify();
        }
        finish();
    }
}