正在查看: SpeedCash v6.5.1482 应用的 DetailDocumentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: SpeedCash v6.5.1482 应用的 DetailDocumentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.bm.sc.bebasbayar.ui.activity.account;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.SearchView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
import com.bm.sc.bebasbayar.BuildConfig;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.adapter.entity.DocumentEntity;
import com.bm.sc.bebasbayar.adapter.entity.ProdukListEntity;
import com.bm.sc.bebasbayar.adapter.list.CashWdTokenAdapter;
import com.bm.sc.bebasbayar.handler.MessageComposer;
import com.bm.sc.bebasbayar.handler.MessageSender;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.helper.Buttonizer;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.MessageProcess;
import com.bm.sc.bebasbayar.message.BaseMessage;
import com.bm.sc.bebasbayar.message.mp.DetailMessage;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.ui.BaseActivity;
import com.bm.sc.bebasbayar.ui.activity.account.DetailDocumentActivity;
import com.bm.sc.bebasbayar.ui.activity.cash.TransferWithdrawActivity;
import com.bm.sc.bebasbayar.ui.activity.ubp.PajakNegaraActivity;
import com.bm.sc.bebasbayar.ui.fragment.dialog.OptionListFragment;
import com.bm.sc.bebasbayar.ui.fragment.home.ProfileFragment;
import com.bm.sc.bebasbayar.ui.widget.AspectImageView;
import com.bm.sc.util.android.Imagery;
import com.bm.sc.util.format.DateTime;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Objects;
public class DetailDocumentActivity extends BaseActivity implements OptionListFragment.OnOptionChoosenListener {
public static final int PICK_FROM_CAMERA = 11111;
public static final int REQUEST_CAMERA_PERMISSIONS = 555;
public static final String TAG = "DetailDocumentActivity";
public final int c = 1000;
public NestedScrollView d;
public String e;
public AspectImageView f;
public Uri g;
public ArrayList<ProdukListEntity> h;
public TextView i;
public TextView j;
public TextView k;
public TextView l;
public TextView m;
public ImageView n;
public ImageView o;
public ImageView p;
public ImageView q;
public View r;
public View s;
public View t;
public View u;
public Boolean v;
public Boolean w;
public Bitmap x;
public File y;
public class a implements MessageProcess {
public final Button a;
public final String b;
public a(Button button, String str) {
this.a = button;
this.b = str;
}
public void b(int i, Boolean bool) {
Affinity.purge(DetailDocumentActivity.this, TransferWithdrawActivity.class);
}
@Override
public void afterProcess(BaseMessage baseMessage) {
Buttonizer.reset(this.a);
DetailMessage detailMessage = new DetailMessage(baseMessage);
if (!detailMessage.isOK()) {
Affinity.info(DetailDocumentActivity.this, false, detailMessage.getMessageDescription());
return;
}
DetailDocumentActivity.this.findViewById(R.id.detail_preview_panel).setVisibility(8);
if (!this.b.equals("IDCARD")) {
SearchView.OnQueryTextListener onQueryTextListener = DetailDocumentActivity.this;
Affinity.info(onQueryTextListener, 1, onQueryTextListener.getString(R.string.title_info), detailMessage.getMessageDescription(), new BBCallback() {
@Override
public final void do_callback(int i, Object obj) {
DetailDocumentActivity.a.this.b(i, (Boolean) obj);
}
});
} else if (DetailDocumentActivity.this.w.booleanValue() || DetailDocumentActivity.this.v.booleanValue()) {
DetailDocumentActivity.this.L();
} else {
DetailDocumentActivity.this.O();
}
}
@Override
public void backgroundProcess(long j, long j2, boolean z) {
}
@Override
public void preProcess() {
Buttonizer.loading(this.a);
DetailDocumentActivity.this.hideKeyboard();
}
}
public void F(View view) {
B((byte) 0);
findViewById(R.id.detail_preview_panel).setVisibility(8);
E();
}
public void G(View view) {
B((byte) 1);
findViewById(R.id.detail_preview_panel).setVisibility(8);
E();
}
public void H(int i, Boolean bool) {
if (bool.booleanValue()) {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.CAMERA"}, REQUEST_CAMERA_PERMISSIONS);
} else {
Affinity.info(this, false, getString(R.string.transaction_camera_permission_denied));
}
}
public void I() {
this.d.fullScroll(130);
}
public void J(int i, Boolean bool) {
if (bool.booleanValue()) {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.CAMERA"}, REQUEST_CAMERA_PERMISSIONS);
} else {
Affinity.info(this, false, getString(R.string.transaction_camera_permission_denied));
}
}
public void K() {
this.q.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_2_active));
this.p.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_1_active));
this.u.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryLight));
}
public void l(View view) {
L();
}
public final void B(byte b) {
if (b == 0) {
this.e = "KTP";
} else if (b == 1) {
this.e = "SELFIE";
}
StringBuilder sb = new StringBuilder();
sb.append("fromUsing ");
sb.append(this.e);
}
public final Bitmap C() {
Uri uri = this.g;
if (uri == null) {
return null;
}
String realPathFromURI = Imagery.getRealPathFromURI(this, uri);
if (realPathFromURI == null) {
realPathFromURI = this.g.getPath();
}
return N(BitmapFactory.decodeFile(realPathFromURI));
}
public final void D(ProdukListEntity produkListEntity) {
StringBuilder sb = new StringBuilder();
sb.append("getChangeID: ");
sb.append(produkListEntity);
this.k.setText(produkListEntity.getName());
this.n.setImageResource(produkListEntity.getDrawable_resid().intValue());
this.o.setImageResource(produkListEntity.getCode().equalsIgnoreCase("ktp") ? R.drawable.ic_ktp : produkListEntity.getCode().equalsIgnoreCase("sim") ? R.drawable.ic_sim : produkListEntity.getCode().equalsIgnoreCase("paspor") ? R.drawable.ic_paspor : R.drawable.foto_selfie);
if (produkListEntity.getCode().equalsIgnoreCase("ktp") || produkListEntity.getCode().equalsIgnoreCase("sim") || produkListEntity.getCode().equalsIgnoreCase("paspor")) {
this.r.setVisibility(0);
this.s.setVisibility(8);
this.j.setVisibility(0);
this.i.setVisibility(8);
this.m.setText(getString(R.string.detail_upload_doc_ktp_2, produkListEntity.getCode()));
this.p.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_1_active));
this.q.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_2_inactive));
this.u.setBackgroundColor(ContextCompat.getColor(this, R.color.LightGrey));
} else {
this.r.setVisibility(8);
this.s.setVisibility(0);
this.t.setVisibility(8);
this.j.setVisibility(8);
this.i.setVisibility(0);
this.l.setText("Ketentuan Foto Selfie dengan Identitas");
this.q.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_2_active));
this.p.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_1_active));
this.u.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryLight));
}
this.j.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DetailDocumentActivity.this.F(view);
}
});
this.i.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DetailDocumentActivity.this.G(view);
}
});
}
public final void E() {
if (Affinity.isPermissionGranted(this, "android.permission.CAMERA")) {
M();
} else {
Affinity.confirm(this, getString(R.string.title_confirm), getString(R.string.transaction_camera_permission), new BBCallback() {
@Override
public final void do_callback(int i, Object obj) {
DetailDocumentActivity.this.H(i, (Boolean) obj);
}
});
}
}
public final void L() {
setResult(-1);
finish();
}
public final void M() {
File file;
File cacheDir = getCacheDir();
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
try {
file = File.createTempFile(String.valueOf(System.currentTimeMillis()), ".jpg", cacheDir);
} catch (IOException e) {
e.printStackTrace();
file = null;
}
this.g = Uri.fromFile(file);
this.y = file;
if (file != null) {
this.g = FileProvider.getUriForFile(getApplicationContext(), BuildConfig.APPLICATION_ID + ".fileprovider", file);
StringBuilder sb = new StringBuilder();
sb.append("mImageCaptureUri.toString() ");
sb.append(this.g.toString());
intent.putExtra("return-data", true);
intent.putExtra("output", this.g);
startActivityForResult(intent, 11111);
}
}
public final Bitmap N(Bitmap bitmap) {
int i;
if (bitmap == null) {
return null;
}
float width = bitmap.getWidth() / bitmap.getHeight();
int i2 = 1000;
if (width > RecyclerView.G0) {
i = (int) (1000 / width);
} else {
i2 = (int) (1000 * width);
i = 1000;
}
return Bitmap.createScaledBitmap(bitmap, i2, i, false);
}
public final void O() {
this.r.setVisibility(8);
this.s.setVisibility(0);
this.t.setVisibility(8);
this.j.setVisibility(8);
this.i.setVisibility(0);
this.o.setImageResource(R.drawable.foto_selfie);
this.l.setText("Ketentuan Foto Selfie dengan Identitas");
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
DetailDocumentActivity.this.K();
}
}, 500L);
}
public final void P(View view, String str, String str2, String str3) {
Bitmap bitmap;
try {
bitmap = C();
} catch (Exception e) {
StringBuilder sb = new StringBuilder();
sb.append("Exception getBitmapFromUri() ");
sb.append(e);
bitmap = null;
}
if (bitmap == null) {
try {
bitmap = this.x;
} catch (Exception e2) {
StringBuilder sb2 = new StringBuilder();
sb2.append("Exception bitmapFoto ");
sb2.append(e2);
}
}
if (bitmap == null) {
Affinity.info(this, false, "Silakan pilih gambar!");
return;
}
Button button = (Button) view;
double width = bitmap.getWidth();
double height = bitmap.getHeight();
double d = width > height ? 600.0d / width : 600.0d / height;
String createBase64FromBitmap = Imagery.createBase64FromBitmap(Bitmap.createScaledBitmap(bitmap, (int) (width * d), (int) (height * d), false));
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("id", str);
hashMap.put("kode_dokumen", str2);
hashMap.put("nama_dokumen", str3);
hashMap.put("time_upload", DateTime.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
hashMap.put("time_verifikasi", 0);
hashMap.put("ket_verifikasi", "");
hashMap.put("status", "");
hashMap.put("no_file", "");
try {
hashMap.put("file_raw", URLEncoder.encode(createBase64FromBitmap, "UTF-8"));
} catch (UnsupportedEncodingException unused) {
hashMap.put("file_raw", "");
}
ArrayList<HashMap<String, Object>> arrayList = new ArrayList<>();
arrayList.add(hashMap);
DetailMessage detailMessage = new DetailMessage(this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID), this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_PIN), this.appSession.retrieve(AppSession.PROPERTY_AUTH_TOKEN));
detailMessage.setProductCode(DetailMessage.INC_PRODUCT_CODE_UPLOAD);
detailMessage.setUploads_detail(arrayList);
MessageComposer messageComposer = new MessageComposer(1, "");
messageComposer.setRequest_method(MessageComposer.POST);
messageComposer.setData_type(1);
messageComposer.setIs_credential(true);
messageComposer.setShowProgressRegular(true);
messageComposer.setIs_encrypted(true);
messageComposer.setMessageProcess(new a(button, str2));
MessageSender messageSender = new MessageSender(this, messageComposer);
messageSender.setRequestMessage(detailMessage);
messageSender.execute();
}
@Override
public String getClassSimpleName() {
return "detaildocument";
}
@Override
public int getLayoutResource() {
return R.layout.activity_detail_document;
}
@Override
public String getWikiNameSpace() {
return null;
}
@Override
public boolean isEligibleForFavorit() {
return false;
}
@Override
public void onActivityResult(int r7, int r8, android.content.Intent r9) {
throw new UnsupportedOperationException("Method not decompiled: com.bm.sc.bebasbayar.ui.activity.account.DetailDocumentActivity.onActivityResult(int, int, android.content.Intent):void");
}
@Override
public void onBackPressed() {
L();
}
@Override
public void onClick(View view) {
if (view.getId() == 2131362535) {
OptionListFragment optionListFragment = new OptionListFragment();
optionListFragment.setArguments(optionListFragment.setupDefaultBundle(111, "Pilih Jenis Identitas", this.h, Boolean.FALSE));
optionListFragment.show(getSupportFragmentManager(), "id_options");
return;
}
if (view.getId() == 2131363238) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction("android.intent.action.GET_CONTENT");
startActivityForResult(Intent.createChooser(intent, "Complete action using"), 22222);
return;
}
if (view.getId() == 2131363239) {
if (Affinity.isPermissionGranted(this, "android.permission.CAMERA")) {
M();
return;
} else {
Affinity.confirm(this, getString(R.string.title_confirm), getString(R.string.transaction_camera_permission), new BBCallback() {
@Override
public final void do_callback(int i, Object obj) {
DetailDocumentActivity.this.J(i, (Boolean) obj);
}
});
return;
}
}
if (view.getId() == 2131362336) {
B((byte) 0);
findViewById(R.id.detail_preview_panel).setVisibility(8);
E();
return;
}
if (view.getId() == 2131362337) {
B((byte) 1);
findViewById(R.id.detail_preview_panel).setVisibility(8);
E();
return;
}
if (view.getId() != 2131362455) {
if (view.getId() != 2131362284) {
super.onClick(view);
return;
} else {
this.g = null;
findViewById(R.id.detail_preview_panel).setVisibility(8);
return;
}
}
StringBuilder sb = new StringBuilder();
sb.append("klik upload fromUsing: ");
sb.append(this.e);
String str = this.e;
if (str != null && str.equals("SELFIE")) {
P(view, "6", "SELFIEID", "Selfie Wajah dan KTP");
return;
}
String str2 = this.e;
if (str2 == null || !str2.equals("KTP")) {
return;
}
P(view, "1", "IDCARD", "KTP / SIM / PASPOR");
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.h = new ArrayList<>();
Bundle extras = getIntent().getExtras();
ProdukListEntity produkListEntity = new ProdukListEntity("KTP", "Kartu Tanda Penduduk");
produkListEntity.setDrawable_resid(Integer.valueOf(R.drawable.ic_ktp));
this.h.add(produkListEntity);
ProdukListEntity produkListEntity2 = new ProdukListEntity("SIM", "Surat Ijin Mengemudi");
produkListEntity2.setDrawable_resid(Integer.valueOf(R.drawable.ic_sim));
this.h.add(produkListEntity2);
ProdukListEntity produkListEntity3 = new ProdukListEntity(PajakNegaraActivity.PASPOR, "Paspor");
produkListEntity3.setDrawable_resid(Integer.valueOf(R.drawable.ic_paspor));
this.h.add(produkListEntity3);
this.u = findViewById(R.id.v_line_doc);
this.d = findViewById(R.id.sc_scroll);
TextView textView = (TextView) findViewById(R.id.id_card);
this.k = textView;
textView.setText(produkListEntity.getName());
ImageView imageView = (ImageView) findViewById(R.id.img_card);
this.n = imageView;
imageView.setImageResource(produkListEntity.getDrawable_resid().intValue());
this.r = findViewById(R.id.line_info_ktp);
this.s = findViewById(R.id.line_info_non_ktp);
this.t = findViewById(R.id.line_info_tipe);
TextView textView2 = (TextView) findViewById(R.id.btn_foto_selfie);
this.i = textView2;
textView2.setOnClickListener(this);
TextView textView3 = (TextView) findViewById(R.id.btn_foto_ktp);
this.j = textView3;
textView3.setOnClickListener(this);
this.p = (ImageView) findViewById(R.id.tm_ktp);
this.q = (ImageView) findViewById(R.id.tm_selfie);
this.o = (ImageView) findViewById(R.id.term_img);
this.m = (TextView) findViewById(R.id.tv_term_2);
this.l = (TextView) findViewById(R.id.tv_term_identitas);
this.f = (AspectImageView) findViewById(R.id.detail_preview);
findViewById(R.id.detail_browse).setOnClickListener(this);
findViewById(R.id.detail_camera).setOnClickListener(this);
findViewById(R.id.btn_upload).setOnClickListener(this);
findViewById(R.id.btn_cancel).setOnClickListener(this);
findViewById(R.id.card_type_container).setOnClickListener(this);
findViewById(R.id.line_info_ktp).setOnClickListener(this);
if (extras != null) {
ArrayList arrayList = (ArrayList) extras.getSerializable(ProfileFragment.POPULATED_DATA_STATE_KEY);
this.w = Boolean.valueOf(extras.getBoolean(DetailAccountActivity.IS_SELFIE_VALID_KEY));
this.v = Boolean.valueOf(extras.getBoolean(DetailAccountActivity.IS_SELFIE_WAIT_KEY));
if (arrayList != null) {
for (int i = 0; i < arrayList.size(); i++) {
if (((DocumentEntity) arrayList.get(i)).getId().equals("1") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("1")) {
this.j.setVisibility(8);
}
if (((DocumentEntity) arrayList.get(i)).getId().equals("6") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("1")) {
this.i.setVisibility(8);
}
if (((DocumentEntity) arrayList.get(i)).getId().equals("1") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("3")) {
this.j.setVisibility(8);
}
if (((DocumentEntity) arrayList.get(i)).getId().equals("6") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("3")) {
this.i.setVisibility(8);
}
if ((((DocumentEntity) arrayList.get(i)).getId().equals("1") && ((DocumentEntity) arrayList.get(i)).getStatus().equals(CashWdTokenAdapter.STATE_CANCELED)) || (((DocumentEntity) arrayList.get(i)).getId().equals("1") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("0"))) {
this.r.setVisibility(0);
this.s.setVisibility(8);
this.j.setVisibility(0);
this.i.setVisibility(8);
this.o.setImageResource(R.drawable.ic_ktp);
this.m.setText(getString(R.string.detail_upload_doc_ktp_2, this.h.get(0).getCode()));
this.p.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_1_active));
this.q.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_2_inactive));
this.u.setBackgroundColor(ContextCompat.getColor(this, R.color.LightGrey));
break;
}
if ((((DocumentEntity) arrayList.get(i)).getId().equals("6") && ((DocumentEntity) arrayList.get(i)).getStatus().equals(CashWdTokenAdapter.STATE_CANCELED)) || (((DocumentEntity) arrayList.get(i)).getId().equals("6") && ((DocumentEntity) arrayList.get(i)).getStatus().equals("0"))) {
this.r.setVisibility(8);
this.s.setVisibility(0);
this.t.setVisibility(8);
this.j.setVisibility(8);
this.i.setVisibility(0);
this.l.setText("Ketentuan Foto Selfie dengan Identitas");
this.o.setImageResource(R.drawable.foto_selfie);
this.q.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_2_active));
this.p.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.ic_angka_1_active));
this.u.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryLight));
break;
}
}
}
}
getToolbar().setNavigationOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DetailDocumentActivity.this.l(view);
}
});
}
@Override
public void onOptionChoosen(OptionListFragment optionListFragment, int i, ProdukListEntity produkListEntity) {
if (i == 111) {
D(produkListEntity);
}
}
@Override
public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
if (i != 555) {
super.onRequestPermissionsResult(i, strArr, iArr);
} else if (iArr[0] == 0) {
M();
} else {
Affinity.info(this, false, getString(R.string.transaction_camera_permission_denied));
}
}
public void onRestoreInstanceState(@NonNull Bundle bundle) {
super/*android.app.Activity*/.onRestoreInstanceState(bundle);
if (bundle != null) {
try {
String string = bundle.getString("filePhoto");
Objects.requireNonNull(string);
this.y = new File(string);
StringBuilder sb = new StringBuilder();
sb.append("onRestoreInstanceState filePhoto ");
sb.append(this.y);
this.g = (Uri) bundle.getParcelable("mImageCaptureUri");
StringBuilder sb2 = new StringBuilder();
sb2.append("onRestoreInstanceState mImageCaptureUri ");
Uri uri = this.g;
Objects.requireNonNull(uri);
sb2.append(uri);
byte b = bundle.getByte("fromUsing");
if (Byte.valueOf(b) != null) {
B(b);
}
} catch (Exception e) {
StringBuilder sb3 = new StringBuilder();
sb3.append("error onRestoreInstanceState ");
sb3.append(e);
}
}
}
public void onSaveInstanceState(@NonNull Bundle bundle) {
super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
try {
File file = this.y;
if (file != null) {
bundle.putString("filePhoto", file.toString());
}
Uri uri = this.g;
if (uri != null) {
bundle.putParcelable("mImageCaptureUri", uri);
}
String str = this.e;
if (str != null) {
if (str.equals("KTP")) {
bundle.putByte("fromUsing", (byte) 0);
} else if (this.e.equals("SELFIE")) {
bundle.putByte("fromUsing", (byte) 1);
}
}
} catch (Exception e) {
StringBuilder sb = new StringBuilder();
sb.append("error onSaveInstanceState ");
sb.append(e);
}
}
}