RbChat v4.56630229版本的 MD5 值为:d137f4b55d6b64b50641a810905f5957
以下内容为反编译后的 CardIOActivity.java 源代码,内容仅作参考
package io.card.payment;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.util.Log;
import android.view.OrientationEventListener;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.core.view.ViewCompat;
import io.agora.rtc2.Constants;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
public final class CardIOActivity extends Activity implements InterfaceC0146c {
public static final String EXTRA_APP_TOKEN = "io.card.payment.appToken";
public static final String EXTRA_LANGUAGE_OR_LOCALE = "io.card.payment.languageOrLocale";
public static final String EXTRA_NO_CAMERA = "io.card.payment.noCamera";
public static final String EXTRA_REQUIRE_CVV = "io.card.payment.requireCVV";
public static final String EXTRA_REQUIRE_EXPIRY = "io.card.payment.requireExpiry";
public static final String EXTRA_REQUIRE_ZIP = "io.card.payment.requireZip";
public static final String EXTRA_SCAN_RESULT = "io.card.payment.scanResult";
public static final String EXTRA_SUPPRESS_MANUAL_ENTRY = "io.card.payment.suppressManual";
public static final String EXTRA_USE_CARDIO_LOGO = "io.card.payment.useCardIOLogo";
public static final int RESULT_CARD_INFO = 13274384;
public static final int RESULT_CONFIRMATION_SUPPRESSED;
public static final int RESULT_ENTRY_CANCELED = 13274385;
public static final int RESULT_SCAN_NOT_AVAILABLE;
public static final int RESULT_SCAN_SUPPRESSED;
static Bitmap a = null;
private static int b = 13274385;
private static final long[] c;
private static final int d;
private static String e = null;
private static int q = 0;
private static boolean u = false;
private static boolean v = true;
private Z f;
private OrientationEventListener g;
private aa h;
private CreditCard i;
private Rect j;
private int k;
private int l;
private RelativeLayout o;
private FrameLayout p;
private CardScanner r;
private O s;
private boolean m = false;
private boolean n = false;
private boolean t = false;
static {
int i = RESULT_ENTRY_CANCELED + 1;
b = i;
int i2 = i + 1;
b = i2;
RESULT_SCAN_NOT_AVAILABLE = i;
int i3 = i2 + 1;
b = i3;
RESULT_SCAN_SUPPRESSED = i2;
b = i3 + 1;
RESULT_CONFIRMATION_SUPPRESSED = i3;
c = new long[]{0, 70, 10, 40};
d = 10;
q = 0;
u = true;
a = null;
}
public void a(int i) {
int i2;
int i3;
if (i < 0 || this.r == null) {
return;
}
int rotation = ((WindowManager) getSystemService("window")).getDefaultDisplay().getRotation();
int i4 = Constants.VIDEO_ORIENTATION_270;
if (rotation != 0) {
if (rotation == 1) {
i2 = 90;
} else if (rotation == 2) {
i2 = 180;
} else if (rotation == 3) {
i2 = Constants.VIDEO_ORIENTATION_270;
}
i3 = i + i2;
if (i3 > 360) {
i3 -= 360;
}
if (i3 >= 15 || i3 > 345) {
this.l = 1;
i4 = 0;
} else if (i3 > 75 && i3 < 105) {
this.l = 4;
i4 = 90;
} else if (i3 > 165 && i3 < 195) {
this.l = 2;
i4 = 180;
} else if (i3 <= 255 || i3 >= 285) {
i4 = -1;
} else {
this.l = 3;
}
if (i4 >= 0 || i4 == this.k) {
}
this.r.a(this.l);
b(i4);
return;
}
i2 = 0;
i3 = i + i2;
if (i3 > 360) {
}
if (i3 >= 15) {
}
this.l = 1;
i4 = 0;
if (i4 >= 0) {
}
}
public void a(int i, Intent intent) {
setResult(i, intent);
a = null;
finish();
}
private void a(Exception exc) {
am amVar = am.ERROR_CAMERA_UNEXPECTED_FAIL;
Toast makeText = Toast.makeText(this, al.a(amVar), 1);
makeText.setGravity(17, 0, -75);
makeText.show();
this.t = true;
this.s.a(amVar, exc, (Map) null);
}
private void a(boolean z) {
if ((this.h == null || this.f == null || !this.r.b(z)) ? false : true) {
this.f.a(z);
}
}
private void b(int i) {
SurfaceView a2 = this.h.a();
if (a2 == null) {
Log.wtf("card.io", "surface view is null.. recovering... rotation might be weird.");
return;
}
Rect a3 = this.r.a(a2.getWidth(), a2.getHeight());
this.j = a3;
a3.top += a2.getTop();
this.j.bottom += a2.getTop();
this.f.a(this.j, i);
this.k = i;
}
public static CreditCard c(CardIOActivity cardIOActivity) {
cardIOActivity.i = null;
return null;
}
public static boolean canReadCardWithCamera() {
try {
if (u) {
return ad.a();
}
return false;
} catch (CameraUnavailableException unused) {
return false;
}
}
public static boolean canReadCardWithCamera(Context context) {
return canReadCardWithCamera();
}
public static int d() {
return 10;
}
public void e() {
if (u) {
getIntent();
new Handler().post(new RunnableC0148e(this));
}
}
public static Date sdkBuildDate() {
return new Date("08/13/2013 11:23:14 -0500");
}
public static String sdkVersion() {
return "sdk-3.1.0";
}
public final void a() {
SurfaceView a2 = this.h.a();
Z z = this.f;
if (z != null) {
z.a(new Rect(a2.getLeft(), a2.getTop(), a2.getRight(), a2.getBottom()));
}
this.l = 1;
b(0);
if (1 != this.l) {
Log.wtf("card.io", "the orientation of the scanner doesn't match the orientation of the activity");
}
a(new DetectionInfo());
}
public final void a(Bitmap bitmap, DetectionInfo detectionInfo) {
float f;
float f2;
try {
((Vibrator) getSystemService("vibrator")).vibrate(c, -1);
} catch (SecurityException | Exception unused) {
}
this.r.c();
this.o.setVisibility(4);
if (detectionInfo.a()) {
CreditCard b2 = detectionInfo.b();
this.i = b2;
this.f.a(b2);
this.s.c(this.r.e());
}
int i = this.l;
if (i == 1 || i == 2) {
f = this.j.right / 428.0f;
f2 = 0.95f;
} else {
f = this.j.right / 428.0f;
f2 = 1.15f;
}
float f3 = f * f2;
Matrix matrix = new Matrix();
matrix.postScale(f3, f3);
this.f.a(Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false));
e();
}
public final void a(DetectionInfo detectionInfo) {
this.f.a(detectionInfo);
}
@Override
public final void authorizeScanFailed(Throwable th) {
th.getMessage();
}
@Override
public final void authorizeScanSuccessful() {
}
@Override
public final void authorizeScanUnsuccessful() {
if (u) {
u = false;
new AlertDialog.Builder(this).setTitle(al.a(am.WHOOPS)).setMessage(al.a(am.APP_NOT_AUTHORIZED_MESSAGE)).setNegativeButton(al.a(am.CANCEL), new DialogInterface$OnClickListenerC0152i(this)).setCancelable(false).create().show();
}
}
public final void b() {
a(!this.r.f());
}
public final void c() {
this.r.a(true);
}
@Override
protected final void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
String.format("onActivityResult(requestCode:%d, resultCode:%d, ...", Integer.valueOf(i), Integer.valueOf(i2));
if (i2 == RESULT_CARD_INFO || i2 == RESULT_ENTRY_CANCELED || this.t) {
if (intent != null && intent.hasExtra(EXTRA_SCAN_RESULT)) {
Objects.toString(intent.getParcelableExtra(EXTRA_SCAN_RESULT));
}
a(i2, intent);
return;
}
RelativeLayout relativeLayout = this.o;
if (relativeLayout != null) {
relativeLayout.setVisibility(0);
}
}
@Override
public final void onBackPressed() {
CardScanner cardScanner;
if (!this.t) {
Z.c();
}
O o = this.s;
if (o == null || (cardScanner = this.r) == null) {
return;
}
o.a(cardScanner.e());
super.onBackPressed();
}
@Override
protected final void onCreate(Bundle bundle) {
CardScanner cardScanner;
int i = q + 1;
q = i;
if (i != 1) {
String.format("INTERNAL WARNING: There are %d (not 1) CardIOActivity allocations!", Integer.valueOf(i));
}
super.onCreate(bundle);
Intent intent = getIntent();
al.a(intent);
String stringExtra = intent.getStringExtra(EXTRA_APP_TOKEN);
e = stringExtra;
if (stringExtra == null || stringExtra.length() == 0 || e.contains(" ")) {
throw new IllegalArgumentException("A valid card.io app token must be supplied as a stringExtra with the key CardIOActivity.EXTRA_APP_TOKEN. Get one at https://card.io");
}
this.n = false;
this.s = new O(this, e, false);
String str = e;
C0144a a2 = W.a();
a2.a(str, null);
a2.a(this, "https://api.card.io/0/sdk/auth.json", new ab(this));
String a3 = ad.a(getPackageManager().resolveActivity(intent, 65536), CardIOActivity.class);
if (a3 != null) {
throw new RuntimeException(a3);
}
this.m = intent.getBooleanExtra(EXTRA_SUPPRESS_MANUAL_ENTRY, false);
if (intent.getBooleanExtra(EXTRA_NO_CAMERA, false)) {
this.t = true;
} else {
try {
if (!ad.a()) {
am amVar = am.ERROR_NO_DEVICE_SUPPORT;
al.a(amVar);
Objects.toString(amVar);
this.t = true;
this.s.a(amVar, (Map) null);
}
} catch (CameraUnavailableException e2) {
am amVar2 = am.ERROR_CAMERA_CONNECT_FAIL;
String a4 = al.a(amVar2);
Objects.toString(amVar2);
Toast makeText = Toast.makeText(this, a4, 1);
makeText.setGravity(17, 0, -75);
makeText.show();
this.t = true;
this.s.a(amVar2, e2, (Map) null);
} catch (Exception e3) {
a(e3);
}
}
if (u && !this.t) {
try {
requestWindowFeature(1);
this.j = new Rect();
this.l = 1;
if (!intent.getBooleanExtra("io.card.payment.cameraBypassTestMode", false)) {
cardScanner = new CardScanner(this, this.l);
} else if (!getPackageName().contentEquals("io.card.development")) {
getPackageName();
throw new IllegalStateException("illegal access of private extra");
} else {
cardScanner = (CardScanner) Class.forName("io.card.payment.CardScannerTester").getConstructor(getClass(), Integer.TYPE).newInstance(this, Integer.valueOf(this.l));
}
this.r = cardScanner;
this.r.b();
FrameLayout frameLayout = new FrameLayout(this);
this.p = frameLayout;
frameLayout.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.p.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
FrameLayout frameLayout2 = new FrameLayout(this);
frameLayout2.setId(1);
this.r.getClass();
this.r.getClass();
aa aaVar = new aa(this);
this.h = aaVar;
aaVar.setLayoutParams(new FrameLayout.LayoutParams(-1, -1, 48));
frameLayout2.addView(this.h);
Z z = new Z(this, ad.a(this));
this.f = z;
z.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.f.b(getIntent().getBooleanExtra(EXTRA_USE_CARDIO_LOGO, false));
frameLayout2.addView(this.f);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(10);
layoutParams.addRule(2, 2);
this.p.addView(frameLayout2, layoutParams);
RelativeLayout relativeLayout = new RelativeLayout(this);
this.o = relativeLayout;
relativeLayout.setGravity(80);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -2);
layoutParams.addRule(12);
this.o.setLayoutParams(layoutParams2);
this.o.setId(2);
this.o.setGravity(85);
if (!this.m) {
Button button = new Button(this);
button.setId(3);
button.setText(al.a(am.KEYBOARD));
button.setTextSize(12.0f);
button.setOnClickListener(new View$OnClickListenerC0150g(this));
this.o.addView(button);
C0156m.a((View) button, false, (Context) this);
button.setTextSize(14.0f);
button.setMinimumHeight(C0156m.a("42dip", this));
RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) button.getLayoutParams();
layoutParams3.width = -2;
layoutParams3.height = -2;
layoutParams3.addRule(12);
C0156m.a(button, "16dip", null, "16dip", null);
C0156m.b(button, "4dip", "4dip", "4dip", "4dip");
}
RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-1, -2);
layoutParams4.addRule(12);
int i2 = (int) ((getResources().getDisplayMetrics().density * 15.0f) + 0.5f);
layoutParams4.setMargins(0, i2, 0, i2);
this.p.addView(this.o, layoutParams4);
setContentView(this.p);
this.g = new C0147d(this, this);
} catch (Exception e4) {
a(e4);
}
}
if ((this.t || !u) && this.m) {
a(RESULT_SCAN_NOT_AVAILABLE, (Intent) null);
}
}
@Override
protected final void onDestroy() {
this.f = null;
q--;
CardScanner cardScanner = this.r;
if (cardScanner != null) {
cardScanner.d();
this.r = null;
}
super.onDestroy();
}
@Override
protected final void onPause() {
super.onPause();
OrientationEventListener orientationEventListener = this.g;
if (orientationEventListener != null) {
orientationEventListener.disable();
}
a(false);
CardScanner cardScanner = this.r;
if (cardScanner != null) {
cardScanner.c();
} else if (this.t) {
} else {
Log.wtf("card.io", "cardScanner is null in onPause()");
}
}
@Override
protected final void onResume() {
super.onResume();
if (this.t) {
this.s.b((Map) null);
e();
} else if (!u) {
a(0, (Intent) null);
} else {
ad.b();
getWindow().addFlags(1024);
getWindow().addFlags(128);
setRequestedOrientation(1);
this.g.enable();
this.i = null;
if (!v && this.h == null) {
throw new AssertionError();
}
boolean a2 = this.r.a(this.h.b());
if (a2) {
this.o.setVisibility(0);
}
if (a2) {
a(false);
this.s.a();
} else {
am amVar = am.ERROR_CAMERA_UNEXPECTED_FAIL;
Toast.makeText(this, al.a(amVar), 1).show();
e();
this.s.a(amVar, this.r.e());
}
a(this.k);
}
}
}