正在查看: Moneyman v2.316.0.0 应用的 PictureAttachmentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Moneyman v2.316.0.0 应用的 PictureAttachmentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.freshchat.consumer.sdk.activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.exponea.sdk.services.inappcontentblock.ContentBlockCarouselViewController;
import com.freshchat.consumer.sdk.FreshchatImageLoader;
import com.freshchat.consumer.sdk.FreshchatImageLoaderRequest;
import com.freshchat.consumer.sdk.R;
import com.freshchat.consumer.sdk.beans.ValidateFileTypeTaskRequest;
import com.freshchat.consumer.sdk.util.Cdo;
import com.freshchat.consumer.sdk.util.da;
public class PictureAttachmentActivity extends cr {
static String gc;
private int f18875a;
private View bK;
private ProgressDialog di;
private Intent eN;
private ImageView fW;
private EditText fX;
private Uri fY;
private Uri fZ;
private TextView gA;
private com.freshchat.consumer.sdk.l.y gB;
private ProgressBar gj;
private boolean gk;
private LinearLayout go;
private LinearLayout gv;
private View gx;
private ImageView gz;
private TextWatcher dP = new dx(this);
private View.OnClickListener gC = new dy(this);
public class a implements DialogInterface.OnDismissListener {
public a() {
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
PictureAttachmentActivity.this.finish();
}
}
private void cG() {
ViewGroup.LayoutParams layoutParams = this.go.getLayoutParams();
layoutParams.width = getResources().getDimensionPixelSize(R.dimen.freshchat_button_max_width);
this.go.setLayoutParams(layoutParams);
}
private void cH() {
String stringExtra = this.eN.getStringExtra("FILE_NAME");
long longExtra = this.eN.getLongExtra("FILE_SIZE", 0L);
boolean booleanExtra = this.eN.getBooleanExtra("EXTRA_BOT_ATTACHMENT_ENABLED", false);
com.freshchat.consumer.sdk.b.o.d(this.gv);
if (!this.eN.getBooleanExtra("ATTACHMENT_CREATION_MODE", false)) {
l(this.eN.getStringExtra("PICTURE_URL"));
com.freshchat.consumer.sdk.b.o.d(this.gx);
com.freshchat.consumer.sdk.b.o.d(this.go);
return;
}
Uri uri = (Uri) this.eN.getParcelableExtra("PICTURE_URL");
this.fZ = uri;
a(uri, com.freshchat.consumer.sdk.util.as.f(a(), this.fZ));
if (com.freshchat.consumer.sdk.util.ds.a((CharSequence) stringExtra)) {
setTitle(stringExtra);
if (getSupportActionBar() != null) {
getSupportActionBar().s(com.freshchat.consumer.sdk.util.as.i(a(), longExtra));
}
} else {
setTitle(getString(R.string.freshchat_attachment_preview_title));
}
if (booleanExtra) {
com.freshchat.consumer.sdk.b.o.d(this.gx);
com.freshchat.consumer.sdk.b.o.c(this.go);
} else {
com.freshchat.consumer.sdk.b.o.d(this.go);
com.freshchat.consumer.sdk.b.o.c(this.gx);
}
}
private void cI() {
this.gz.setVisibility(0);
String stringExtra = this.eN.getStringExtra("FILE_NAME");
long longExtra = this.eN.getLongExtra("FILE_SIZE", 0L);
boolean booleanExtra = this.eN.getBooleanExtra("EXTRA_BOT_ATTACHMENT_ENABLED", false);
com.freshchat.consumer.sdk.b.o.c(this.gv);
this.gA.setText(stringExtra);
if (com.freshchat.consumer.sdk.util.ds.a((CharSequence) stringExtra)) {
setTitle(stringExtra);
if (getSupportActionBar() != null) {
getSupportActionBar().s(com.freshchat.consumer.sdk.util.as.i(a(), longExtra));
}
} else {
setTitle(getString(R.string.freshchat_attachment_preview_title));
}
if (booleanExtra) {
com.freshchat.consumer.sdk.b.o.d(this.gx);
this.go.setAlpha(1.0f);
this.go.setEnabled(true);
com.freshchat.consumer.sdk.b.o.c(this.go);
} else {
this.bK.setAlpha(1.0f);
this.bK.setEnabled(true);
com.freshchat.consumer.sdk.b.o.d(this.go);
com.freshchat.consumer.sdk.b.o.c(this.gx);
}
Uri uri = (Uri) this.eN.getParcelableExtra("FILE_URL");
String f7 = com.freshchat.consumer.sdk.util.as.f(a(), uri);
if (com.freshchat.consumer.sdk.util.ds.a((CharSequence) f7) && f7.startsWith("image") && !com.freshchat.consumer.sdk.util.cj.xV.contains(f7)) {
this.gz.setVisibility(8);
this.gA.setVisibility(8);
a(uri, f7);
}
}
public void cJ() {
ProgressDialog progressDialog = new ProgressDialog(a(), R.style.Widget_Freshchat_ProgressDialog);
this.di = progressDialog;
progressDialog.setMessage(a().getString(R.string.freshchat_spinner_text));
this.di.show();
this.di.setCancelable(false);
new ValidateFileTypeTaskRequest(gc, this.fY);
com.freshchat.consumer.sdk.service.d.h.b(a().getApplicationContext(), new ValidateFileTypeTaskRequest(gc, this.fY));
}
public void cK() {
this.gB.d(this.fZ, this.fX.getText().toString());
setResult(-1, this.gB.Bx.mo());
finish();
}
private void k(int i5) {
ProgressDialog progressDialog = this.di;
if (progressDialog != null && progressDialog.isShowing()) {
this.di.dismiss();
}
if (i5 != 200) {
com.freshchat.consumer.sdk.util.ba.bO(a());
com.freshchat.consumer.sdk.b.o.h(a(), a().getString(R.string.freshchat_file_not_supported_message));
} else {
setResult(-1, this.gB.Bw.mo());
finish();
}
}
private void l(String str) {
String bm2 = com.freshchat.consumer.sdk.util.ch.bm(str);
int h3 = Cdo.h(a(), R.attr.freshchatCarouselCardErrorImage);
if (!com.freshchat.consumer.sdk.util.ds.a((CharSequence) bm2)) {
com.freshchat.consumer.sdk.b.o.c(this.fW);
this.fW.setImageResource(h3);
return;
}
int width = this.fW.getWidth();
int height = this.fW.getHeight();
if (width == 0 || height == 0) {
this.fW.setImageResource(h3);
}
dz dzVar = new dz(this);
FreshchatImageLoaderRequest a8 = new FreshchatImageLoaderRequest.a(bm2).a(width, height).b(h3).a();
FreshchatImageLoader jS = com.freshchat.consumer.sdk.util.cj.jS();
if (jS != null) {
jS.loadInto(a8, this.fW, dzVar);
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if (configuration == null || configuration.orientation != 2) {
return;
}
cG();
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.gB = new com.freshchat.consumer.sdk.l.y(this);
if (getSupportActionBar() != null) {
getSupportActionBar().n(true);
}
this.gB.ml();
setContentView(R.layout.freshchat_activity_picture_attachment);
this.go = (LinearLayout) findViewById(R.id.freshchat_file_attachment_preview_send_btn_background);
this.fW = (ImageView) findViewById(R.id.freshchat_picture_attachment_imageview);
this.gA = (TextView) findViewById(R.id.freshchat_file_attachment_preview_text);
this.gx = findViewById(R.id.freshchat_conv_detail_text_reply_layout);
this.gj = (ProgressBar) findViewById(R.id.freshchat_picture_attachment_progress_bar);
this.gv = (LinearLayout) findViewById(R.id.freshchat_file_attachment_preview_container);
this.gz = (ImageView) findViewById(R.id.freshchat_file_attachment_placeholder);
this.fX = (EditText) findViewById(R.id.freshchat_conv_detail_reply_text);
View findViewById = findViewById(R.id.freshchat_conv_detail_attach_image);
View findViewById2 = findViewById(R.id.freshchat_conv_detail_record_voice_reply_button);
this.bK = findViewById(R.id.freshchat_conv_detail_send_reply_button);
this.di = new ProgressDialog(a(), R.style.Widget_Freshchat_ProgressDialog);
findViewById.setVisibility(8);
findViewById2.setVisibility(8);
this.bK.setVisibility(0);
this.bK.setEnabled(true);
this.bK.setOnClickListener(this.gC);
this.go.setEnabled(false);
this.go.setOnClickListener(this.gC);
Intent intent = getIntent();
this.eN = intent;
String stringExtra = intent.getStringExtra("IMAGE_CAPTION");
this.gk = da.b.TYPE_ANY.b().equals(this.eN.getStringExtra("MIME_TYPE"));
boolean hasExtra = this.eN.hasExtra("PICTURE_URL");
if (com.freshchat.consumer.sdk.util.ds.a((CharSequence) stringExtra)) {
this.fX.setText(stringExtra);
}
if (this.gk) {
cI();
} else if (hasExtra) {
cH();
}
EditText editText = this.fX;
if (editText != null) {
editText.addTextChangedListener(this.dP);
}
cG();
applySDK35InsetsPadding(findViewById(android.R.id.content));
}
@Override
public String[] b() {
return new String[]{"com.freshchat.consumer.sdk.actions.TokenWaitTimeout", "FILE_ATTACHMENT_VALIDATION"};
}
public static Intent a(Context context, Uri uri, int i5, String str, da.b bVar, boolean z7) {
Intent intent = new Intent(context, (Class<?>) PictureAttachmentActivity.class);
if (i5 == 126) {
intent.putExtra("FILE_NAME", ContentBlockCarouselViewController.EMPTY_PLACEHOLDER_ID);
} else {
intent.putExtra("FILE_NAME", com.freshchat.consumer.sdk.util.as.d(context, uri));
}
gc = uri.toString();
intent.putExtra("EXTRA_BOT_ATTACHMENT_ENABLED", z7);
if (bVar == da.b.TYPE_ANY) {
intent.putExtra("FILE_URL", uri);
} else {
intent.putExtra("PICTURE_URL", uri);
}
intent.putExtra("REQUEST_CODE", i5);
intent.putExtra("MIME_TYPE", bVar.b());
intent.putExtra("ATTACHMENT_CREATION_MODE", true);
intent.putExtra("IMAGE_CAPTION", str);
intent.putExtra("FILE_SIZE", com.freshchat.consumer.sdk.util.as.e(context, uri));
return intent;
}
public static Intent a(Context context, String str) {
Intent intent = new Intent(context, (Class<?>) PictureAttachmentActivity.class);
intent.addFlags(67108864);
intent.putExtra("PICTURE_URL", str);
return intent;
}
public void a(Uri uri) {
this.gB.c(uri, this.fX.getText().toString());
}
private void a(Uri uri, String str) {
new com.freshchat.consumer.sdk.k.a(a().getApplicationContext(), this.fW, this.gB.Bx, new eb(this), str).execute(uri);
}
public void a(Exception exc) {
com.freshchat.consumer.sdk.util.aj.a(exc);
if (isFinishing() || isDestroyed()) {
return;
}
com.freshchat.consumer.sdk.b.o.a(this, getString(R.string.freshchat_file_not_supported_message), new a());
}
@Override
public void a(Context context, Intent intent) {
if ("FILE_ATTACHMENT_VALIDATION".equals(intent.getAction())) {
int j2 = this.gB.j(intent.getExtras());
this.f18875a = j2;
k(j2);
}
}
}