导航菜单

页面标题

页面副标题

St.John's v1.0.9 - OTPActivity.java 源代码

正在查看: St.John's v1.0.9 应用的 OTPActivity.java JAVA 源代码文件

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


package com.mcb.stjohnsemschool.activity;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import com.mcb.stjohnsemschool.utils.Utility;
import com.mukesh.OtpView;

public class OTPActivity extends AppCompatActivity {
    private Activity activity;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_otp);
        this.activity = this;
        Bundle extras = getIntent().getExtras();
        String string = extras.getString("MobileNo", "");
        String string2 = extras.getString("EmailId", "");
        final String string3 = extras.getString("OTP", "");
        extras.getInt("UserId", 0);
        extras.getInt("StudentEnrollmentId", 0);
        final int i = extras.getInt("IsChangePassword", 0);
        boolean z = extras.getBoolean("MaskEmail", false);
        boolean z2 = extras.getBoolean("MaskMobile", false);
        TextView textView = (TextView) findViewById(R.id.txv_mobile_no_text);
        OtpView findViewById = findViewById(R.id.otp_view);
        if (z2) {
            string = Utility.maskPhoneNo(string);
        }
        if (z) {
            string2 = Utility.maskEmail(string2);
        }
        textView.setText("Please type the verification code sent to \n" + string + "\n\n" + string2);
        findViewById.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable editable) {
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
                Intent intent;
                if (charSequence == null || charSequence.length() != 6) {
                    return;
                }
                if (!string3.equalsIgnoreCase(charSequence.toString())) {
                    Utility.showInfoDialog(OTPActivity.this.activity, "Please enter valid OTP");
                    return;
                }
                SharedPreferences sharedPreferences = OTPActivity.this.getSharedPreferences("", 0);
                SharedPreferences.Editor edit = sharedPreferences.edit();
                edit.putBoolean("isloggedin", true);
                edit.putBoolean("IsValidUser", true);
                edit.commit();
                if (i == 1) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(OTPActivity.this);
                    builder.setMessage("Your password has expired. Please set a new password.").setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i5) {
                            OTPActivity.this.startActivity(new Intent(OTPActivity.this.getApplicationContext(), (Class<?>) ChangePasswordActivity.class));
                            if (ParentDetailsSelectionForLoginActivity.activity != null) {
                                ParentDetailsSelectionForLoginActivity.activity.finish();
                            }
                            OTPActivity.this.finish();
                        }
                    }).setCancelable(false);
                    builder.create().show();
                    return;
                }
                if (sharedPreferences.getInt("ThemeIdKey", 0) == 2) {
                    intent = new Intent((Context) OTPActivity.this, (Class<?>) Theme2HomeActivity.class);
                } else {
                    intent = new Intent((Context) OTPActivity.this, (Class<?>) ManageAccountsActivity.class);
                }
                OTPActivity.this.startActivity(intent);
                if (ParentDetailsSelectionForLoginActivity.activity != null) {
                    ParentDetailsSelectionForLoginActivity.activity.finish();
                }
                OTPActivity.this.finish();
            }
        });
    }
}