导航菜单

页面标题

页面副标题

Mint v5.7.3 - CommentActivity.java 源代码

正在查看: Mint v5.7.3 应用的 CommentActivity.java JAVA 源代码文件

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


package com.htmedia.mint.ui.activity;

import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.MenuItemCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.SubscriptionTrigger;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.disqus.DetailDisqusPojo;
import com.htmedia.mint.pojo.disqus.DisqusMessagePojo;
import com.htmedia.mint.pojo.disqus.LikePojo;
import com.htmedia.mint.pojo.disqus.PostMessagePojo;
import com.htmedia.mint.pojo.disqus.RemoteAuthPojo;
import com.htmedia.mint.pojo.disqus.Response;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.ui.fragments.EPaperPayWallBottomSheetFragment;
import com.htmedia.mint.utils.n;
import com.htmedia.mint.utils.q;
import com.htmedia.sso.activities.LoginRegisterActivity;
import com.htmedia.sso.helpers.WebEngageNewSSOEvents;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import q7.d;

public class CommentActivity extends AppCompatActivity implements k6.w, d.f {
    String A;
    int C;
    private int D;
    private x4.o a;
    public MenuItem b;
    public MenuItem c;
    public MenuItem d;
    public MenuItem e;
    private TextView f;
    private TextView g;
    private TextView h;
    private Config i;
    k6.v j;
    private Content o;
    q7.d p;
    private ArrayList<Response> q;
    private int t;
    private int u;
    private boolean x;
    LinearLayoutManager z;
    private String r = BuildConfig.FLAVOR;
    private String s = "desc";
    private boolean v = false;
    private boolean w = false;
    private boolean y = false;
    boolean B = false;

    class a extends RecyclerView.OnScrollListener {
        a() {
        }

        public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int i) {
            super.onScrollStateChanged(recyclerView, i);
        }

