导航菜单

页面标题

页面副标题

CityMall v1.42.1 - CTInboxActivity.java 源代码

正在查看: CityMall v1.42.1 应用的 CTInboxActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.clevertap.android.sdk.inbox;

import L0.B;
import L0.C;
import L0.C0331f;
import L0.D;
import android.content.Context;
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.RestrictTo;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;
import com.clevertap.android.sdk.CTInboxListener;
import com.clevertap.android.sdk.CTInboxStyleConfig;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.DidClickForHardPermissionListener;
import com.clevertap.android.sdk.InAppNotificationActivity;
import com.clevertap.android.sdk.inbox.CTInboxListViewFragment;
import com.clevertap.android.sdk.t;
import com.clevertap.android.sdk.v;
import com.google.android.material.tabs.TabLayout;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;

@RestrictTo
public class CTInboxActivity extends FragmentActivity implements CTInboxListViewFragment.InboxListener, DidClickForHardPermissionListener {

    public static int f13364k;

    o f13365a;

    CTInboxStyleConfig f13366b;

    TabLayout f13367c;

    ViewPager f13368d;

    private CleverTapInstanceConfig f13369e;

    private WeakReference f13370f;

    private CleverTapAPI f13371g;

    private CTInboxListener f13372h = null;

    private v f13373i;

    private WeakReference f13374j;

    public interface InboxActivityListener {
        void a(CTInboxActivity cTInboxActivity, CTInboxMessage cTInboxMessage, Bundle bundle);

