正在查看: Moneyman v2.316.0.0 应用的 ArticleDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Moneyman v2.316.0.0 应用的 ArticleDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.freshchat.consumer.sdk.activity;
import B.AbstractC0151g;
import android.R;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.loader.content.e;
import com.exponea.sdk.services.inappcontentblock.ContentBlockCarouselViewController;
import com.freshchat.consumer.sdk.FaqOptions;
import com.freshchat.consumer.sdk.Freshchat;
import com.freshchat.consumer.sdk.FreshchatWebViewListener;
import com.freshchat.consumer.sdk.activity.ds;
import com.freshchat.consumer.sdk.beans.Article;
import com.freshchat.consumer.sdk.beans.Category;
import com.freshchat.consumer.sdk.service.d.e;
import com.freshchat.consumer.sdk.service.e.o;
import com.freshchat.consumer.sdk.service.e.y;
import com.freshchat.consumer.sdk.util.b;
import com.freshchat.consumer.sdk.util.cn;
import g2.O;
import g2.Q;
import g2.Z;
import java.lang.ref.WeakReference;
import java.util.Locale;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
import n5.AbstractC1615a;
public class ArticleDetailActivity extends cr implements P2.a, ds.b {
private static String f18778l = "isArticleVoted";
private static String f18779s = "HL_ARTICLE_TITLE";
private static final String f18780t;
private static final String f18781u;
private static String f18782z;
private String[] f18784B;
private String f18788a;
private String f18789b;
private String f18790c;
private View f18794i;
private View f18795j;
private ds k;
private RelativeLayout f18796m;
private View f18797n;
private View f18798o;
private View f18799p;
private View f18800q;
private com.freshchat.consumer.sdk.b.t f18801r;
private String f18802v;
private boolean f18803w;
private boolean f18805y;
FaqOptions f18792g = new FaqOptions();
private Bundle f18793h = null;
private boolean f18804x = false;
private String f18791d = "article_list";
private boolean f18783A = false;
WebViewClient f18785C = new c(this);
View.OnClickListener f18786D = new f(this);
View.OnClickListener f18787E = new g(this);
public class a implements Runnable {
public a() {
}
@Override
public void run() {
ArticleDetailActivity.this.k.scrollBy(0, 1);
}
}
static {
String t7 = AbstractC0151g.t(new StringBuilder("<head><link rel=\"stylesheet\" type=\"text/css\" href=\"file:///android_res/raw/normalize.css\"/><script src='file:///freshchat_assets/freshchat_hacks.js'></script><title>"), f18779s, "</title></head>");
f18780t = t7;
f18781u = Z.l.p("<!DOCTYPE html>\t<html>", t7, "<body onload='correctIframe()'> <bdi>");
}
private void f0() {
if (this.f18796m == null) {
return;
}
AbstractC1615a.z(getWindow(), false);
RelativeLayout relativeLayout = this.f18796m;
com.freshchat.consumer.sdk.activity.a aVar = new com.freshchat.consumer.sdk.activity.a(this);
WeakHashMap weakHashMap = Z.f21482a;
Q.m(relativeLayout, aVar);
O.c(this.f18796m);
}
public int g0() {
TypedValue typedValue = new TypedValue();
if (getTheme().resolveAttribute(R.attr.actionBarSize, typedValue, true)) {
return TypedValue.complexToDimensionPixelSize(typedValue.data, getResources().getDisplayMetrics());
}
return 0;
}
private void n() {
if (this.f18803w) {
return;
}
String str = f18782z;
if (str == null || !str.equals(this.f18802v)) {
Animation loadAnimation = AnimationUtils.loadAnimation(this, com.freshchat.consumer.sdk.R.anim.freshchat_slide_up);
this.f18797n.bringToFront();
this.f18797n.startAnimation(loadAnimation);
this.f18797n.setVisibility(0);
}
}
public void o() {
if (this.f18803w) {
return;
}
this.f18797n.startAnimation(AnimationUtils.loadAnimation(this, com.freshchat.consumer.sdk.R.anim.freshchat_slide_down));
this.f18797n.setVisibility(8);
}
private void p() {
if (getSupportActionBar() != null) {
getSupportActionBar().f();
}
}
private void q() {
if (getSupportActionBar() != null) {
getSupportActionBar().v();
}
}
private void r() {
this.k.postDelayed(new a(), 500L);
}
public com.freshchat.consumer.sdk.util.ao s() {
return com.freshchat.consumer.sdk.util.cc.a(a(), this.f18792g);
}
@Override
public void a(Context context, Intent intent) {
}
@Override
public void m() {
q();
r();
this.f18804x = false;
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if (this.f18804x) {
return;
}
r();
}
@Override
public void onCreate(Bundle bundle) {
FreshchatWebViewListener webviewListener;
super.onCreate(bundle);
Locale cd = cn.cd(this);
a(bundle);
Intent intent = getIntent();
a(intent);
Bundle extras = intent.getExtras();
this.f18793h = extras;
this.f18792g = com.freshchat.consumer.sdk.util.an.e(extras);
e();
setContentView(com.freshchat.consumer.sdk.R.layout.freshchat_activity_article_detail);
E();
c(!com.freshchat.consumer.sdk.util.ds.c(this.f18792g.getFilteredViewTitle()) ? this.f18792g.getFilteredViewTitle() : com.freshchat.consumer.sdk.util.ds.c(this.f18790c) ? getString(com.freshchat.consumer.sdk.R.string.freshchat_activity_title_article_detail) : this.f18790c);
d();
if (Build.VERSION.SDK_INT >= 35) {
f0();
}
b.a(getApplicationContext(), o.a.NORMAL);
f();
this.f18803w = h().Z(this.f18802v);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
layoutParams.addRule(13, -1);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
layoutParams2.addRule(10, -1);
this.f18795j = LayoutInflater.from(this).inflate(com.freshchat.consumer.sdk.R.layout.freshchat_partial_article_progress, (ViewGroup) null);
ds dsVar = new ds(this);
this.k = dsVar;
dsVar.setWebViewClient(this.f18785C);
this.k.a(this, 85);
this.f18796m.addView(this.k.getLayout(), layoutParams2);
this.f18796m.addView(this.f18795j, layoutParams);
if (bundle != null) {
this.k.restoreState(bundle);
}
this.f18794i = this.k;
Locale cd2 = cn.cd(this);
if (cd == null || cd2 == null || !com.freshchat.consumer.sdk.util.ds.B(cd.getLanguage(), cd2.getLanguage()) || (webviewListener = Freshchat.getInstance(this).getWebviewListener()) == null) {
return;
}
webviewListener.onLocaleChangedByWebView(new WeakReference<>(this));
}
@Override
public e onCreateLoader(int i5, Bundle bundle) {
return new com.freshchat.consumer.sdk.h.m(getApplicationContext(), bundle.getString("article_id"), bundle.containsKey("EXTRA_FETCH_CATEGORY_INFO"));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(com.freshchat.consumer.sdk.R.menu.freshchat_article_detail_list, menu);
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
ds dsVar = this.k;
if (dsVar != null) {
dsVar.destroy();
}
}
@Override
public boolean onKeyDown(int i5, KeyEvent keyEvent) {
if (i5 != 4 || !this.k.cz()) {
return super.onKeyDown(i5, keyEvent);
}
this.k.cA();
return true;
}
@Override
public void onLoaderReset(e eVar) {
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
return super.onOptionsItemSelected(menuItem);
}
@Override
@TargetApi(11)
public void onPause() {
super.onPause();
if (com.freshchat.consumer.sdk.util.dz.kw() && com.freshchat.consumer.sdk.util.dz.kj()) {
this.k.onPause();
} else if (com.freshchat.consumer.sdk.util.dz.kh()) {
this.k.cB();
}
}
@Override
@TargetApi(11)
public void onResume() {
super.onResume();
this.f18803w = h().Z(this.f18802v);
g();
if (com.freshchat.consumer.sdk.util.dz.kw() && com.freshchat.consumer.sdk.util.dz.kj()) {
this.k.onResume();
}
}
@Override
public void onSaveInstanceState(Bundle bundle) {
bundle.putBoolean(f18778l, this.f18803w);
super.onSaveInstanceState(bundle);
}
@Override
public void onStart() {
super.onStart();
if (com.freshchat.consumer.sdk.util.dz.kr()) {
this.k.onResume();
}
}
@Override
public void onStop() {
super.onStop();
if (com.freshchat.consumer.sdk.util.dz.kr()) {
this.k.onPause();
}
this.k.stopLoading();
}
private void c() {
com.freshchat.consumer.sdk.util.ba.a(a(), this.f18789b, this.f18790c, this.f18802v, this.f18788a, this.f18784B);
if (this.f18783A) {
return;
}
new com.freshchat.consumer.sdk.service.d.e(getApplicationContext(), e.a.faq_open_article).r("category_id", this.f18789b).r("category_name", this.f18790c).r("article_id", this.f18802v).r("article_name", this.f18788a).r("source", this.f18791d).hV();
this.f18783A = true;
}
private void d() {
this.f18799p = findViewById(com.freshchat.consumer.sdk.R.id.freshchat_upvote);
this.f18800q = findViewById(com.freshchat.consumer.sdk.R.id.freshchat_downvote);
this.f18797n = findViewById(com.freshchat.consumer.sdk.R.id.freshchat_voting_view);
this.f18798o = findViewById(com.freshchat.consumer.sdk.R.id.freshchat_contact_us_group);
this.f18796m = (RelativeLayout) findViewById(com.freshchat.consumer.sdk.R.id.freshchat_solution_article_root_layout);
((TextView) findViewById(com.freshchat.consumer.sdk.R.id.freshchat_contact_us_btn)).setText(com.freshchat.consumer.sdk.R.string.freshchat_faq_not_helpful_contact_us);
}
private void e() {
Bundle bundle = new Bundle();
bundle.putString("article_id", this.f18802v);
if (com.freshchat.consumer.sdk.util.ds.c(this.f18790c)) {
bundle.putBoolean("EXTRA_FETCH_CATEGORY_INFO", true);
}
getSupportLoaderManager().b(bundle, this);
}
private void f() {
this.f18799p.setOnClickListener(this.f18786D);
this.f18800q.setOnClickListener(this.f18786D);
this.f18798o.setOnClickListener(this.f18787E);
}
private void g() {
if (!this.f18792g.shouldShowContactUsOnFaqNotHelpful() || !this.f18803w || !h().Y(this.f18802v)) {
this.f18798o.setVisibility(8);
} else {
this.f18798o.bringToFront();
this.f18798o.setVisibility(0);
}
}
public void i() {
new com.freshchat.consumer.sdk.service.d.e(getApplicationContext(), e.a.channels_launch).r("source", "article_not_helpful").r("article_id", this.f18802v).r("category_id", this.f18789b).hV();
}
@Override
public String[] b() {
return new String[]{"com.freshchat.consumer.sdk.actions.TokenWaitTimeout", "com.freshchat.consumer.sdk.actions.FAQApiVersionChanged"};
}
public com.freshchat.consumer.sdk.b.t h() {
if (this.f18801r == null) {
this.f18801r = new com.freshchat.consumer.sdk.b.t(this);
}
return this.f18801r;
}
@Override
public void j() {
n();
}
@Override
public void k() {
o();
}
@Override
public void l() {
p();
this.f18804x = true;
this.f18797n.setVisibility(8);
}
private void a(Intent intent) {
if (!intent.hasExtra("article_id")) {
Toast.makeText(this, com.freshchat.consumer.sdk.R.string.freshchat_faq_failed_to_load, 0).show();
finish();
}
long longExtra = intent.getLongExtra("article_id", -1L);
if (longExtra > 0) {
this.f18802v = Long.toString(longExtra);
} else {
Toast.makeText(this, com.freshchat.consumer.sdk.R.string.freshchat_faq_failed_to_load, 0).show();
finish();
}
if (intent.hasExtra("category_id")) {
this.f18789b = intent.getStringExtra("category_id");
}
if (intent.hasExtra("category_name")) {
this.f18790c = intent.getStringExtra("category_name");
}
if (intent.hasExtra("EVENT_LAUNCH_SOURCE")) {
this.f18791d = intent.getStringExtra("EVENT_LAUNCH_SOURCE");
}
if (intent.hasExtra("LAUNCHED_FROM_CONVERSATION")) {
this.f18805y = intent.getBooleanExtra("LAUNCHED_FROM_CONVERSATION", false);
}
this.f18784B = intent.getStringArrayExtra("INPUT_TAGS");
}
public void a(y.a aVar) {
y.a aVar2 = y.a.Upvote;
com.freshchat.consumer.sdk.util.ba.a(a(), this.f18789b, this.f18790c, this.f18802v, this.f18788a, aVar == aVar2);
new com.freshchat.consumer.sdk.service.d.e(getApplicationContext(), aVar == aVar2 ? e.a.faq_upvote_article : e.a.faq_downvote_article).r("article_id", this.f18802v).r("category_id", this.f18789b).r("article_name", this.f18788a).hV();
}
@Override
public void onLoadFinished(androidx.loader.content.e eVar, Article article) {
Category hw;
String a8 = a(article);
if (com.freshchat.consumer.sdk.util.ds.a((CharSequence) a8)) {
if ((eVar instanceof com.freshchat.consumer.sdk.h.m) && (hw = ((com.freshchat.consumer.sdk.h.m) eVar).hw()) != null) {
String title = hw.getTitle();
this.f18790c = title;
a8 = a8.replace(f18779s, title);
}
this.k.loadDataWithBaseURL(null, a8, "text/html", "utf-8", null);
}
c();
}
private String a(Article article) {
String str;
if (article == null) {
return null;
}
this.f18789b = article.getCategoryId();
StringBuilder sb = new StringBuilder();
String replaceAll = article.getDescription().replaceAll("src=\"//", "src=\"http://").replaceAll("value=\"//", "value=\"http://");
Pattern compile = Pattern.compile("<\\s*(img|iframe).*?src\\s*=[ '\"]+http[s]?:\\/\\/.*?>");
if (!com.freshchat.consumer.sdk.util.db.cm(this) && compile.matcher(replaceAll).find()) {
str = "<div class='offline-article-message'>" + getString(com.freshchat.consumer.sdk.R.string.freshchat_faq_rich_media_content_cannot_be_displayed) + "</div>";
} else {
str = ContentBlockCarouselViewController.EMPTY_PLACEHOLDER_ID;
}
this.f18788a = article.getTitle();
sb.append(f18781u);
sb.append("<div class=\"article-title\";><h3 >");
Z.l.y(sb, this.f18788a, "</h3></div>", str, "<div class=\"article-body\">");
String t7 = AbstractC0151g.t(sb, replaceAll, "</div></bdi></body></html>");
return !com.freshchat.consumer.sdk.util.ds.c(this.f18790c) ? t7.replace(f18779s, this.f18790c) : t7;
}
private void a(Bundle bundle) {
if (bundle != null) {
this.f18803w = bundle.getBoolean(f18778l);
} else {
this.f18803w = false;
}
}
}