导航菜单

页面标题

页面副标题

Mint v5.7.3 - StoryDetailViewFragment.java 源代码

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

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


package com.htmedia.mint.ui.fragments;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.comscore.Analytics;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.htmedia.mint.AppController;
import com.htmedia.mint.author.pojo.Author;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.htsubscription.MeterModelTimer;
import com.htmedia.mint.htsubscription.SnowplowSubscriptionAnalytices;
import com.htmedia.mint.htsubscription.WebEngageAnalytices;
import com.htmedia.mint.piano.PianoAppConstant;
import com.htmedia.mint.piano.PianoCallbackListener;
import com.htmedia.mint.piano.PianoCallbacks;
import com.htmedia.mint.piano.PianoResponse;
import com.htmedia.mint.piano.PianoResponseSingleTon;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.ContextualTargetPojo;
import com.htmedia.mint.pojo.ForyouPojo;
import com.htmedia.mint.pojo.ListElement;
import com.htmedia.mint.pojo.Metadata;
import com.htmedia.mint.pojo.OfferPremium;
import com.htmedia.mint.pojo.Paragraph;
import com.htmedia.mint.pojo.PinnedArticlePojo;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.Epaper;
import com.htmedia.mint.pojo.config.NewsLetter;
import com.htmedia.mint.pojo.config.Section;
import com.htmedia.mint.pojo.config.mobilepaywall.Items;
import com.htmedia.mint.pojo.config.mobilepaywall.MobilePaywall;
import com.htmedia.mint.pojo.config.mobilepaywall.Mode;
import com.htmedia.mint.pojo.config.mobilepaywall.PaywallTypes;
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.giftingarticle.CouponPojo;
import com.htmedia.mint.pojo.giftingarticle.GiftingArticleListPojo;
import com.htmedia.mint.pojo.giftingarticle.GiftingArticleUserInfoPojo;
import com.htmedia.mint.pojo.metermodel.Default;
import com.htmedia.mint.pojo.metermodel.MeterModel;
import com.htmedia.mint.pojo.mintsubscribenowmodel.SubscribeNowPerant;
import com.htmedia.mint.pojo.premiumstories.PianoNonLogin;
import com.htmedia.mint.pojo.premiumstories.PianoUnlockArticle;
import com.htmedia.mint.pojo.premiumstories.PremiumStoryMeter;
import com.htmedia.mint.pojo.storydetail.BrandProductItem;
import com.htmedia.mint.pojo.storydetail.abwidgets.WidgetType;
import com.htmedia.mint.pojo.subscription.userdetail.MintSubscriptionDetail;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.ui.activity.TableOfContentsClickCallback;
import com.htmedia.mint.utils.WrapContentLinearLayoutManager;
import com.htmedia.mint.utils.j;
import com.htmedia.mint.utils.k;
import com.htmedia.mint.utils.q;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import in.juspay.hyper.constants.LogSubCategory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.json.JSONObject;
import p4.a;
import q7.h0;
import q7.k7;
import q7.q4;
import t7.e;
import x4.uj;

public class StoryDetailViewFragment extends Fragment implements k6.h0, h0.a, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, k6.z0, k6.u, s6.d, PianoCallbackListener, h0.b, q4.i, k7.b, k6.x1, TableOfContentsClickCallback, a.c, v4.d, t6.b {
    private static int SCROLL_THRESHOLD = 5;
    public static PopupWindow popupWindow;
    public static OfferPremium premiumDiscountOffer;
    g7.a abWidgetHelper;
    int actualContentSize;
    private int adsIndex;
    private t6.a affiliateAdsPresenter;
    private AppController appController;
    private long articleId;
    private String articleOpenType;
    private uj binding;
    private Bundle bundle;
    public CardView cardViewTopic;
    Config config;
    private Content content;
    private List<String> contextualID;
    private k6.t contextualTargetPresenter;
    private k6.v disqusPresenter;
    private long endtime;
    private ForyouPojo forYouPojo;
    private ForyouPojo foryouPojo;
    public FrameLayout frameLayoutCloseButton;
    private String giftCode;
    private HashMap<String, String> headers;
    private k6.g0 homePresenter;
    private LinearLayoutManager horizontalLayoutManager;
    String imageDeeplinkElementId;
    private int initPos;
    private boolean is100Done;
    private boolean is25Done;
    private boolean is50Done;
    private boolean is75Done;
    private boolean isContinueRead;
    boolean isDiscountShowingInCurrentStory;
    boolean isEventSend;
    boolean isImageDeeplink;
    private boolean isListEmpty;
    boolean isMarketGenieActive;
    private boolean isMintLounge;
    private boolean isToShowBottomToast;
    private boolean isToShowToast;
    private boolean isVerticalStory;
    int lastDataSize;
    int lastProgress;
    public LinearLayout layoutClose;
    private LinearLayoutManager linearLayoutManager;
    private int listSize;
    private int liveblogListElementsSize;
    private com.htmedia.mint.utils.q1 lotameClass;
    private LinearLayoutManager mLinearLayoutManager;
    com.htmedia.mint.utils.r1 marketHelperClass;
    private MeterModelTimer meterModelTimer;
    e.b onBottomSheetGiftRecipientListener;
    private String origin;
    private String pageId;
    private int pageNo;
    private String pageTittle;
    private PianoCallbacks pianoCallbacks;
    private PianoResponse pianoResponse;
    private s6.c premiumStoryMeterPresenter;
    public RecyclerView.Adapter recyclerViewAdapter;
    private int screenHeight;
    public Section section;
    private int selectedPos;
    private long startTime;
    private k7 topNavTopicsAdapter;
    v4.d updateYourListCallback;
    v4.d updateYourTopAuthorListCallback;
    private String userId;
    private i7.c userSelectedPlan;
    private v4.b viewModel;
    private final String TAG = "Tag_Story_Detail";
    private Handler handler = new Handler();
    private final int tabPosition = -1;
    public List<Section> topicsList = new ArrayList();
    public int bannerAdsCounter = 0;
    public ArrayList<Content> list = new ArrayList<>();
    public int brandedStoryCount = 0;
    public HashMap<Integer, Boolean> brandStoryMap = new HashMap<>();
    public String storyUrl = BuildConfig.FLAVOR;
    public String listUrl = BuildConfig.FLAVOR;
    int adsCounter = 0;
    int prvIndex = 0;
    int storyLastIndex = 0;
    int bookmarkImageIndex = 0;
    private String serverUrl = BuildConfig.FLAVOR;
    private String serverUrlwithLeftSection = BuildConfig.FLAVOR;
    private boolean isBookmarkDetail = false;
    private ArrayList<PinnedArticlePojo> pinnedArticleList = new ArrayList<>();
    private String isPersonalizeCheck = BuildConfig.FLAVOR;
    private boolean isDailyNewsLetterAdded = false;
    private boolean isEpaperAdded = false;
    private final int totalDy = 0;
    private boolean isContinueReadDelete = true;
    private boolean isTopStory = false;
    private String strContentUrl = BuildConfig.FLAVOR;
    private boolean isLoginPressedFromGiftArticle = false;
    private String storyId = BuildConfig.FLAVOR;

    static class AnonymousClass12 {
        static final int[] $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES;
        static final int[] $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS;