        void b(CTInboxActivity cTInboxActivity, int i5, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap hashMap, int i6);
    }

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            CTInboxActivity.this.finish();
        }
    }

    class b implements TabLayout.OnTabSelectedListener {
        b() {
        }

        public void a(TabLayout.e eVar) {
            CTInboxListViewFragment cTInboxListViewFragment = (CTInboxListViewFragment) CTInboxActivity.this.f13365a.t(eVar.g());
            if (cTInboxListViewFragment.C() != null) {
                cTInboxListViewFragment.C().C1();
            }
        }

        public void b(TabLayout.e eVar) {
            CTInboxListViewFragment cTInboxListViewFragment = (CTInboxListViewFragment) CTInboxActivity.this.f13365a.t(eVar.g());
            if (cTInboxListViewFragment.C() != null) {
                cTInboxListViewFragment.C().B1();
            }
        }

        public void c(TabLayout.e eVar) {
        }
    }

    private String C() {
        return this.f13369e.d() + ":CT_INBOX_LIST_VIEW_FRAGMENT";
    }

    void A(Bundle bundle, int i5, CTInboxMessage cTInboxMessage, HashMap hashMap, int i6) {
        InboxActivityListener D4 = D();
        if (D4 != null) {
            D4.b(this, i5, cTInboxMessage, bundle, hashMap, i6);
        }
    }

    void B(Bundle bundle, CTInboxMessage cTInboxMessage) {
        t.r("CTInboxActivity:didShow() called with: data = [" + bundle + "], inboxMessage = [" + cTInboxMessage.f() + "]");
        InboxActivityListener D4 = D();
        if (D4 != null) {
            D4.a(this, cTInboxMessage, bundle);
        }
    }

    InboxActivityListener D() {
        InboxActivityListener inboxActivityListener;
        try {
            inboxActivityListener = (InboxActivityListener) this.f13370f.get();
        } catch (Throwable unused) {
            inboxActivityListener = null;
        }
        if (inboxActivityListener == null) {
            this.f13369e.s().v(this.f13369e.d(), "InboxActivityListener is null for notification inbox ");
        }
        return inboxActivityListener;
    }

    void E(InboxActivityListener inboxActivityListener) {
        this.f13370f = new WeakReference(inboxActivityListener);
    }

    public void F(InAppNotificationActivity.PushPermissionResultCallback pushPermissionResultCallback) {
        this.f13374j = new WeakReference(pushPermissionResultCallback);
    }

    public void G(boolean z4) {
        this.f13373i.i(z4, (InAppNotificationActivity.PushPermissionResultCallback) this.f13374j.get());
    }

    @Override
    public void b(Context context, CTInboxMessage cTInboxMessage, Bundle bundle) {
        t.r("CTInboxActivity:messageDidShow() called with: data = [" + bundle + "], inboxMessage = [" + cTInboxMessage.f() + "]");
        B(bundle, cTInboxMessage);
    }

    @Override
    public void d(Context context, int i5, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap hashMap, int i6) {
        A(bundle, i5, cTInboxMessage, hashMap, i6);
    }

    @Override
    public void h(boolean z4) {
        G(z4);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        try {
            Bundle extras = getIntent().getExtras();
            if (extras == null) {
                throw new IllegalArgumentException();
            }
            this.f13366b = (CTInboxStyleConfig) extras.getParcelable("styleConfig");
            Bundle bundle2 = extras.getBundle("configBundle");
            if (bundle2 != null) {
                this.f13369e = (CleverTapInstanceConfig) bundle2.getParcelable("config");
            }
            CleverTapAPI F02 = CleverTapAPI.F0(getApplicationContext(), this.f13369e);
            this.f13371g = F02;
            if (F02 != null) {
                E(F02);
                F(CleverTapAPI.F0(this, this.f13369e).Z().n());
                this.f13373i = new v(this, this.f13369e);
            }
            f13364k = getResources().getConfiguration().orientation;
            setContentView(D.f1423l);
            this.f13371g.Z().i().K(this);
            Toolbar toolbar = (Toolbar) findViewById(C.f1340I0);
            toolbar.setTitle(this.f13366b.e());
            toolbar.setTitleTextColor(Color.parseColor(this.f13366b.f()));
            toolbar.setBackgroundColor(Color.parseColor(this.f13366b.d()));
            Drawable f5 = androidx.core.content.res.g.f(getResources(), B.f1317b, null);
            if (f5 != null) {
                f5.setColorFilter(Color.parseColor(this.f13366b.a()), PorterDuff.Mode.SRC_IN);
            }
            toolbar.setNavigationIcon(f5);
            toolbar.setNavigationOnClickListener(new a());
            LinearLayout linearLayout = (LinearLayout) findViewById(C.f1375h0);
            linearLayout.setBackgroundColor(Color.parseColor(this.f13366b.c()));
            this.f13367c = linearLayout.findViewById(C.f1336G0);
            this.f13368d = (ViewPager) linearLayout.findViewById(C.f1344K0);
            TextView textView = (TextView) findViewById(C.f1409y0);
            Bundle bundle3 = new Bundle();
            bundle3.putParcelable("config", this.f13369e);
            bundle3.putParcelable("styleConfig", this.f13366b);
            int i5 = 0;
            if (!this.f13366b.s()) {
                this.f13368d.setVisibility(8);
                this.f13367c.setVisibility(8);
                CleverTapAPI cleverTapAPI = this.f13371g;
                if (cleverTapAPI != null && cleverTapAPI.m0() == 0) {
                    textView.setBackgroundColor(Color.parseColor(this.f13366b.c()));
                    textView.setVisibility(0);
                    textView.setText(this.f13366b.g());
                    textView.setTextColor(Color.parseColor(this.f13366b.h()));
                    return;
                }
                ((FrameLayout) findViewById(C.f1393q0)).setVisibility(0);
                textView.setVisibility(8);
                for (Fragment fragment : getSupportFragmentManager().y0()) {
                    if (fragment.getTag() != null && !fragment.getTag().equalsIgnoreCase(C())) {
                        i5 = 1;
                    }
                }
                if (i5 == 0) {
                    Fragment cTInboxListViewFragment = new CTInboxListViewFragment();
                    cTInboxListViewFragment.setArguments(bundle3);
                    getSupportFragmentManager().p().c(C.f1393q0, cTInboxListViewFragment, C()).h();
                    return;
                }
                return;
            }
            this.f13368d.setVisibility(0);
            ArrayList l5 = this.f13366b.l();
            this.f13365a = new o(getSupportFragmentManager(), l5.size() + 1);
            this.f13367c.setVisibility(0);
            this.f13367c.setTabGravity(0);
            this.f13367c.setTabMode(1);
            this.f13367c.setSelectedTabIndicatorColor(Color.parseColor(this.f13366b.j()));
            this.f13367c.O(Color.parseColor(this.f13366b.o()), Color.parseColor(this.f13366b.i()));
            this.f13367c.setBackgroundColor(Color.parseColor(this.f13366b.k()));
            Bundle bundle4 = (Bundle) bundle3.clone();
            bundle4.putInt("position", 0);
            CTInboxListViewFragment cTInboxListViewFragment2 = new CTInboxListViewFragment();
            cTInboxListViewFragment2.setArguments(bundle4);
            this.f13365a.w(cTInboxListViewFragment2, this.f13366b.b(), 0);
            while (i5 < l5.size()) {
                String str = (String) l5.get(i5);
                i5++;
                Bundle bundle5 = (Bundle) bundle3.clone();
                bundle5.putInt("position", i5);
                bundle5.putString("filter", str);
                CTInboxListViewFragment cTInboxListViewFragment3 = new CTInboxListViewFragment();
                cTInboxListViewFragment3.setArguments(bundle5);
                this.f13365a.w(cTInboxListViewFragment3, str, i5);
                this.f13368d.setOffscreenPageLimit(i5);
            }
            this.f13368d.setAdapter(this.f13365a);
            this.f13365a.j();
            this.f13368d.c(new TabLayout.f(this.f13367c));
            this.f13367c.h(new b());
            this.f13367c.setupWithViewPager(this.f13368d);
        } catch (Throwable th) {
            t.u("Cannot find a valid notification inbox bundle to show!", th);
        }
    }

    @Override
    protected void onDestroy() {
        this.f13371g.Z().i().K(null);
        if (this.f13366b.s()) {
            for (Fragment fragment : getSupportFragmentManager().y0()) {
                if (fragment instanceof CTInboxListViewFragment) {
                    t.r("Removing fragment - " + fragment.toString());
                    getSupportFragmentManager().y0().remove(fragment);
                }
            }
        }
        super.onDestroy();
    }

    @Override
    public void onRequestPermissionsResult(int i5, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i5, strArr, iArr);
        C0331f.c(this, this.f13369e).e(false);
        C0331f.f(this, this.f13369e);
        if (i5 == 102) {
            if (iArr.length <= 0 || iArr[0] != 0) {
                ((InAppNotificationActivity.PushPermissionResultCallback) this.f13374j.get()).d();
            } else {
                ((InAppNotificationActivity.PushPermissionResultCallback) this.f13374j.get()).b();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!this.f13373i.c() || Build.VERSION.SDK_INT < 33) {
            return;
        }
        if (ContextCompat.a(this, "android.permission.POST_NOTIFICATIONS") == 0) {
            ((InAppNotificationActivity.PushPermissionResultCallback) this.f13374j.get()).b();
        } else {
            ((InAppNotificationActivity.PushPermissionResultCallback) this.f13374j.get()).d();
        }
    }
}