导航菜单

页面标题

页面副标题

Chaupal v3.2 - CTInboxActivity.java 源代码

正在查看: Chaupal v3.2 应用的 CTInboxActivity.java JAVA 源代码文件

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


package com.clevertap.android.sdk.inbox;

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.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.clevertap.android.sdk.CTInboxStyleConfig;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.InAppNotificationActivity;
import com.clevertap.android.sdk.inbox.m;
import com.clevertap.android.sdk.t;
import com.clevertap.android.sdk.v;
import com.connectsdk.service.DeviceService;
import com.connectsdk.service.config.ServiceDescription;
import com.google.android.material.tabs.TabLayout;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import r3.r0;
import r3.s0;
import r3.t0;
import r3.z;

public class CTInboxActivity extends androidx.fragment.app.h implements m.b, z {

    public static int f8648l;

    o f8649a;

    CTInboxStyleConfig f8650c;

    TabLayout f8651d;

    ViewPager f8652e;

    private CleverTapInstanceConfig f8653f;

    private WeakReference<b> f8654g;

    private CleverTapAPI f8655h;

    private r3.d f8656i = null;

    private v f8657j;

    private WeakReference<InAppNotificationActivity.c> f8658k;

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

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

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

        void b(CTInboxActivity cTInboxActivity, int i7, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap<String, String> hashMap, int i8);
    }

    private String V() {
        return this.f8653f.c() + ":CT_INBOX_LIST_VIEW_FRAGMENT";
    }

    @Override
    public void K(boolean z6) {
        Z(z6);
    }

    void T(Bundle bundle, int i7, CTInboxMessage cTInboxMessage, HashMap<String, String> hashMap, int i8) {
        b W = W();
        if (W != null) {
            W.b(this, i7, cTInboxMessage, bundle, hashMap, i8);
        }
    }

    void U(Bundle bundle, CTInboxMessage cTInboxMessage) {
        t.q("CTInboxActivity:didShow() called with: data = [" + bundle + "], inboxMessage = [" + cTInboxMessage.h() + "]");
        b W = W();
        if (W != null) {
            W.a(this, cTInboxMessage, bundle);
        }
    }

    b W() {
        b bVar;
        try {
            bVar = this.f8654g.get();
        } catch (Throwable unused) {
            bVar = null;
        }
        if (bVar == null) {
            this.f8653f.p().a(this.f8653f.c(), "InboxActivityListener is null for notification inbox ");
        }
        return bVar;
    }

    void X(b bVar) {
        this.f8654g = new WeakReference<>(bVar);
    }

    public void Y(InAppNotificationActivity.c cVar) {
        this.f8658k = new WeakReference<>(cVar);
    }

    public void Z(boolean z6) {
        this.f8657j.i(z6, this.f8658k.get());
    }

    @Override
    public void i(Context context, CTInboxMessage cTInboxMessage, Bundle bundle) {
        t.q("CTInboxActivity:messageDidShow() called with: data = [" + bundle + "], inboxMessage = [" + cTInboxMessage.h() + "]");
        U(bundle, cTInboxMessage);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        try {
            Bundle extras = getIntent().getExtras();
            if (extras == null) {
                throw new IllegalArgumentException();
            }
            this.f8650c = (CTInboxStyleConfig) extras.getParcelable("styleConfig");
            Bundle bundle2 = extras.getBundle("configBundle");
            if (bundle2 != null) {
                this.f8653f = (CleverTapInstanceConfig) bundle2.getParcelable(DeviceService.KEY_CONFIG);
            }
            CleverTapAPI V = CleverTapAPI.V(getApplicationContext(), this.f8653f);
            this.f8655h = V;
            if (V != null) {
                X(V);
                Y(CleverTapAPI.V(this, this.f8653f).E().l());
                this.f8657j = new v(this, this.f8653f);
            }
            f8648l = getResources().getConfiguration().orientation;
            setContentView(t0.f18557l);
            this.f8655h.E().h().K(this);
            Toolbar toolbar = (Toolbar) findViewById(s0.I0);
            toolbar.setTitle(this.f8650c.h());
            toolbar.setTitleTextColor(Color.parseColor(this.f8650c.i()));
            toolbar.setBackgroundColor(Color.parseColor(this.f8650c.d()));
            Drawable e7 = androidx.core.content.res.h.e(getResources(), r0.f18489b, null);
            if (e7 != null) {
                e7.setColorFilter(Color.parseColor(this.f8650c.a()), PorterDuff.Mode.SRC_IN);
            }
            toolbar.setNavigationIcon(e7);
            toolbar.setNavigationOnClickListener(new a());
            LinearLayout linearLayout = (LinearLayout) findViewById(s0.f18510h0);
            linearLayout.setBackgroundColor(Color.parseColor(this.f8650c.c()));
            this.f8651d = linearLayout.findViewById(s0.G0);
            this.f8652e = (ViewPager) linearLayout.findViewById(s0.K0);
            TextView textView = (TextView) findViewById(s0.f18543y0);
            Bundle bundle3 = new Bundle();
            bundle3.putParcelable(DeviceService.KEY_CONFIG, this.f8653f);
            bundle3.putParcelable("styleConfig", this.f8650c);
            int i7 = 0;
            if (!this.f8650c.q()) {
                this.f8652e.setVisibility(8);
                this.f8651d.setVisibility(8);
                CleverTapAPI cleverTapAPI = this.f8655h;
                if (cleverTapAPI != null && cleverTapAPI.L() == 0) {
                    textView.setBackgroundColor(Color.parseColor(this.f8650c.c()));
                    textView.setVisibility(0);
                    textView.setText(this.f8650c.j());
                    textView.setTextColor(Color.parseColor(this.f8650c.k()));
                    return;
                }
                ((FrameLayout) findViewById(s0.f18527q0)).setVisibility(0);
                textView.setVisibility(8);
                for (Fragment fragment : getSupportFragmentManager().w0()) {
                    if (fragment.getTag() != null && !fragment.getTag().equalsIgnoreCase(V())) {
                        i7 = 1;
                    }
                }
                if (i7 == 0) {
                    Fragment mVar = new m();
                    mVar.setArguments(bundle3);
                    getSupportFragmentManager().q().c(s0.f18527q0, mVar, V()).i();
                    return;
                }
                return;
            }
            this.f8652e.setVisibility(0);
            ArrayList<String> o7 = this.f8650c.o();
            this.f8649a = new o(getSupportFragmentManager(), o7.size() + 1);
            this.f8651d.setVisibility(0);
            this.f8651d.setTabGravity(0);
            this.f8651d.setTabMode(1);
            this.f8651d.setSelectedTabIndicatorColor(Color.parseColor(this.f8650c.m()));
            this.f8651d.M(Color.parseColor(this.f8650c.p()), Color.parseColor(this.f8650c.l()));
            this.f8651d.setBackgroundColor(Color.parseColor(this.f8650c.n()));
            Bundle bundle4 = (Bundle) bundle3.clone();
            bundle4.putInt("position", 0);
            m mVar2 = new m();
            mVar2.setArguments(bundle4);
            this.f8649a.w(mVar2, this.f8650c.b(), 0);
            while (i7 < o7.size()) {
                String str = o7.get(i7);
                i7++;
                Bundle bundle5 = (Bundle) bundle3.clone();
                bundle5.putInt("position", i7);
                bundle5.putString(ServiceDescription.KEY_FILTER, str);
                m mVar3 = new m();
                mVar3.setArguments(bundle5);
                this.f8649a.w(mVar3, str, i7);
                this.f8652e.setOffscreenPageLimit(i7);
            }
            this.f8652e.setAdapter(this.f8649a);
            this.f8649a.j();
            this.f8652e.c(new TabLayout.h(this.f8651d));
            this.f8651d.setupWithViewPager(this.f8652e);
        } catch (Throwable th) {
            t.t("Cannot find a valid notification inbox bundle to show!", th);
        }
    }

    @Override
    protected void onDestroy() {
        this.f8655h.E().h().K(null);
        if (this.f8650c.q()) {
            for (Fragment fragment : getSupportFragmentManager().w0()) {
                if (fragment instanceof m) {
                    t.q("Removing fragment - " + fragment.toString());
                    getSupportFragmentManager().w0().remove(fragment);
                }
            }
        }
        super.onDestroy();
    }

    @Override
    public void onRequestPermissionsResult(int i7, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i7, strArr, iArr);
        boolean z6 = false;
        r3.h.c(this, this.f8653f).e(false);
        r3.h.f(this, this.f8653f);
        if (i7 == 102) {
            if (iArr.length > 0 && iArr[0] == 0) {
                z6 = true;
            }
            if (z6) {
                this.f8658k.get().a();
            } else {
                this.f8658k.get().b();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!this.f8657j.c() || Build.VERSION.SDK_INT < 33) {
            return;
        }
        if (androidx.core.content.a.checkSelfPermission(this, "android.permission.POST_NOTIFICATIONS") == 0) {
            this.f8658k.get().a();
        } else {
            this.f8658k.get().b();
        }
    }

    @Override
    public void p(Context context, int i7, CTInboxMessage cTInboxMessage, Bundle bundle, HashMap<String, String> hashMap, int i8) {
        T(bundle, i7, cTInboxMessage, hashMap, i8);
    }
}