导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - HomeActivity.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 HomeActivity.java JAVA 源代码文件

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


package com.showself.ui;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import chat.entity.MessageInfo;
import chat.entity.NotificationNumber;
import chat.ui.activity.SJChatActivity;
import chat.ui.fragment.SJChatMenuFragment;
import cn.jpush.android.api.JPluginPlatformInterface;
import cn.jpush.android.api.JPushInterface;
import com.airbnb.lottie.LottieAnimationView;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.mifeng.ui.R;
import com.r.m.b.e;
import com.r.m.b.j;
import com.showself.domain.LoginResultInfo;
import com.showself.domain.SystemInfo;
import com.showself.event.NewsHandleEvent;
import com.showself.event.NewsNoticeInfo;
import com.showself.fragment.BaseFragment;
import com.showself.fragment.CardOwnFragment;
import com.showself.fragment.HomeFollowFragment;
import com.showself.fragment.LiveShowsFragment;
import com.showself.fragment.RankingListFragment;
import com.showself.resource.ResourceManager;
import com.showself.ui.HomeActivity;
import com.showself.ui.login.LoginListDialogActivity;
import com.showself.ui.show.AudioShowActivity;
import com.showself.utils.Utils;
import com.showself.utils.e0;
import com.showself.utils.f0;
import com.showself.utils.k0;
import com.showself.utils.l0;
import com.showself.utils.m0;
import com.showself.utils.o;
import com.showself.utils.o0;
import com.showself.utils.p;
import com.showself.utils.r;
import com.showself.utils.r0;
import com.showself.utils.u;
import com.showself.utils.u0;
import com.showself.view.d0;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.smtt.utils.TbsLog;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.eventbus.m;
import org.jivesoftware.smack.packet.PrivacyItem;
import org.json.JSONObject;

public class HomeActivity extends com.showself.ui.c {
    public static int I;
    private JPluginPlatformInterface A;
    private View b;
    private View c;
    private View d;

    private View f2655e;

    private View f2656f;

    private LottieAnimationView f2657g;

    private LottieAnimationView f2658h;

    private LottieAnimationView f2659i;

    private LottieAnimationView f2660j;

    private LottieAnimationView f2661k;
    private ImageView l;
    private TextView m;
    private TextView n;
    private androidx.fragment.app.g o;
    public Fragment p;
    LoginResultInfo q;
    private d.d.c r;
    private com.m.b.d.g s;
    private ImageView u;
    private TextView v;
    private RelativeLayout w;
    private LiveShowsFragment y;
    private String a = "";
    private boolean t = false;
    private int x = 3;
    private Handler z = new d();
    private boolean B = false;
    private View.OnClickListener C = new h();
    private View.OnClickListener G = new i();
    private BroadcastReceiver H = new b();

    class a implements com.showself.utils.l {

        class RunnableC0072a implements Runnable {
            RunnableC0072a(a aVar) {
            }

            @Override
            public void run() {
                com.showself.ui.c.exit();
            }
        }

        a() {
        }

        @Override
        public void a(boolean z) {
            if (z) {
                return;
            }
            try {
                Intent intent = new Intent();
                intent.addCategory("android.intent.category.HOME");
                intent.setAction("android.intent.action.MAIN");
                intent.addFlags(270532608);
                HomeActivity.this.startActivity(intent);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            HomeActivity.this.b.postDelayed(new RunnableC0072a(this), 500L);
        }
    }

    class b extends BroadcastReceiver {
        b() {
        }