        static {
            int[] iArr = new int[PianoAppConstant.PIANO_STORY_TYPES.values().length];
            $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES = iArr;
            try {
                iArr[PianoAppConstant.PIANO_STORY_TYPES.PREMIUM_PAYWALL.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.METER_PAYWLL.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.FULL_STORY_WALL_TEMPLATE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.ARTICLE_IN_TEMPLATE.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.SKIP_LOGIN_TEMPLATE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.UNLOCK_ARTICLE.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.FULL_STORY.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            int[] iArr2 = new int[g7.o.values().length];
            $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS = iArr2;
            try {
                iArr2[g7.o.PAYWALL.ordinal()] = 1;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.PREMIUM_PAYWALL.ordinal()] = 2;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.INTEGRATED_PAYWALL_PREMIUM.ordinal()] = 3;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.FULL_STORY_WALL_TEMPLATE.ordinal()] = 4;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.PREMIUM_LOGIN.ordinal()] = 5;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.SKIP_LOGIN_WALL.ordinal()] = 6;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.ARTICLE_IN_TEMPLATE.ordinal()] = 7;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.FREEMIUM.ordinal()] = 8;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.MARKET_TYPE.ordinal()] = 9;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.RECOMMENDED.ordinal()] = 10;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.ROW_WISE_SIMILAR.ordinal()] = 11;
            } catch (NoSuchFieldError unused18) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.PREMIUM_STORY.ordinal()] = 12;
            } catch (NoSuchFieldError unused19) {
            }
            try {
                $SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[g7.o.MORE_STORIES.ordinal()] = 13;
            } catch (NoSuchFieldError unused20) {
            }
        }
    }

    class AnonymousClass5 implements Runnable {
        AnonymousClass5() {
        }

        @Override
        public void run() {
            if (com.htmedia.mint.utils.h1.e(StoryDetailViewFragment.this.getActivity())) {
                g7.g gVar = new g7.g();
                StoryDetailViewFragment storyDetailViewFragment = StoryDetailViewFragment.this;
                storyDetailViewFragment.content = gVar.h(storyDetailViewFragment.content);
                StoryDetailViewFragment storyDetailViewFragment2 = StoryDetailViewFragment.this;
                storyDetailViewFragment2.giftCode = (storyDetailViewFragment2.getArguments() == null || !StoryDetailViewFragment.this.getArguments().containsKey("coupon")) ? BuildConfig.FLAVOR : StoryDetailViewFragment.this.getArguments().getString("coupon");
                Log.e("TAG_run", com.htmedia.mint.utils.h1.h(StoryDetailViewFragment.this.getActivity(), StoryDetailViewFragment.this.content) + BuildConfig.FLAVOR);
                StoryDetailViewFragment.this.content.setFullStoryFromGiftCoupon(com.htmedia.mint.utils.h1.h(StoryDetailViewFragment.this.getActivity(), StoryDetailViewFragment.this.content));
            }
            com.htmedia.mint.utils.f0.s++;
            StoryDetailViewFragment.this.content.setStoryCountIndex(com.htmedia.mint.utils.f0.s);
            if (StoryDetailViewFragment.this.content != null && StoryDetailViewFragment.this.content.getListElement() != null) {
                if (j5.b.b.a().equalsIgnoreCase(StoryDetailViewFragment.this.content.getType())) {
                    StoryDetailViewFragment storyDetailViewFragment3 = StoryDetailViewFragment.this;
                    storyDetailViewFragment3.setPayWallIndexForStory(storyDetailViewFragment3.content.getListElement());
                }
                StoryDetailViewFragment.this.content.setListElement(com.htmedia.mint.utils.j.K((ArrayList) StoryDetailViewFragment.this.content.getListElement()));
            }
            StoryDetailViewFragment storyDetailViewFragment4 = StoryDetailViewFragment.this;
            storyDetailViewFragment4.checkAndUpdateCounterForSkipLogin(storyDetailViewFragment4.getActivity(), StoryDetailViewFragment.this.content, StoryDetailViewFragment.this.section);
            StoryDetailViewFragment storyDetailViewFragment5 = StoryDetailViewFragment.this;
            String upEmbedKeysAndData = storyDetailViewFragment5.setUpEmbedKeysAndData(storyDetailViewFragment5.content);
            StoryDetailViewFragment.this.iniAdapterByTemplate(j5.b.e.ordinal(), StoryDetailViewFragment.this.section);
            StoryDetailViewFragment.this.submitAffiliatesCodeGetData(upEmbedKeysAndData);
            if (StoryDetailViewFragment.this.getActivity() != null) {
                StoryDetailViewFragment.this.getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Config config;
                        if (com.htmedia.mint.utils.h1.e(StoryDetailViewFragment.this.getActivity()) && !StoryDetailViewFragment.this.content.isFullStoryFromGiftCoupon()) {
                            StoryDetailViewFragment storyDetailViewFragment6 = StoryDetailViewFragment.this;
                            storyDetailViewFragment6.showCouponDialogue(storyDetailViewFragment6.giftCode, StoryDetailViewFragment.this.content);
                        }
                        if (StoryDetailViewFragment.this.isListEmpty && StoryDetailViewFragment.this.content != null) {
                            StoryDetailViewFragment.this.sendAnalyticsDataOnPageVisibility();
                        }
                        if (StoryDetailViewFragment.this.binding.c != null) {
                            StoryDetailViewFragment storyDetailViewFragment7 = StoryDetailViewFragment.this;
                            if (storyDetailViewFragment7.recyclerViewAdapter != null) {
                                storyDetailViewFragment7.setContextualTargetPojo();
                                StoryDetailViewFragment.this.binding.c.setAdapter(StoryDetailViewFragment.this.recyclerViewAdapter);
                                StoryDetailViewFragment.this.setListBackgroundAsPerStoryType();
                            }
                        }
                        StoryDetailViewFragment storyDetailViewFragment8 = StoryDetailViewFragment.this;
                        storyDetailViewFragment8.hideBottomAd(storyDetailViewFragment8.content);
                        f6.m.w(StoryDetailViewFragment.this.content);
                        Section section = StoryDetailViewFragment.this.section;
                        if (section != null && !TextUtils.isEmpty(section.getType()) && StoryDetailViewFragment.this.section.getType().equals("mintLounge")) {
                            StoryDetailViewFragment.this.content.setMintLoungeStory(true);
                        }
                        if (StoryDetailViewFragment.this.isBookmarkDetail) {
                            StoryDetailViewFragment storyDetailViewFragment9 = StoryDetailViewFragment.this;
                            storyDetailViewFragment9.smoothScrollToTop(storyDetailViewFragment9.binding.c, StoryDetailViewFragment.this.bookmarkImageIndex);
                            StoryDetailViewFragment storyDetailViewFragment10 = StoryDetailViewFragment.this;
                            storyDetailViewFragment10.bookmarkImageIndex = -1;
                            storyDetailViewFragment10.imageDeeplinkElementId = BuildConfig.FLAVOR;
                            storyDetailViewFragment10.isImageDeeplink = false;
                        } else {
                            StoryDetailViewFragment storyDetailViewFragment11 = StoryDetailViewFragment.this;
                            if (storyDetailViewFragment11.isImageDeeplink && storyDetailViewFragment11.bookmarkImageIndex > -1) {
                                storyDetailViewFragment11.smoothScrollToTop(storyDetailViewFragment11.binding.c, StoryDetailViewFragment.this.bookmarkImageIndex);
                                StoryDetailViewFragment storyDetailViewFragment12 = StoryDetailViewFragment.this;
                                storyDetailViewFragment12.isImageDeeplink = false;
                                storyDetailViewFragment12.bookmarkImageIndex = -1;
                                storyDetailViewFragment12.imageDeeplinkElementId = BuildConfig.FLAVOR;
                            }
                        }
                        StoryDetailViewFragment storyDetailViewFragment13 = StoryDetailViewFragment.this;
                        storyDetailViewFragment13.articleId = storyDetailViewFragment13.content.getId();
                        StoryDetailViewFragment storyDetailViewFragment14 = StoryDetailViewFragment.this;
                        storyDetailViewFragment14.disqusPresenter = new k6.v(storyDetailViewFragment14.getActivity(), new k6.w() {
                            @Override
                            public void onDetailDisqus(DetailDisqusPojo detailDisqusPojo, String str) {
                                if (detailDisqusPojo == null || detailDisqusPojo.getResponse() == null) {
                                    return;
                                }
                                StoryDetailViewFragment.this.content.setCommentOnStory(detailDisqusPojo.getResponse().getPosts());
                                StoryDetailViewFragment.this.content.setThreadId(detailDisqusPojo.getResponse().getId());
                            }

                            @Override
                            public void onDetailListing(DisqusMessagePojo disqusMessagePojo) {
                            }

                            @Override
                            public void onError(int i, String str) {
                            }

                            @Override
                            public void onLikeDislike(LikePojo likePojo, int i) {
                            }

                            @Override
                            public void onPostMessage(PostMessagePojo postMessagePojo, boolean z) {
                            }

                            @Override
                            public void remoteAuth(RemoteAuthPojo remoteAuthPojo) {
                            }
                        });
                        if (StoryDetailViewFragment.this.config.getDisqus() != null) {
                            StoryDetailViewFragment.this.disqusPresenter.f(StoryDetailViewFragment.this.articleId + BuildConfig.FLAVOR);
                        }
                        if (StoryDetailViewFragment.this.content.getMetadata() == null || StoryDetailViewFragment.this.content.getMetadata().getCanonicalUrl() == null) {
                            com.htmedia.mint.utils.f0.y(BuildConfig.FLAVOR, StoryDetailViewFragment.this.contextualTargetPresenter, StoryDetailViewFragment.this.config.getContextualTarget_url());
                        } else {
                            com.htmedia.mint.utils.f0.y(StoryDetailViewFragment.this.content.getMetadata().getCanonicalUrl(), StoryDetailViewFragment.this.contextualTargetPresenter, StoryDetailViewFragment.this.config.getContextualTarget_url());
                        }
                        if (StoryDetailViewFragment.this.content.getType().equalsIgnoreCase(j5.b.b.a()) && StoryDetailViewFragment.this.content.getMetadata() != null && (config = StoryDetailViewFragment.this.config) != null && config.getBudgetKeyword() != null && StoryDetailViewFragment.this.content.getMetadata().getKeywords() != null && !TextUtils.isEmpty(StoryDetailViewFragment.this.config.getBudgetKeyword().getKeyword()) && StoryDetailViewFragment.this.content.getMetadata().getKeywords().contains(StoryDetailViewFragment.this.config.getBudgetKeyword().getKeyword())) {
                            StoryDetailViewFragment.this.content.setBudgetStoryDetail(true);
                        }
                        if (StoryDetailViewFragment.this.content.getType().equalsIgnoreCase(j5.b.u.a())) {
                            StoryDetailViewFragment.this.content.setType(j5.b.o.a());
                            StoryDetailViewFragment.this.content.setConvertedListicle(true);
                        }
                        String id2 = StoryDetailViewFragment.this.section.getId();
                        String[] strArr = com.htmedia.mint.utils.q.d;
                        if (id2.equalsIgnoreCase(strArr[6]) || id2.equalsIgnoreCase(strArr[15])) {
                            int size = StoryDetailViewFragment.this.appController.g().getBottomNav().size();
                            StoryDetailViewFragment storyDetailViewFragment15 = StoryDetailViewFragment.this;
                            storyDetailViewFragment15.section = storyDetailViewFragment15.appController.g().getBottomNav().get(com.htmedia.mint.utils.f0.E0(size));
                            com.htmedia.mint.utils.k1.k(StoryDetailViewFragment.this.getActivity(), 0, StoryDetailViewFragment.this.content, StoryDetailViewFragment.this.section.getDisplayName(), true);
                        }
                        if (StoryDetailViewFragment.this.getActivity() != null) {
                            if (StoryDetailViewFragment.this.isMintLounge) {
                                StoryDetailViewFragment.this.getActivity().t1();
                            } else {
                                StoryDetailViewFragment.this.getActivity().V3();
                            }
                        }
                        if (StoryDetailViewFragment.this.isToShowToast && StoryDetailViewFragment.this.getActivity() != null) {
                            StoryDetailViewFragment.this.getActivity().r4();
                        }
                        if (!TextUtils.isEmpty(StoryDetailViewFragment.this.articleOpenType) && StoryDetailViewFragment.this.articleOpenType.equalsIgnoreCase("click")) {
                            StoryDetailViewFragment.this.endtime = System.currentTimeMillis();
                            long unused = StoryDetailViewFragment.this.endtime;
                            long unused2 = StoryDetailViewFragment.this.startTime;
                        }
                        StoryDetailViewFragment storyDetailViewFragment16 = StoryDetailViewFragment.this;
                        storyDetailViewFragment16.openOptionAccordingAction(storyDetailViewFragment16.content);
                    }
                });
            }
        }
    }

    private ListElement addGiftingBanner(Content content, boolean z) {
        if (!com.htmedia.mint.utils.h1.e(getActivity()) || content == null || content.getMetadata() == null || !content.getMetadata().isPremiumStory()) {
            return null;
        }
        if (z) {
            ListElement listElement = new ListElement();
            listElement.setStoryListElement(g7.o.GIFT_ARTICLE_BANNER);
            listElement.setType(g7.o.GIFT_ARTICLE_BANNER_BOTTOM.a());
            return listElement;
        }
        ListElement listElement2 = new ListElement();
        if (!content.isFullStoryFromGiftCoupon()) {
            g7.o oVar = g7.o.GIFT_ARTICLE_BANNER;
            listElement2.setStoryListElement(oVar);
            listElement2.setType(oVar.a());
        } else if (getActivity() == null || !com.htmedia.mint.utils.h1.n(this.appController, getActivity(), content)) {
            g7.o oVar2 = g7.o.GIFT_ARTICLE_BANNER;
            listElement2.setStoryListElement(oVar2);
            listElement2.setType(oVar2.a());
        } else {
            g7.o oVar3 = g7.o.GIFT_ARTICLE_BANNER_REDEEMED;
            listElement2.setStoryListElement(oVar3);
            listElement2.setType(oVar3.a());
        }
        return listElement2;
    }

    private void addStoryLastElement(Content content, ArrayList<ListElement> arrayList, int i, boolean z) {
        ListElement addGiftingBanner;
        ListElement listElement = new ListElement();
        g7.o oVar = g7.o.END_ARTICLE_VIEW;
        listElement.setStoryListElement(oVar);
        listElement.setType(oVar.a());
        if (i >= 0) {
            arrayList.add(i, listElement);
            if (!z || (addGiftingBanner = addGiftingBanner(content, true)) == null) {
                return;
            }
            arrayList.add(i, addGiftingBanner);
            return;
        }
        if (z) {
            arrayList.add(listElement);
            ListElement addGiftingBanner2 = addGiftingBanner(content, true);
            if (addGiftingBanner2 != null) {
                arrayList.add(addGiftingBanner2);
            }
        }
    }

    public void checkAndUpdateCounterForSkipLogin(Context context, Content content, Section section) {
        int i;
        j.q0 H;
        boolean isSubscribedUser = CheckSubscriptionFromLocal.isSubscribedUser(context);
        boolean z = false;
        n4.b.c = false;
        com.htmedia.mint.utils.j.P(HomeActivity.G0, section, content);
        List<String> list = null;
        String section2 = (content == null || content.getMetadata() == null) ? null : content.getMetadata().getSection();
        if (TextUtils.isEmpty(section2)) {
            section2 = BuildConfig.FLAVOR;
        }
        if (!isSubscribedUser && content.getType().equalsIgnoreCase(j5.b.b.a()) && content.getMetadata() != null && content.getMetadata().isPremiumStory()) {
            String str = content.getId() + BuildConfig.FLAVOR;
            if (!TextUtils.isEmpty(str) && ((H = com.htmedia.mint.utils.j.H(str)) == j.q0.FULL_BODY || H == j.q0.PREMIUM_LOGIN)) {
                PremiumStoryMeter o = AppController.j().o();
                List<String> premiumStories = o.getPremiumStories();
                List<String> deviceIdStories = o.getDeviceIdStories();
                if (o.getPartners() != null && o.getPartners().getCred() != null) {
                    list = o.getPartners().getCred().getPremiumStories();
                }
                if ((premiumStories == null || premiumStories.isEmpty() || !premiumStories.contains(str)) && ((deviceIdStories == null || deviceIdStories.isEmpty() || !deviceIdStories.contains(str)) && (list == null || list.isEmpty() || !list.contains(str)))) {
                    int premiumViewed = o.getPremiumViewed();
                    int premiumLimit = o.getPremiumLimit();
                    int deviceIdBalance = o.getDeviceIdBalance();
                    int deviceIdLimit = o.getDeviceIdLimit();
                    if (deviceIdBalance > 0) {
                        if (deviceIdStories == null) {
                            ArrayList arrayList = new ArrayList();
                            arrayList.add(str);
                            o.setDeviceIdStories(arrayList);
                        } else if (!deviceIdStories.contains(str)) {
                            deviceIdStories.add(str);
                        }
                        n4.b.J((deviceIdLimit - deviceIdBalance) + 1);
                        int i2 = deviceIdBalance - 1;
                        if (i2 > 0) {
                            showToastOnUITheard(String.format("%1$s Free Premium article remaining", i2 + BuildConfig.FLAVOR));
                        } else if (i2 == 0) {
                            showToastOnUITheard("You’ve read your last free Premium Article");
                        }
                        new n4.d().a(getActivity(), content, "deviceId", true);
                    } else {
                        int i3 = premiumViewed + 1;
                        o.setPremiumViewed(i3);
                        if (i3 <= premiumLimit) {
                            showToastOnUITheard(String.format("You’re reading %1$s free premium article", com.htmedia.mint.utils.f0.H2(i3)));
                            if (list == null || !list.contains(str)) {
                                if (premiumStories == null) {
                                    ArrayList arrayList2 = new ArrayList();
                                    arrayList2.add(str);
                                    o.setPremiumStories(arrayList2);
                                } else if (!premiumStories.contains(str) && premiumStories.size() < premiumLimit) {
                                    premiumStories.add(str);
                                }
                            }
                        }
                    }
                    AppController.j().W(o);
                }
            }
        } else if (!isSubscribedUser && content.getType().equalsIgnoreCase(j5.b.b.a()) && !com.htmedia.mint.utils.f0.d2(section2, null, content)) {
            Config g = this.appController.g();
            if (g == null || g.getSubscription() == null || !g.getSubscription().isSubscriptionEnable() || g.getMeterDefaultValue() == null) {
                i = 0;
            } else {
                int limit = g.getMeterDefaultValue().getLimit();
                i = g.getMeterDefaultValue().getViewed();
                if (i < limit && !AppController.j().B(content.getId())) {
                    AppController.j().e0(content.getId());
                    i++;
                    g.getMeterDefaultValue().setViewed(i);
                    g.getMeterDefaultValue().setStoryCount(i);
                } else if (i >= limit && !AppController.j().B(content.getId())) {
                    g.getMeterDefaultValue().setStoryCount(g.getMeterDefaultValue().getStoryCount() + 1);
                }
            }
            if (com.htmedia.mint.utils.f0.G1(context, "userName") == null) {
                int d = f6.l.d(context, "storyReadCounter");
                if (d == Integer.MIN_VALUE) {
                    d = 0;
                }
                int i4 = d + 1;
                int M = com.htmedia.mint.utils.j.M();
                if (M <= 0 || i <= M || i == i4) {
                    i = i4;
                }
                if (!q.s.DEEP_BI.a().equalsIgnoreCase(AppController.j().s()) || g.getMeterDefaultValue() == null) {
                    content.setDeepBiStoryStatus(q.e.DEFAULT.ordinal());
                } else if (g.getMeterDefaultValue().isDecision()) {
                    content.setDeepBiStoryStatus(q.e.PAID.ordinal());
                } else {
                    content.setDeepBiStoryStatus(q.e.DEFAULT.ordinal());
                }
                content.setDeepBiStoryClickIndex(i);
                f6.l.m(context, "storyReadCounter", Integer.valueOf(i));
                if (this.appController.g().getSkipConfig() != null && this.appController.g().getSkipConfig().isSkipLoginPopShown()) {
                    if (this.appController.g().getSkipConfig().isPopShownForSingleSession() && i == this.appController.g().getSkipConfig().getFreeSkipLoginPopCounter()) {
                        AppController.j().f0(content.getId());
                    } else if (!this.appController.g().getSkipConfig().isPopShownForSingleSession() && i < this.appController.g().getSkipConfig().getFreeSkipLoginPopCounter()) {
                        AppController.j().f0(content.getId());
                    }
                }
            }
        }
        boolean z2 = (content == null || content.getMetadata() == null || !content.getMetadata().isPremiumStory()) ? false : true;
        MintSubscriptionDetail l = AppController.j().l();
        if (l != null && l.isSubscriptionActive()) {
            z = true;
        }
        if (!z2 || z) {
            return;
        }
        setPaywallTypeInContent(content);
    }

    private PianoAppConstant.PIANO_STORY_TYPES checkForUnlockOrPremiumWall(PianoResponse pianoResponse, Content content) {
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        PaywallTypes unlockArticleTemplate = mobilePaywall != null ? mobilePaywall.getUnlockArticleTemplate() : null;
        Items items = unlockArticleTemplate.getItems() != null ? unlockArticleTemplate.getItems() : new Items();
        if (AppController.j().o() != null && AppController.j().o().getPartners() != null) {
            PianoUnlockArticle piano = AppController.j().o().getPartners().getPiano() != null ? AppController.j().o().getPartners().getPiano() : new PianoUnlockArticle();
            PianoNonLogin pianoNonLogin = AppController.j().o().getPartners().getPianoNonLogin() != null ? AppController.j().o().getPartners().getPianoNonLogin() : new PianoNonLogin();
            if (items != null && (piano.getBalance() > 0 || pianoNonLogin.getBalance() > 0)) {
                boolean z = com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null;
                int limit = (z ? piano.getLimit() : pianoNonLogin.getLimit()) - (z ? piano.getBalance() : pianoNonLogin.getBalance());
                int loggedInUnlockArticleLimit = z ? items.getLoggedInUnlockArticleLimit() : items.getNonLoggedInUnlockArticleLimit();
                if (!z && limit <= loggedInUnlockArticleLimit) {
                    return PianoAppConstant.PIANO_STORY_TYPES.UNLOCK_ARTICLE;
                }
                if (z && limit < loggedInUnlockArticleLimit) {
                    return PianoAppConstant.PIANO_STORY_TYPES.UNLOCK_ARTICLE;
                }
                if (z && limit >= loggedInUnlockArticleLimit) {
                    return PianoAppConstant.PIANO_STORY_TYPES.PREMIUM_PAYWALL;
                }
            }
        }
        return PianoAppConstant.PIANO_STORY_TYPES.PREMIUM_PAYWALL;
    }

    public void checkPaywallVisiblity() throws Exception {
        RecyclerView.Adapter adapter;
        ListElement listElement;
        g7.o storyListElement;
        String str;
        String str2;
        String str3;
        if (this.binding.c == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof g7.q)) {
            return;
        }
        LinearLayoutManager linearLayoutManager = this.linearLayoutManager;
        int findFirstCompletelyVisibleItemPosition = linearLayoutManager != null ? linearLayoutManager.findFirstCompletelyVisibleItemPosition() : 0;
        LinearLayoutManager linearLayoutManager2 = this.linearLayoutManager;
        int findLastCompletelyVisibleItemPosition = linearLayoutManager2 != null ? linearLayoutManager2.findLastCompletelyVisibleItemPosition() : 0;
        if (findFirstCompletelyVisibleItemPosition <= findLastCompletelyVisibleItemPosition) {
            RecyclerView.Adapter adapter2 = this.recyclerViewAdapter;
            ArrayList<ListElement> h = adapter2 != null ? ((g7.q) adapter2).h() : new ArrayList<>();
            if (h == null || h.isEmpty()) {
                return;
            }
            int size = h.size();
            if (this.isEventSend && !setEventFalse(findFirstCompletelyVisibleItemPosition, findLastCompletelyVisibleItemPosition, size, h)) {
                this.isEventSend = false;
            }
            while (findFirstCompletelyVisibleItemPosition <= findLastCompletelyVisibleItemPosition) {
                if (findFirstCompletelyVisibleItemPosition < size && (listElement = h.get(findFirstCompletelyVisibleItemPosition)) != null && (storyListElement = listElement.getStoryListElement()) != null) {
                    Content content = this.content;
                    Metadata metadata = content != null ? content.getMetadata() : null;
                    if (metadata != null) {
                        str = metadata.getUrl();
                        str2 = metadata.getSection();
                        str3 = metadata.isPremiumStory() ? "Premium" : "Dynamic";
                    } else {
                        str = BuildConfig.FLAVOR;
                        str2 = BuildConfig.FLAVOR;
                        str3 = str2;
                    }
                    if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && !this.isEventSend) {
                        switch (AnonymousClass12.$SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[storyListElement.ordinal()]) {
                            case 1:
                            case 2:
                            case 3:
                                this.isEventSend = true;
                                SnowplowSubscriptionAnalytices.trackPaywallViewScreen(str, str2);
                                WebEngageAnalytices.customPopUpShow("Paywall Pop Up Viewed", this.content, str3, false, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                                com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.c1, null, com.htmedia.mint.utils.n.m0, this.content, null);
                                break;
                            case 4:
                                this.isEventSend = true;
                                SnowplowSubscriptionAnalytices.trackPaywallViewScreen(str, str2);
                                WebEngageAnalytices.customPopUpShow(" Skippable Newsletter Wall Viewed", this.content, str3, false, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                                break;
                            case 5:
                                this.isEventSend = true;
                                SnowplowSubscriptionAnalytices.trackPaywallViewScreen(str, str2);
                                if (this.content.isSoftLogin()) {
                                    com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.Z0, null, com.htmedia.mint.utils.n.m0, this.content, null);
                                } else {
                                    com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.a1, null, com.htmedia.mint.utils.n.m0, this.content, null);
                                }
                                WebEngageAnalytices.customPopUpShow("Sign Up Pop Up Viewed", this.content, str3, false, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                                break;
                            case 6:
                                this.isEventSend = true;
                                SnowplowSubscriptionAnalytices.trackPaywallViewScreen(str, str2);
                                WebEngageAnalytices.customPopUpShow(" Skippable Login Wall Viewed", this.content, str3, false, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                                break;
                            case 7:
                                WebEngageAnalytices.customPopUpShow("In Article Banner Viewed", this.content, BuildConfig.FLAVOR, false, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                                break;
                            case 8:
                                this.isEventSend = true;
                                SnowplowSubscriptionAnalytices.trackPaywallViewScreen(str, str2);
                                WebEngageAnalytices.customPopUpShow("Freemium Pop Up Viewed", this.content, "Premium", true, "Freemium", "Freemium");
                                com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.c1, null, com.htmedia.mint.utils.n.m0, this.content, null);
                                break;
                            case 9:
                                sendWidgetImpressionEvent(this.content, findFirstCompletelyVisibleItemPosition, str);
                                break;
                        }
                    }
                    isContextualWidgetVisible(storyListElement, listElement, findFirstCompletelyVisibleItemPosition, this.recyclerViewAdapter);
                }
                findFirstCompletelyVisibleItemPosition++;
            }
        }
    }

    private boolean checkPremiumCounterForUser(String str) {
        com.htmedia.mint.utils.f0.a2("P-CRED");
        PremiumStoryMeter o = AppController.j().o();
        if (CheckSubscriptionFromLocal.isSubscribedUser(getActivity())) {
            return false;
        }
        if (o == null || TextUtils.isEmpty(str)) {
            return true;
        }
        List<String> premiumStories = o.getPremiumStories();
        if (premiumStories != null && !premiumStories.isEmpty() && premiumStories.contains(str)) {
            return false;
        }
        List<String> deviceIdStories = o.getDeviceIdStories();
        if (deviceIdStories != null && !deviceIdStories.isEmpty() && deviceIdStories.contains(str)) {
            return false;
        }
        List<String> premiumStories2 = (o.getPartners() == null || o.getPartners().getCred() == null) ? null : o.getPartners().getCred().getPremiumStories();
        return premiumStories2 == null || premiumStories2.isEmpty() || !premiumStories2.contains(str);
    }

    private void checkTableOfContentAndAdd(ArrayList<ListElement> arrayList, Content content) {
        if (arrayList == null || content == null || content.getMetadata() == null || content.getMetadata().getTableOfContentsHeading() == null || content.getMetadata().getTableOfContentsHeading().isEmpty()) {
            return;
        }
        ListElement listElement = new ListElement();
        g7.o oVar = g7.o.TABLE_OF_CONTENTS_HEADING;
        listElement.setStoryListElement(oVar);
        listElement.setType(oVar.a());
        arrayList.add(0, listElement);
    }

    private void collapseView(int i) {
        RecyclerView.Adapter adapter;
        if (this.list.size() > 0) {
            Content content = this.list.get(i);
            System.out.println("----position--------" + content.getMobileHeadline());
            System.out.println("----position--------" + i);
            content.setCloseButtonSticky(false);
            content.setExpanded(false);
            content.setDeepBiStoryStatus(q.e.DEFAULT.ordinal());
            content.setDeepBiStoryClickIndex(0);
            this.list.set(i, content);
            this.layoutClose.setVisibility(4);
            if (this.binding.c == null || (adapter = this.recyclerViewAdapter) == null) {
                return;
            }
            if (adapter instanceof q7.h0) {
                ((q7.h0) adapter).p(this.list);
            }
            this.binding.c.setAdapter(this.recyclerViewAdapter);
            this.recyclerViewAdapter.notifyItemChanged(i);
        }
    }

    private void deleteAuthorsWithNullIdOrEmptyBio(ArrayList<Author> arrayList) {
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        Iterator<Author> it = arrayList.iterator();
        while (it.hasNext()) {
            Author next = it.next();
            if (next.getId() == null || next.getId().longValue() == 0 || TextUtils.isEmpty(next.getBio())) {
                it.remove();
            }
        }
    }

    private void deleteKeys() {
        Bundle arguments = getArguments();
        if (arguments != null && arguments.containsKey("deeplinkpagewhatsapp")) {
            arguments.remove("deeplinkpagewhatsapp");
        }
        setArguments(arguments);
        Bundle extras = getActivity().getIntent().getExtras();
        if (extras.containsKey("deeplinkpage")) {
            extras.remove("deeplinkpage");
            getActivity().getIntent().removeExtra("deeplinkpage");
        }
        getActivity().getIntent().putExtras(extras);
    }

    private void deleteNullAuthorIdsAndBio(Content content) {
        deleteAuthorsWithNullIdOrEmptyBio(content != null ? content.getMetadata().getAuthorsList() : null);
        deleteAuthorsWithNullIdOrEmptyBio(content != null ? content.getMetadata().getReportedByList() : null);
        deleteAuthorsWithNullIdOrEmptyBio(content != null ? content.getMetadata().getWrittenByList() : null);
        deleteAuthorsWithNullIdOrEmptyBio(content != null ? content.getMetadata().getEditedByList() : null);
    }

    private void fetchDecisionForPremiumStories(int i, Section section, String str, Content content) {
        if (this.premiumStoryMeterPresenter == null) {
            this.premiumStoryMeterPresenter = new s6.c(getActivity(), this);
        }
        this.premiumStoryMeterPresenter.i(section);
        this.premiumStoryMeterPresenter.j(str);
        this.premiumStoryMeterPresenter.g(content);
        this.premiumStoryMeterPresenter.h(i);
        String G1 = com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
        Config g = AppController.j().g();
        String replace = ((g == null || g.getSubscription() == null) ? BuildConfig.FLAVOR : g.getSubscription().getArticleHistory()).replace("{fingerprint}", f6.d.b(getActivity()));
        String replace2 = !TextUtils.isEmpty(G1) ? replace.replace("{clientId}", G1) : replace.replace("&clientId={clientId}", BuildConfig.FLAVOR);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("Domain", "lm");
        this.premiumStoryMeterPresenter.a(0, "PremiumStoryCounter", replace2, null, hashMap, false, false);
    }

    private void fetchImageElementIdFromDeepLink(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            Uri parse = Uri.parse(str);
            if (parse == null || parse.getQueryParameter("inline") == null) {
                return;
            }
            this.imageDeeplinkElementId = parse.getQueryParameter("inline");
            this.isImageDeeplink = true;
        } catch (Exception unused) {
        }
    }

    private void fetchStoryData(Section section, String str) {
        Section section2 = section;
        String str2 = BuildConfig.FLAVOR;
        for (Section section3 : this.appController.g().getOthers()) {
            if (section3.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                str2 = section3.getUrl().contains("http") ? section3.getUrl() : this.serverUrl + section3.getUrl();
            }
        }
        String string = getArguments().getString("story_id");
        if (TextUtils.isEmpty(string) || !TextUtils.isEmpty(this.listUrl)) {
            string = str;
        }
        if (getArguments() != null && getArguments().containsKey("mintLounge") && getArguments().getBoolean("mintLounge")) {
            if (section2 == null) {
                section2 = new Section();
            }
            section2.setType("mintLounge");
        } else {
            section2.setType(null);
        }
        com.htmedia.mint.utils.o1.a("URL", str2 + string + "&elements=true");
        if (isToUpdateAdCount()) {
            com.htmedia.mint.utils.k.s(getActivity(), string);
        }
        if (TextUtils.isEmpty(section2.getType()) || !section2.getType().equals("mintLounge")) {
            this.isMintLounge = false;
            this.homePresenter.f(0, "Tag_Story_Detail", str2 + string + "&elements=true", null, this.headers, false, false);
            return;
        }
        if (this.appController.g().getMintLounge() == null || TextUtils.isEmpty(this.appController.g().getMintLounge().getDetailUrl())) {
            return;
        }
        String str3 = this.appController.g().getMintLounge().getDetailUrl() + string;
        this.isMintLounge = true;
        this.homePresenter.f(0, "Tag_Story_Detail", str3, null, this.headers, false, false);
    }

    private void fetchStoryDetail(int i, Section section, Content content, String str) {
        Section section2;
        this.isTopStory = getArguments() != null && getArguments().containsKey("isTopStory") && getArguments().getBoolean("isTopStory");
        String string = (getArguments() == null || !getArguments().containsKey("story_id")) ? null : getArguments().getString("story_id");
        if (getArguments().containsKey("keyPremiumStrory")) {
            getArguments().getBoolean("keyPremiumStrory");
        }
        try {
            if (!TextUtils.isEmpty(string)) {
                Long.parseLong(string);
            }
        } catch (Exception e) {
            com.htmedia.mint.utils.o1.a("Error", e.toString());
        }
        if (getArguments() != null && getArguments().containsKey("mintLounge") && getArguments().getBoolean("mintLounge")) {
            section2 = section == null ? new Section() : section;
            section2.setType("mintLounge");
        } else {
            section.setType(null);
            section2 = section;
        }
        String str2 = BuildConfig.FLAVOR;
        if (content != null) {
            if (content.getMetadata() != null) {
                content.getMetadata().isPremiumStory();
            }
            string = content.getId() + BuildConfig.FLAVOR;
        }
        if (TextUtils.isEmpty(string)) {
            if (getArguments() != null && getArguments().containsKey("show_ad") && getArguments().getBoolean("show_ad")) {
                this.binding.q.setVisibility(0);
                this.binding.h.setVisibility(8);
                loadWebView();
                return;
            }
            return;
        }
        this.binding.q.setVisibility(8);
        this.binding.h.setVisibility(0);
        for (Section section3 : this.appController.g().getOthers()) {
            if (section3.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                str2 = section3.getUrl().contains("http") ? section3.getUrl() : this.serverUrl + section3.getUrl();
            }
        }
        if (isToUpdateAdCount()) {
            com.htmedia.mint.utils.k.s(getActivity(), string);
        }
        if (!TextUtils.isEmpty(section2.getType()) && section2.getType().equals("mintLounge")) {
            if (this.appController.g().getMintLounge() == null || TextUtils.isEmpty(this.appController.g().getMintLounge().getDetailUrl())) {
                return;
            }
            String str3 = this.appController.g().getMintLounge().getDetailUrl() + string;
            this.isMintLounge = true;
            this.homePresenter.f(0, "Tag_Story_Detail", str3, null, this.headers, false, false);
            return;
        }
        this.isMintLounge = false;
        if (!this.bundle.containsKey("isPreview") || !this.bundle.getBoolean("isPreview")) {
            this.homePresenter.f(0, "Tag_Story_Detail", str2 + string + "&elements=true", null, this.headers, false, false);
            return;
        }
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("Domain", f6.l.k(requireContext(), "PREVIEW_DOMAIN_ID"));
        hashMap.put("Authorization", "Bearer " + f6.l.k(requireContext(), "PREVIEW_TOKEN"));
        this.homePresenter.f(0, "Tag_Story_Detail", f6.l.k(requireContext(), "PREVIEW_DETAIL_URL") + "/" + string + "?search=Id:" + string, null, hashMap, false, false);
    }

    private List<Content> filterListByStoryId(List<Content> list) {
        Bundle arguments = getArguments();
        if (arguments != null && arguments.containsKey("story_id")) {
            String string = arguments.getString("story_id");
            if (!TextUtils.isEmpty(string) && com.htmedia.mint.utils.f0.X1(string)) {
                long parseLong = Long.parseLong(string);
                ArrayList arrayList = new ArrayList();
                for (Content content : list) {
                    if (parseLong != content.getId()) {
                        arrayList.add(content);
                    }
                }
                return arrayList;
            }
        }
        return list;
    }

    private int findElementIdIndex(long j, List<ListElement> list) {
        int size = list != null ? list.size() - 1 : -1;
        if (size >= 0) {
            while (size >= 0) {
                ListElement listElement = list.get(size);
                if (listElement != null && listElement.getId() == j && listElement.getType() != null && listElement.getType().equalsIgnoreCase(g7.o.IMAGE.a())) {
                    return size;
                }
                size--;
            }
        }
        return -1;
    }

    private int findElementIdIndexWRTImageUrl(java.lang.String r7, java.util.List<com.htmedia.mint.pojo.ListElement> r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.ui.fragments.StoryDetailViewFragment.findElementIdIndexWRTImageUrl(java.lang.String, java.util.List):int");
    }

    private void findListingTemplate(HashMap<String, String> hashMap, Section section) {
        String str;
        String str2;
        String str3;
        String id2 = section.getId();
        if (id2 != null) {
            String[] strArr = com.htmedia.mint.utils.q.d;
            if (id2.equalsIgnoreCase(strArr[6]) || id2.equalsIgnoreCase(strArr[15])) {
                fetchStoryDetail(0, section, null, null);
                return;
            }
        }
        if (id2 != null && id2.equalsIgnoreCase(com.htmedia.mint.utils.q.d[2])) {
            if (section.getUrl().contains("http")) {
                str3 = section.getUrl();
            } else {
                str3 = this.serverUrl + section.getUrl();
            }
            String replaceAll = getArguments().getString("topicName").replaceAll(" ", "%20");
            com.htmedia.mint.utils.o1.a("Tag URL", str3 + replaceAll);
            String str4 = str3 + replaceAll;
            this.storyUrl = str4;
            this.homePresenter.f(0, "Tag_Story_Detail", str4, null, hashMap, false, false);
            return;
        }
        if (id2 != null && id2.equalsIgnoreCase(com.htmedia.mint.utils.q.d[12])) {
            if (section.getUrl().contains("http")) {
                str2 = section.getUrl();
            } else {
                str2 = this.serverUrl + section.getUrl();
            }
            String replaceAll2 = getArguments().getString("author_name").trim().replaceAll(" ", "%20");
            com.htmedia.mint.utils.o1.a("Tag URL", String.format(str2, replaceAll2));
            String format = String.format(str2, replaceAll2);
            this.storyUrl = format;
            this.homePresenter.f(0, "Tag_Story_Detail", format, null, hashMap, false, false);
            return;
        }
        if (id2 != null && id2.equalsIgnoreCase(com.htmedia.mint.utils.q.d[13])) {
            if (section.getUrl().contains("http")) {
                str = section.getUrl();
            } else {
                str = this.serverUrl + section.getUrl();
            }
            String string = getArguments().getString("column_name");
            if (string != null) {
                String str5 = str + string.trim().replaceAll(" ", "%20");
                this.storyUrl = str5;
                com.htmedia.mint.utils.o1.a("Column URL", str5);
                this.homePresenter.f(0, "Tag_Story_Detail", this.storyUrl, null, hashMap, false, false);
                return;
            }
            return;
        }
        if (getURL(section).contains("http")) {
            this.storyUrl = getURL(section);
            if (TextUtils.isEmpty(section.getWebsiteUrl())) {
                com.htmedia.mint.utils.f0.y(BuildConfig.FLAVOR, this.contextualTargetPresenter, this.config.getContextualTarget_url());
            } else {
                com.htmedia.mint.utils.f0.y(section.getWebsiteUrl(), this.contextualTargetPresenter, this.config.getContextualTarget_url());
            }
        } else if (getArguments() == null || !getArguments().containsKey("is_from_left_nav")) {
            this.storyUrl = this.serverUrl + getURL(section);
            com.htmedia.mint.utils.f0.y(section.getWebsiteUrl(), this.contextualTargetPresenter, this.config.getContextualTarget_url());
        } else if (section.getDisplayName().equalsIgnoreCase("latest-news")) {
            this.storyUrl = this.config.getBottomNav().get(1).getUrl();
        } else if (section.getDisplayName().equalsIgnoreCase("mostpopular")) {
            this.storyUrl = this.config.getBottomNav().get(2).getUrl();
        } else {
            this.storyUrl = this.serverUrlwithLeftSection + getURL(section);
            com.htmedia.mint.utils.f0.y(this.serverUrl + getURL(section), this.contextualTargetPresenter, this.config.getContextualTarget_url());
        }
        if (isForYouOrPopularFromAnalytics(section)) {
            this.storyUrl = getURL(section) + "?offset=" + (this.pageNo * 10) + "&limit=10&u=" + this.userId;
        } else if (isForYouURL(section)) {
            this.storyUrl += "?u=" + this.userId;
        }
        if (!TextUtils.isEmpty(this.listUrl)) {
            this.storyUrl = this.listUrl;
        }
        com.htmedia.mint.utils.o1.a("Story URL", this.storyUrl);
        this.homePresenter.f(0, "Tag_Story_Detail", this.storyUrl, null, hashMap, false, false);
    }

    private int findPositionByID(long j, ArrayList<ListElement> arrayList) {
        if (arrayList == null || arrayList.isEmpty()) {
            return -1;
        }
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i).getId() == j) {
                return i;
            }
        }
        return -1;
    }

    private int findStoryLastItem(List<ListElement> list) {
        int size = list != null ? list.size() - 1 : -1;
        if (size >= 0) {
            while (size >= 0) {
                ListElement listElement = list.get(size);
                if (listElement != null && listElement.getStoryListElement() != null && listElement.getStoryListElement() == g7.o.END_ARTICLE_VIEW) {
                    return size;
                }
                size--;
            }
        }
        return -1;
    }

    private void getAllFollowedAuthorId() {
        HashMap j = u4.h.j(getActivity());
        v4.b bVar = this.viewModel;
        if (bVar != null) {
            bVar.u(j);
        }
    }

    public static int getBackgroundColor(View view) {
        Drawable background = view.getBackground();
        if (background instanceof ColorDrawable) {
            return ((ColorDrawable) background).getColor();
        }
        return 0;
    }

    private Content getDailyNewsLetterContent() {
        NewsLetter newsLetter = AppController.j().g().getNewsLetter();
        if (newsLetter == null || !newsLetter.isEnableAndroid() || TextUtils.isEmpty(newsLetter.getPreviewUrl()) || !URLUtil.isValidUrl(newsLetter.getPreviewUrl())) {
            return null;
        }
        Content content = new Content();
        Metadata metadata = new Metadata();
        metadata.setExternalUrl(newsLetter.getPreviewUrl());
        content.setMetadata(metadata);
        content.setHeadline(BuildConfig.FLAVOR);
        content.setLastPublishedDate(BuildConfig.FLAVOR);
        content.setType(j5.b.g1.a());
        return content;
    }

    private String getDefaultNavigationForLatestUrl(Config config) {
        for (Section section : config.getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[14])) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url;
                }
                return this.serverUrl + url;
            }
        }
        return BuildConfig.FLAVOR;
    }

    private String getDefaultNavigationUrl(Config config) {
        for (Section section : config.getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[11])) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url;
                }
                return this.serverUrl + url;
            }
        }
        return BuildConfig.FLAVOR;
    }

    private Content getEPaperContent() {
        Epaper epaper = AppController.j().g().getEpaper();
        if (epaper == null || !epaper.isFlag()) {
            return null;
        }
        Content content = new Content();
        Metadata metadata = new Metadata();
        metadata.setExternalUrl(epaper.getUrl());
        content.setMetadata(metadata);
        content.setHeadline(BuildConfig.FLAVOR);
        content.setLastPublishedDate(BuildConfig.FLAVOR);
        content.setType(j5.b.t.a());
        return content;
    }

    private int getRelativeTop(View view) {
        int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        return iArr[1];
    }

    private int getScrollPosition(RecyclerView recyclerView) {
        LinearLayoutManager layoutManager = recyclerView.getLayoutManager();
        if (layoutManager != null) {
            return layoutManager.findFirstVisibleItemPosition();
        }
        return 0;
    }

    private void getStoryData(String str, Content content) {
        String str2 = BuildConfig.FLAVOR;
        for (Section section : this.appController.g().getOthers()) {
            if (section.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                str2 = section.getUrl().contains("http") ? section.getUrl() : this.serverUrl + section.getUrl();
            }
        }
        if (getArguments() != null && getArguments().containsKey("mintLounge") && getArguments().getBoolean("mintLounge")) {
            if (this.section == null) {
                this.section = new Section();
            }
            this.section.setType("mintLounge");
        } else {
            this.section.setType(null);
        }
        com.htmedia.mint.utils.o1.a("URL", str2 + str + "&elements=true");
        if (isToUpdateAdCount()) {
            com.htmedia.mint.utils.k.s(getActivity(), str);
        }
        Section section2 = this.section;
        if (section2 != null && !TextUtils.isEmpty(section2.getType()) && this.section.getType().equals("mintLounge")) {
            if (this.appController.g().getMintLounge() == null || TextUtils.isEmpty(this.appController.g().getMintLounge().getDetailUrl())) {
                return;
            }
            String str3 = this.appController.g().getMintLounge().getDetailUrl() + str;
            this.isMintLounge = true;
            this.homePresenter.f(0, "Tag_Story_Detail", str3, null, this.headers, false, false);
            return;
        }
        this.isMintLounge = false;
        if (!this.bundle.containsKey("isPreview") || !this.bundle.getBoolean("isPreview")) {
            this.homePresenter.f(0, "Tag_Story_Detail", str2 + str + "&elements=true", null, this.headers, false, false);
            return;
        }
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("Domain", f6.l.k(requireContext(), "PREVIEW_DOMAIN_ID"));
        hashMap.put("Authorization", "Bearer " + f6.l.k(requireContext(), "PREVIEW_TOKEN"));
        this.homePresenter.f(0, "Tag_Story_Detail", f6.l.k(requireContext(), "PREVIEW_DETAIL_URL") + "/" + str + "?search=Id:" + str, null, hashMap, false, false);
    }

    private String getTemplete(Section section) {
        return section.getTemplate();
    }

    private int getTempleteIndex(String str) {
        int i = 0;
        while (true) {
            String[] strArr = com.htmedia.mint.utils.q.c;
            if (i >= strArr.length) {
                return 1;
            }
            if (str.trim().equalsIgnoreCase(strArr[i])) {
                return i;
            }
            i++;
        }
    }

    private String getURL(Section section) {
        if (section.getUrl() == null || !section.getUrl().contains("/market/market-stats") || !this.isMarketGenieActive || this.config.getMarkets() == null || TextUtils.isEmpty(this.config.getMarkets().getMintgenieMarketDashboard())) {
            return (AppController.j().l() == null || !AppController.j().l().isSubscriptionActive() || section.getMintGenieSubscribedUrl() == null || TextUtils.isEmpty(section.getMintGenieSubscribedUrl())) ? !TextUtils.isEmpty(section.getMintGenieUrl()) ? section.getMintGenieUrl() : section.getUrl() : section.getMintGenieSubscribedUrl();
        }
        section.setUrl(section.getUrl().replace("market/market-stats", this.config.getMarkets().getMintgenieMarketDashboard()));
        return section.getUrl();
    }

    public void hideBottomAd(Content content) {
        FragmentActivity activity = getActivity();
        if (activity == null || !(activity instanceof HomeActivity)) {
            return;
        }
        HomeActivity activity2 = getActivity();
        if (content != null && content.getMetadata() != null && content.getMetadata().isPremiumStory()) {
            if (activity2 != null) {
                activity2.o4(true);
                activity2.O3(0);
                return;
            }
            return;
        }
        if (this.config == null) {
            this.config = AppController.j().g();
        }
        Config config = this.config;
        if (config == null || config.getAdsAndroidNew() == null || this.config.getAdsAndroidNew().getStoryBottomStickyAd() == null || !this.config.getAdsAndroidNew().getStoryBottomStickyAd().getStoryBottomStickyAdEnabled() || TextUtils.isEmpty(this.config.getAdsAndroidNew().getStoryBottomStickyAd().getStoryBottomStickyAdId())) {
            activity2.O3(0);
        } else {
            activity2.O3(100);
        }
        activity2.o4(false);
    }

    public void iniAdapterByTemplate(int i, Section section) {
        if (getActivity() == null || this.recyclerViewAdapter != null) {
            return;
        }
        Content content = this.content;
        ArrayList<ListElement> updateListElement = updateListElement(content, (ArrayList) content.getListElement());
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView != null) {
            recyclerView.clearOnScrollListeners();
        }
        this.liveblogListElementsSize = updateListElement != null ? updateListElement.size() : 0;
        initScrollListinerForLiveBlog();
        this.onBottomSheetGiftRecipientListener = new e.b() {
            @Override
            public void cancelLoginClicked() {
                StoryDetailViewFragment.this.isLoginPressedFromGiftArticle = false;
                RecyclerView.Adapter adapter = StoryDetailViewFragment.this.recyclerViewAdapter;
                if (adapter != null) {
                    ((g7.q) adapter).j(false);
                }
            }

            @Override
            public void onSubscribeOrLoginClicked() {
                StoryDetailViewFragment.this.isLoginPressedFromGiftArticle = true;
            }
        };
        g7.q qVar = new g7.q(getActivity(), this.config, updateListElement, this.content, section, false, this.list, null, this.isToShowBottomToast, this, getActivity(), this, this, this.onBottomSheetGiftRecipientListener);
        this.recyclerViewAdapter = qVar;
        qVar.l(this.userSelectedPlan);
    }

    private void initScrollListinerForLiveBlog() {
        RecyclerView recyclerView;
        if (getActivity() == null || (recyclerView = this.binding.c) == null) {
            return;
        }
        recyclerView.clearOnScrollListeners();
        this.binding.c.addOnScrollListener(new RecyclerView.OnScrollListener() {
            public void onScrollStateChanged(@NonNull RecyclerView recyclerView2, int i) {
                super.onScrollStateChanged(recyclerView2, i);
                if ((i == 1 || i == 0) && StoryDetailViewFragment.this.content != null) {
                    StoryDetailViewFragment.this.scrollDepthAnalyticsTracking();
                }
                if (i == 0) {
                    try {
                        StoryDetailViewFragment.this.checkPaywallVisiblity();
                        if (StoryDetailViewFragment.this.binding.c != null) {
                            g7.q qVar = (g7.q) StoryDetailViewFragment.this.binding.c.getAdapter();
                            LinearLayoutManager layoutManager = StoryDetailViewFragment.this.binding.c.getLayoutManager();
                            if (StoryDetailViewFragment.this.getActivity() == null || qVar == null || layoutManager == null) {
                                return;
                            }
                            StoryDetailViewFragment storyDetailViewFragment = StoryDetailViewFragment.this;
                            storyDetailViewFragment.sendAnalyticsEventForAB(storyDetailViewFragment.getActivity(), layoutManager, qVar);
                        }
                    } catch (Exception unused) {
                    }
                }
            }

            public void onScrolled(@NonNull RecyclerView recyclerView2, int i, int i2) {
                super.onScrolled(recyclerView2, i, i2);
                int computeVerticalScrollRange = recyclerView2.computeVerticalScrollRange();
                float computeVerticalScrollOffset = recyclerView2.computeVerticalScrollOffset();
                if (Math.abs(i2) >= StoryDetailViewFragment.SCROLL_THRESHOLD) {
                    if (StoryDetailViewFragment.SCROLL_THRESHOLD == 0) {
                        int unused = StoryDetailViewFragment.SCROLL_THRESHOLD = 5;
                    }
                    int i3 = (int) ((computeVerticalScrollOffset / (computeVerticalScrollRange - StoryDetailViewFragment.this.screenHeight)) * 100.0f);
                    if (i2 >= 0) {
                        StoryDetailViewFragment storyDetailViewFragment = StoryDetailViewFragment.this;
                        if (storyDetailViewFragment.lastProgress < i3) {
                            storyDetailViewFragment.lastProgress = i3;
                            if (storyDetailViewFragment.binding.u != null) {
                                int findLastVisibleItemPosition = (StoryDetailViewFragment.this.linearLayoutManager != null ? StoryDetailViewFragment.this.linearLayoutManager : recyclerView2.getLayoutManager()).findLastVisibleItemPosition();
                                int findFirstCompletelyVisibleItemPosition = (StoryDetailViewFragment.this.linearLayoutManager != null ? StoryDetailViewFragment.this.linearLayoutManager : recyclerView2.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
                                StoryDetailViewFragment storyDetailViewFragment2 = StoryDetailViewFragment.this;
                                int i4 = storyDetailViewFragment2.storyLastIndex;
                                if (i4 >= findFirstCompletelyVisibleItemPosition && i4 <= findLastVisibleItemPosition && storyDetailViewFragment2.lastProgress < storyDetailViewFragment2.binding.u.getMax()) {
                                    StoryDetailViewFragment.this.binding.u.setMax(StoryDetailViewFragment.this.lastProgress);
                                }
                                StoryDetailViewFragment.this.binding.u.setProgress(StoryDetailViewFragment.this.lastProgress);
                            }
                        }
                    } else {
                        StoryDetailViewFragment storyDetailViewFragment3 = StoryDetailViewFragment.this;
                        if (storyDetailViewFragment3.lastProgress > i3 && i3 >= 0 && i3 <= 100) {
                            storyDetailViewFragment3.lastProgress = i3;
                            if (storyDetailViewFragment3.binding.u != null) {
                                StoryDetailViewFragment.this.binding.u.setProgress(StoryDetailViewFragment.this.lastProgress);
                            }
                        }
                    }
                }
                int J2 = com.htmedia.mint.utils.f0.J2(i2 - 1);
                if (J2 > 2) {
                    if (StoryDetailViewFragment.this.getActivity() != null) {
                        StoryDetailViewFragment.this.getActivity().E1();
                        StoryDetailViewFragment.this.getActivity().D1();
                        return;
                    }
                    return;
                }
                if (J2 >= -2 || StoryDetailViewFragment.this.getActivity() == null) {
                    return;
                }
                StoryDetailViewFragment.this.getActivity().E1();
                StoryDetailViewFragment.this.getActivity().D1();
            }
        });
    }

    private boolean isArticleHistoryEnabled(Config config) {
        if (config == null) {
            config = AppController.j().g();
        }
        return config == null || config.getSubscription() == null || config.getSubscription().getArticleHistoryEnabled() == null || config.getSubscription().getArticleHistoryEnabled().booleanValue();
    }

    private void isContextualWidgetVisible(g7.o oVar, ListElement listElement, int i, RecyclerView.Adapter adapter) {
        WidgetType widgetType;
        if (oVar == null || oVar != g7.o.ROW_WISE_SIMILAR || listElement == null || adapter == null || listElement.isRefreshRowWiseWidget() || StoryDetailFragment.refreshRowWiseItem || (widgetType = listElement.getWidgetType()) == null || widgetType.getRefreshListener() == null) {
            return;
        }
        StoryDetailFragment.refreshRowWiseItem = true;
        widgetType.getRefreshListener().onRefresh();
    }

    private boolean isForYouOrPopularFromAnalytics(Section section) {
        return this.section.getId().trim().contains("_offset");
    }

    private boolean isForYouURL(Section section) {
        return section.getId().contains("foryou_page");
    }

    private boolean isOtherThanPhotoVedioAndCollection(String str) {
        return (TextUtils.isEmpty(str) || str.equalsIgnoreCase(j5.b.d.a()) || str.equalsIgnoreCase(j5.b.g.a()) || str.equalsIgnoreCase(j5.b.H.a()) || str.equalsIgnoreCase(j5.b.q.a()) || str.equalsIgnoreCase(j5.b.r.a()) || str.equalsIgnoreCase(j5.b.p.a()) || str.equalsIgnoreCase(j5.b.i.a())) ? false : true;
    }

    private boolean isPianoExpRunForStory() {
        PianoResponse pianoResponse = PianoResponseSingleTon.getInstance().getPianoResponse();
        MobilePaywall mobilePaywall = pianoResponse != null ? pianoResponse.getMobilePaywall() : null;
        return mobilePaywall == null || !("appsplashpage".equalsIgnoreCase(mobilePaywall.getPageName()) || ("subscriptionplanpage".equalsIgnoreCase(mobilePaywall.getPageName()) && pianoResponse.isMeterExpired()));
    }

    private boolean isSeventyPercentCrossed(boolean z, View view, double d, int i) {
        if (view == null || i <= 0 || this.screenHeight <= 0) {
            return false;
        }
        int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        int i2 = iArr[1];
        return ((double) (((z ? i2 < 0 ? i2 + i : i2 < 50 ? i - i2 : i : this.screenHeight - i2) * 100) / i)) >= d;
    }

    private boolean isStoryContentAndRunPiano(ForyouPojo foryouPojo, String str) {
        if (foryouPojo == null || foryouPojo.getContentList() == null || foryouPojo.getContentList().size() <= 0 || !str.contains("search=id:") || foryouPojo.getContentList().size() != 1 || foryouPojo.getContentList().get(0).getListElement() == null) {
            return false;
        }
        Content content = foryouPojo.getContentList().get(0);
        return isPianoExpRunForStory() && content != null && content.getMetadata() != null && content.getMetadata().isPremiumStory() && j5.b.b.a().equalsIgnoreCase(content.getType());
    }

    private boolean isToUpdateAdCount() {
        Config config = this.config;
        if (config != null && config.getInterstitial_ad_visible_On_android() != null) {
            for (String str : this.config.getInterstitial_ad_visible_On_android()) {
                if (str.equalsIgnoreCase("story")) {
                    return true;
                }
            }
        }
        return false;
    }

    public void lambda$onCreateView$0() {
        checkTheme(AppController.j().E());
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
    }

    public void lambda$progressBarVisible$1() {
        ProgressBar progressBar = this.binding.u;
        if (progressBar != null) {
            progressBar.setVisibility(0);
        }
    }

    public void lambda$progressBarVisible$2() {
        ProgressBar progressBar = this.binding.u;
        if (progressBar != null) {
            progressBar.setVisibility(8);
        }
    }

    private void loadWebView() {
        String adUrlAndroid = com.htmedia.mint.utils.f0.r0().getStoryDetailInterstitialAd().getAdUrlAndroid();
        this.binding.L.getSettings().setJavaScriptEnabled(true);
        this.binding.L.getSettings().setDomStorageEnabled(true);
        this.binding.L.getSettings().setAllowFileAccess(true);
        this.binding.L.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView webView, String str) {
                super.onPageFinished(webView, str);
                if (StoryDetailViewFragment.this.binding.t != null) {
                    StoryDetailViewFragment.this.binding.t.setVisibility(8);
                }
            }

            @Override
            public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                super.onPageStarted(webView, str, bitmap);
                if (StoryDetailViewFragment.this.binding.t != null) {
                    StoryDetailViewFragment.this.binding.t.setVisibility(0);
                }
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                StoryDetailViewFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                return true;
            }
        });
        this.binding.L.loadUrl(adUrlAndroid);
    }

    public void openOptionAccordingAction(Content content) {
        Bundle arguments = getArguments();
        HomeActivity activity = getActivity();
        Bundle extras = (activity == null || activity.getIntent() == null) ? null : activity.getIntent().getExtras();
        if (extras == null || arguments == null || activity == null || content == null || !extras.containsKey("story_action") || !this.section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[15])) {
            return;
        }
        String string = extras.getString("story_action");
        if (TextUtils.isEmpty(string)) {
            return;
        }
        if (string.equalsIgnoreCase("sharing")) {
            extras.remove("story_action");
            com.htmedia.mint.utils.v2.j(activity, content);
            return;
        }
        if (string.equalsIgnoreCase("bookmark")) {
            String str = content.getId() + BuildConfig.FLAVOR;
            extras.remove("story_action");
            if (com.htmedia.mint.utils.f0.G1(activity, "userName") == null) {
                com.htmedia.mint.utils.p1.a(activity, activity.getString(2131952168), str, false);
                return;
            }
            if (AppController.O.a(str)) {
                return;
            }
            u7.q.v0(content.getId() + BuildConfig.FLAVOR, activity.s, getActivity(), getActivity(), u7.q.d, false, (ArrayList) this.forYouPojo.getContentList(), content, null, false);
            RecyclerView.Adapter adapter = this.recyclerViewAdapter;
            if (adapter != null) {
                adapter.notifyItemChanged(0);
            }
        }
    }

    public void openRecipentBottomSheetWithData(boolean z) {
        t7.h hVar = new t7.h();
        this.isLoginPressedFromGiftArticle = false;
        hVar.u(getActivity(), this.content, z, new e.b() {
            @Override
            public void cancelLoginClicked() {
                StoryDetailViewFragment.this.isLoginPressedFromGiftArticle = false;
            }

            @Override
            public void onSubscribeOrLoginClicked() {
                StoryDetailViewFragment.this.isLoginPressedFromGiftArticle = true;
            }
        });
        hVar.setCancelable(true);
        FragmentTransaction beginTransaction = getActivity().getSupportFragmentManager().beginTransaction();
        beginTransaction.add(hVar, t7.h.class.getSimpleName());
        beginTransaction.commitAllowingStateLoss();
    }

    private void parseResponseArticleInTemplate(Content content, PianoResponse pianoResponse) {
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        content.setPaywallTypes(mobilePaywall != null ? mobilePaywall.getArticleInTemplate() : null);
    }

    private void parseResponseForFullStoryTemplate(Content content, PianoResponse pianoResponse) {
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        content.setPaywallTypes(mobilePaywall != null ? mobilePaywall.getFullStoryWallTemplate() : null);
    }

    private void parseResponseForPaywall(Content content, PianoResponse pianoResponse) {
        boolean z = (content == null || content.getMetadata() == null || !content.getMetadata().isPremiumStory()) ? false : true;
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        Config g = AppController.j().g();
        MobilePaywall mobilePaywall2 = (g == null || g.getStandardization() == null) ? null : g.getStandardization().getMobilePaywall();
        if (mobilePaywall != null) {
            PaywallTypes premiumPaywall = mobilePaywall.getPremiumPaywall();
            if (z && premiumPaywall != null) {
                Items items = premiumPaywall.getItems();
                if (items == null) {
                    items = (mobilePaywall2 == null || mobilePaywall2.getPremiumPaywall() == null) ? new Items() : mobilePaywall2.getPremiumPaywall().getItems();
                }
                Mode nightMode = premiumPaywall.getNightMode();
                if (nightMode == null) {
                    nightMode = (mobilePaywall2 == null || mobilePaywall2.getPremiumPaywall() == null) ? new Mode() : mobilePaywall2.getPremiumPaywall().getNightMode();
                }
                Mode dayMode = premiumPaywall.getDayMode();
                if (dayMode == null) {
                    dayMode = (mobilePaywall2 == null || mobilePaywall2.getPremiumPaywall() == null) ? new Mode() : mobilePaywall2.getPremiumPaywall().getDayMode();
                }
                premiumPaywall.setItems(items);
                premiumPaywall.setNightMode(nightMode);
                premiumPaywall.setDayMode(dayMode);
                content.setPaywallTypes(premiumPaywall);
            }
            PaywallTypes meteredPaywall = mobilePaywall.getMeteredPaywall();
            if (z || meteredPaywall == null) {
                return;
            }
            Items items2 = meteredPaywall.getItems();
            if (items2 == null) {
                items2 = (mobilePaywall2 == null || mobilePaywall2.getMeteredPaywall() == null) ? new Items() : mobilePaywall2.getMeteredPaywall().getItems();
            }
            Mode nightMode2 = meteredPaywall.getNightMode();
            if (nightMode2 == null) {
                nightMode2 = (mobilePaywall2 == null || mobilePaywall2.getMeteredPaywall() == null) ? new Mode() : mobilePaywall2.getMeteredPaywall().getNightMode();
            }
            Mode dayMode2 = meteredPaywall.getDayMode();
            if (dayMode2 == null) {
                dayMode2 = (mobilePaywall2 == null || mobilePaywall2.getMeteredPaywall() == null) ? new Mode() : mobilePaywall2.getMeteredPaywall().getDayMode();
            }
            meteredPaywall.setItems(items2);
            meteredPaywall.setNightMode(nightMode2);
            meteredPaywall.setDayMode(dayMode2);
            content.setPaywallTypes(meteredPaywall);
        }
    }

    private void parseResponseSkipLoginTemplate(Content content, PianoResponse pianoResponse) {
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        content.setPaywallTypes(mobilePaywall != null ? mobilePaywall.getSkipLoginTemplate() : null);
    }

    private void parseResponseUnlockArticleTemplate(Content content, PianoResponse pianoResponse) {
        MobilePaywall mobilePaywall = pianoResponse.getMobilePaywall();
        content.setPaywallTypes(mobilePaywall != null ? mobilePaywall.getUnlockArticleTemplate() : null);
    }

    private void postDMPvalue() {
        if (getTag() == null || getTag().equalsIgnoreCase("HOME") || getTag().equalsIgnoreCase("LATEST") || getTag().equalsIgnoreCase("NEWS") || getTag().equalsIgnoreCase("TRENDING") || getTag().equalsIgnoreCase("MY READS") || getTag().equalsIgnoreCase("Tag_Story_Detail") || getTag().equalsIgnoreCase("Tag_Section") || getTag().equalsIgnoreCase("Tag_Indice_News_Detail")) {
            return;
        }
        com.htmedia.mint.utils.o1.a("TAG", getTag().toUpperCase() + " else");
    }

    private void postScreenEvent(Section section) {
        String str;
        String str2;
        String str3;
        String id2 = section.getId();
        if (id2 != null) {
            String[] strArr = com.htmedia.mint.utils.q.d;
            if (id2.equalsIgnoreCase(strArr[6]) && id2.equalsIgnoreCase(strArr[15])) {
                return;
            }
            String url = section.getUrl();
            if (id2.equalsIgnoreCase(strArr[2])) {
                if (section.getUrl().contains("http")) {
                    str3 = section.getUrl();
                } else {
                    str3 = this.serverUrl + section.getUrl();
                }
                url = str3 + getArguments().getString("topicName").replaceAll(" ", "%20");
            } else if (id2.equalsIgnoreCase(strArr[12])) {
                if (section.getUrl().contains("http")) {
                    str2 = section.getUrl();
                } else {
                    str2 = this.serverUrl + section.getUrl();
                }
                url = String.format(str2, getArguments().getString("author_name").trim().replaceAll(" ", "%20"));
            } else if (id2.equalsIgnoreCase(strArr[13])) {
                if (section.getUrl().contains("http")) {
                    str = section.getUrl();
                } else {
                    str = this.serverUrl + section.getUrl();
                }
                String string = getArguments().getString("column_name");
                if (string != null) {
                    url = str + string.trim().replaceAll(" ", "%20");
                }
            } else if (getArguments() != null && getArguments().containsKey("is_from_left_nav")) {
                url = this.serverUrlwithLeftSection + url;
            } else if (!url.contains("http")) {
                url = this.serverUrl + url;
            }
            String str4 = url;
            com.htmedia.mint.utils.o1.a("postScreenEvent URL", str4);
            com.htmedia.mint.utils.n.B(getActivity(), com.htmedia.mint.utils.n.U0, str4, isForYouURL(section) ? "home" : "topic_page", null, getArguments().containsKey(com.htmedia.mint.utils.n.X) ? getArguments().getString(com.htmedia.mint.utils.n.X) : null, this.articleOpenType, this.isTopStory, BuildConfig.FLAVOR);
        }
    }

    private void progressBarVisible(Content content) {
        if (content == null || this.binding.u == null || getActivity() == null) {
            return;
        }
        if (content.isShowListenButton() || j5.b.e.a().equalsIgnoreCase(content.getType())) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    StoryDetailViewFragment.this.lambda$progressBarVisible$1();
                }
            });
        } else {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    StoryDetailViewFragment.this.lambda$progressBarVisible$2();
                }
            });
        }
    }

    private void refreshList() {
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView == null || this.recyclerViewAdapter == null) {
            return;
        }
        recyclerView.post(new Runnable() {
            @Override
            public void run() {
                StoryDetailViewFragment.this.recyclerViewAdapter.notifyItemInserted(r0.list.size() - 1);
            }
        });
    }

    private void removeBlankListElement(ArrayList<ListElement> arrayList) {
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        Iterator<ListElement> it = arrayList.iterator();
        while (it.hasNext()) {
            ListElement next = it.next();
            if (next != null) {
                boolean equalsIgnoreCase = g7.o.PARAGRAPH.a().equalsIgnoreCase(next.getType());
                String str = BuildConfig.FLAVOR;
                if (equalsIgnoreCase) {
                    if (next.getParagraph() != null && !TextUtils.isEmpty(next.getParagraph().getBody())) {
                        str = next.getParagraph().getBody();
                    }
                    if (TextUtils.isEmpty(str) || (!TextUtils.isEmpty(str) && (str.trim().length() == 0 || str.trim().equalsIgnoreCase("<p></p>") || str.trim().equalsIgnoreCase("<p> </p>")))) {
                        it.remove();
                    }
                } else if (g7.o.EMBED.a().equalsIgnoreCase(next.getType())) {
                    if (next.getEmbed() != null && !TextUtils.isEmpty(next.getEmbed().getBody())) {
                        str = next.getEmbed().getBody();
                    }
                    if (TextUtils.isEmpty(str) && !next.isAffiliatedAds()) {
                        it.remove();
                    }
                }
            }
        }
    }

    private List<Content> removeWsjFromPreinum(List<Content> list) {
        Iterator<Content> it = list.iterator();
        while (it.hasNext()) {
            Content next = it.next();
            if (next.getMetadata() != null && next.getMetadata().getAgency() != null && next.getMetadata().getAgency().equalsIgnoreCase("wsj")) {
                it.remove();
            }
        }
        return list;
    }

    private void reset() {
        ArrayList<Content> arrayList = this.list;
        if (arrayList != null) {
            arrayList.clear();
        }
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
        this.lastDataSize = 0;
        this.pageNo = 0;
        u7.q.q0();
        q4.t();
        this.isDailyNewsLetterAdded = false;
        this.isEpaperAdded = false;
    }

    private void runPianoExperience(String str, ForyouPojo foryouPojo) {
        if (this.pianoCallbacks == null) {
            this.pianoCallbacks = new PianoCallbacks(getActivity(), this);
        }
        this.pianoCallbacks.setForyouPojo(foryouPojo);
        this.pianoCallbacks.setUrl(str);
        if (foryouPojo == null || foryouPojo.getContentList() == null || foryouPojo.getContentList().size() <= 0 || !str.contains("search=id:") || foryouPojo.getContentList().size() != 1 || foryouPojo.getContentList().get(0).getListElement() == null) {
            return;
        }
        Content content = foryouPojo.getContentList().get(0);
        content.getType();
        Metadata metadata = content.getMetadata();
        if (metadata != null) {
            String url = metadata.getUrl();
            if (!url.startsWith("http")) {
                Config config = this.config;
                url = (config != null ? config.getServerUrl() : "https://www.livemint.com") + url;
            }
            String str2 = url;
            String str3 = metadata.isPremiumStory() ? "premium" : "non-premium";
            String section = metadata.getSection();
            ArrayList arrayList = new ArrayList();
            arrayList.add("storydetail");
            arrayList.add(str3);
            this.pianoCallbacks.checkUserScope(section, arrayList, str2, (HashMap) null, content);
        }
    }

    public void scrollDepthAnalyticsTracking() {
        int i;
        int i2;
        int i3;
        int i4;
        if (!this.is25Done && (i4 = this.lastProgress) >= 0 && i4 <= 25) {
            com.htmedia.mint.utils.n.c(getContext(), com.htmedia.mint.utils.n.O2, BuildConfig.FLAVOR, BuildConfig.FLAVOR, this.content, com.htmedia.mint.utils.n.P2, com.htmedia.mint.utils.n.U2);
            n4.b.D(this.content, com.htmedia.mint.utils.n.P2);
            this.is25Done = true;
        } else if (!this.is50Done && (i3 = this.lastProgress) >= 26 && i3 <= 50) {
            com.htmedia.mint.utils.n.c(getContext(), com.htmedia.mint.utils.n.O2, BuildConfig.FLAVOR, BuildConfig.FLAVOR, this.content, com.htmedia.mint.utils.n.Q2, com.htmedia.mint.utils.n.U2);
            n4.b.D(this.content, com.htmedia.mint.utils.n.Q2);
            this.is50Done = true;
        } else if (!this.is75Done && (i2 = this.lastProgress) >= 51 && i2 <= 75) {
            com.htmedia.mint.utils.n.c(getContext(), com.htmedia.mint.utils.n.O2, BuildConfig.FLAVOR, BuildConfig.FLAVOR, this.content, com.htmedia.mint.utils.n.R2, com.htmedia.mint.utils.n.U2);
            n4.b.D(this.content, com.htmedia.mint.utils.n.R2);
            this.is75Done = true;
        } else if (!this.is100Done && (i = this.lastProgress) >= 76 && i <= 100) {
            com.htmedia.mint.utils.n.c(getContext(), com.htmedia.mint.utils.n.O2, BuildConfig.FLAVOR, BuildConfig.FLAVOR, this.content, com.htmedia.mint.utils.n.S2, com.htmedia.mint.utils.n.U2);
            n4.b.D(this.content, com.htmedia.mint.utils.n.S2);
            this.is100Done = true;
        }
        if (this.lastProgress >= 50) {
            this.isContinueReadDelete = false;
        }
    }

    private void sendAnalyticEventForMarket(Section section) {
        if (getArguments().getString("MARKET_TAB_KEY") != null) {
            if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("MARKET")) {
                com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.I2, this.storyUrl, (getString(2131952182) + "-" + getString(2131952186)).toLowerCase(), null, "market/market_dashboard");
                return;
            }
            if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("STOCKS")) {
                com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.I2, this.storyUrl, (getString(2131952182) + "-" + getString(2131952569)).toLowerCase(), null, "market/market_dashboard");
                return;
            }
            if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("MUTUAL_FUNDS")) {
                com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.I2, this.storyUrl, (getString(2131952182) + "-" + getString(2131952266)).toLowerCase(), null, "market/market_dashboard");
            }
        }
    }

    public void sendAnalyticsEventForAB(Activity activity, LinearLayoutManager linearLayoutManager, g7.q qVar) {
        if (linearLayoutManager == null || qVar == null) {
            return;
        }
        int findFirstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = linearLayoutManager.findLastVisibleItemPosition();
        linearLayoutManager.findFirstCompletelyVisibleItemPosition();
        linearLayoutManager.findLastCompletelyVisibleItemPosition();
        if (findFirstVisibleItemPosition >= findLastVisibleItemPosition || findLastVisibleItemPosition <= 0 || findLastVisibleItemPosition >= qVar.getItemCount()) {
            return;
        }
        int i = 0;
        for (int i2 = findFirstVisibleItemPosition; i2 <= findLastVisibleItemPosition; i2++) {
            ListElement listElement = qVar.h().get(i2);
            if (listElement != null && listElement.getWidgetType() != null) {
                g7.o storyListElement = listElement.getStoryListElement();
                if (i2 == findFirstVisibleItemPosition) {
                    if (storyListElement != null) {
                        switch (AnonymousClass12.$SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[storyListElement.ordinal()]) {
                            case 10:
                            case 11:
                                sendAnalyticsEvents(activity, 30, true, true, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.f2, listElement, this.content);
                                break;
                            case 12:
                            case 13:
                                sendAnalyticsEvents(activity, 60, true, true, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.V1, listElement, this.content);
                                break;
                        }
                    }
                } else if (i2 == findLastVisibleItemPosition) {
                    if (storyListElement != null) {
                        switch (AnonymousClass12.$SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[storyListElement.ordinal()]) {
                            case 10:
                            case 11:
                                sendAnalyticsEvents(activity, 30, true, false, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.f2, listElement, this.content);
                                break;
                            case 12:
                            case 13:
                                sendAnalyticsEvents(activity, 60, true, false, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.V1, listElement, this.content);
                                break;
                        }
                    }
                } else if (storyListElement != null) {
                    switch (AnonymousClass12.$SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[storyListElement.ordinal()]) {
                        case 10:
                        case 11:
                            sendAnalyticsEvents(activity, 30, false, false, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.f2, listElement, this.content);
                            break;
                        case 12:
                        case 13:
                            sendAnalyticsEvents(activity, 60, false, false, this.binding.c.getChildAt(i), i2, com.htmedia.mint.utils.n.V1, listElement, this.content);
                            break;
                    }
                }
            }
            i++;
        }
    }

    private void sendAnalyticsEvents(Activity activity, int i, boolean z, boolean z2, View view, int i2, String str, ListElement listElement, Content content) {
        int height;
        WidgetType widgetType;
        if (view == null || (height = view.getHeight()) <= 0) {
            return;
        }
        if (!(z ? isSeventyPercentCrossed(z2, view, i, height) : true) || (widgetType = listElement.getWidgetType()) == null) {
            return;
        }
        String title = widgetType.getTitle();
        String str2 = TextUtils.isEmpty(title) ? BuildConfig.FLAVOR : title;
        String template = widgetType.getTemplate();
        String str3 = TextUtils.isEmpty(template) ? BuildConfig.FLAVOR : template;
        int position = widgetType.getPosition();
        if (widgetType.isSendEvent()) {
            return;
        }
        sendAnalyticsEventsForAB(activity, str2, i2, str, content, str3, position);
        widgetType.setSendEvent(true);
    }

    private void sendAnalyticsEventsForAB(Activity activity, String str, int i, String str2, Content content, String str3, int i2) {
        com.htmedia.mint.utils.n.f0(activity, str2, com.htmedia.mint.utils.n.m0, com.htmedia.mint.utils.n.k(activity), str3, i2, content, BuildConfig.FLAVOR, str, BuildConfig.FLAVOR, BuildConfig.FLAVOR, String.valueOf(1 + i));
    }

    private void sendScreenLoadEvent() {
        if (AppController.V || StoryDetailFragment.START_TIME <= 0) {
            return;
        }
        String valueOf = String.valueOf(System.currentTimeMillis() - StoryDetailFragment.START_TIME);
        if (valueOf.length() <= 4) {
            com.htmedia.mint.utils.n.C(getActivity(), com.htmedia.mint.utils.n.S0, "storyDetail", valueOf);
        }
        StoryDetailFragment.START_TIME = 0L;
    }

    private List<Content> setAds(List<Content> list) {
        int i;
        if (this.adsIndex <= 0) {
            return list;
        }
        int size = list.size();
        this.actualContentSize += size;
        ArrayList arrayList = new ArrayList();
        List<String> bannerAdIds = this.appController.g().getAdsAndroid().getBannerAdIds();
        int templeteIndex = this.section.getTemplate() != null ? getTempleteIndex(this.section.getTemplate()) : 1;
        if (this.section.getDesign() != null) {
            templeteIndex = getTempleteIndex(this.section.getDesign());
        }
        if (this.adsCounter >= 2 && templeteIndex == 0) {
            this.adsIndex = 7;
        }
        com.htmedia.mint.utils.o1.a("TAG adcounter", "adsCounter: " + this.adsCounter + " adsIndex: " + this.adsIndex);
        for (int i2 = 1; i2 <= size; i2++) {
            Content content = list.get(i2 - 1);
            if (content != null && content.getListElement() != null && content.getListElement().size() > 0) {
                FirebaseCrashlytics.getInstance().log("E/LIST_ELEMENTS_AVAILABLE: Story Id:" + content.getId());
            }
            content.setWebPageId(UUID.randomUUID().toString());
            arrayList.add(content);
            int i3 = this.lastDataSize + i2;
            if (i3 % this.adsIndex == 0) {
                this.prvIndex = i3;
                if (this.adsCounter >= bannerAdIds.size()) {
                    this.adsCounter = 0;
                }
                Content content2 = new Content();
                content2.setType(j5.b.r.a());
                content2.setId(this.adsCounter);
                arrayList.add(content2);
                if (this.adsCounter > 0 && (i = this.brandedStoryCount) < 3) {
                    if (i == 0) {
                        this.brandStoryMap.put(Integer.valueOf(this.list.size() + arrayList.size() + 1), Boolean.FALSE);
                        this.brandedStoryCount++;
                    } else if (i == 1) {
                        this.brandStoryMap.put(Integer.valueOf(this.list.size() + arrayList.size() + 3), Boolean.FALSE);
                        this.brandedStoryCount++;
                    } else if (i == 2) {
                        this.brandStoryMap.put(Integer.valueOf(this.list.size() + arrayList.size() + 2), Boolean.FALSE);
                        this.brandedStoryCount++;
                    }
                }
                if (this.adsCounter == 0 && this.pageNo == 0) {
                    Content content3 = new Content();
                    content3.setType(j5.b.y.a());
                    arrayList.add(content3);
                }
                this.adsCounter++;
            }
        }
        if (list.size() < this.adsIndex && list.size() > 2 && this.adsCounter == 0 && this.pageNo == 0) {
            int size2 = list.size() - 1;
            Content content4 = new Content();
            content4.setType(j5.b.y.a());
            arrayList.add(size2, content4);
        }
        this.lastDataSize = this.actualContentSize % this.adsIndex;
        return arrayList;
    }

    private void setContentData(ForyouPojo foryouPojo, String str) {
        if (this.section.getId().equals("DAILY_DIGEST")) {
            this.section.setDisplayName(foryouPojo.getName() != null ? foryouPojo.getName() : BuildConfig.FLAVOR);
            getActivity().j4(this.section.getDisplayName(), false);
        }
        this.binding.A.setVisibility(8);
        this.binding.A.stopShimmerAnimation();
        SwipeRefreshLayout swipeRefreshLayout = this.binding.o;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setRefreshing(false);
        }
        if (this.pinnedArticleList == null) {
            this.pinnedArticleList = new ArrayList<>();
        }
        if (foryouPojo.getPinnedArticles() != null && foryouPojo.getPinnedArticles().size() > 0) {
            this.pinnedArticleList.addAll(foryouPojo.getPinnedArticles());
        }
        if (foryouPojo.getPersonalizeCheck() != null) {
            this.isPersonalizeCheck = foryouPojo.getPersonalizeCheck();
        }
        setStoryData(foryouPojo, str);
    }

    public void setContextualTargetPojo() {
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            if (adapter instanceof q7.h0) {
                ((q7.h0) adapter).o(this.contextualID);
            } else if (adapter instanceof q4) {
                ((q4) adapter).u(this.contextualID);
            }
        }
    }

    private boolean setEventFalse(int i, int i2, int i3, ArrayList<ListElement> arrayList) throws Exception {
        ListElement listElement;
        g7.o storyListElement;
        int i4;
        if (i > i2) {
            return false;
        }
        while (i <= i2) {
            if (i < i3 && (listElement = arrayList.get(i)) != null && (storyListElement = listElement.getStoryListElement()) != null && ((i4 = AnonymousClass12.$SwitchMap$com$htmedia$mint$storydatailpage$StoryDetailPageConstants$STORY_LIST_ELEMENTS[storyListElement.ordinal()]) == 1 || i4 == 2 || i4 == 4 || i4 == 5 || i4 == 6 || i4 == 8 || i4 == 9)) {
                return true;
            }
            i++;
        }
        return false;
    }

    public void setPayWallIndexForStory(List<ListElement> list) {
        ListElement listElement;
        int size = list != null ? list.size() : 0;
        if (size > 0 && (listElement = list.get(0)) != null && q.e0.PAYWALL.a().equalsIgnoreCase(listElement.getType())) {
            list.remove(0);
            this.content.setPaywallElementOnDetail(false);
            return;
        }
        for (int i = 0; i < size; i++) {
            ListElement listElement2 = list.get(i);
            if (listElement2 != null && q.e0.PAYWALL.a().equalsIgnoreCase(listElement2.getType())) {
                this.content.setPaywallElementOnDetail(true);
                this.content.setPaywallIndex(i + 1);
                return;
            }
        }
        this.content.setPaywallElementOnDetail(false);
    }

    private void setPaywallTypeInContent(Content content) {
        if (this.pianoResponse == null || content == null || !j5.b.b.a().equalsIgnoreCase(content.getType())) {
            return;
        }
        PianoAppConstant.PIANO_STORY_TYPES pianoStoryTypes = this.pianoResponse.getPianoStoryTypes();
        if (pianoStoryTypes != null && pianoStoryTypes == PianoAppConstant.PIANO_STORY_TYPES.UNLOCK_ARTICLE) {
            pianoStoryTypes = checkForUnlockOrPremiumWall(this.pianoResponse, content);
        }
        if (pianoStoryTypes != null) {
            switch (AnonymousClass12.$SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[pianoStoryTypes.ordinal()]) {
                case 1:
                    parseResponseForPaywall(content, this.pianoResponse);
                    break;
                case 2:
                    parseResponseForPaywall(content, this.pianoResponse);
                    break;
                case 3:
                    parseResponseForFullStoryTemplate(content, this.pianoResponse);
                    break;
                case 4:
                    parseResponseArticleInTemplate(content, this.pianoResponse);
                    break;
                case 5:
                    parseResponseSkipLoginTemplate(content, this.pianoResponse);
                    break;
                case 6:
                    parseResponseUnlockArticleTemplate(content, this.pianoResponse);
                    break;
            }
            content.setPianoStoryTypes(pianoStoryTypes);
            com.htmedia.mint.utils.o1.a("Tag_Story_Detail", "***PIANO STORY TYPE***" + pianoStoryTypes);
        }
        n4.b.d = content.getMetadata() != null ? content.getMetadata().getSection() : BuildConfig.FLAVOR;
    }

    private void setPremiumStoryCampaign(Content content) {
        if (getActivity() != null) {
            getActivity().H3(content.getId() + BuildConfig.FLAVOR);
            if (content.getMetadata() != null && content.getMetadata().isPremiumStory()) {
                if (!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                    if (premiumDiscountOffer != null) {
                        getActivity().b4(content, premiumDiscountOffer, true);
                        this.isDiscountShowingInCurrentStory = true;
                        return;
                    } else {
                        getActivity().s4(content);
                        this.isDiscountShowingInCurrentStory = false;
                        return;
                    }
                }
                if (AppController.j().l() == null || AppController.j().l().isSubscriptionActive()) {
                    if (premiumDiscountOffer == null) {
                        this.isDiscountShowingInCurrentStory = false;
                        return;
                    } else {
                        getActivity().b4(content, premiumDiscountOffer, true);
                        this.isDiscountShowingInCurrentStory = true;
                        return;
                    }
                }
                if (premiumDiscountOffer != null) {
                    getActivity().b4(content, premiumDiscountOffer, true);
                    this.isDiscountShowingInCurrentStory = true;
                    return;
                } else {
                    getActivity().s4(content);
                    this.isDiscountShowingInCurrentStory = false;
                    return;
                }
            }
            if (!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                if (com.htmedia.mint.utils.f0.r) {
                    getActivity().b4(content, premiumDiscountOffer, false);
                    this.isDiscountShowingInCurrentStory = true;
                    return;
                }
                int i = com.htmedia.mint.utils.f0.q;
                if (i == 1 || i == 5 || i == 7) {
                    getActivity().b4(content, premiumDiscountOffer, false);
                    this.isDiscountShowingInCurrentStory = true;
                } else {
                    getActivity().w1();
                    this.isDiscountShowingInCurrentStory = false;
                }
                com.htmedia.mint.utils.f0.q++;
                return;
            }
            if (AppController.j().l() == null || AppController.j().l().isSubscriptionActive()) {
                return;
            }
            if (com.htmedia.mint.utils.f0.r) {
                getActivity().b4(content, premiumDiscountOffer, false);
                this.isDiscountShowingInCurrentStory = true;
                return;
            }
            int i2 = com.htmedia.mint.utils.f0.q;
            if (i2 == 1 || i2 == 5 || i2 == 7) {
                getActivity().b4(content, premiumDiscountOffer, false);
                this.isDiscountShowingInCurrentStory = true;
            } else {
                getActivity().w1();
                this.isDiscountShowingInCurrentStory = false;
            }
            com.htmedia.mint.utils.f0.q++;
        }
    }

    private List<Content> setPremiumUserAds(List<Content> list) {
        com.htmedia.mint.utils.o1.a("Tag_Story_Detail", "setPremiumUserAds: " + this.list.size());
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            Content content = list.get(i);
            if (com.htmedia.mint.utils.k.l(getContext()) == k.d.HOME && content.getType().equals(j5.b.f0.a()) && content.getSubType().equals(q.EnumC0038q.RFU_CAROUSEL.a())) {
                String type = list.get(i - 1).getType();
                j5.b bVar = j5.b.r;
                if (!type.equals(bVar.a())) {
                    Content content2 = new Content();
                    content2.setType(bVar.a());
                    content2.setOldUuid(com.htmedia.mint.utils.k.g(k.c.SUBSCRIPTION_BANNER, null));
                    arrayList.add(content2);
                    arrayList.add(content);
                }
            }
            if (com.htmedia.mint.utils.k.l(getContext()) == k.d.SECTION && i == 8) {
                String type2 = content.getType();
                j5.b bVar2 = j5.b.r;
                if (!type2.equals(bVar2.a())) {
                    com.htmedia.mint.utils.o1.a("Tag_Story_Detail", "setPremiumUserAds: abcde");
                    Content content3 = new Content();
                    content3.setType(bVar2.a());
                    content3.setOldUuid(com.htmedia.mint.utils.k.g(k.c.SUBSCRIPTION_BANNER, null));
                    arrayList.add(content3);
                }
            }
            arrayList.add(content);
        }
        return arrayList;
    }

    private void setStoryContentData(Config config, ForyouPojo foryouPojo, String str) {
        if (config == null) {
            config = AppController.j().g();
        }
        if (!((config == null || config.getPiano() == null || !config.getPiano().isPaywallExperience()) ? false : true)) {
            setContentData(foryouPojo, str);
            return;
        }
        if (CheckSubscriptionFromLocal.isSubscribedUser(getActivity())) {
            setContentData(foryouPojo, str);
        } else if (isStoryContentAndRunPiano(foryouPojo, str)) {
            runPianoExperience(str, foryouPojo);
        } else {
            setContentData(foryouPojo, str);
            runPianoExperience(str, foryouPojo);
        }
    }

    private List<Content> setTopicTagListing(List<Content> list) {
        com.htmedia.mint.utils.o1.a("TAG data", this.adsCounter + "   page " + this.pageNo);
        if (list.size() >= 5 || list.size() <= 2) {
            for (int i = 0; i < list.size(); i++) {
                if (i == 4 && this.pageNo == 0) {
                    Content content = new Content();
                    content.setType(j5.b.y.a());
                    list.add(content);
                }
            }
        } else {
            int size = list.size() - 1;
            Content content2 = new Content();
            content2.setType(j5.b.y.a());
            list.add(size, content2);
        }
        return list;
    }

    public String setUpEmbedKeysAndData(Content content) {
        String str;
        String str2;
        String str3 = BuildConfig.FLAVOR;
        if (content == null || !content.isContainAffiliateEmbed() || content.getListElement() == null || content.getListElement().size() <= 0) {
            return BuildConfig.FLAVOR;
        }
        ArrayList arrayList = new ArrayList();
        HashMap<String, BrandProductItem> hashMap = new HashMap<>();
        ArrayList<String> c = g7.s.c(content.getListElement(), g7.m.AMAZON);
        if (c == null || c.size() <= 0) {
            str = BuildConfig.FLAVOR;
        } else {
            str = TextUtils.join(",", c);
            arrayList.addAll(c);
        }
        ArrayList<String> c2 = g7.s.c(content.getListElement(), g7.m.FLIPKART);
        if (c2 == null || c2.size() <= 0) {
            str2 = BuildConfig.FLAVOR;
        } else {
            str2 = TextUtils.join(",", c2);
            arrayList.addAll(c2);
        }
        ArrayList<String> c3 = g7.s.c(content.getListElement(), g7.m.CROMA);
        if (c3 != null && c3.size() > 0) {
            str3 = TextUtils.join(",", c3);
            arrayList.addAll(c3);
        }
        if (arrayList.size() > 0) {
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                hashMap.put((String) it.next(), null);
            }
        }
        g7.e.c().e(hashMap);
        return "amazonIds=" + str + "&flipkartIds=" + str2 + "&cromaIds=" + str3;
    }

    private void showBottomSheet() {
        Snackbar.make(this.binding.i, BuildConfig.FLAVOR, 0).getView().addView(((LayoutInflater) getActivity().getSystemService("layout_inflater")).inflate(2131624073, (ViewGroup) null), 0);
    }

    public void showCouponDialogue(String str, Content content) {
        if (getActivity() == null || com.htmedia.mint.utils.f0.G1(getActivity(), "userName") == null) {
            String string = (getArguments() == null || !getArguments().containsKey("coupon_url")) ? BuildConfig.FLAVOR : getArguments().getString("coupon_url");
            if (TextUtils.isEmpty(str) || content == null) {
                return;
            }
            if (string.contains(BuildConfig.FLAVOR + content.getId())) {
                openRecipentBottomSheetWithData(false);
                return;
            }
            return;
        }
        String string2 = (getArguments() == null || !getArguments().containsKey("coupon_url")) ? BuildConfig.FLAVOR : getArguments().getString("coupon_url");
        if (TextUtils.isEmpty(str) || content == null) {
            return;
        }
        if (!string2.contains(BuildConfig.FLAVOR + content.getId()) || getActivity() == null) {
            return;
        }
        if (com.htmedia.mint.utils.h1.a(content.getId() + BuildConfig.FLAVOR, com.htmedia.mint.utils.g1.b().a())) {
            content.setFullStoryFromGiftCoupon(true);
            updateAndRefreshList(content);
            return;
        }
        if (this.appController != null && com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null && this.appController.l() == null) {
            redeemGift(str, content.getId() + BuildConfig.FLAVOR);
            return;
        }
        if (getActivity() == null || !com.htmedia.mint.utils.h1.d(AppController.j(), getActivity(), content)) {
            return;
        }
        redeemGift(str, content.getId() + BuildConfig.FLAVOR);
    }

    private void showToastOnUITheard(final String str) {
        if (getActivity() != null) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText((Context) StoryDetailViewFragment.this.getActivity(), (CharSequence) str, 0).show();
                }
            });
        }
    }

    public void smoothScrollToTop(RecyclerView recyclerView, int i) {
        if (recyclerView == null || recyclerView.getAdapter() == null) {
            return;
        }
        LinearLayoutManager layoutManager = recyclerView.getLayoutManager();
        int max = Math.max(0, Math.min(i, recyclerView.getAdapter().getItemCount() - 1));
        if (layoutManager != null) {
            SCROLL_THRESHOLD = 0;
            layoutManager.scrollToPositionWithOffset(max, 0);
        }
    }

    public void submitAffiliatesCodeGetData(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.affiliateAdsPresenter = new t6.a(getActivity(), this);
        Config config = this.config;
        String getItemsUrl = (config == null || config.getAffiliateAdUrls() == null || TextUtils.isEmpty(this.config.getAffiliateAdUrls().getGetItemsUrl())) ? BuildConfig.FLAVOR : this.config.getAffiliateAdUrls().getGetItemsUrl();
        if (TextUtils.isEmpty(getItemsUrl)) {
            return;
        }
        this.affiliateAdsPresenter.c(0, "Tag_Story_Detail", getItemsUrl + str, null, this.headers, false, false);
    }

    private void submitLtsToServer(PianoResponse pianoResponse) {
        k6.w1 w1Var = new k6.w1(getActivity(), this);
        Config config = this.config;
        String blockingSamplingLts = (config == null || config.getSubscription() == null || this.config.getSubscription().getBlockingSamplingLts() == null) ? BuildConfig.FLAVOR : this.config.getSubscription().getBlockingSamplingLts();
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("clientIdOrFingerPrint", com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null ? com.htmedia.mint.utils.f0.G1(getActivity(), "userClient") : f6.d.b(getActivity()));
            if (!"Empty".equalsIgnoreCase(PianoResponse.getLtsPiano())) {
                jSONObject.put("lts", PianoResponse.getLtsPiano());
            }
            jSONObject.put("referrer", "LM");
            jSONObject.put("platform", LogSubCategory.LifeCycle.ANDROID);
        } catch (Exception e) {
            e.printStackTrace();
        }
        w1Var.a(1, "LtsUser", blockingSamplingLts, jSONObject, new HashMap<>(), false, false);
    }

    private ArrayList<ListElement> updateListElement(Content content, ArrayList<ListElement> arrayList) {
        ArrayList<ListElement> arrayList2 = arrayList != null ? (ArrayList) arrayList.clone() : new ArrayList<>();
        removeBlankListElement(arrayList2);
        if (content != null && content.getMetadata() != null && !TextUtils.isEmpty(content.getMetadata().getDisclaimer())) {
            String str = "<i>" + content.getMetadata().getDisclaimer() + "<i>";
            ListElement listElement = new ListElement();
            Paragraph paragraph = new Paragraph();
            paragraph.setBody(str);
            listElement.setParagraph(paragraph);
            listElement.setType(g7.o.PARAGRAPH.a());
            arrayList2.add(listElement);
        }
        if (this.userSelectedPlan == null) {
            this.userSelectedPlan = i7.b.a().c().g();
        }
        g7.g gVar = new g7.g();
        Content h = gVar.h(content);
        com.htmedia.mint.utils.j.x(getActivity(), arrayList2, h);
        this.abWidgetHelper = new g7.a();
        if (getActivity() != null) {
            if (h != null && j5.b.b.a().equalsIgnoreCase(h.getType())) {
                AppCompatActivity appCompatActivity = (AppCompatActivity) getActivity();
                j.q0 I = com.htmedia.mint.utils.j.I(appCompatActivity, h, this.abWidgetHelper);
                boolean e = gVar.e(I, h);
                this.abWidgetHelper.B(getActivity(), h, arrayList2, e);
                Config config = this.config;
                ArrayList<ListElement> c = gVar.c(appCompatActivity, h, arrayList2, I, (config == null || config.getStandardization() == null || this.config.getStandardization().getMobilePaywallAndroid() == null || this.config.getStandardization().getMobilePaywallAndroid().getIntegratedPaywall() == null || !this.config.getStandardization().getMobilePaywallAndroid().getIntegratedPaywall().isPaywallEnabledV1()) ? false : true);
                this.userSelectedPlan.m(gVar.b());
                ArrayList<ListElement> updateListElementForContent = updateListElementForContent(h, c, e);
                this.storyLastIndex = findStoryLastItem(updateListElementForContent);
                progressBarVisible(h);
                return updateListElementForContent;
            }
            if (h != null && j5.b.e.a().equalsIgnoreCase(h.getType())) {
                this.abWidgetHelper.B(getActivity(), h, arrayList2, true);
                ArrayList<ListElement> updateListElementForLiveBlog = updateListElementForLiveBlog(updateListElementForContent(h, arrayList2, true));
                this.storyLastIndex = findStoryLastItem(updateListElementForLiveBlog);
                progressBarVisible(h);
                return updateListElementForLiveBlog;
            }
        }
        this.abWidgetHelper.B(getActivity(), h, arrayList2, true);
        ArrayList<ListElement> updateListElementForContent2 = updateListElementForContent(h, arrayList2, true);
        progressBarVisible(h);
        this.storyLastIndex = findStoryLastItem(updateListElementForContent2);
        return updateListElementForContent2;
    }

    private ArrayList<ListElement> updateListElementForContent(Content content, ArrayList<ListElement> arrayList, boolean z) {
        ListElement h;
        if (arrayList == null) {
            arrayList = new ArrayList<>();
        }
        ArrayList<ListElement> arrayList2 = arrayList;
        if (!arrayList2.isEmpty()) {
            ListElement listElement = new ListElement();
            if (content != null) {
                boolean z2 = (content.getLeadMedia() == null || content.getLeadMedia().getImage() == null || !content.getLeadMedia().getImage().isVerticalImage()) ? false : true;
                String verticalImage = (content.getLeadMedia() == null || content.getLeadMedia().getImage() == null || content.getLeadMedia().getImage().getImages() == null || TextUtils.isEmpty(content.getLeadMedia().getImage().getImages().getVerticalImage())) ? BuildConfig.FLAVOR : content.getLeadMedia().getImage().getImages().getVerticalImage();
                boolean z3 = content.getMetadata() != null && content.getMetadata().isPremiumStory();
                ArrayList<ListElement> c = g7.c.c(getActivity(), z3, content.getType(), this.config, arrayList2, content.isConvertedListicle());
                if (j5.b.e.a().equalsIgnoreCase(content.getType()) && !TextUtils.isEmpty(content.getIntroBody())) {
                    ListElement listElement2 = new ListElement();
                    g7.o oVar = g7.o.LIVE_BLOG_TEXT;
                    listElement2.setStoryListElement(oVar);
                    listElement2.setType(oVar.a());
                    c.add(0, listElement2);
                }
                checkTableOfContentAndAdd(c, content);
                if (!z2 || TextUtils.isEmpty(verticalImage)) {
                    if (z3) {
                        g7.o oVar2 = g7.o.PREMIUM_STORY_TOP_CONTENT;
                        listElement.setStoryListElement(oVar2);
                        listElement.setType(oVar2.a());
                    } else {
                        g7.o oVar3 = g7.o.TOP_CONTENT;
                        listElement.setStoryListElement(oVar3);
                        listElement.setType(oVar3.a());
                    }
                    ListElement addGiftingBanner = addGiftingBanner(content, false);
                    if (addGiftingBanner != null) {
                        c.add(0, addGiftingBanner);
                    }
                    c.add(0, listElement);
                    if (StoryDetailFragment.CURRENT_STORY_ID.equalsIgnoreCase(BuildConfig.FLAVOR + content.getId()) && (h = g7.c.h(getActivity(), this.config, content)) != null) {
                        c.add(0, h);
                    }
                    ListElement i = g7.c.i(this.config);
                    if (i != null) {
                        c.add(0, i);
                    }
                } else {
                    this.isVerticalStory = true;
                    g7.o oVar4 = g7.o.VERTICAL_IMAGE_TOP_CONTENT;
                    listElement.setStoryListElement(oVar4);
                    listElement.setType(oVar4.a());
                    RecyclerView recyclerView = this.binding.c;
                    if (recyclerView != null) {
                        listElement.setHeightOfView(recyclerView.getHeight() - com.htmedia.mint.utils.f0.a0(55));
                    }
                    g7.c.a(getActivity(), this.config, listElement, content);
                    g7.c.b(this.config, listElement);
                    ListElement listElement3 = new ListElement();
                    g7.o oVar5 = g7.o.VERTICAL_SUMMARY;
                    listElement3.setStoryListElement(oVar5);
                    listElement3.setType(oVar5.a());
                    ListElement addGiftingBanner2 = addGiftingBanner(content, false);
                    if (addGiftingBanner2 != null) {
                        c.add(0, addGiftingBanner2);
                    }
                    c.add(0, listElement3);
                    c.add(0, listElement);
                }
                arrayList2 = c;
            }
            Iterator<ListElement> it = arrayList2.iterator();
            int i2 = 0;
            while (it.hasNext()) {
                ListElement next = it.next();
                if (!TextUtils.isEmpty(next.getType())) {
                    if (next.getType().equalsIgnoreCase("quote")) {
                        if (!TextUtils.isEmpty(next.getQuoteDesign())) {
                            if (next.getQuoteDesign().equalsIgnoreCase("Bold")) {
                                next.setType(g7.o.QUOTE_DESIGN_BOLD.a());
                            } else if (next.getQuoteDesign().equalsIgnoreCase("Circular")) {
                                next.setType(g7.o.QUOTE_DESIGN_CIRCULAR.a());
                            } else if (next.getQuoteDesign().equalsIgnoreCase("Normal")) {
                                next.setType(g7.o.QUOTE.a());
                            } else {
                                next.setType(g7.o.QUOTE.a());
                            }
                        }
                    } else if (next.getType().equalsIgnoreCase("contentheading")) {
                        next.setType(g7.o.CONTENTS_HEADING.a());
                    } else if (next.getType().equalsIgnoreCase("image")) {
                        if (next.getImage() != null && next.getImage().isOverImage()) {
                            next.setType(g7.o.OVER_IMAGE.a());
                        } else {
                            next.setType(g7.o.IMAGE.a());
                        }
                    } else if (next.getType().equalsIgnoreCase(j5.b.o.a())) {
                        StringBuilder sb2 = new StringBuilder();
                        i2++;
                        sb2.append(i2);
                        sb2.append(BuildConfig.FLAVOR);
                        next.setListicleCount(sb2.toString());
                    } else if (next.getType().equalsIgnoreCase(g7.o.EMBED.a()) && next.isAffiliatedAds()) {
                        next.setType(g7.o.AFFILIATE_WIDGET.a());
                    }
                }
            }
        }
        if (content == null || !content.isShowListenButton() || arrayList2.isEmpty()) {
            addStoryLastElement(content, arrayList2, -1, z);
        } else {
            com.htmedia.mint.utils.j.E(arrayList2, content);
            int size = arrayList2.size();
            ListElement listElement4 = !arrayList2.isEmpty() ? arrayList2.get(size - 1) : null;
            if (listElement4 == null || g7.o.BANNER_ADS != listElement4.getStoryListElement()) {
                addStoryLastElement(content, arrayList2, -1, z);
            } else {
                addStoryLastElement(content, arrayList2, size - 1, z);
            }
            ListElement listElement5 = new ListElement();
            g7.o oVar6 = g7.o.ABOUT_AUTHOR;
            listElement5.setStoryListElement(oVar6);
            listElement5.setType(oVar6.a());
            arrayList2.add(listElement5);
            deleteNullAuthorIdsAndBio(content);
            getAllFollowedAuthorId();
        }
        g7.a aVar = this.abWidgetHelper;
        if (aVar != null) {
            aVar.a(arrayList2);
        }
        ListElement listElement6 = new ListElement();
        g7.o oVar7 = g7.o.STORY_BOTTOM_VIEW;
        listElement6.setStoryListElement(oVar7);
        listElement6.setType(oVar7.a());
        arrayList2.add(listElement6);
        if (this.isBookmarkDetail) {
            if (this.bundle.containsKey("image_id")) {
                long j = this.bundle.getLong("image_id");
                if (j > 0) {
                    this.bookmarkImageIndex = findElementIdIndex(j, arrayList2);
                    content.setBookmarkImageId(j);
                }
            } else if (!TextUtils.isEmpty(this.imageDeeplinkElementId)) {
                this.bookmarkImageIndex = findElementIdIndexWRTImageUrl(this.imageDeeplinkElementId, arrayList2);
            }
        } else if (this.isImageDeeplink && !TextUtils.isEmpty(this.imageDeeplinkElementId)) {
            this.bookmarkImageIndex = findElementIdIndexWRTImageUrl(this.imageDeeplinkElementId, arrayList2);
        }
        return arrayList2;
    }

    private ArrayList<ListElement> updateListElementForLiveBlog(ArrayList<ListElement> arrayList) {
        ArrayList<ListElement> arrayList2 = new ArrayList<>();
        if (arrayList != null && arrayList.size() > 0) {
            Iterator<ListElement> it = arrayList.iterator();
            while (it.hasNext()) {
                ListElement next = it.next();
                if (next != null) {
                    arrayList2.add(next);
                    if (g7.o.LIVE_BLOG_CONTENT.a().equalsIgnoreCase(next.getType())) {
                        if (next.getLiveBlog() != null && next.getLiveBlog().getInlineElement() != null) {
                            arrayList2.add(next.getLiveBlog().getInlineElement());
                        }
                        ListElement listElement = new ListElement();
                        g7.o oVar = g7.o.LIVE_BLOG_CONTENT_BOTTOM_VIEW;
                        listElement.setType(oVar.a());
                        listElement.setStoryListElement(oVar);
                        arrayList2.add(listElement);
                    }
                }
            }
        }
        return arrayList2;
    }

    public void ShowOrRedeemCoupon() {
        if (getActivity() == null || !com.htmedia.mint.utils.h1.e(getActivity()) || this.content == null) {
            return;
        }
        if (com.htmedia.mint.utils.h1.a(this.content.getId() + BuildConfig.FLAVOR, com.htmedia.mint.utils.g1.b().a())) {
            this.content.setFullStoryFromGiftCoupon(true);
            updateAndRefreshList(this.content);
            return;
        }
        if (this.appController != null && com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null && this.appController.l() == null) {
            redeemGift(this.giftCode, this.content.getId() + BuildConfig.FLAVOR);
            return;
        }
        if (getActivity() == null || !com.htmedia.mint.utils.h1.d(AppController.j(), getActivity(), this.content)) {
            return;
        }
        redeemGift(this.giftCode, this.content.getId() + BuildConfig.FLAVOR);
    }

    public void authorFollowClickAndShowSnackBar(@Nullable String str) {
        if (getActivity() == null || !(getActivity() instanceof HomeActivity)) {
            return;
        }
        getActivity().n4(str);
    }

    public void bookmark(MenuItem menuItem) {
        ForyouPojo foryouPojo = this.forYouPojo;
        if (foryouPojo == null || foryouPojo.getContentList() == null || this.forYouPojo.getContentList().size() <= 0 || this.recyclerViewAdapter == null) {
            return;
        }
        Content content = this.forYouPojo.getContentList().get(0);
        u7.q.v0(content.getId() + BuildConfig.FLAVOR, menuItem, getActivity(), getActivity(), this.recyclerViewAdapter, false, (ArrayList) this.forYouPojo.getContentList(), content, null, false);
    }

    public void bookmarkStory(MenuItem menuItem) {
        bookmark(menuItem);
    }

    public void checkTheme(boolean z) {
        if (z) {
            this.binding.h.setBackgroundColor(getResources().getColor(2131100969));
            this.binding.v.setBackgroundColor(getResources().getColor(2131100945));
            this.binding.c.setBackgroundColor(getResources().getColor(2131100969));
            this.binding.i.setBackgroundColor(getResources().getColor(2131100969));
            this.binding.G.setTextColor(getResources().getColor(2131101009));
            this.binding.H.setTextColor(getResources().getColor(2131101009));
            this.binding.A.setShimmerColor(getResources().getColor(2131100802));
            this.binding.w.q.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.g.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.a.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.r.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.h.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.b.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.s.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.i.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.c.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.t.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.j.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.d.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.u.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.o.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.e.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.v.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.p.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.w.f.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.a.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.e.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.c.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.f.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.g.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.d.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.h.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.i.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.x.b.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.J.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.K.setBackgroundColor(getResources().getColor(2131100799));
            return;
        }
        this.binding.h.setBackgroundColor(getResources().getColor(2131100968));
        this.binding.v.setBackgroundColor(getResources().getColor(2131100944));
        this.binding.c.setBackgroundColor(getResources().getColor(2131101002));
        this.binding.i.setBackgroundColor(getResources().getColor(2131100968));
        this.binding.G.setTextColor(getResources().getColor(2131101008));
        this.binding.H.setTextColor(getResources().getColor(2131101008));
        this.binding.A.setShimmerColor(getResources().getColor(2131100801));
        this.binding.w.q.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.g.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.a.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.r.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.h.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.b.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.s.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.i.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.c.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.t.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.j.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.d.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.u.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.o.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.e.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.v.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.p.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.w.f.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.a.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.e.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.c.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.f.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.g.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.d.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.h.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.i.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.x.b.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.J.setBackgroundColor(getResources().getColor(2131100798));
        this.binding.K.setBackgroundColor(getResources().getColor(2131100798));
    }

    public Content content() {
        ForyouPojo foryouPojo = this.forYouPojo;
        if (foryouPojo == null || foryouPojo.getContentList() == null) {
            return null;
        }
        return this.forYouPojo.getContentList().get(0);
    }

    @Override
    public void fetchPremiumCounterMeter(PremiumStoryMeter premiumStoryMeter) {
        if (this.foryouPojo == null || TextUtils.isEmpty(this.strContentUrl)) {
            Toast.makeText((Context) getActivity(), (CharSequence) getResources().getString(2131952559), 0).show();
        } else {
            setStoryContentData(this.config, this.foryouPojo, this.strContentUrl);
        }
    }

    @Override
    public void getData(ContextualTargetPojo contextualTargetPojo) {
        ContextualTargetPojo.Targeting targeting;
        if (contextualTargetPojo == null || (targeting = contextualTargetPojo.getTargeting()) == null || targeting.getVndPrxSegments().size() <= 0) {
            return;
        }
        List<String> vndPrxSegments = targeting.getVndPrxSegments();
        this.contextualID = vndPrxSegments;
        com.htmedia.mint.utils.f0.T2(vndPrxSegments, "contextual_ids", getActivity());
        setContextualTargetPojo();
    }

    @Override
    public void getFetchDicisionResult(Default r1) {
    }

    public int getListSize() {
        return this.listSize;
    }

    public void getMeterValue(MeterModel meterModel) {
    }

    public void getPianoResponse(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
        this.pianoResponse = pianoResponse;
        boolean z = false;
        Content content = (foryouPojo == null || foryouPojo.getContentList() == null || foryouPojo.getContentList().isEmpty()) ? null : foryouPojo.getContentList().get(0);
        if (content != null && content.getMetadata() != null && content.getMetadata().isPremiumStory()) {
            z = true;
        }
        if (z) {
            setContentData(foryouPojo, str);
        }
        submitLtsToServer(pianoResponse);
    }

    @Override
    public void getResponse(com.htmedia.mint.pojo.storydetail.AffiliateAdsProductResponse r24) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.ui.fragments.StoryDetailViewFragment.getResponse(com.htmedia.mint.pojo.storydetail.AffiliateAdsProductResponse):void");
    }

    @Override
    public void getResponse(JSONObject jSONObject, String str) {
    }

    public String getScreenName() {
        Section section = this.section;
        return (section == null || section.getDisplayName() == null) ? BuildConfig.FLAVOR : this.section.getDisplayName();
    }

    public Section getSection() {
        return this.section;
    }

    public void getStoryData(ForyouPojo foryouPojo) {
    }

    @Override
    public void getStoryData(ForyouPojo foryouPojo, String str) {
        try {
            this.foryouPojo = foryouPojo;
            this.strContentUrl = str;
            this.list = (foryouPojo == null || foryouPojo.getContentList() == null) ? new ArrayList<>() : (ArrayList) foryouPojo.getContentList();
            Config g = AppController.j().g();
            ArrayList<Content> arrayList = this.list;
            Content content = (arrayList == null || arrayList.isEmpty() || this.list.size() <= 0) ? null : this.list.get(0);
            if (content != null && content.getMetadata() != null) {
                content.getMetadata().isPremiumStory();
            }
            if (content != null) {
                content.getId();
            }
            setStoryContentData(g, foryouPojo, str);
        } catch (Exception e) {
            e.printStackTrace();
            com.htmedia.mint.utils.o0.h(e, str, e.getMessage());
        }
    }

    public void handleTextSize(int i) {
        Config config;
        ForyouPojo foryouPojo = this.forYouPojo;
        if (foryouPojo == null || foryouPojo.getContentList() == null || this.forYouPojo.getContentList().size() <= 0 || this.recyclerViewAdapter == null) {
            return;
        }
        Content content = this.forYouPojo.getContentList().get(0);
        if ((CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) && (config = this.config) != null && config.getSponsoredBanner() != null && this.config.getSponsoredBanner().isSponsoredBanner()) || com.htmedia.mint.utils.f0.O1()) {
            i = 1;
        } else if (!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) || (AppController.j().l() != null && !AppController.j().l().isSubscriptionActive())) {
            i = 0;
        }
        u7.q.G(getActivity(), this.recyclerViewAdapter, i, content);
        com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.e2, "article_detail_page", content, BuildConfig.FLAVOR, "fonts");
    }

    public void initCall(Section section) {
        showNoInternetBackGround(false);
        if (section != null) {
            int templeteIndex = section.getTemplate() != null ? getTempleteIndex(section.getTemplate()) : 1;
            if (section.getDesign() != null) {
                templeteIndex = getTempleteIndex(section.getDesign());
            }
            if (templeteIndex == 0) {
                if (this.appController.g() != null) {
                    this.adsIndex = this.appController.g().getCardads();
                }
                this.binding.z.setVisibility(8);
                this.binding.y.setVisibility(0);
            } else {
                if (this.appController.g() != null) {
                    this.adsIndex = this.appController.g().getListads();
                }
                this.binding.z.setVisibility(0);
                this.binding.y.setVisibility(8);
            }
            this.binding.A.startShimmerAnimation();
            this.adsCounter = 0;
            this.brandedStoryCount = 0;
            com.htmedia.mint.utils.k.g = 0;
            this.brandStoryMap.clear();
            HashMap<String, String> hashMap = new HashMap<>();
            this.headers = hashMap;
            hashMap.put("Authorization", com.htmedia.mint.utils.q.a);
            findListingTemplate(this.headers, section);
        }
    }

    public void initObjects(Section section) {
        RecyclerView recyclerView;
        if (section != null) {
            if (this.list.size() <= 0) {
                this.homePresenter = new k6.g0(getActivity(), this);
                initCall(section);
                return;
            }
            setListBackgroundAsPerStoryType();
            RecyclerView.Adapter adapter = this.recyclerViewAdapter;
            if (adapter == null || (recyclerView = this.binding.c) == null) {
                return;
            }
            recyclerView.setAdapter(adapter);
        }
    }

    @Override
    public boolean isFreemium() {
        return super.isFreemium();
    }

    @Override
    public boolean isRFVTag() {
        return this.section.getId().equals("DAILY_DIGEST") || (getTag() != null && getTag().equals("FOR YOU"));
    }

    public void myAuthorNoDataFound() {
    }

    public void onAuthorFollowFollowingItemClick(ArrayList<Author> arrayList, Integer num, a.b bVar) {
        AppCompatActivity activity = getActivity();
        if (activity != null) {
            u4.j.a.b(activity);
            this.viewModel.O(u4.h.j(activity), arrayList, bVar, num.intValue(), BuildConfig.FLAVOR, false);
        }
    }

    public void onAuthorItemClick(@NonNull Author author, int i) {
        if (getActivity() == null || getActivity().getSupportFragmentManager() == null) {
            return;
        }
        u4.i.a.b(getActivity().getSupportFragmentManager(), author, true);
    }

    @Override
    public void onClick(View view) {
        int id2 = view.getId();
        if (id2 == 2131427754) {
            if (this.section == null || !com.htmedia.mint.utils.m0.a(getActivity())) {
                return;
            }
            showNoInternetBackGround(false);
            this.list.clear();
            initCall(this.section);
            return;
        }
        if (id2 != 2131431085) {
            return;
        }
        this.binding.C.setVisibility(8);
        SwipeRefreshLayout swipeRefreshLayout = this.binding.o;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setRefreshing(true);
        }
        reset();
        initCall(this.section);
        com.htmedia.mint.utils.n.N(getContext(), com.htmedia.mint.utils.n.Z1, "home", com.htmedia.mint.utils.n.k(HomeActivity.G0), null, BuildConfig.FLAVOR, "Refresh Button");
    }

    @Override
    public void onCloseButtonClick(int i, Content content) {
        if (content != null) {
            com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.z2, com.htmedia.mint.utils.n.m0, content, BuildConfig.FLAVOR, com.htmedia.mint.utils.n.c0);
            com.htmedia.mint.utils.f0.T("Close", BuildConfig.FLAVOR, content.getId() + BuildConfig.FLAVOR, getActivity());
            WebEngageAnalytices.trackArticleReadORClose(false, this.section.getDisplayName(), (String) null, content, this.origin);
        }
        collapseView(i);
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView != null) {
            recyclerView.scrollToPosition(i);
        }
        if (getActivity() != null && getActivity().i0.a.q != null) {
            getActivity().i0.a.q.setExpanded(true, true);
        }
        if (getActivity() != null) {
            getActivity().y4();
        }
        com.htmedia.mint.utils.k1.r(getActivity());
    }

    @Nullable
    public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        this.binding = uj.c(layoutInflater, viewGroup, false);
        this.viewModel = v4.c.a.b();
        getAllFollowedAuthorId();
        this.linearLayoutManager = new WrapContentLinearLayoutManager(getActivity());
        this.contextualTargetPresenter = new k6.t(getActivity(), this);
        this.binding.c.setLayoutManager(this.linearLayoutManager);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), 0, false);
        this.horizontalLayoutManager = linearLayoutManager;
        this.binding.v.setLayoutManager(linearLayoutManager);
        k7 k7Var = new k7(getActivity(), this.topicsList, this, 0);
        this.topNavTopicsAdapter = k7Var;
        this.binding.v.setAdapter(k7Var);
        this.binding.o.setOnRefreshListener(this);
        showErrorBackGround(BuildConfig.FLAVOR);
        if (getActivity() != null) {
            com.htmedia.mint.utils.f0.N1(getActivity());
        }
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(getActivity());
        this.mLinearLayoutManager = linearLayoutManager2;
        linearLayoutManager2.setOrientation(0);
        this.binding.B.c.setLayoutManager(this.mLinearLayoutManager);
        checkTheme(AppController.j().E());
        this.startTime = System.currentTimeMillis();
        this.meterModelTimer = new MeterModelTimer();
        this.lotameClass = new com.htmedia.mint.utils.q1(getActivity());
        this.marketHelperClass = new com.htmedia.mint.utils.r1();
        if (getActivity() != null) {
            getActivity().D3(new com.htmedia.mint.ui.activity.j1() {
                @Override
                public final void onRefresh() {
                    StoryDetailViewFragment.this.lambda$onCreateView$0();
                }
            });
        }
        return this.binding.getRoot();
    }

    public void onDestroy() {
        super.onDestroy();
        Content content = this.content;
        if (content != null) {
            if (this.isContinueRead) {
                AppController.O.h(content.getId(), this.content);
            }
            if (!this.isContinueReadDelete) {
                AppController.O.f(this.content.getId() + BuildConfig.FLAVOR);
            }
        }
        ArrayList arrayList = HomeActivity.H0;
        if (arrayList != null && arrayList.size() > 0) {
            HomeActivity.H0.clear();
            HomeActivity.E0 = 0;
        }
        PopupWindow popupWindow2 = popupWindow;
        if (popupWindow2 == null || !popupWindow2.isShowing()) {
            popupWindow = null;
        } else {
            popupWindow.dismiss();
        }
        if (getActivity() != null) {
            getActivity().D3((com.htmedia.mint.ui.activity.j1) null);
        }
    }

    @Override
    public void onError(String str) {
    }

    @Override
    public void onError(String str, String str2) {
        com.htmedia.mint.utils.o1.a("On error url", str2 + "-----" + str);
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            if (adapter instanceof q7.h0) {
                ((q7.h0) adapter).q(true);
            } else if (adapter instanceof q4) {
                ((q4) adapter).C(true);
            }
        }
        if (str2.contains("/search/story")) {
            RecyclerView.Adapter adapter2 = this.recyclerViewAdapter;
            if (adapter2 != null) {
                adapter2.notifyDataSetChanged();
            }
            if (str.equalsIgnoreCase("server not responding") && getActivity() != null) {
                Toast.makeText((Context) getActivity(), (CharSequence) "Sorry, Server is not responding. Please try after some time.", 1).show();
            }
        }
        SwipeRefreshLayout swipeRefreshLayout = this.binding.o;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setRefreshing(false);
        }
        this.binding.A.setVisibility(8);
        this.binding.A.stopShimmerAnimation();
    }

    @Override
    public void onListItemClick(int i, Content content, RecyclerView.Adapter adapter, Section section, ArrayList<Content> arrayList) {
    }

    public void onPause() {
        super.onPause();
        Analytics.notifyExitForeground();
    }

    @Override
    public void onPersonalisedHyperLinkClick(int i, Content content, Section section) {
        super.onPersonalisedHyperLinkClick(i, content, section);
    }

    @Override
    public void onPremiumMeterError(String str) {
        if (this.foryouPojo == null || TextUtils.isEmpty(this.strContentUrl)) {
            Toast.makeText((Context) getActivity(), (CharSequence) getResources().getString(2131952559), 0).show();
        } else {
            setStoryContentData(this.config, this.foryouPojo, this.strContentUrl);
        }
    }

    @Override
    public void onRecycleItemClick(int i, Content content, ArrayList<Content> arrayList, boolean z) {
    }

    public void onRefresh() {
        this.binding.C.setVisibility(8);
        reset();
        this.bannerAdsCounter = 0;
        com.htmedia.mint.utils.k.n();
        initCall(this.section);
    }

    public void onResume() {
        Content content;
        Content content2;
        Bundle extras;
        super.onResume();
        getActivity().z1(true);
        Analytics.notifyEnterForeground();
        f6.l.m(getActivity(), "screen_start_time", Long.valueOf(System.currentTimeMillis()));
        if (HomeActivity.G0 == null) {
            HomeActivity activity = getActivity();
            HomeActivity.G0 = activity;
            if (activity.getIntent().getExtras() != null && HomeActivity.G0.getIntent().getExtras().containsKey("AppBack") && (extras = getActivity().getIntent().getExtras()) != null && extras.getBoolean("AppBack")) {
                extras.remove("AppBack");
                Intent intent = getActivity().getIntent();
                intent.putExtras(extras);
                HomeActivity.G0.setIntent(intent);
            }
        }
        this.listSize--;
        if (getActivity() != null && getActivity().h != null) {
            getActivity().h.setVisible(false);
        }
        if (getActivity() != null && getActivity().g != null) {
            getActivity().g.setVisible(false);
        }
        if (AppController.j().C()) {
            checkTheme(this.appController.E());
            RecyclerView.Adapter adapter = this.recyclerViewAdapter;
            if (adapter != null) {
                adapter.notifyDataSetChanged();
            }
            if (this.binding.v.getAdapter() != null) {
                this.binding.v.getAdapter().notifyDataSetChanged();
            }
        }
        if (getActivity() != null) {
            if (this.isMintLounge) {
                getActivity().t1();
            } else {
                getActivity().V3();
                ForyouPojo foryouPojo = this.forYouPojo;
                if (foryouPojo != null && foryouPojo.getContentList() != null && this.forYouPojo.getContentList().size() > 0 && (content = this.forYouPojo.getContentList().get(0)) != null) {
                    getActivity().H3(content.getId() + BuildConfig.FLAVOR);
                }
            }
            com.htmedia.mint.utils.f0.b = false;
            if (!this.isDiscountShowingInCurrentStory && (content2 = this.content) != null && content2.getMetadata() != null && this.content.getMetadata().isPremiumStory()) {
                setPremiumStoryCampaign(this.content);
            }
            initScrollListinerForLiveBlog();
            updateAndRefreshList(this.content);
        }
    }

    public void onSaveInstanceState(@NonNull Bundle bundle) {
    }

    public void onScroll(final int i) {
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView != null) {
            recyclerView.post(new Runnable() {
                @Override
                public void run() {
                    StoryDetailViewFragment.this.binding.c.scrollBy(0, i);
                }
            });
        }
    }

    public void onStart() {
        super.onStart();
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
            this.userId = com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
        } else {
            this.userId = f6.d.b(getActivity());
        }
    }

    public void onStop() {
        RecyclerView.Adapter adapter;
        super.onStop();
        MeterModelTimer meterModelTimer = this.meterModelTimer;
        if (meterModelTimer != null) {
            meterModelTimer.stopTimerForMeterModel();
            this.meterModelTimer = null;
        }
        if (this.section == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        com.htmedia.mint.utils.k1.r(getActivity());
        AppController.j().Y();
    }

    @Override
    public void onTableOfContentSelect(long j) {
        ArrayList<ListElement> h;
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter == null || !(adapter instanceof g7.q) || this.binding.c == null || (h = ((g7.q) adapter).h()) == null || h.isEmpty()) {
            return;
        }
        int findPositionByID = findPositionByID(j, h);
        if (findPositionByID != -1 && findPositionByID < h.size()) {
            smoothScrollToTop(this.binding.c, findPositionByID);
            return;
        }
        LinearLayoutManager linearLayoutManager = this.linearLayoutManager;
        if (linearLayoutManager != null) {
            linearLayoutManager.scrollToPosition(this.storyLastIndex);
        }
    }

    @Override
    public void onTopNavTopicClick(int i, int i2, Section section) {
    }

    public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.lastDataSize = 0;
        u7.q.q0();
        q4.t();
        this.screenHeight = com.htmedia.mint.utils.f0.j1(getActivity());
        LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(2131429271);
        this.layoutClose = linearLayout;
        linearLayout.setVisibility(4);
        FrameLayout frameLayout = (FrameLayout) getActivity().findViewById(2131428019);
        this.frameLayoutCloseButton = frameLayout;
        frameLayout.setVisibility(8);
        this.appController = getActivity().getApplication();
        this.bundle = getArguments();
        if (getActivity().i0.a.q != null) {
            getActivity().i0.a.q.setExpanded(true, true);
        }
        getActivity().F3(false);
        if (this.binding.c != null) {
            if (getActivity().i0.a.b.getVisibility() == 0) {
                this.binding.c.setPadding(0, 0, 0, 80);
            } else {
                this.binding.c.setPadding(0, 0, 0, 0);
            }
        }
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
            this.userId = com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
        } else {
            this.userId = f6.d.b(getActivity());
        }
        if (this.appController.g() != null) {
            this.config = this.appController.g();
            this.serverUrl = this.appController.g().getServerUrl();
            this.serverUrlwithLeftSection = this.appController.g().getLeftsectionUrl();
            this.isMarketGenieActive = this.config.getMarkets().isMintgenieAndroid();
        }
        this.binding.a.setOnClickListener(this);
        if (getActivity().g != null && getActivity().h != null) {
            if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") == null || this.bundle.getString("MARKET_TAB_KEY") != null) {
                getActivity().h.setVisible(false);
            } else {
                getActivity().g.setVisible(false);
                getActivity().h.setVisible(true);
            }
        }
        Bundle bundle2 = this.bundle;
        if (bundle2 == null || !bundle2.containsKey("top_section_section")) {
            return;
        }
        Section section = (Section) this.bundle.getParcelable("top_section_section");
        this.section = section;
        this.listUrl = section != null ? section.getListUrl() : BuildConfig.FLAVOR;
        this.selectedPos = this.bundle.getInt("selectedPos", 0);
        this.initPos = this.bundle.getInt("initPos", 0);
        this.listSize = this.bundle.getInt("pos", 0);
        this.articleOpenType = this.bundle.getString("article_open_type");
        this.isToShowToast = this.bundle.getBoolean("showToast", false);
        this.isToShowBottomToast = this.bundle.getBoolean("showToastBottom", false);
        this.isBookmarkDetail = this.bundle.getBoolean("is_bookmark_detail", false);
        fetchImageElementIdFromDeepLink(this.bundle.getString("story_url", BuildConfig.FLAVOR));
        Section section2 = this.section;
        if (section2 != null) {
            if (section2.getUrl().equalsIgnoreCase("/daily-digest")) {
                this.section.setUrl(this.config.getDailyDigestURL() + "htfpId=" + this.userId + "&propertyId=lm&platformId=app&numStories=50");
                this.section.setId("DAILY_DIGEST");
                this.section.setDisplayName("Your daily digest");
            }
            if (this.section.getDisplayName() != null) {
                this.pageTittle = this.section.getDisplayName();
            } else {
                this.pageTittle = BuildConfig.FLAVOR;
            }
            String id2 = this.section.getId();
            String[] strArr = com.htmedia.mint.utils.q.d;
            if (id2.equalsIgnoreCase(strArr[15])) {
                if (getArguments() == null || !getArguments().containsKey("story_tittle")) {
                    com.htmedia.mint.utils.n.q0(getActivity(), "Launch From : " + this.section.getPageType());
                } else {
                    String string = getArguments().getString("story_tittle");
                    com.htmedia.mint.utils.n.q0(getActivity(), "Launch From : " + this.section.getPageType() + ", Headline :  " + string);
                }
            } else if (this.section.getId().equalsIgnoreCase(strArr[6])) {
                if (getArguments() == null || !getArguments().containsKey("story_tittle")) {
                    com.htmedia.mint.utils.n.q0(getActivity(), this.pageTittle);
                } else {
                    String string2 = getArguments().getString("story_tittle");
                    com.htmedia.mint.utils.n.q0(getActivity(), this.pageTittle + " Headline :  " + string2);
                }
                if (getArguments().containsKey("origin")) {
                    String string3 = getArguments().getString("origin");
                    this.origin = string3;
                    AppController.L = string3;
                }
            } else {
                com.htmedia.mint.utils.n.q0(getActivity(), this.pageTittle);
                this.section.getId();
                com.htmedia.mint.utils.k1.x(com.htmedia.mint.utils.k1.l(getActivity()), "/" + this.pageTittle.replaceAll(" ", "-"));
                postScreenEvent(this.section);
            }
            postDMPvalue();
            String id3 = this.section.getId();
            this.pageId = id3;
            if (id3.equalsIgnoreCase(strArr[6]) || (this.pageId.equalsIgnoreCase(strArr[15]) && this.binding.o != null)) {
                this.binding.o.setEnabled(false);
                this.binding.o.setRefreshing(false);
            }
            initObjects(this.section);
        }
    }

    public void openSection(Section section) {
        FragmentManager supportFragmentManager = getActivity().getSupportFragmentManager();
        StoryDetailViewFragment storyDetailViewFragment = new StoryDetailViewFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable("top_section_section", section);
        bundle.putBoolean("is_from_left_nav", true);
        storyDetailViewFragment.setArguments(bundle);
        supportFragmentManager.beginTransaction().add(2131429286, storyDetailViewFragment, "Tag_Section").addToBackStack("Tag_Section").commitAllowingStateLoss();
        getActivity().f4(false, section.getDisplayName().toUpperCase());
    }

    public void pianoError(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
        setContentData(foryouPojo, str);
    }

    void redeemGift(String str, String str2) {
        String str3;
        Log.e("Tag_Story_Detail", "redeemGift: " + str + ", storyId: " + str2);
        p6.e eVar = new p6.e(getActivity(), new p6.f() {
            @Override
            public void getCouponCode(CouponPojo couponPojo) {
                if (couponPojo.getStatus() != 200) {
                    StoryDetailViewFragment.this.openRecipentBottomSheetWithData(true);
                    return;
                }
                if (StoryDetailViewFragment.this.content != null) {
                    if (com.htmedia.mint.utils.g1.b().a() != null) {
                        com.htmedia.mint.utils.g1.b().a().add(StoryDetailViewFragment.this.content.getId() + BuildConfig.FLAVOR);
                    } else {
                        ArrayList<String> arrayList = new ArrayList<>();
                        arrayList.add(StoryDetailViewFragment.this.content.getId() + BuildConfig.FLAVOR);
                        com.htmedia.mint.utils.g1.b().c(arrayList);
                    }
                    StoryDetailViewFragment.this.content.setFullStoryFromGiftCoupon(true);
                    StoryDetailViewFragment storyDetailViewFragment = StoryDetailViewFragment.this;
                    storyDetailViewFragment.updateAndRefreshList(storyDetailViewFragment.content);
                    if (StoryDetailViewFragment.this.getActivity() != null) {
                        Toast.makeText((Context) StoryDetailViewFragment.this.getActivity(), (CharSequence) "Article Unlocked", 1).show();
                    }
                }
            }

            @Override
            public void getCouponData(GiftingArticleUserInfoPojo giftingArticleUserInfoPojo) {
            }

            @Override
            public void getGiftedArticleListCouponData(GiftingArticleListPojo giftingArticleListPojo) {
            }

            @Override
            public void onError(String str4, String str5) {
            }
        });
        if (getActivity() != null) {
            String G1 = com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
            String str4 = "https://apigw.livemint.com/ss/api/v1/subscription/gift/app/redeem?giftCode=" + str + "&clientId=" + G1 + "&storyId=" + str2;
            Config r0 = com.htmedia.mint.utils.f0.r0();
            if (r0 == null || r0.getGiftArticleConfig() == null || TextUtils.isEmpty(r0.getGiftArticleConfig().getRedeem())) {
                str3 = str4;
            } else {
                str3 = r0.getGiftArticleConfig().getRedeem() + "?giftCode=" + str + "&clientId=" + G1 + "&storyId=" + str2;
            }
            eVar.e(1, com.htmedia.mint.storydatailpage.viewholder.s.h, str3, null, null, false, true);
        }
    }

    public void registerFollowUpdate(v4.d dVar) {
        super.registerFollowUpdate(dVar);
        this.updateYourListCallback = dVar;
    }

    public void registerTopAuthorFollowUpdate(v4.d dVar) {
        super.registerFollowUpdate(dVar);
        this.updateYourTopAuthorListCallback = dVar;
    }

    public void scrollToSummary(int i) {
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView != null) {
            smoothScrollToTop(recyclerView, i);
        }
    }

    public void sendAnalyticsDataOnPageVisibility() {
        ArrayList<Content> arrayList = this.list;
        if (arrayList == null || arrayList.isEmpty()) {
            this.isListEmpty = true;
            return;
        }
        this.isContinueRead = true;
        this.isListEmpty = false;
        ArrayList<Content> arrayList2 = this.list;
        Content content = arrayList2.get(arrayList2.size() - 1);
        if (content != null) {
            setPremiumStoryCampaign(content);
            if (isOtherThanPhotoVedioAndCollection(content.getType())) {
                content.setCloseButtonSticky(true);
                content.setExpanded(true);
                content.setWebPageId(UUID.randomUUID().toString());
                Tracker instance = Tracker.instance();
                Section section = this.section;
                String str = com.htmedia.mint.utils.q.c[0];
                com.htmedia.mint.utils.k1.w(instance, content, section, str, str, content.isExpanded(), -1, this.pinnedArticleList, this.isPersonalizeCheck);
                com.htmedia.mint.utils.n.q0(getActivity(), "Story Detail :- Template : Card,  Section : " + this.pageTittle + ", Headline : " + content.getHeadline());
            }
        }
        com.htmedia.mint.utils.n.B(getContext(), com.htmedia.mint.utils.n.U0, null, "article_detail_page", content, this.origin, this.articleOpenType, this.isTopStory, BuildConfig.FLAVOR);
        WebEngageAnalytices.trackArticleReadORClose(true, this.section.getDisplayName(), (String) null, this.content, this.origin);
    }

    public void sendWidgetImpressionEvent(Content content, int i, String str) {
        Bundle bundle = new Bundle();
        bundle.putString("widget_position", BuildConfig.FLAVOR + i);
        com.htmedia.mint.utils.n.L(getActivity(), com.htmedia.mint.utils.n.V1, com.htmedia.mint.utils.n.n0, content, str, bundle, "mini stock widget", BuildConfig.FLAVOR, BuildConfig.FLAVOR);
    }

    public void setArticleOpenType(String str) {
        this.articleOpenType = str;
    }

    public void setDiscountData(SubscribeNowPerant subscribeNowPerant) {
        if (subscribeNowPerant == null || subscribeNowPerant.getAndroidPremiumDiscountOfferV2() == null) {
            return;
        }
        premiumDiscountOffer = subscribeNowPerant.getAndroidPremiumDiscountOfferV2();
    }

    void setListBackgroundAsPerStoryType() {
        if (this.binding == null || getActivity() == null || getActivity().getResources() == null || this.binding.c == null) {
            return;
        }
        Content content = this.content;
        if (content != null && content.getMetadata() != null && !this.content.getMetadata().isPremiumStory()) {
            if (AppController.j().E()) {
                this.binding.c.setBackgroundColor(getActivity().getResources().getColor(2131100969));
                return;
            } else {
                this.binding.c.setBackgroundColor(getActivity().getResources().getColor(2131101002));
                return;
            }
        }
        if (AppController.j().E()) {
            this.binding.c.setBackgroundColor(getActivity().getResources().getColor(2131100916));
        } else if (this.isVerticalStory) {
            this.binding.c.setBackgroundColor(getActivity().getResources().getColor(2131101002));
        } else {
            this.binding.c.setBackgroundColor(getActivity().getResources().getColor(2131100360));
        }
    }

    public void setStoryData(ForyouPojo foryouPojo, String str) {
        if (foryouPojo != null && foryouPojo.getContentList() != null && foryouPojo.getContentList().size() > 0 && ((str.contains("search=id:") || str.contains("search=Id:")) && foryouPojo.getContentList().size() == 1 && foryouPojo.getContentList().get(0).getListElement() != null)) {
            if (foryouPojo.getContentList().get(0).getMetadata().isKilled()) {
                String redirectUrl = foryouPojo.getContentList().get(0).getMetadata().getRedirectUrl();
                if (redirectUrl.equalsIgnoreCase(BuildConfig.FLAVOR)) {
                    showErrorBackGround("server not responding");
                } else {
                    getArguments().putString("story_id", com.htmedia.mint.utils.j1.I(redirectUrl));
                    fetchStoryDetail(0, this.section, null, null);
                }
            } else {
                this.forYouPojo = foryouPojo;
                this.content = foryouPojo.getContentList().get(0);
                new Thread(new AnonymousClass5()).start();
            }
        }
        if (com.htmedia.mint.utils.n.p(getContext()).equals("home")) {
            m7.g.p(AppController.V);
        }
        sendScreenLoadEvent();
    }

    public void setToastMessage(String str) {
        this.binding.I.setVisibility(0);
        this.binding.F.setText(str);
        this.binding.f.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                StoryDetailViewFragment.this.binding.I.setVisibility(8);
                WebEngageAnalytices.trackUnlockArticleClossEvent();
            }
        });
    }

    public void share() {
        ForyouPojo foryouPojo = this.forYouPojo;
        if (foryouPojo == null || foryouPojo.getContentList() == null) {
            return;
        }
        Content content = this.forYouPojo.getContentList().get(0);
        com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.T1, com.htmedia.mint.utils.n.m0, content, BuildConfig.FLAVOR, "Share");
        com.htmedia.mint.utils.v2.j(getActivity(), content);
        com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.e2, "article_detail_page", content, BuildConfig.FLAVOR, "share");
    }

    public void shareStory() {
        share();
    }

    public void showErrorBackGround(String str) {
        if (str.equalsIgnoreCase("server not responding") || str.equalsIgnoreCase("JSONEXPECTION")) {
            RecyclerView recyclerView = this.binding.c;
            if (recyclerView != null) {
                recyclerView.setVisibility(8);
            }
            CardView cardView = this.cardViewTopic;
            if (cardView != null) {
                cardView.setVisibility(8);
            }
            RecyclerView recyclerView2 = this.binding.v;
            if (recyclerView2 != null) {
                recyclerView2.setVisibility(8);
            }
            LinearLayout linearLayout = this.binding.j;
            if (linearLayout != null) {
                linearLayout.setVisibility(0);
            }
            ImageView imageView = this.binding.g;
            if (imageView != null) {
                imageView.setImageResource(2131232480);
            }
            TextView textView = this.binding.G;
            if (textView != null) {
                textView.setVisibility(8);
            }
            TextView textView2 = this.binding.H;
            if (textView2 != null) {
                textView2.setText(2131952025);
            }
            Button button = this.binding.a;
            if (button != null) {
                button.setVisibility(0);
                return;
            }
            return;
        }
        if (!str.equalsIgnoreCase("Network not available")) {
            RecyclerView recyclerView3 = this.binding.c;
            if (recyclerView3 != null) {
                recyclerView3.setVisibility(0);
            }
            LinearLayout linearLayout2 = this.binding.j;
            if (linearLayout2 != null) {
                linearLayout2.setVisibility(8);
                return;
            }
            return;
        }
        CardView cardView2 = this.cardViewTopic;
        if (cardView2 != null) {
            cardView2.setVisibility(8);
        }
        RecyclerView recyclerView4 = this.binding.v;
        if (recyclerView4 != null) {
            recyclerView4.setVisibility(8);
        }
        RecyclerView recyclerView5 = this.binding.c;
        if (recyclerView5 != null) {
            recyclerView5.setVisibility(8);
        }
        LinearLayout linearLayout3 = this.binding.j;
        if (linearLayout3 != null) {
            linearLayout3.setVisibility(0);
        }
        ImageView imageView2 = this.binding.g;
        if (imageView2 != null) {
            imageView2.setImageResource(2131232697);
        }
        TextView textView3 = this.binding.G;
        if (textView3 != null) {
            textView3.setVisibility(8);
        }
        TextView textView4 = this.binding.H;
        if (textView4 != null) {
            textView4.setText(2131952314);
        }
        Button button2 = this.binding.a;
        if (button2 != null) {
            button2.setVisibility(0);
        }
    }

    public void showNoInternetBackGround(boolean z) {
        RecyclerView recyclerView = this.binding.c;
        if (recyclerView != null) {
            if (!z) {
                recyclerView.setVisibility(0);
                this.binding.j.setVisibility(8);
                return;
            }
            recyclerView.setVisibility(8);
            this.cardViewTopic.setVisibility(8);
            this.binding.v.setVisibility(8);
            this.binding.j.setVisibility(0);
            this.binding.g.setImageResource(2131232697);
            this.binding.G.setVisibility(8);
            this.binding.H.setText(2131952314);
            this.binding.a.setVisibility(0);
        }
    }

    public void showToastSwipe(Activity activity) {
        if (activity != null) {
            View inflate = activity.getLayoutInflater().inflate(2131625274, (ViewGroup) activity.findViewById(2131430936));
            TextView textView = (TextView) inflate.findViewById(2131430817);
            Toast toast = new Toast(activity);
            toast.setGravity(80, 0, -200);
            toast.setMargin(0.0f, -100.0f);
            toast.setDuration(1);
            toast.setView(inflate);
            toast.show();
            if (AppController.j().E()) {
                inflate.setBackground(ContextCompat.getDrawable(activity, 2131231336));
                textView.setTextColor(activity.getResources().getColor(2131100968));
            } else {
                inflate.setBackground(ContextCompat.getDrawable(activity, 2131231339));
                textView.setTextColor(activity.getResources().getColor(2131100598));
            }
        }
    }

    public void textSize() {
        handleTextSize(0);
    }

    public void updateAndRefreshList(Content content) {
        ArrayList<Content> arrayList;
        if (this.isLoginPressedFromGiftArticle) {
            if (TextUtils.isEmpty(this.giftCode)) {
                ((g7.q) this.recyclerViewAdapter).j(this.isLoginPressedFromGiftArticle);
            } else {
                if (!com.htmedia.mint.utils.h1.a(content.getId() + BuildConfig.FLAVOR, com.htmedia.mint.utils.g1.b().a())) {
                    showCouponDialogue(this.giftCode, content);
                }
            }
        }
        if (content == null) {
            content = this.content;
        }
        com.htmedia.mint.utils.o1.a("Tag_Story_Detail", "***IS_APP_BACKGROUND***" + com.htmedia.mint.utils.f0.b);
        if (content == null || com.htmedia.mint.utils.f0.b || (arrayList = this.list) == null || arrayList.size() <= 0 || this.recyclerViewAdapter == null) {
            return;
        }
        ArrayList<ListElement> updateListElement = updateListElement(content, (ArrayList) content.getListElement());
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            if (adapter instanceof g7.q) {
                ((g7.q) adapter).k(updateListElement);
            }
            this.recyclerViewAdapter.notifyDataSetChanged();
        }
    }

    public void updateYourData() {
        v4.d dVar = this.updateYourListCallback;
        if (dVar != null) {
            dVar.updateYourData();
        }
        v4.d dVar2 = this.updateYourTopAuthorListCallback;
        if (dVar2 != null) {
            dVar2.updateYourData();
        }
    }

    public void updateYourDataBottomAuthor() {
        v4.d dVar = this.updateYourListCallback;
        if (dVar != null) {
            dVar.updateYourData();
        }
    }

    public void updateYourDataTopAuthor() {
        v4.d dVar = this.updateYourTopAuthorListCallback;
        if (dVar != null) {
            dVar.updateYourData();
        }
    }
}