正在查看: OLX India v19.42.007 应用的 ChatActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 ChatActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.naspers.ragnarok.universal.ui.ui.message.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.naspers.ragnarok.data.R;
import com.naspers.ragnarok.domain.constant.Constants;
import com.naspers.ragnarok.domain.entity.chat.ChatAd;
import com.naspers.ragnarok.domain.entity.chat.ChatProfile;
import com.naspers.ragnarok.domain.entity.conversation.Conversation;
import com.naspers.ragnarok.domain.message.interactor.n;
import com.naspers.ragnarok.domain.repository.common.ExtrasRepository;
import com.naspers.ragnarok.domain.util.common.C2BUtils;
import com.naspers.ragnarok.domain.util.common.EventWrapper;
import com.naspers.ragnarok.domain.util.common.JsonUtils;
import com.naspers.ragnarok.universal.e;
import com.naspers.ragnarok.universal.h;
import com.naspers.ragnarok.universal.ui.ui.message.activity.ChatActivity;
import com.naspers.ragnarok.universal.ui.ui.message.fragment.C2BChatFragment;
import com.naspers.ragnarok.universal.ui.ui.message.fragment.ChatFragment;
import com.naspers.ragnarok.universal.ui.ui.message.fragment.f;
import com.naspers.ragnarok.universal.ui.ui.message.view.ChatNudgeView;
import com.naspers.ragnarok.universal.ui.ui.message.viewmodel.d;
import com.naspers.ragnarok.universal.ui.ui.notification.g;
import com.naspers.ragnarok.universal.ui.ui.toolTip.Tooltip;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class ChatActivity extends com.naspers.ragnarok.universal.ui.ui.base.b implements ChatFragment.k, ChatFragment.j, ChatFragment.m {
private com.naspers.ragnarok.universal.ui.ui.widget.common.b U;
private ExtrasRepository V;
private com.naspers.ragnarok.common.ab.a W;
private com.naspers.ragnarok.universal.ui.ui.util.imageLoader.c X;
private com.naspers.ragnarok.universal.ui.ui.message.viewmodel.d i0;
private Conversation T = null;
private final Context Y = this;
private String Z = "";
private String a0 = "";
ChatFragment b0 = null;
private String c0 = "";
private String d0 = "";
private String e0 = "";
private boolean f0 = false;
Tooltip g0 = null;
private com.naspers.ragnarok.universal.ui.ui.c2b.entities.a h0 = null;
class AnonymousClass1 implements Runnable {
class a implements Tooltip.c {
a() {
}
@Override
public void a() {
ChatFragment chatFragment = ChatActivity.this.b0;
if (chatFragment != null) {
chatFragment.m7(false);
}
}
}
AnonymousClass1() {
}
public void b(View view) {
ChatActivity.this.A();
}
@Override
public void run() {
View findViewById = ChatActivity.this.findViewById(com.naspers.ragnarok.universal.d.menu_meeting);
int dimensionPixelOffset = ChatActivity.this.getResources().getDimensionPixelOffset(R.dimen.module_small);
int dimensionPixelOffset2 = ChatActivity.this.getResources().getDimensionPixelOffset(R.dimen.module_medium);
View inflate = ((LayoutInflater) ChatActivity.this.Y.getSystemService("layout_inflater")).inflate(e.ragnarok_make_offer_tooltip, (ViewGroup) null);
TextView textView = (TextView) inflate.findViewById(com.naspers.ragnarok.universal.d.tooltipView);
((ImageView) inflate.findViewById(com.naspers.ragnarok.universal.d.ivTooltipClose)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivity.AnonymousClass1.this.b(view);
}
});
textView.setText(R.string.ragnarok_meeting_chat_tooltip_msg);
ChatActivity chatActivity = ChatActivity.this;
chatActivity.g0 = new Tooltip.Builder(chatActivity.Y).s(findViewById, 3).y(inflate).u(true).D(new Tooltip.d(dimensionPixelOffset2, dimensionPixelOffset, androidx.core.content.b.getColor(ChatActivity.this.Y, R.color.ragnarok_secondary))).t(new com.naspers.ragnarok.universal.ui.ui.toolTip.c(1, 500)).x(true).z((ViewGroup) ChatActivity.this.getWindow().getDecorView().getRootView()).B(new a()).A();
}
}
private int G2() {
return this.f0 ? getResources().getColor(R.color.c2b_dark_blue) : getResources().getColor(R.color.ragnarokWhite);
}
private String I2() {
Conversation conversation = this.T;
if (conversation == null || conversation.getCurrentAd() == null) {
return null;
}
if (!this.V.isCurrentUserBuyer(this.T.getCurrentAd().getSellerId())) {
C2BUtils c2BUtils = C2BUtils.INSTANCE;
Conversation conversation2 = this.T;
ExtrasRepository extrasRepository = this.V;
Objects.requireNonNull(extrasRepository);
return c2BUtils.getC2BPackageTypeForSeller(conversation2, new n(extrasRepository));
}
C2BUtils c2BUtils2 = C2BUtils.INSTANCE;
Conversation conversation3 = this.T;
com.naspers.ragnarok.common.entity.b userMonetPackage = this.V.getUserMonetPackage();
ExtrasRepository extrasRepository2 = this.V;
Objects.requireNonNull(extrasRepository2);
return c2BUtils2.getC2BPackageTypeForBuyer(conversation3, userMonetPackage, new n(extrasRepository2));
}
private ChatFragment M2(Bundle bundle) {
return this.f0 ? C2BChatFragment.V7(bundle) : ChatFragment.N6(bundle);
}
private int N2() {
return this.f0 ? getResources().getColor(R.color.ragnarokWhite) : getResources().getColor(R.color.ragnarok_text_h1);
}
private void Q2() {
Serializable serializableExtra;
if (Build.VERSION.SDK_INT < 33) {
this.h0 = (com.naspers.ragnarok.universal.ui.ui.c2b.entities.a) getIntent().getSerializableExtra(Constants.Intent.Extra.C2B_AD_ITEM_DETAIL);
} else {
serializableExtra = getIntent().getSerializableExtra(Constants.Intent.Extra.C2B_AD_ITEM_DETAIL, com.naspers.ragnarok.universal.ui.ui.c2b.entities.a.class);
this.h0 = (com.naspers.ragnarok.universal.ui.ui.c2b.entities.a) serializableExtra;
}
}
private void R2() {
if (getIntent().hasExtra("conversationExtra")) {
this.T = (Conversation) JsonUtils.getGson().fromJson(getIntent().getStringExtra("conversationExtra"), Conversation.class);
}
}
public void T2(EventWrapper eventWrapper) {
d.b bVar;
if (eventWrapper == null || (bVar = (d.b) eventWrapper.getContentIfNotHandled()) == null) {
return;
}
if (bVar instanceof d.b.c) {
e3(((d.b.c) bVar).a());
} else if (bVar instanceof d.b.a) {
W2(((d.b.a) bVar).a());
} else if (bVar instanceof d.b.C0064b) {
Y2(((d.b.C0064b) bVar).a());
}
}
public void U2(ChatProfile chatProfile, View view) {
if (Constants.ProfileStatus.CONFIRMED != chatProfile.getProfileStatus()) {
Toast.makeText(this.Y, getString(R.string.profile_does_not_exist), 0).show();
return;
}
com.naspers.ragnarok.universal.ui.provider.a.s().M(this, com.naspers.ragnarok.universal.ui.ui.util.common.c.CHAT_WINDOW, chatProfile.getId(), chatProfile.getName(), new HashMap());
}
private void V2() {
this.i0.u().observe(this, new Observer() {
public final void onChanged(Object obj) {
ChatActivity.this.T2((EventWrapper) obj);
}
});
}
private void Z2() {
p2().setPopupTheme(h.C2BPopUpMenuStyle);
}
private void b3(Bundle bundle) {
Map map = (Map) getIntent().getSerializableExtra("extras");
if (map.size() > 0) {
if (map.get("experiment_variant") != null) {
this.Z = (String) map.get("experiment_variant");
}
if (map.get(Constants.Intent.Extra.SELECT_FROM) != null) {
this.a0 = (String) map.get(Constants.Intent.Extra.SELECT_FROM);
}
if (map.get(Constants.Intent.Extra.BROWSING_MODE) != null) {
this.e0 = (String) map.get(Constants.Intent.Extra.BROWSING_MODE);
}
}
bundle.putString(Constants.Intent.Extra.SELECT_FROM, this.a0);
bundle.putString("experiment_variant", this.Z);
bundle.putString(Constants.Intent.Extra.BROWSING_MODE, this.e0);
}
private void d3() {
p2().setPopupTheme(h.PopUpMenuStyle);
}
private void f3() {
String N = com.naspers.ragnarok.universal.ui.provider.a.s().N();
getSupportActionBar().w(true);
getSupportActionBar().B(true);
getSupportActionBar().x(true);
getSupportActionBar().y(false);
p2().setBackgroundColor(G2());
p2().getNavigationIcon().setColorFilter(N2(), PorterDuff.Mode.SRC_ATOP);
com.naspers.ragnarok.universal.ui.ui.widget.common.b bVar = new com.naspers.ragnarok.universal.ui.ui.widget.common.b(this);
this.U = bVar;
bVar.setActionBarTitle(N);
getSupportActionBar().t(this.U);
B2(true);
if (this.f0) {
Z2();
} else {
d3();
}
}
private void g3() {
Conversation conversation = this.T;
if (conversation != null) {
final ChatProfile profile = conversation.getProfile();
ChatAd currentAd = this.T.getCurrentAd();
if (profile == null || currentAd == null) {
return;
}
this.U.setActionBarTitle(profile.getName());
j3();
l3(currentAd.getCategoryId(), profile);
p2().setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivity.this.U2(profile, view);
}
});
}
}
private void h3() {
Map map = (Map) getIntent().getSerializableExtra("extras");
if (map != null && map.containsKey(Constants.ExtraKeys.ORIGIN_SOURCE)) {
this.c0 = (String) map.get(Constants.ExtraKeys.ORIGIN_SOURCE);
}
if (map == null || !map.containsKey(Constants.ExtraKeys.FLOW_TYPE)) {
return;
}
this.d0 = (String) map.get(Constants.ExtraKeys.FLOW_TYPE);
}
private boolean i3(com.naspers.ragnarok.universal.ui.ui.c2b.entities.a aVar) {
if (!this.W.c()) {
return false;
}
if (aVar == null || !aVar.d()) {
return !TextUtils.isEmpty(I2());
}
return true;
}
private void j3() {
p2().setContentInsetStartWithNavigation(0);
p2().setContentInsetsRelative(0, 0);
this.U.m(this.X, this.T.getCurrentAd());
this.U.n(this.X, this.T.getProfile());
}
private void k3(boolean z) {
this.U.o(z);
}
private void l3(String str, ChatProfile chatProfile) {
this.U.p(str, chatProfile);
}
private void m3() {
Q2();
boolean i3 = i3(this.h0);
this.f0 = i3;
if (i3) {
F2();
}
}
@Override
public void A() {
Tooltip tooltip = this.g0;
if (tooltip != null) {
tooltip.g();
}
}
@Override
public void A0(boolean z) {
k3(z);
}
public void F2() {
}
public String H2() {
return this.e0;
}
@Override
public void I0(Conversation conversation) {
boolean z = !conversation.getProfile().equals(this.T.getProfile());
this.T.setProfile(conversation.getProfile());
if (z) {
g3();
}
}
public com.naspers.ragnarok.universal.ui.ui.c2b.entities.a J2() {
return this.h0;
}
public Conversation K2() {
return this.T;
}
@Override
public void L0() {
if (findViewById(com.naspers.ragnarok.universal.d.menu_meeting) != null) {
new Handler().postDelayed(new AnonymousClass1(), 1000L);
}
}
public String L2() {
return this.d0;
}
public String O2() {
return this.a0;
}
public String P2() {
return this.c0;
}
protected void S2(Intent intent) {
if (!com.naspers.ragnarok.universal.ui.provider.a.s().J()) {
finish();
return;
}
if (intent.hasExtra("conversationExtra")) {
this.T = (Conversation) JsonUtils.getGson().fromJson(intent.getStringExtra("conversationExtra"), Conversation.class);
Bundle bundle = intent.getExtras() == null ? new Bundle() : intent.getExtras();
b3(bundle);
ChatFragment M2 = M2(bundle);
this.b0 = M2;
v2(M2, true);
f3();
this.U.setActionBarTitle(this.T.getProfile().getName());
if (intent.getBooleanExtra("fromNotification", false)) {
com.naspers.ragnarok.universal.ui.provider.a.s().Y().c();
}
}
}
public void W2(f fVar) {
}
public void X2(Constants.LeadFormRequestType leadFormRequestType, HashMap hashMap) {
for (Fragment fragment : getSupportFragmentManager().F0()) {
if (fragment instanceof ChatFragment) {
((ChatFragment) fragment).Q6(leadFormRequestType, hashMap);
return;
}
}
}
public void Y2(f fVar) {
}
public void a3(boolean z, ChatNudgeView.b bVar) {
this.i0.o0(new d.a.C0063a(z, bVar));
}
public void c3(String str) {
this.i0.o0(new d.a.b(str));
}
public void e3(String str) {
if (this.U == null) {
return;
}
if (!TextUtils.isEmpty(str)) {
this.U.l(str);
}
this.U.s();
}
@Override
public void i(Constants.LeadFormRequestType leadFormRequestType) {
}
@Override
public void l0(ChatAd chatAd, String str, String str2) {
}
@Override
public void onBackPressed() {
Fragment p0 = getSupportFragmentManager().p0(ChatFragment.class.getName());
if (p0 != null && (p0 instanceof ChatFragment) && ((ChatFragment) p0).onBackPressed()) {
return;
}
super.onBackPressed();
}
@Override
protected void onCreate(Bundle bundle) {
com.naspers.ragnarok.universal.ui.provider.a.s().x().e0(this);
this.V = com.naspers.ragnarok.universal.ui.provider.a.s().U();
this.W = com.naspers.ragnarok.universal.ui.provider.a.s().p();
R2();
m3();
super.onCreate(bundle);
this.X = com.naspers.ragnarok.universal.ui.provider.a.s().V();
com.naspers.ragnarok.universal.ui.ui.message.viewmodel.d dVar = new ViewModelProvider(this).get(com.naspers.ragnarok.universal.ui.ui.message.viewmodel.e.class);
this.i0 = dVar;
dVar.d0(this.h0);
f3();
h3();
V2();
if (bundle == null) {
String action = getIntent().getAction();
if (action != null && !action.isEmpty() && !TextUtils.isEmpty(action) && ((action.equalsIgnoreCase(Constants.Notification.Actions.VIEW) || action.equalsIgnoreCase("default")) && getIntent().hasExtra("id") && getIntent().getExtras().get("id") != null && !TextUtils.isEmpty(String.valueOf(getIntent().getExtras().get("id"))))) {
String valueOf = String.valueOf(getIntent().getExtras().get("id"));
g Y = com.naspers.ragnarok.universal.ui.provider.a.s().Y();
com.naspers.ragnarok.universal.ui.ui.util.d.b(this, getIntent());
Y.d(Integer.parseInt(valueOf));
}
S2(getIntent());
}
g3();
}
protected void onNewIntent(Intent intent) {
super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
S2(intent);
g3();
}
public void setUpNudgeView(View c2bNudgeView) {
}
}