乐健体育 v3.9.1版本的 MD5 值为:87ae8a64955cdd0e43f3559ee8984d75
以下内容为反编译后的 CollectionSuccessActivity.java 源代码,内容仅作参考
package com.ledreamer.zz.activity.face;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Observer;
import com.baidu.idl.face.platform.utils.Base64Utils;
import com.baidu.idl.face.platform.utils.BitmapUtils;
import com.baidu.idl.face.platform.utils.FileUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.google.mlkit.common.sdkinternal.OptionalModuleUtils;
import com.ledreamer.zz.R;
import com.ledreamer.zz.activity.face.CollectionSuccessActivity;
import com.ledreamer.zz.activity.face.viewmodel.CollectionSuccessViewModel;
import com.ledreamer.zz.widget.LoadingPopWindow;
import com.legym.base.mvvm.BaseActivity;
import com.legym.base.utils.XUtil;
import com.lxj.xpopup.core.BasePopupView;
import com.taobao.weex.el.parse.Operators;
import f.l.f.e.a;
import f.m.e.g;
import f.p.b.a;
import java.io.File;
public class CollectionSuccessActivity extends BaseActivity<a, CollectionSuccessViewModel> {
private File file;
private BasePopupView loadingPop;
private Bitmap base64ToBitmap(String str) {
byte[] decode = Base64Utils.decode(str, 2);
return BitmapFactory.decodeByteArray(decode, 0, decode.length);
}
private String getFrameSavePath(String str) {
File sDRootFile = FileUtils.getSDRootFile();
if (sDRootFile == null) {
return null;
}
File file = new File(sDRootFile.toString() + "/image");
if (!file.exists()) {
file.mkdir();
}
return file + Operators.DIV + str + ".jpg";
}
private void initIntentData() {
Intent intent = getIntent();
if (intent != null) {
String stringExtra = intent.getStringExtra("bmpStr");
if (TextUtils.isEmpty(stringExtra)) {
return;
}
RequestOptions.circleCropTransform().dontAnimate().diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true);
RequestManager with = Glide.with((FragmentActivity) this);
with.load("data:image/jpg;base64," + stringExtra).into(((a) this.binding).a);
saveImage(base64ToBitmap(stringExtra));
}
}
private void initView() {
((a) this.binding).b.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CollectionSuccessActivity.this.p(view);
}
});
((a) this.binding).f3794f.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CollectionSuccessActivity.this.q(view);
}
});
((a) this.binding).f3795g.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CollectionSuccessActivity.this.r(view);
}
});
a.C0141a c0141a = new a.C0141a(this);
Boolean bool = Boolean.FALSE;
this.loadingPop = c0141a.c(bool).b(bool).a(new LoadingPopWindow(this));
}
public void p(View view) {
finish();
}
public void q(View view) {
finish();
}
public void r(View view) {
File file = this.file;
if (file != null) {
((CollectionSuccessViewModel) this.viewModel).uploadFaceImage(file);
} else {
XUtil.l("资源错误,请稍后或重新识别");
}
}
public void s(Boolean bool) {
if (bool.booleanValue()) {
XUtil.l("人脸上传成功");
setResult(200001);
((f.l.f.e.a) this.binding).b.postDelayed(new Runnable() {
@Override
public final void run() {
CollectionSuccessActivity.this.finish();
}
}, 300L);
}
}
public void t(Bitmap bitmap) {
try {
String frameSavePath = getFrameSavePath(OptionalModuleUtils.FACE);
if (frameSavePath == null) {
return;
}
File file = new File(frameSavePath);
this.file = file;
BitmapUtils.saveBitmap(file, bitmap);
bitmap.recycle();
} catch (Exception e2) {
e2.printStackTrace();
}
}
private void saveImage(final Bitmap bitmap) {
new Thread(new Runnable() {
@Override
public final void run() {
CollectionSuccessActivity.this.t(bitmap);
}
}).start();
}
public void updateLoadingUI(Integer num) {
int intValue = num.intValue();
if (intValue != -1) {
if (intValue == 1) {
this.loadingPop.show();
return;
} else if (intValue != 2) {
return;
}
}
this.loadingPop.dismiss();
}
@Override
public void darkBarFont() {
g.l0(this).c(false).h0().h0().o(false).d0(true).E();
}
@Override
public int initContentView(Bundle bundle) {
return R.layout.activity_collect_success;
}
@Override
public int initVariableId() {
return 0;
}
@Override
public void initViewObservable() {
super.initViewObservable();
((CollectionSuccessViewModel) this.viewModel).getUploadFaceResult().observe(this, new Observer() {
@Override
public final void onChanged(Object obj) {
CollectionSuccessActivity.this.s((Boolean) obj);
}
});
((CollectionSuccessViewModel) this.viewModel).getUploadFaceStatus().observe(this, new Observer() {
@Override
public final void onChanged(Object obj) {
CollectionSuccessActivity.this.updateLoadingUI((Integer) obj);
}
});
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
darkBarFont();
initView();
initIntentData();
}
@Override
public void whiteBarFont() {
g.l0(this).c(false).h0().h0().o(false).d0(false).E();
}
}