        public void onScrolled(@NonNull RecyclerView recyclerView, int i, int i2) {
            super.onScrolled(recyclerView, i, i2);
            int childCount = CommentActivity.this.z.getChildCount();
            int itemCount = CommentActivity.this.z.getItemCount();
            int findFirstVisibleItemPosition = CommentActivity.this.z.findFirstVisibleItemPosition();
            if (childCount + findFirstVisibleItemPosition < itemCount || findFirstVisibleItemPosition < 0 || !CommentActivity.this.x) {
                return;
            }
            CommentActivity.this.y = true;
            CommentActivity.this.j.c(CommentActivity.this.o.getId() + BuildConfig.FLAVOR, CommentActivity.this.s, CommentActivity.this.r, BuildConfig.FLAVOR);
        }
    }

    class b implements TextWatcher {
        b() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.length() > 3) {
                CommentActivity.this.a.h.setEnabled(true);
                CommentActivity.this.a.h.setBackgroundColor(ContextCompat.getColor(CommentActivity.this, 2131100663));
            } else {
                CommentActivity.this.a.h.setEnabled(false);
                CommentActivity.this.a.h.setBackgroundColor(ContextCompat.getColor(CommentActivity.this, 2131100232));
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }
    }

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

        @Override
        public void onClick(View view) {
            Bundle bundle = new Bundle();
            bundle.putString(com.htmedia.mint.utils.n.X, "top_nav");
            com.htmedia.mint.utils.n.l0(CommentActivity.this, com.htmedia.mint.utils.n.s1, bundle);
            Config g = AppController.j().g();
            String str = BuildConfig.FLAVOR;
            if (g != null && g.getEpaper() != null) {
                str = g.getEpaper().getUrl();
            }
            if (TextUtils.isEmpty(str)) {
                return;
            }
            if (!str.startsWith("http")) {
                str = AppController.j().g().getServerUrl() + str;
            }
            com.htmedia.mint.utils.f0.A2(CommentActivity.this, str + "?utm_source=androidapp&utm_medium=topnav&utm_campaign=promo");
        }
    }

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

        @Override
        public void onClick(View view) {
            CommentActivity commentActivity = CommentActivity.this;
            commentActivity.onOptionsItemSelected(commentActivity.b);
        }
    }

    class e implements View.OnClickListener {
        final MenuItem a;

        e(MenuItem menuItem) {
            this.a = menuItem;
        }

        @Override
        public void onClick(View view) {
            CommentActivity.this.onOptionsItemSelected(this.a);
        }
    }

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

        @Override
        public void onClick(View view) {
            CommentActivity commentActivity = CommentActivity.this;
            commentActivity.onOptionsItemSelected(commentActivity.b);
        }
    }

    class g implements View.OnClickListener {
        final MenuItem a;

        g(MenuItem menuItem) {
            this.a = menuItem;
        }

        @Override
        public void onClick(View view) {
            CommentActivity.this.onOptionsItemSelected(this.a);
        }
    }

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

        @Override
        public void onClick(View view) {
            com.htmedia.mint.utils.o1.a("DEBUG", "onOptionsItemSelected: my account");
            WebEngageAnalytices.trackClickEvents("My Account", (String) null, "My Account Viewed", (Content) null, "Top Header", BuildConfig.FLAVOR, BuildConfig.FLAVOR);
            CommentActivity.this.startActivityForResult(SubscriptionTrigger.openProfileActivity(CommentActivity.this), 5004);
        }
    }

    private void X() {
        if (this.o != null) {
            this.j.c(this.o.getId() + BuildConfig.FLAVOR, this.s, this.r, BuildConfig.FLAVOR);
        }
        this.a.i.addOnScrollListener(new a());
    }

    public void Z(View view) {
        if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
            this.j.e();
            this.a.e.setVisibility(8);
            this.a.f.setVisibility(0);
            this.v = false;
            p0();
            this.a.c.requestFocus();
            return;
        }
        n.a aVar = n.a.HEADER;
        com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
        WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
        Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent.putExtra("origin", "Home Login");
        intent.putExtra("referer", "Home Login");
        intent.setFlags(603979776);
        overridePendingTransition(2130772024, 2130772025);
        startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(this, 2130772024, 2130772030).toBundle());
    }

    public void a0() {
        this.j.m(this.a.c.getText().toString(), this.o.getThreadId(), this.v, this.A);
    }

    public void b0() {
        this.j.m(this.a.c.getText().toString(), this.o.getThreadId(), this.v, BuildConfig.FLAVOR);
    }

    public void c0(View view) {
        if (TextUtils.isEmpty(this.a.c.getText().toString())) {
            return;
        }
        this.j.e();
        if (this.v) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    CommentActivity.this.a0();
                }
            }, 1500L);
        } else {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    CommentActivity.this.b0();
                }
            }, 1500L);
        }
    }

    public void d0(int i, String str) {
        this.j.g(i, str);
    }

    public void e0(int i, String str) {
        this.j.g(i, str);
    }

    public void f0(View view) {
        startActivity(new Intent((Context) this, (Class<?>) PrivacyPolicyDiscussActivity.class));
    }

    public void g0(View view) {
        finish();
    }

    public void h0(View view) {
        if (this.s.equalsIgnoreCase("desc")) {
            this.a.q.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131232977, 0);
            this.s = "asc";
        } else {
            this.s = "desc";
            this.a.q.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131232978, 0);
        }
        ArrayList<Response> arrayList = this.q;
        if (arrayList != null && arrayList.size() > 0) {
            this.q.clear();
        }
        this.j.c(this.o.getId() + BuildConfig.FLAVOR, this.s, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
    }

    private void i0() {
        this.a.e.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommentActivity.this.Z(view);
            }
        });
        this.a.c.addTextChangedListener(new b());
        this.a.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommentActivity.this.c0(view);
            }
        });
    }

    private void j0() {
        onRestart();
    }

    private void k0() {
        this.a.p.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommentActivity.this.f0(view);
            }
        });
    }

    private ArrayList<Response> l0(DisqusMessagePojo disqusMessagePojo) {
        ArrayList<Response> arrayList = new ArrayList<>();
        int i = -1;
        for (int i2 = 0; i2 < disqusMessagePojo.getResponse().size(); i2++) {
            Response response = disqusMessagePojo.getResponse().get(i2);
            if (response.getDepth() <= 0) {
                arrayList.add(response);
                i++;
            } else if (arrayList.size() > 0) {
                Response response2 = arrayList.get(i);
                List<Response> replyToCommentArray = response2.getReplyToCommentArray();
                if (replyToCommentArray == null) {
                    replyToCommentArray = new ArrayList<>();
                }
                replyToCommentArray.add(response);
                response2.setReplyToCommentArray(replyToCommentArray);
            }
        }
        return arrayList;
    }

    private void m0() {
        if (!AppController.j().E()) {
            getWindow().setStatusBarColor(-1);
            getWindow().getDecorView().setSystemUiVisibility(8192);
            this.a.j.setBackgroundColor(getResources().getColor(2131101002));
            this.a.j.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131100950, (Resources.Theme) null));
            this.a.j.setNavigationIcon(2131231330);
            this.a.b.setBackgroundColor(getResources().getColor(2131101002));
            this.a.c.setBackgroundColor(getResources().getColor(2131101002));
            this.a.o.setBackgroundDrawable(getResources().getDrawable(2131231474));
            this.a.o.setTextColor(getResources().getColor(2131100962));
            this.a.p.setTextColor(getResources().getColor(2131100905));
            this.a.q.setTextColor(getResources().getColor(2131100905));
            this.a.s.setTextColor(getResources().getColor(2131100618));
            this.a.c.setTextColor(getResources().getColor(2131099901));
            this.a.u.setBackgroundColor(getResources().getColor(2131100213));
            this.a.v.setBackgroundColor(getResources().getColor(2131100213));
            this.a.t.setTextColor(ResourcesCompat.getColor(getResources(), 2131101008, (Resources.Theme) null));
            this.a.t.setBackgroundColor(ResourcesCompat.getColor(getResources(), 2131101002, (Resources.Theme) null));
            this.a.r.setTextColor(ContextCompat.getColor(this, 2131100859));
            return;
        }
        getWindow().setStatusBarColor(-16777216);
        getWindow().getDecorView().setSystemUiVisibility(0);
        this.a.b.setBackgroundColor(getResources().getColor(2131101012));
        this.a.c.setBackgroundColor(getResources().getColor(2131100062));
        this.a.o.setBackgroundDrawable(getResources().getDrawable(2131231475));
        this.a.o.setTextColor(getResources().getColor(2131101002));
        this.a.p.setTextColor(getResources().getColor(2131100127));
        this.a.q.setTextColor(getResources().getColor(2131100905));
        this.a.q.setBackground(getResources().getDrawable(2131231472));
        this.a.p.setBackground(getResources().getDrawable(2131231472));
        this.a.s.setTextColor(getResources().getColor(2131100618));
        this.a.c.setTextColor(getResources().getColor(2131101002));
        this.a.u.setBackgroundColor(getResources().getColor(2131100216));
        this.a.v.setBackgroundColor(getResources().getColor(2131100915));
        this.a.t.setTextColor(ResourcesCompat.getColor(getResources(), 2131101009, (Resources.Theme) null));
        this.a.t.setBackgroundColor(ResourcesCompat.getColor(getResources(), 2131100008, (Resources.Theme) null));
        this.a.r.setTextColor(ContextCompat.getColor(this, 2131100951));
        this.a.j.setBackgroundColor(getResources().getColor(2131100008));
        this.a.j.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131100951, (Resources.Theme) null));
        this.a.j.setNavigationIcon(2131231333);
    }

    private void n0() {
        this.j = new k6.v(this, this);
        X();
    }

    private void o0(int i) {
        this.a.o.setText(getString(2131951840, Integer.valueOf(i)));
    }

    private void q0() {
        this.a.q.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CommentActivity.this.h0(view);
            }
        });
    }

    private void setupToolbar() {
        this.a.j.setContentInsetStartWithNavigation(0);
        setSupportActionBar(this.a.j);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayShowTitleEnabled(false);
            getSupportActionBar().setDisplayHomeAsUpEnabled(false);
            getSupportActionBar().setDisplayShowHomeEnabled(false);
        }
        this.a.j.setTitle("Back");
        this.a.j.setTitleTextColor(ResourcesCompat.getColor(getResources(), 2131100950, (Resources.Theme) null));
        this.a.j.setNavigationIcon(2131231330);
        if (this.a.j.getTitle() != null) {
            String charSequence = this.a.j.getTitle().toString();
            for (int i = 0; i < this.a.j.getChildCount(); i++) {
                AppCompatTextView childAt = this.a.j.getChildAt(i);
                if ("androidx.appcompat.widget.AppCompatTextView".equals(childAt.getClass().getName())) {
                    AppCompatTextView appCompatTextView = childAt;
                    if (appCompatTextView.getText().equals(charSequence)) {
                        appCompatTextView.setTypeface(ResourcesCompat.getFont(this, 2131296270));
                        appCompatTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                        appCompatTextView.setCompoundDrawablePadding(0);
                        childAt.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                CommentActivity.this.g0(view);
                            }
                        });
                    }
                }
            }
        }
        this.a.r.setVisibility(0);
        this.a.r.setText("e-paper");
        if (this.a.r.getText() == null || !this.a.r.getText().toString().equals("e-paper")) {
            return;
        }
        this.a.r.getText().toString();
        this.a.r.setTypeface(ResourcesCompat.getFont(this, 2131296266));
        this.a.r.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131231823, 0);
        this.a.r.setCompoundDrawablePadding(5);
        this.a.r.setOnClickListener(new c());
    }

    public void Y(Context context, EditText editText) {
        ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(editText.getWindowToken(), 0);
    }

    @Override
    public void i(int i, String str) {
        if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
            this.t = i;
            this.v = true;
            this.A = str;
            if (this.a.e.getVisibility() == 0) {
                this.a.e.setVisibility(8);
            }
            this.a.f.setVisibility(0);
            p0();
            this.a.c.requestFocus();
            return;
        }
        n.a aVar = n.a.HEADER;
        com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
        WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
        Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent.putExtra("origin", "Home Login");
        intent.putExtra("referer", "Home Login");
        intent.setFlags(603979776);
        overridePendingTransition(2130772024, 2130772025);
        startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(this, 2130772024, 2130772030).toBundle());
    }

    @Override
    public void m(int i, final int i2, final String str) {
        if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
            this.D = i;
            this.w = false;
            if (!TextUtils.isEmpty(AppController.j().p())) {
                this.j.g(i2, str);
                return;
            } else {
                this.j.e();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        CommentActivity.this.d0(i2, str);
                    }
                }, 1500L);
                return;
            }
        }
        n.a aVar = n.a.HEADER;
        com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
        WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
        Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent.putExtra("origin", "Home Login");
        intent.putExtra("referer", "Home Login");
        intent.setFlags(603979776);
        overridePendingTransition(2130772024, 2130772025);
        startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(this, 2130772024, 2130772030).toBundle());
    }

    protected void onActivityResult(int i, int i2, @Nullable Intent intent) {
        MintSubscriptionDetail l;
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        if (i == 5004 && i2 == -1) {
            j0();
            invalidateOptionsMenu();
        }
        if (i != 102) {
            if (i == 1009 && i2 == -1 && (l = AppController.j().l()) != null && l.isAdFreeUserToReLauch()) {
                com.htmedia.mint.utils.f0.R2(new Intent((Context) this, (Class<?>) HomeActivity.class), this);
                return;
            }
            return;
        }
        if (i2 == -1) {
            HashMap hashMap = new HashMap();
            String F1 = com.htmedia.mint.utils.f0.F1(this);
            if (F1 != null) {
                hashMap.put("userEmail", F1);
            }
            if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
                hashMap.put("userName", com.htmedia.mint.utils.f0.G1(this, "userName"));
            }
            if (!hashMap.isEmpty()) {
                com.htmedia.mint.utils.o0.i(hashMap);
            }
            EPaperPayWallBottomSheetFragment findFragmentByTag = getSupportFragmentManager().findFragmentByTag("epaper_paywall");
            if (findFragmentByTag instanceof EPaperPayWallBottomSheetFragment) {
                findFragmentByTag.dismissAllowingStateLoss();
                com.htmedia.mint.utils.f0.A2(this, null);
            }
            MintSubscriptionDetail l2 = AppController.j().l();
            if (l2 != null && l2.isAdFreeUserToReLauch()) {
                com.htmedia.mint.utils.f0.R2(new Intent((Context) this, (Class<?>) HomeActivity.class), this);
            }
            invalidateOptionsMenu();
        }
    }

    public void onConfigurationChanged(@NonNull Configuration configuration) {
        super.onConfigurationChanged(configuration);
        AppController.e(getIntent(), this);
    }

    protected void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        this.a = DataBindingUtil.setContentView(this, 2131623972);
        this.i = AppController.j().g();
        setupToolbar();
        if (getIntent() != null && getIntent().hasExtra("content")) {
            Content content = (Content) getIntent().getParcelableExtra("content");
            this.o = content;
            this.u = content.getCommentOnStory();
        }
        o0(this.u);
        n0();
        this.q = new ArrayList<>();
        i0();
        m0();
        k0();
        q0();
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(2131689474, menu);
        this.b = menu.findItem(2131427416);
        this.e = menu.findItem(2131427431);
        View actionView = MenuItemCompat.getActionView(this.b);
        MenuItem findItem = menu.findItem(2131427435);
        View actionView2 = MenuItemCompat.getActionView(findItem);
        View actionView3 = MenuItemCompat.getActionView(menu.findItem(2131427429));
        this.f = (TextView) actionView.findViewById(2131431603);
        this.g = (TextView) actionView2.findViewById(2131431493);
        boolean z = AppController.j().l() != null && AppController.j().l().isSubscriptionActive();
        Config config = this.i;
        boolean z2 = config == null || (config.getSubscription() != null && this.i.getSubscription().isSubscriptionEnable());
        this.h = (TextView) actionView3.findViewById(2131431821);
        MenuItem findItem2 = menu.findItem(2131427428);
        this.d = findItem2;
        MenuItemCompat.getActionView(findItem2);
        if (AppController.j().E()) {
            TextView textView = this.f;
            if (textView != null) {
                textView.setTextColor(getResources().getColor(2131100951));
            }
            TextView textView2 = this.g;
            if (textView2 != null) {
                textView2.setTextColor(getResources().getColor(2131100951));
                this.g.setBackground(ContextCompat.getDrawable(this, 2131234051));
            }
        } else {
            TextView textView3 = this.f;
            if (textView3 != null) {
                textView3.setTextColor(getResources().getColor(2131100859));
            }
            TextView textView4 = this.g;
            if (textView4 != null) {
                textView4.setTextColor(getResources().getColor(2131100859));
                this.g.setBackground(ContextCompat.getDrawable(this, 2131234050));
            }
        }
        actionView.setOnClickListener(new d());
        actionView2.setOnClickListener(new e(findItem));
        TextView textView5 = this.f;
        if (textView5 != null) {
            textView5.setVisibility(0);
        }
        this.d.setVisible(false);
        this.e.setVisible(false);
        if (z || !z2) {
            TextView textView6 = this.g;
            if (textView6 != null) {
                textView6.setVisibility(8);
            }
            findItem.setVisible(false);
        } else {
            findItem.setVisible(true);
            TextView textView7 = this.g;
            if (textView7 != null) {
                textView7.setVisibility(0);
            }
        }
        return true;
    }

    @Override
    public void onDetailDisqus(DetailDisqusPojo detailDisqusPojo, String str) {
        if (detailDisqusPojo != null) {
            this.o.setThreadId(detailDisqusPojo.getResponse().getId());
            this.j.d(detailDisqusPojo.getResponse().getId(), this.s, this.r, BuildConfig.FLAVOR);
        }
    }

    @Override
    public void onDetailListing(DisqusMessagePojo disqusMessagePojo) {
        if (disqusMessagePojo != null) {
            if (disqusMessagePojo.getCursor() != null) {
                this.x = disqusMessagePojo.getCursor().getHasNext().booleanValue();
                this.r = disqusMessagePojo.getCursor().getNext();
            }
            if (disqusMessagePojo.getResponse() == null || disqusMessagePojo.getResponse().size() <= 0) {
                this.a.i.setVisibility(8);
                this.a.s.setVisibility(0);
                return;
            }
            if (this.y) {
                int size = this.q.size();
                ArrayList<Response> l0 = l0(disqusMessagePojo);
                if (l0 == null || l0.size() <= 0) {
                    return;
                }
                this.q.addAll(l0);
                this.p.notifyItemRangeInserted(size, l0.size());
                return;
            }
            this.q = l0(disqusMessagePojo);
            q7.d dVar = new q7.d(this, this);
            this.p = dVar;
            dVar.n(this.q);
            this.a.i.setAdapter(this.p);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            this.z = linearLayoutManager;
            this.a.i.setLayoutManager(linearLayoutManager);
            this.a.i.setVisibility(0);
            this.a.s.setVisibility(8);
        }
    }

    @Override
    public void onError(int i, String str) {
        if (i == 2) {
            if (str.equalsIgnoreCase(q.f.DETAIL.name()) || str.equalsIgnoreCase(q.f.THREAD.name())) {
                this.j.e();
                this.B = true;
            }
        }
    }

    @Override
    public void onLikeDislike(LikePojo likePojo, int i) {
        q7.d dVar = this.p;
        if (dVar != null) {
            Response response = dVar.j().get(this.D);
            if (this.w) {
                List<Response> replyToCommentArray = response.getReplyToCommentArray();
                if (replyToCommentArray != null) {
                    replyToCommentArray.get(this.C).setLikes(likePojo.getResponse().getPost().getLikes());
                    replyToCommentArray.get(this.C).setDislikes(likePojo.getResponse().getPost().getDislikes());
                }
            } else {
                response.setLikeDislikeByMe(i);
                response.setDislikes(likePojo.getResponse().getPost().getDislikes());
                response.setLikes(likePojo.getResponse().getPost().getLikes());
            }
            this.p.notifyItemChanged(this.D);
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 16908332) {
            finish();
            overridePendingTransition(2130772025, 2130772031);
            return true;
        }
        if (itemId == 2131427416) {
            n.a aVar = n.a.HEADER;
            com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
            WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
            Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
            intent.putExtra("origin", "Home Login");
            intent.putExtra("referer", "Home Login");
            intent.setFlags(603979776);
            overridePendingTransition(2130772024, 2130772025);
            startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(this, 2130772024, 2130772030).toBundle());
            return true;
        }
        if (itemId != 2131427435) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        Bundle bundle = new Bundle();
        bundle.putString(com.htmedia.mint.utils.n.X, "top_nav");
        com.htmedia.mint.utils.n.l0(this, com.htmedia.mint.utils.n.t1, bundle);
        WebEngageAnalytices.trackClickEvents("Hamburger_Subscribe", (String) null, (String) null, (Content) null, "Home Page Header", BuildConfig.FLAVOR, BuildConfig.FLAVOR);
        Intent openPlanPageIntent = SubscriptionTrigger.openPlanPageIntent(this, "top_header", false);
        openPlanPageIntent.putExtra("urlkey", "https://accounts.hindustantimes.com/lm/userplan");
        openPlanPageIntent.putExtra("funnelName", "top_header");
        startActivityForResult(openPlanPageIntent, 1009);
        return true;
    }

    @Override
    public void onPostMessage(PostMessagePojo postMessagePojo, boolean z) {
        View view;
        if (postMessagePojo.getCode() == 0) {
            if (this.a.c.getText() != null && this.a.c.getText().length() > 0) {
                this.a.c.getText().clear();
            }
            this.a.c.clearFocus();
            this.a.e.setVisibility(0);
            this.a.f.setVisibility(8);
            Y(this, this.a.c);
            if (z) {
                Response response = this.q.get(this.t);
                if (response.getReplyToCommentArray() != null) {
                    response.getReplyToCommentArray().add(postMessagePojo.getResponse());
                } else {
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(postMessagePojo.getResponse());
                    response.setReplyToCommentArray(arrayList);
                }
                this.p.notifyItemChanged(this.t);
            } else {
                postMessagePojo.getResponse().setNewAdded(true);
                int i = this.u + 1;
                this.u = i;
                o0(i);
                if (this.q.size() == 0) {
                    this.q.add(postMessagePojo.getResponse());
                    this.p = new q7.d(this, this);
                    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
                    this.z = linearLayoutManager;
                    this.a.i.setLayoutManager(linearLayoutManager);
                    this.a.i.setAdapter(this.p);
                    this.p.n(this.q);
                    this.a.i.setVisibility(0);
                    this.a.s.setVisibility(8);
                } else {
                    Response response2 = postMessagePojo.getResponse();
                    response2.setReplyToCommentArray(new ArrayList());
                    this.q.add(0, response2);
                    this.p.notifyItemInserted(0);
                    this.a.i.smoothScrollToPosition(0);
                    RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.a.i.findViewHolderForAdapterPosition(0);
                    if (findViewHolderForAdapterPosition != null && (view = findViewHolderForAdapterPosition.itemView) != null) {
                        view.getRootView().setAlpha(0.4f);
                    }
                }
            }
            Toast.makeText((Context) this, (CharSequence) this.i.getDisqus().getMessage(), 1).show();
        }
    }

    public boolean onPrepareOptionsMenu(Menu menu) {
        this.c = menu.findItem(2131427429);
        MenuItem findItem = menu.findItem(2131427416);
        this.b = findItem;
        View actionView = MenuItemCompat.getActionView(findItem);
        MenuItem findItem2 = menu.findItem(2131427435);
        View actionView2 = MenuItemCompat.getActionView(findItem2);
        this.g = (TextView) actionView2.findViewById(2131431493);
        boolean z = false;
        if (AppController.j().E()) {
            TextView textView = this.f;
            if (textView != null) {
                textView.setTextColor(getResources().getColor(2131100951));
            }
            this.h.setTextColor(getResources().getColor(2131100951));
            this.h.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131232453, 0);
        } else {
            TextView textView2 = this.f;
            if (textView2 != null) {
                textView2.setTextColor(getResources().getColor(2131100859));
            }
            this.h.setTextColor(getResources().getColor(2131100859));
            this.h.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131232452, 0);
        }
        boolean z2 = AppController.j().l() != null && AppController.j().l().isSubscriptionActive();
        Config config = this.i;
        boolean z3 = config == null || (config.getSubscription() != null && this.i.getSubscription().isSubscriptionEnable());
        actionView.setOnClickListener(new f());
        actionView2.setOnClickListener(new g(findItem2));
        this.h.setOnClickListener(new h());
        if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
            this.b.setVisible(false);
            this.c.setVisible(true);
        } else {
            this.b.setVisible(true);
            this.c.setVisible(false);
        }
        if (!z2 && z3) {
            z = true;
        }
        findItem2.setVisible(z);
        return super/*android.app.Activity*/.onPrepareOptionsMenu(menu);
    }

    protected void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        if (AppController.j().E()) {
            getWindow().setStatusBarColor(-16777216);
            getWindow().getDecorView().setSystemUiVisibility(0);
        } else {
            getWindow().setStatusBarColor(-1);
            getWindow().getDecorView().setSystemUiVisibility(8192);
        }
    }

    public void p0() {
        ((InputMethodManager) getSystemService("input_method")).toggleSoftInput(2, 0);
    }

    @Override
    public void r(int i, final int i2, final String str, int i3) {
        if (com.htmedia.mint.utils.f0.G1(this, "userName") != null) {
            this.D = i;
            this.w = true;
            this.C = i3;
            if (!TextUtils.isEmpty(AppController.j().p())) {
                this.j.g(i2, str);
                return;
            } else {
                this.j.e();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        CommentActivity.this.e0(i2, str);
                    }
                }, 1500L);
                return;
            }
        }
        n.a aVar = n.a.HEADER;
        com.htmedia.mint.utils.n.g0(null, null, aVar.a(), aVar.a());
        WebEngageNewSSOEvents.trackSSOLinkClicked("Login", "Home Login");
        Intent intent = new Intent((Context) this, (Class<?>) LoginRegisterActivity.class);
        intent.putExtra("origin", "Home Login");
        intent.putExtra("referer", "Home Login");
        intent.setFlags(603979776);
        overridePendingTransition(2130772024, 2130772025);
        startActivityForResult(intent, 102, ActivityOptions.makeCustomAnimation(this, 2130772024, 2130772030).toBundle());
    }

    @Override
    public void remoteAuth(RemoteAuthPojo remoteAuthPojo) {
        if (this.B) {
            this.j.b(this.o);
            this.B = false;
        }
    }
}