正在查看: Hopscotch v9.7.2 应用的 CTInboxActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 CTInboxActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.sdk.inbox;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.res.g;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager;
import com.clevertap.android.sdk.CTInboxStyleConfig;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.InAppNotificationActivity;
import com.clevertap.android.sdk.c1;
import com.clevertap.android.sdk.f1;
import com.clevertap.android.sdk.g1;
import com.clevertap.android.sdk.h1;
import com.clevertap.android.sdk.inbox.j;
import com.clevertap.android.sdk.k0;
import com.clevertap.android.sdk.u;
import com.clevertap.android.sdk.y0;
import com.google.android.material.tabs.TabLayout;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
public class CTInboxActivity extends androidx.fragment.app.n implements j.b, k0 {
public static int m;
private u cleverTapAPI;
private CleverTapInstanceConfig config;
public m i;
private com.clevertap.android.sdk.k inboxContentUpdatedListener;
public CTInboxStyleConfig j;
public TabLayout k;
public ViewPager l;
private WeakReference<c> listenerWeakReference;
private c1 pushPermissionManager;
private WeakReference<InAppNotificationActivity.e> pushPermissionResultCallbackWeakReference;
public class a implements View.OnClickListener {
public a() {
}
@Override
public final void onClick(View view) {
CTInboxActivity.this.finish();
}
}
public class b implements TabLayout.d {
public b() {
}
public final void a(TabLayout.g gVar) {
com.clevertap.android.sdk.customviews.a aVar = ((j) CTInboxActivity.this.i.a(gVar.g())).L1;
if (aVar != null) {
aVar.G0();
}
}
public final void b(TabLayout.g gVar) {
com.clevertap.android.sdk.customviews.a aVar = ((j) CTInboxActivity.this.i.a(gVar.g())).L1;
if (aVar != null) {
aVar.F0();
}
}
}
public interface c {
void a(int i, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap hashMap, int i2);
void c(CTInboxMessage cTInboxMessage);
}
@Override
public final void F0(boolean z) {
this.pushPermissionManager.d(z, this.pushPermissionResultCallbackWeakReference.get());
}
public final c R0() {
c cVar;
try {
cVar = this.listenerWeakReference.get();
} catch (Throwable unused) {
cVar = null;
}
if (cVar == null) {
android.support.v4.media.session.c.m(this.config, this.config.z(), "InboxActivityListener is null for notification inbox ");
}
return cVar;
}
@Override
public final void a(int i, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap hashMap, int i2) {
c R0 = R0();
if (R0 != null) {
R0.a(i, cTInboxMessage, bundle, hashMap, i2);
}
}
@Override
public final void c(CTInboxMessage cTInboxMessage) {
y0.j("CTInboxActivity:messageDidShow() called with: data = [null], inboxMessage = [" + cTInboxMessage.f() + "]");
y0.j("CTInboxActivity:didShow() called with: data = [null], inboxMessage = [" + cTInboxMessage.f() + "]");
c R0 = R0();
if (R0 != null) {
R0.c(cTInboxMessage);
}
}
@Override
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
try {
Bundle extras = getIntent().getExtras();
if (extras == null) {
throw new IllegalArgumentException();
}
this.j = (CTInboxStyleConfig) extras.getParcelable("styleConfig");
Bundle bundle2 = extras.getBundle("configBundle");
if (bundle2 != null) {
this.config = (CleverTapInstanceConfig) bundle2.getParcelable("config");
}
u G = u.G(getApplicationContext(), this.config, null);
this.cleverTapAPI = G;
if (G != null) {
this.listenerWeakReference = new WeakReference<>(G);
this.pushPermissionResultCallbackWeakReference = new WeakReference<>(u.G(this, this.config, null).t().l());
this.pushPermissionManager = new c1(this, this.config);
}
m = getResources().getConfiguration().orientation;
setContentView(h1.inbox_activity);
this.cleverTapAPI.t().h().I(this);
Toolbar toolbar = (Toolbar) findViewById(g1.toolbar);
toolbar.setTitle(this.j.f());
toolbar.setTitleTextColor(Color.parseColor(this.j.g()));
toolbar.setBackgroundColor(Color.parseColor(this.j.e()));
Resources resources = getResources();
int i = f1.ct_ic_arrow_back_white_24dp;
int i2 = androidx.core.content.res.g.a;
Drawable a2 = g.a.a(resources, i, null);
if (a2 != null) {
a2.setColorFilter(Color.parseColor(this.j.b()), PorterDuff.Mode.SRC_IN);
}
toolbar.setNavigationIcon(a2);
toolbar.setNavigationOnClickListener(new a());
LinearLayout linearLayout = (LinearLayout) findViewById(g1.inbox_linear_layout);
linearLayout.setBackgroundColor(Color.parseColor(this.j.d()));
this.k = linearLayout.findViewById(g1.tab_layout);
this.l = (ViewPager) linearLayout.findViewById(g1.view_pager);
TextView textView = (TextView) findViewById(g1.no_message_view);
Bundle bundle3 = new Bundle();
bundle3.putParcelable("config", this.config);
bundle3.putParcelable("styleConfig", this.j);
int i3 = 0;
if (this.j.F()) {
this.l.setVisibility(0);
ArrayList<String> C = this.j.C();
this.i = new m(getSupportFragmentManager(), C.size() + 1);
this.k.setVisibility(0);
this.k.setTabGravity(0);
this.k.setTabMode(1);
this.k.setSelectedTabIndicatorColor(Color.parseColor(this.j.w()));
TabLayout tabLayout = this.k;
int parseColor = Color.parseColor(this.j.E());
int parseColor2 = Color.parseColor(this.j.n());
tabLayout.getClass();
tabLayout.setTabTextColors(TabLayout.o(parseColor, parseColor2));
this.k.setBackgroundColor(Color.parseColor(this.j.z()));
Bundle bundle4 = (Bundle) bundle3.clone();
bundle4.putInt("position", 0);
j jVar = new j();
jVar.setArguments(bundle4);
this.i.b(jVar, this.j.c(), 0);
while (i3 < C.size()) {
String str = C.get(i3);
i3++;
Bundle bundle5 = (Bundle) bundle3.clone();
bundle5.putInt("position", i3);
bundle5.putString("filter", str);
j jVar2 = new j();
jVar2.setArguments(bundle5);
this.i.b(jVar2, str, i3);
this.l.setOffscreenPageLimit(i3);
}
this.l.setAdapter(this.i);
this.i.notifyDataSetChanged();
this.l.addOnPageChangeListener(new TabLayout.h(this.k));
this.k.g(new b());
this.k.setupWithViewPager(this.l);
return;
}
this.l.setVisibility(8);
this.k.setVisibility(8);
u uVar = this.cleverTapAPI;
if (uVar != null && uVar.x() == 0) {
textView.setBackgroundColor(Color.parseColor(this.j.d()));
textView.setVisibility(0);
textView.setText(this.j.i());
textView.setTextColor(Color.parseColor(this.j.j()));
return;
}
((FrameLayout) findViewById(g1.list_view_fragment)).setVisibility(0);
textView.setVisibility(8);
boolean z = false;
for (Fragment fragment : getSupportFragmentManager().Y()) {
if (fragment.getTag() != null) {
if (!fragment.getTag().equalsIgnoreCase(this.config.d() + ":CT_INBOX_LIST_VIEW_FRAGMENT")) {
z = true;
}
}
}
if (z) {
return;
}
j jVar3 = new j();
jVar3.setArguments(bundle3);
FragmentManager supportFragmentManager = getSupportFragmentManager();
androidx.fragment.app.a f = android.support.v4.media.a.f(supportFragmentManager, supportFragmentManager);
f.k(g1.list_view_fragment, jVar3, this.config.d() + ":CT_INBOX_LIST_VIEW_FRAGMENT", 1);
f.p(false);
} catch (Throwable th) {
y0.m("Cannot find a valid notification inbox bundle to show!", th);
}
}
@Override
public final void onDestroy() {
this.cleverTapAPI.t().h().I(null);
if (this.j.F()) {
for (Fragment fragment : getSupportFragmentManager().Y()) {
if (fragment instanceof j) {
y0.j("Removing fragment - " + fragment.toString());
getSupportFragmentManager().Y().remove(fragment);
}
}
}
super.onDestroy();
}
@Override
public final void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
com.clevertap.android.sdk.o.a(this, this.config);
com.clevertap.android.sdk.o.b = false;
com.clevertap.android.sdk.o.b(this, this.config);
if (i == 102) {
if (iArr.length <= 0 || iArr[0] != 0) {
this.pushPermissionResultCallbackWeakReference.get().c();
} else {
this.pushPermissionResultCallbackWeakReference.get().b();
}
}
}
@Override
public final void onResume() {
super.onResume();
if (!this.pushPermissionManager.c() || Build.VERSION.SDK_INT < 33) {
return;
}
if (androidx.core.content.a.a(this, "android.permission.POST_NOTIFICATIONS") == 0) {
this.pushPermissionResultCallbackWeakReference.get().b();
} else {
this.pushPermissionResultCallbackWeakReference.get().c();
}
}
}