        public void b(MessageInfo messageInfo, View view) {
            if (Utils.o0()) {
                return;
            }
            m0.a();
            if (!r0.E(HomeActivity.this.q.getUserId()) && !messageInfo.getIsOfficial().equals("1")) {
                HomeActivity.this.f0("UserProfile", 0, true);
                if (Utils.v0(HomeActivity.class.getCanonicalName())) {
                    HomeActivity.this.B = true;
                    HomeActivity.this.k0("find");
                    return;
                } else if (Utils.v0(AudioShowActivity.class.getCanonicalName())) {
                    org.greenrobot.eventbus.c.c().k(new com.r.m.b.e(e.a.SHOW_CHAT, 0));
                    return;
                } else {
                    HomeActivity.this.startActivity(new Intent((Context) HomeActivity.this, (Class<?>) MessageActivity.class));
                    return;
                }
            }
            if (Utils.v0(AudioShowActivity.class.getCanonicalName())) {
                org.greenrobot.eventbus.c.c().k(new com.r.m.b.e(e.a.SHOW_CHAT_MSG, messageInfo));
            } else {
                com.r.n.g j2 = com.r.n.g.j();
                com.r.n.d c = com.r.n.d.c();
                c.e("Chat");
                c.f("PrivateChat");
                c.d("Room");
                c.a(Oauth2AccessToken.KEY_UID, Integer.valueOf(HomeActivity.this.q.getUserId()));
                c.a("url", messageInfo.getRedirectUrl());
                c.h(com.r.n.e.Click);
                j2.u(c.b());
                d.c.a.U(HomeActivity.this, messageInfo.getFrom(), messageInfo.getAvatar(), messageInfo.getNickname(), messageInfo.getIsOfficial(), messageInfo.getGender(), 1);
            }
            HomeActivity.this.f0("NavigationUser", messageInfo.getFrom(), true);
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            if (!e0.b.equals(intent.getAction()) && !"com.showself.receive_openfiremsg".equals(intent.getAction())) {
                if ("com.showself.receive_mall_update".equals(intent.getAction())) {
                    HomeActivity.this.n0();
                    return;
                } else if ("com.showself.custom_url".equals(intent.getAction())) {
                    HomeActivity.this.Z(intent.getExtras());
                    return;
                } else {
                    if ("sjchat_recall".equals(intent.getAction())) {
                        HomeActivity.this.m0();
                        return;
                    }
                    return;
                }
            }
            String m0 = HomeActivity.this.m0();
            if (m0 == null || m0.equals("")) {
                return;
            }
            if (Integer.parseInt(m0) > 99) {
                m0 = "99+";
            }
            if (!"com.showself.receive_openfiremsg".equals(intent.getAction()) || TextUtils.isEmpty(m0) || intent.getExtras() == null) {
                return;
            }
            Bundle extras = intent.getExtras();
            if (extras.getInt("type", -1) == 4) {
                return;
            }
            final MessageInfo messageInfo = extras.getSerializable("messageInfo") != null ? (MessageInfo) extras.getSerializable("messageInfo") : null;
            if (Utils.v0(SJChatActivity.class.getCanonicalName()) || Utils.v0(MessageActivity.class.getCanonicalName())) {
                return;
            }
            if ((HomeActivity.this.p instanceof SJChatMenuFragment) && Utils.v0(HomeActivity.class.getCanonicalName())) {
                return;
            }
            if (Utils.v0(AudioShowActivity.class.getCanonicalName())) {
                org.greenrobot.eventbus.c.c().k(new com.r.m.b.e(e.a.SHOW_TOP_CHAT, m0, messageInfo));
            } else {
                m0.d(messageInfo, m0, HomeActivity.this.q.getUserId(), new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        HomeActivity.b.this.b(messageInfo, view);
                    }
                });
            }
        }
    }

    class c implements com.r.a.b {
        final int a;

        c(int i2) {
            this.a = i2;
        }

        @Override
        public void a() {
            if (HomeActivity.this.s.f() || HomeActivity.this.t) {
                HomeActivity.this.X(this.a);
            } else {
                Utils.a1("资源下载上请稍后再试");
            }
            HomeActivity.this.mPermissionHelper = null;
        }

        @Override
        public void b(String str) {
            new com.r.a.c(HomeActivity.this).d(str);
            HomeActivity.this.mPermissionHelper = null;
        }
    }

    class d extends Handler {
        d() {
        }

        @Override
        @SuppressLint({"HandlerLeak"})
        public void handleMessage(Message message) {
            if (message.what == 0) {
                HomeActivity.this.v.setText("跳过 " + HomeActivity.this.W());
                if (HomeActivity.this.x > 0) {
                    HomeActivity.this.z.sendEmptyMessageDelayed(0, 1000L);
                    return;
                }
                HomeActivity.this.w.setVisibility(8);
                HomeActivity.this.z.removeCallbacksAndMessages(null);
                com.showself.ui.juvenile.a.a.f(HomeActivity.this);
                HomeActivity.this.j0();
            }
        }
    }

    class e implements com.r.c.d {
        e(HomeActivity homeActivity) {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            if (jSONObject == null || jSONObject.optInt("statuscode") != 0) {
                return;
            }
            JSONObject optJSONObject = jSONObject.optJSONObject("data");
            r0.w0(optJSONObject.optJSONArray("1"));
            r0.x0(optJSONObject.optJSONArray("2"));
            r0.B0(optJSONObject.optJSONArray("3"));
            r0.p0(optJSONObject.optJSONArray("4"));
        }
    }

    class f implements Runnable {
        f() {
        }

        @Override
        public void run() {
            HomeActivity.this.m0();
        }
    }

    class g implements u.c {
        g() {
        }

        @Override
        public void filePath(String str) {
            if (new File(str).exists()) {
                HomeActivity.this.t = true;
                com.a.d = str;
                return;
            }
            HomeActivity.this.t = true;
            com.a.d = new File(new File(HomeActivity.this.getExternalFilesDir("assets").getAbsolutePath() + File.separator + "resource", "LicenseBag.bundle"), com.a.d).getAbsolutePath();
        }

        @Override
        public void updataProgress(int i2, int i3) {
        }
    }

    class h implements View.OnClickListener {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                HomeActivity.this.w.setVisibility(8);
                com.showself.ui.juvenile.a.a.f(HomeActivity.this);
            }
        }

        h() {
        }

        @Override
        public void onClick(View view) {
            Intent intent;
            if (Utils.o0()) {
                return;
            }
            int id = view.getId();
            if (id != 2131296927) {
                if (id != 2131298905) {
                    return;
                }
                com.showself.ui.juvenile.a.a.f(HomeActivity.this);
                HomeActivity.this.w.setVisibility(8);
                HomeActivity.this.z.removeCallbacksAndMessages(null);
                HomeActivity.this.j0();
                return;
            }
            String str = (String) view.getTag();
            if (str == null || TextUtils.isEmpty(str)) {
                return;
            }
            com.r.n.g j2 = com.r.n.g.j();
            com.r.n.d c = com.r.n.d.c();
            c.e("Splash");
            c.f("Splash");
            c.d("Page");
            c.h(com.r.n.e.Click);
            j2.u(c.b());
            try {
                intent = o.g(str, HomeActivity.this.getApplicationContext(), true);
            } catch (Exception e2) {
                e2.printStackTrace();
                intent = null;
            }
            if (intent != null) {
                o.h(HomeActivity.this.getApplicationContext(), intent);
                HomeActivity.this.z.removeCallbacksAndMessages(null);
                new Handler().postDelayed(new a(), 1000L);
            }
        }
    }

    class i implements View.OnClickListener {

        class a implements l0.i {
            a(i iVar) {
            }

            @Override
            public void a(boolean z) {
            }
        }

        i() {
        }

        @Override
        public void onClick(View view) {
            if (Utils.o0()) {
            }
            switch (view.getId()) {
                case R.id.home_bottom_tab1:
                    HomeActivity.this.k0("liveshow");
                    HomeActivity.this.j0();
                    break;
                case R.id.home_bottom_tab2:
                    HomeActivity.this.k0("game");
                    break;
                case R.id.home_bottom_tab3:
                    HomeActivity.this.k0("board");
                    break;
                case R.id.home_bottom_tab4:
                    HomeActivity.this.B = false;
                    HomeActivity.this.k0("find");
                    break;
                case R.id.home_bottom_tab5:
                    com.r.n.g j2 = com.r.n.g.j();
                    com.r.n.d c = com.r.n.d.c();
                    c.e("Me");
                    c.f("Profile");
                    c.d("Me");
                    c.h(com.r.n.e.Click);
                    j2.u(c.b());
                    HomeActivity.this.k0("me");
                    break;
                case R.id.home_live_show:
                    if (!LoginListDialogActivity.i0(HomeActivity.this, true) && !l0.e()) {
                        l0.i(HomeActivity.this, new a(this));
                        break;
                    }
                    break;
            }
        }
    }

    class j implements l0.i {
        j(HomeActivity homeActivity) {
        }

        @Override
        public void a(boolean z) {
        }
    }

    class k implements l0.i {
        k(HomeActivity homeActivity) {
        }

        @Override
        public void a(boolean z) {
        }
    }

    class l implements l0.i {
        l(HomeActivity homeActivity) {
        }

        @Override
        public void a(boolean z) {
        }
    }

    private void R() {
        LottieAnimationView lottieAnimationView = this.f2657g;
        if (lottieAnimationView != null) {
            I = 0;
            lottieAnimationView.u(0, 27);
            this.f2657g.setFrame(27);
            this.n.setText("首页");
        }
    }

    private void S() {
        if (I == 1) {
            this.f2657g.u(30, 59);
            this.f2657g.setFrame(59);
            this.n.setText("刷新");
        }
    }

    private void T() {
        if (I == 1) {
            this.f2657g.u(0, 27);
            this.f2657g.setFrame(27);
            this.n.setText("首页");
        }
    }

    private void U(LottieAnimationView lottieAnimationView) {
        this.f2657g.i();
        int i2 = I;
        if (i2 == 0) {
            this.f2657g.u(0, 27);
            this.f2657g.setFrame(0);
            this.n.setText("首页");
        } else if (i2 == 1) {
            LiveShowsFragment liveShowsFragment = this.y;
            if (liveShowsFragment == null || liveShowsFragment.I() == 0) {
                this.f2657g.u(30, 59);
                this.f2657g.setFrame(30);
                if (this.a.equals("liveshow")) {
                    this.n.setText("刷新");
                } else {
                    this.n.setText("首页");
                }
            } else {
                this.f2657g.u(0, 27);
                this.f2657g.setFrame(0);
                this.n.setText("首页");
            }
        }
        this.f2658h.i();
        this.f2658h.setFrame(0);
        this.f2659i.i();
        this.f2659i.setFrame(0);
        this.f2660j.i();
        this.f2660j.setFrame(0);
        this.f2661k.i();
        this.f2661k.setFrame(0);
        lottieAnimationView.q();
    }

    private void V() {
        LottieAnimationView lottieAnimationView = this.f2657g;
        if (lottieAnimationView != null) {
            I = 1;
            lottieAnimationView.u(60, 80);
            this.f2657g.q();
            this.n.setText("刷新");
        }
    }

    public int W() {
        int i2 = this.x - 1;
        this.x = i2;
        return i2;
    }

    public void X(int i2) {
        if (Build.VERSION.SDK_INT < 21) {
            Utils.X0(R.string.no_broadcast);
            return;
        }
        if (!this.mPermissionHelper.b()) {
            Utils.X0(R.string.camera_permission_lack_prompt);
        } else if (this.mPermissionHelper.a()) {
            z(i2);
        } else {
            Utils.X0(R.string.record_permission_lack_prompt);
        }
    }

    private void Y() {
        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("accessToken", r0.y(this).getSessionId());
        new com.r.c.c(String.format(com.showself.net.f.D0().W("v2/share/multisetting", hashMap), new Object[0]), null, new com.r.c.b(1), this).v(new e(this));
    }

    public void Z(Bundle bundle) {
        try {
            String string = bundle.getString("customUrl");
            if (string != null) {
                Intent e2 = o.e(string, getApplicationContext());
                if (e2 == null || e2.getStringExtra("action_type") == null || !e2.getStringExtra("action_type").equals("customerservice")) {
                    com.r.n.g j2 = com.r.n.g.j();
                    com.r.n.d c2 = com.r.n.d.c();
                    c2.e("Chat");
                    c2.f("PrivateChat");
                    c2.d("Room");
                    c2.a(Oauth2AccessToken.KEY_UID, Integer.valueOf(this.q.getUserId()));
                    c2.a("url", string);
                    c2.h(com.r.n.e.Click);
                    j2.u(c2.b());
                    o.h(this, e2);
                    return;
                }
                int i2 = bundle.getInt("isInRoom", 1);
                MessageInfo serializable = bundle.getSerializable("messageInfo");
                if (serializable == null) {
                    return;
                }
                if (i2 == 0) {
                    org.greenrobot.eventbus.c.c().k(new com.r.m.b.e(e.a.SHOW_SERVICECENTER, serializable));
                } else {
                    com.showself.provider.l.a.c().f(this, "");
                }
                com.r.n.g j3 = com.r.n.g.j();
                com.r.n.d c3 = com.r.n.d.c();
                c3.e("Chat");
                c3.f("PrivateChat");
                c3.d("CustomerService");
                c3.h(com.r.n.e.Click);
                j3.u(c3.b());
            }
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    private void a0() {
        this.u = (ImageView) findViewById(R.id.iv_ad_pic);
        this.v = (TextView) findViewById(R.id.tv_ad_pic);
        this.w = (RelativeLayout) findViewById(R.id.rl_ad_pic);
        this.v.setOnClickListener(this.C);
        ((RelativeLayout.LayoutParams) this.v.getLayoutParams()).topMargin = r.a(10.0f) + u0.d();
        String stringExtra = getIntent().getStringExtra("ad_display_url");
        String stringExtra2 = getIntent().getStringExtra("ad_hyper_link");
        this.x = getIntent().getIntExtra("time_count", 3);
        this.u.setOnClickListener(this.C);
        this.u.setTag(stringExtra2);
        if (TextUtils.isEmpty(stringExtra)) {
            com.showself.ui.juvenile.a.a.f(this);
            this.w.setVisibility(8);
            return;
        }
        File file = new File(getCacheDir(), f0.b(stringExtra));
        if (!file.exists() || file.length() <= 0) {
            com.showself.ui.juvenile.a.a.f(this);
            this.w.setVisibility(8);
            return;
        }
        try {
            FileInputStream fileInputStream = new FileInputStream(file);
            Bitmap decodeStream = BitmapFactory.decodeStream(fileInputStream);
            if (decodeStream != null) {
                com.r.n.g j2 = com.r.n.g.j();
                com.r.n.d c2 = com.r.n.d.c();
                c2.e("Splash");
                c2.f("Splash");
                c2.d("Page");
                c2.h(com.r.n.e.View);
                j2.u(c2.b());
                this.u.setImageBitmap(decodeStream);
                this.w.setVisibility(0);
                this.v.setText("跳过 " + this.x);
                this.z.sendEmptyMessageDelayed(0, 1500L);
            }
            try {
                fileInputStream.close();
            } catch (IOException e2) {
                e2.printStackTrace();
            }
        } catch (FileNotFoundException e3) {
            e3.printStackTrace();
        }
    }

    private void b0() {
        String registrationID = JPushInterface.getRegistrationID(getApplicationContext());
        if (!k0.k().e().booleanValue()) {
            h0(registrationID);
        }
        k0.k().T(registrationID);
        SystemInfo.getShareSystem().setBaidu_channelid(registrationID);
    }

    private void d0() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(e0.b);
        intentFilter.addAction("com.showself.receive_openfiremsg");
        intentFilter.addAction("com.showself.receive_mall_update");
        intentFilter.addAction("com.showself.custom_url");
        intentFilter.addAction("sjchat_recall");
        intentFilter.setPriority(TbsLog.TBSLOG_CODE_SDK_INIT);
        registerReceiver(this.H, intentFilter);
    }

    private void e0(int i2) {
        if (this.mPermissionHelper == null) {
            this.mPermissionHelper = new com.r.a.a(this);
        }
        this.mPermissionHelper.c(new String[]{"android.permission.CAMERA", "android.permission.RECORD_AUDIO"}, new c(i2));
    }

    public void f0(String str, int i2, boolean z) {
        if (i2 == 0) {
            com.r.n.g j2 = com.r.n.g.j();
            com.r.n.d c2 = com.r.n.d.c();
            c2.e("Navigation");
            c2.f("PrivateChat");
            c2.d(str);
            c2.h(com.r.n.e.Click);
            c2.a(Oauth2AccessToken.KEY_UID, Integer.valueOf(this.q.getUserId()));
            j2.u(c2.b());
            return;
        }
        com.r.n.g j3 = com.r.n.g.j();
        com.r.n.d c3 = com.r.n.d.c();
        c3.e("Navigation");
        c3.f("PrivateChat");
        c3.d(str);
        c3.h(com.r.n.e.Click);
        c3.a(Oauth2AccessToken.KEY_UID, Integer.valueOf(this.q.getUserId()));
        c3.a("touid", Integer.valueOf(i2));
        c3.a("status", Boolean.valueOf(z));
        j3.u(c3.b());
    }

    private void g0(int i2) {
        NotificationManager notificationManager = (NotificationManager) getSystemService("notification");
        Notification.Builder deleteIntent = new Notification.Builder(getApplicationContext()).setSmallIcon(R.drawable.mifeng).setContentTitle(getString(2131689532)).setContentText("您有未读私信消息").setDeleteIntent(PendingIntent.getBroadcast(getApplicationContext(), (int) (System.currentTimeMillis() / 1000), new Intent((Context) this, (Class<?>) NotificationClickReceiver.class), 134217728));
        deleteIntent.setAutoCancel(true);
        Notification notification = Build.VERSION.SDK_INT < 16 ? deleteIntent.getNotification() : deleteIntent.build();
        notification.flags = 16;
        me.leolin.shortcutbadger.c.e(getApplicationContext(), notification, i2);
        notificationManager.notify(0, notification);
        if (i2 == 0) {
            notificationManager.cancel(0);
        }
    }

    private void h0(String str) {
        if (!TextUtils.isEmpty(str) && c0(str)) {
            JPushInterface.setAlias(getApplicationContext(), 0, str);
            k0.k().x(Boolean.TRUE);
        }
    }

    private void i0() {
        CrashReport.setUserId(r0.y(this).getShowid() + "");
    }

    public synchronized void j0() {
        if (d0.k().i()) {
            return;
        }
        NewsNoticeInfo newsNoticeInfo = null;
        List<NewsNoticeInfo> e2 = com.r.g.d.e();
        if (e2 != null) {
            p.c("H5NoticeManager---Home", e2.size() + "");
            for (NewsNoticeInfo newsNoticeInfo2 : e2) {
                if (newsNoticeInfo2 != null) {
                    String location = newsNoticeInfo2.getLocation();
                    if (!TextUtils.isEmpty(location) && (location.equals("hall") || location.equals("all") || location.equals("allpage"))) {
                        p.c("H5NoticeManager", newsNoticeInfo2.toString());
                        newsNoticeInfo = newsNoticeInfo2;
                        break;
                    }
                }
            }
            boolean e3 = com.r.g.e.i().e();
            if (newsNoticeInfo != null) {
                String location2 = newsNoticeInfo.getLocation();
                if (!TextUtils.isEmpty(location2)) {
                    if (!location2.equals("hall") && !location2.equals("all")) {
                        if (location2.equals("allpage")) {
                            if (e3) {
                                return;
                            }
                            if (com.showself.ui.c.isHomeActivityRunning()) {
                                com.r.g.d.i(e2, newsNoticeInfo);
                                com.r.g.d.k(com.blankj.utilcode.util.a.c(), newsNoticeInfo);
                                com.r.g.d.l();
                            }
                        }
                    }
                    if ((this.p instanceof LiveShowsFragment) && !e3) {
                        if (Utils.v0("com.showself.ui.HomeActivity")) {
                            com.r.g.d.i(e2, newsNoticeInfo);
                            com.r.g.d.k(this, newsNoticeInfo);
                            com.r.g.d.l();
                        }
                    }
                    return;
                }
                com.r.g.d.i(e2, newsNoticeInfo);
            }
        }
    }

    public void k0(String str) {
        Fragment fragment;
        if (str == null) {
            return;
        }
        if ("liveshow".equals(str)) {
            if (this.a.equals(str)) {
                Fragment fragment2 = this.p;
                if (fragment2 != null && (fragment2 instanceof LiveShowsFragment) && ((LiveShowsFragment) fragment2).I() == 0) {
                    org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.a("CATEGORY_UPDATE_TAB_REFRESH"));
                    return;
                }
                return;
            }
            this.a = str;
            U(this.f2657g);
            fragment = this.o.e(str);
            if (fragment == null) {
                fragment = LiveShowsFragment.G();
            }
            this.y = (LiveShowsFragment) fragment;
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.b("LIVE_SHOW_FRAGMENT_CHANGE_STATUS_BAR_MODE"));
        } else if ("me".equals(str)) {
            if (LoginListDialogActivity.i0(this, true)) {
                return;
            }
            if (!l0.e()) {
                l0.i(this, new j(this));
                return;
            }
            if (this.a.equals(str)) {
                return;
            }
            this.a = str;
            U(this.f2661k);
            fragment = this.o.e(str);
            if (fragment == null) {
                fragment = CardOwnFragment.K(r0.y(getApplicationContext()).getUserId());
            }
            ((CardOwnFragment) fragment).R();
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.a("CATEGORY_ROOM_FRAGMENT_ITEM_CONTROL_POSTER", Boolean.TRUE));
        } else if ("find".equals(str)) {
            if (LoginListDialogActivity.i0(this, true)) {
                return;
            }
            if (!l0.e()) {
                l0.i(this, new k(this));
                return;
            }
            if (this.a.equals(str)) {
                return;
            }
            this.a = str;
            U(this.f2660j);
            fragment = this.o.e(str);
            if (fragment == null) {
                fragment = SJChatMenuFragment.N(false);
            }
            SJChatMenuFragment sJChatMenuFragment = (SJChatMenuFragment) fragment;
            sJChatMenuFragment.Q();
            sJChatMenuFragment.R();
            sJChatMenuFragment.T(this.B);
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.a("CATEGORY_ROOM_FRAGMENT_ITEM_CONTROL_POSTER", Boolean.TRUE));
        } else if ("board".equals(str)) {
            if (this.a.equals(str)) {
                return;
            }
            this.a = str;
            U(this.f2659i);
            fragment = this.o.e(str);
            if (fragment == null) {
                fragment = new RankingListFragment();
            }
            ((RankingListFragment) fragment).t();
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.a("CATEGORY_ROOM_FRAGMENT_ITEM_CONTROL_POSTER", Boolean.TRUE));
        } else if (!"game".equals(str)) {
            fragment = null;
        } else {
            if (LoginListDialogActivity.i0(this, true)) {
                return;
            }
            if (!l0.e()) {
                l0.i(this, new l(this));
                return;
            }
            if (this.a.equals(str)) {
                return;
            }
            this.a = str;
            U(this.f2658h);
            fragment = this.o.e(str);
            if (fragment == null) {
                fragment = HomeFollowFragment.C(false, this.q.getUserId());
            } else {
                ((HomeFollowFragment) fragment).K(this.q.getUserId());
            }
            ((HomeFollowFragment) fragment).J();
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.a("CATEGORY_ROOM_FRAGMENT_ITEM_CONTROL_POSTER", Boolean.TRUE));
        }
        androidx.fragment.app.g gVar = this.o;
        if (gVar == null || fragment == null) {
            return;
        }
        androidx.fragment.app.l a2 = gVar.a();
        if (fragment.isAdded()) {
            a2.o(this.p);
            a2.t(fragment);
            a2.i();
        } else {
            a2.o(this.p);
            a2.c(R.id.home_container, fragment, str);
            a2.i();
        }
        this.p = fragment;
    }

    public static void l0(Context context, String str, int i2, Bundle bundle) {
        Intent intent = new Intent(context, (Class<?>) HomeActivity.class);
        intent.putExtra("custom_url", str);
        intent.putExtra("roomid", i2);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        context.startActivity(intent);
    }

    public String m0() {
        NotificationNumber.getShareNotificationNum().setChatNum(this.r.f(this.q.getUserId()));
        String showSlefMsgTotalNum = NotificationNumber.getShareNotificationNum().getShowSlefMsgTotalNum();
        if (showSlefMsgTotalNum != null) {
            int parseInt = Integer.parseInt(showSlefMsgTotalNum);
            if (parseInt > 999) {
                parseInt = TbsLog.TBSLOG_CODE_SDK_INIT;
            }
            if (Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) {
                g0(parseInt);
            } else {
                me.leolin.shortcutbadger.c.a(this, parseInt);
            }
            r0.U0(parseInt);
            this.m.setVisibility(0);
            if (parseInt > 99) {
                this.m.setText("99+");
            } else {
                this.m.setText(parseInt + "");
            }
        } else {
            this.m.setVisibility(8);
            if (Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) {
                g0(0);
            } else {
                me.leolin.shortcutbadger.c.a(this, 0);
            }
            r0.U0(0);
        }
        n0();
        Fragment fragment = this.p;
        if (fragment != null && (fragment instanceof BaseFragment)) {
            ((BaseFragment) fragment).k();
        }
        return showSlefMsgTotalNum;
    }

    public void n0() {
        NotificationNumber.getShareNotificationNum().setKefuChatNum(this.r.j(this.q.getUserId()));
        int kefuChatNum = NotificationNumber.getShareNotificationNum().getKefuChatNum();
        if (r0.z(this.q.getUserId()) != 0 || kefuChatNum > 0) {
            this.l.setVisibility(0);
        } else {
            this.l.setVisibility(8);
        }
    }

    public boolean c0(String str) {
        return Pattern.compile("^[一-龥0-9a-zA-Z_!@#$&*+=.|]+$").matcher(str).matches();
    }

    @m(threadMode = ThreadMode.MAIN)
    public void handleMessage(com.r.m.b.e eVar) {
        if (eVar == null) {
            return;
        }
        if (eVar.c() == e.a.KAIBO) {
            e0(eVar.b());
            return;
        }
        if (eVar.c() == e.a.ADD_ACCOUNT || eVar.c() == e.a.CHANGE_ACCOUNT) {
            this.q = r0.y(this);
            Y();
            m0();
            return;
        }
        if (eVar.c() == e.a.HOME_TAB_NORMAL) {
            if (I != 0) {
                R();
            }
        } else if (eVar.c() == e.a.HOME_TAB_UP_REFRESH) {
            if (I != 1) {
                V();
            }
        } else if (eVar.c() == e.a.OTHER_TAB) {
            T();
        } else if (eVar.c() == e.a.HALL_TAB) {
            S();
        }
    }

    @m(threadMode = ThreadMode.MAIN)
    public void handleNews(NewsHandleEvent newsHandleEvent) {
        if (newsHandleEvent == null) {
            return;
        }
        j0();
    }

    @Override
    public void init() {
        r0.y(this);
        a0();
        this.b = findViewById(R.id.home_bottom_tab1);
        this.c = findViewById(R.id.home_bottom_tab2);
        this.d = findViewById(R.id.home_bottom_tab3);
        this.f2655e = findViewById(R.id.home_bottom_tab4);
        this.f2656f = findViewById(R.id.home_bottom_tab5);
        if (!o0.d()) {
            this.d.setVisibility(8);
        }
        this.m = (TextView) this.f2655e.findViewById(R.id.tv_msg_unread);
        this.f2657g = this.b.findViewById(R.id.iv_icon_1);
        this.f2658h = this.c.findViewById(R.id.iv_icon_2);
        this.f2659i = this.d.findViewById(R.id.iv_icon_3);
        this.f2660j = this.f2655e.findViewById(R.id.iv_icon_4);
        this.f2661k = this.f2656f.findViewById(R.id.iv_icon_5);
        this.f2657g.setAnimation("lottie/hall.json");
        this.f2658h.setAnimation("lottie/follow.json");
        this.f2659i.setAnimation("lottie/ranking.json");
        this.f2660j.setAnimation("lottie/chat.json");
        this.f2661k.setAnimation("lottie/user.json");
        this.n = (TextView) this.b.findViewById(R.id.tv_text_1);
        this.l = (ImageView) this.f2656f.findViewById(R.id.tv_msg);
        this.b.setOnClickListener(this.G);
        this.c.setOnClickListener(this.G);
        this.d.setOnClickListener(this.G);
        this.f2655e.setOnClickListener(this.G);
        this.f2656f.setOnClickListener(this.G);
        if (this.o != null) {
            this.a = "liveshow";
            I = 0;
            U(this.f2657g);
            Fragment fragment = (BaseFragment) this.o.e("liveshow");
            if (fragment == null) {
                fragment = LiveShowsFragment.G();
            }
            androidx.fragment.app.l a2 = this.o.a();
            a2.c(R.id.home_container, fragment, "liveshow");
            a2.i();
            org.greenrobot.eventbus.c.c().k(new com.showself.view.hall.b("LIVE_SHOW_FRAGMENT_CHANGE_STATUS_BAR_MODE"));
            this.p = fragment;
            this.y = (LiveShowsFragment) fragment;
        }
        d0();
        b0();
        this.b.postDelayed(new f(), 1000L);
        d.a.a.b.g.c();
        ShowSelfApp.h().m();
        com.m.b.d.g gVar = new com.m.b.d.g();
        this.s = gVar;
        if (!gVar.f()) {
            this.s.g();
        }
        new u(ResourceManager.getConstantsString("dy.sdk.cert"), "licbag", new g()).g();
    }

    @Override
    protected void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
        Fragment fragment = this.p;
        if (fragment != null) {
            fragment.onActivityResult(i2, i3, intent);
        }
        if (i2 == 10001) {
            this.A.onActivityResult(this, i2, i3, intent);
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        Intent intent;
        super.onCreate(bundle);
        setContentView(R.layout.home);
        this.r = new d.d.c();
        this.o = getSupportFragmentManager();
        org.greenrobot.eventbus.c.c().o(this);
        Intent intent2 = null;
        u0.q(this, null);
        com.p.a.b.i().j(getApplicationContext());
        i0();
        init();
        String stringExtra = getIntent().getStringExtra("custom_url");
        if (!TextUtils.isEmpty(stringExtra)) {
            try {
                intent = o.e(stringExtra, this);
            } catch (Exception e2) {
                e2.printStackTrace();
                intent = null;
            }
            if (intent != null) {
                p.a("HomeActivity", stringExtra);
                o.h(this, intent);
            }
        }
        String str = ShowSelfApp.h().a;
        if (!TextUtils.isEmpty(str)) {
            try {
                intent2 = o.e(str, this);
            } catch (Exception e3) {
                e3.printStackTrace();
            }
            if (intent2 != null) {
                p.a("HomeActivity", str);
                o.h(this, intent2);
            }
        }
        int intExtra = getIntent().getIntExtra("roomid", 0);
        if (intExtra > 0) {
            com.showself.ui.show.g.l(this, intExtra, "");
        }
        this.A = new JPluginPlatformInterface(getApplicationContext());
        this.q = r0.y(this);
        Y();
    }

    @Override
    protected void onDestroy() {
        BroadcastReceiver broadcastReceiver = this.H;
        if (broadcastReceiver != null) {
            unregisterReceiver(broadcastReceiver);
        }
        org.greenrobot.eventbus.c.c().q(this);
        super.onDestroy();
    }

    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (keyEvent.getAction() == 0 && i2 == 4) {
            LoginResultInfo y = r0.y(getApplicationContext());
            String r = com.showself.provider.f.h().r(122, 0, y.getGender(), "0");
            if (r == null || "".equals(r)) {
                r = y.getGender() == 1 ? getString(R.string.shutdown_alert1) : getString(R.string.shutdown_alert2);
            }
            Utils.Q0(this, null, r, getString(R.string.shutdown_alert3), getResources().getColor(2131099757), getString(R.string.shutdown_alert4), getResources().getColor(2131099758), new a(), true);
        } else if (i2 == 24) {
            ((AudioManager) getSystemService("audio")).adjustStreamVolume(3, 1, 1);
        } else if (i2 == 25) {
            ((AudioManager) getSystemService("audio")).adjustStreamVolume(3, -1, 1);
        }
        return true;
    }

    protected void onNewIntent(Intent intent) {
        i0();
        k0(intent.getStringExtra(PrivacyItem.PrivacyRule.SUBSCRIPTION_TO));
        String stringExtra = intent.getStringExtra(PushConstants.SUB_TAGS_STATUS_ID);
        if (!TextUtils.isEmpty(stringExtra)) {
            ((LiveShowsFragment) this.p).N(stringExtra);
        }
        if (k0.y()) {
            k0("liveshow");
            LiveShowsFragment liveShowsFragment = this.y;
            if (liveShowsFragment != null) {
                liveShowsFragment.K();
            }
        } else {
            LiveShowsFragment liveShowsFragment2 = this.y;
            if (liveShowsFragment2 != null) {
                liveShowsFragment2.K();
            }
        }
        com.showself.ui.juvenile.a.a.f(this);
        super.onNewIntent(intent);
        int intExtra = intent.getIntExtra("roomid", 0);
        if (intExtra > 0) {
            com.showself.ui.show.g.l(this, intExtra, "");
        }
    }

    @m(threadMode = ThreadMode.MAIN)
    public void onReceiveEventBusMsg(com.r.m.b.c cVar) {
        Object[] objArr = cVar.a;
        String str = (String) objArr[1];
        if (((Boolean) objArr[2]).booleanValue()) {
            return;
        }
        Utils.a1(str + "游戏下载失败,请重试");
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        Fragment fragment;
        super.onRequestPermissionsResult(i2, strArr, iArr);
        com.r.a.a aVar = this.mPermissionHelper;
        if ((aVar == null || !aVar.e(i2, strArr, iArr)) && (fragment = this.p) != null) {
            fragment.onRequestPermissionsResult(i2, strArr, iArr);
        }
    }

    @Override
    protected void onResume() {
        LoginResultInfo y = r0.y(this);
        this.q = y;
        if (y != null) {
            if (y.getTaskDef() == 0) {
                ShowSelfApp.q(false);
            } else if (this.q.getTaskDef() == 1) {
                ShowSelfApp.q(true);
            }
        }
        m0();
        ShowSelfApp.a(false);
        if (Utils.w0()) {
            k0("liveshow");
        }
        if (o0.d()) {
            this.d.setVisibility(0);
        } else {
            this.d.setVisibility(8);
        }
        super.onResume();
        j0();
    }

    @Override
    public void onStart() {
        super.onStart();
        this.A.onStart(this);
    }

    @Override
    public void onStop() {
        super.onStop();
        this.A.onStop(this);
    }

    @Override
    public void refresh(Object... objArr) {
        ((Integer) objArr[0]).intValue();
        HashMap hashMap = (HashMap) objArr[1];
        if (hashMap != null) {
            ((Integer) hashMap.get(com.showself.net.e.n1)).intValue();
        }
    }

    protected void z(int i2) {
        com.showself.ui.show.g.o(this, i2, null);
    }

    @m(threadMode = ThreadMode.MAIN)
    public void onReceiveEventBusMsg(com.r.m.b.j jVar) {
        Activity topActivity;
        if (jVar == null || jVar.a != j.a.UPDATE_APP || (topActivity = com.showself.ui.c.getTopActivity()) == null) {
            return;
        }
        if (this.mPermissionHelper == null) {
            this.mPermissionHelper = new com.r.a.a(this);
        }
        d0.k().o(topActivity, (JSONObject) jVar.b[0], this.mPermissionHelper);
    }
}