导航菜单

页面标题

页面副标题

Mint v5.7.3 - HomeFragment.java 源代码

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

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


package com.htmedia.mint.ui.fragments;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.databinding.ObservableField;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.comscore.Analytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.gson.Gson;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.htsubscription.MeterModelTimer;
import com.htmedia.mint.marketwidget.LShapedViewHolder;
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.GainerLoserPojo;
import com.htmedia.mint.pojo.GoldSilverResponse;
import com.htmedia.mint.pojo.Metadata;
import com.htmedia.mint.pojo.MostActivePojo;
import com.htmedia.mint.pojo.PageAttributeDetails;
import com.htmedia.mint.pojo.PinnedArticlePojo;
import com.htmedia.mint.pojo.SectionData;
import com.htmedia.mint.pojo.SourceBodyPojo;
import com.htmedia.mint.pojo.Table;
import com.htmedia.mint.pojo.TickerPojo;
import com.htmedia.mint.pojo.commodity.CommodityPojo;
import com.htmedia.mint.pojo.config.AdsArray;
import com.htmedia.mint.pojo.config.CarouselItem;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.DailyDigestBanner;
import com.htmedia.mint.pojo.config.Embed;
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.Subscription;
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.indices.IndicesPojo;
import com.htmedia.mint.pojo.indices.IndicesTable;
import com.htmedia.mint.pojo.marketinsightswidget.MarketInsightPojo;
import com.htmedia.mint.pojo.metermodel.Default;
import com.htmedia.mint.pojo.metermodel.MeterModel;
import com.htmedia.mint.pojo.newsletterwidget.DataItem;
import com.htmedia.mint.pojo.newsletterwidget.NewsLetterConfigResponse;
import com.htmedia.mint.pojo.newsletterwidget.NewsLetterConfigSingleton;
import com.htmedia.mint.pojo.newslist.CDPListDto;
import com.htmedia.mint.pojo.newslist.FollowAPIResponseDTO;
import com.htmedia.mint.pojo.newslist.NewsListItem;
import com.htmedia.mint.pojo.newslist.TempDataHolder;
import com.htmedia.mint.pojo.premiumstories.PremiumStoryMeter;
import com.htmedia.mint.pojo.week_high_low.WeekHighLowPojoNew;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.ui.activity.PrefSettingsNewActivity;
import com.htmedia.mint.ui.activity.SplashActivity;
import com.htmedia.mint.ui.fragments.HomeFragment;
import com.htmedia.mint.ui.fragments.leftmenudrawer.model.LeftDrawerResponseParent;
import com.htmedia.mint.utils.WrapContentHeightViewPager;
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.htmedia.sso.helpers.DialogHelper;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import in.juspay.hyper.constants.Labels;
import in.juspay.hypersdk.analytics.LogConstants;
import in.juspay.hypersdk.core.PaymentConstants;
import io.supercharge.shimmerlayout.ShimmerLayout;
import j8.b;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Predicate;
import org.json.JSONObject;
import q7.h0;
import q7.k7;
import q7.n8;
import q7.q4;
import q7.s7;
import x4.wf;
import y5.u;

public class HomeFragment extends Fragment implements h0.b, k6.h0, h0.a, q4.i, s7.b, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, k7.b, k6.v1, k6.w0, k6.u0, k6.d2, k6.f1, k6.l, k6.z0, k6.u, s6.d, PianoCallbackListener, w7.e {
    public static int firstPageSize;
    public static ObservableField<Table> tableObservableField = new ObservableField<>();
    public static ObservableField<TickerPojo> tickerPojoObservableField = new ObservableField<>();
    int actualContentSize;
    private int adsIndex;
    private AppController appController;
    private long articleId;
    public wf binding;
    private List<GainerLoserPojo> bseGainerList;
    private List<GainerLoserPojo> bseLoserList;
    String bseUrl;
    private Bundle bundle;
    private k6.k commodityPresenter;
    Config config;
    private List<String> contextualID;
    private k6.t contextualTargetPresenter;
    private k6.v disqusPresenter;
    private ForyouPojo forYouPojo;
    public FrameLayout frameLayoutCloseButton;
    private q7.n0 gainerLoserPagerAdapter;
    private HashMap<String, String> headers;
    private k6.g0 homePresenter;
    private LinearLayoutManager horizontalLayoutManager;
    private q7.f1 indicesRecyclerViewAdapter;
    private boolean isHomePageDataLoaded;
    boolean isMarketGenieActive;
    int lastDataSize;
    public LinearLayout layoutClose;
    private LinearLayoutManager linearLayoutManager;
    private com.htmedia.mint.utils.q1 lotameClass;
    private LinearLayoutManager mLinearLayoutManager;
    com.htmedia.mint.utils.r1 marketHelperClass;
    private k6.v0 marketPresenter;
    private Thread marketThread;
    private k6.x0 marketsGenericPresenter;
    private MeterModelTimer meterModelTimer;
    private q7.y2 mostActiveByVolumeAdapter;
    private k6.e1 mostActiveByVolumePresenter;
    public Section newSection;
    private e6.b newsListViewModel;
    private List<GainerLoserPojo> nseGainer;
    private List<GainerLoserPojo> nseLoser;
    String nseUrl;
    private String pageId;
    private int pageNo;
    private String pageTittle;
    private q7.h pagerAdapter;
    private PianoCallbacks pianoCallbacks;
    private Section pianoSection;
    private q.a0 pianoSectionType;
    private String pianoSectionUrl;
    private s6.c premiumStoryMeterPresenter;
    public RecyclerView.Adapter recyclerViewAdapter;
    public com.htmedia.mint.utils.l2 scrollListinerForCloseButton;
    public Section section;
    private k6.u1 sectionPresenter;
    private k7 topNavTopicsAdapter;
    private String userId;
    private String webPageId;
    private n8 weekHighLowPagerAdapter;
    private k6.c2 weekHighLowPresenter;
    private final String TAG = "HomeFragment";
    public List<Section> topicsList = new ArrayList();
    public int bannerAdsCounter = 0;
    int adsCounter = 0;
    int totalAddCounter = 0;
    public ArrayList<Content> list = new ArrayList<>();
    public ArrayList<Content> listWithoutAds = new ArrayList<>();
    public int brandedStoryCount = 0;
    public HashMap<Integer, Boolean> brandStoryMap = new HashMap<>();
    public String storyUrl = BuildConfig.FLAVOR;
    public String listUrl = BuildConfig.FLAVOR;
    private String serverUrl = BuildConfig.FLAVOR;
    private String serverUrlwithLeftSection = BuildConfig.FLAVOR;
    private final Handler handler = new Handler();
    private String deeplinkURL = BuildConfig.FLAVOR;
    private boolean isBookmarkDetail = false;
    private ArrayList<PinnedArticlePojo> pinnedArticleList = new ArrayList<>();
    private String isPersonalizeCheck = BuildConfig.FLAVOR;
    List<IndicesTable> indicesList = new ArrayList();
    int prvIndex = 0;
    int lShapedAdsTimerCounter = 0;
    int lShapedAdsImageCounter = 0;
    private boolean isDailyNewsLetterAdded = false;
    private boolean isEpaperAdded = false;
    private boolean isDailyDigestPopupAdded = false;
    private boolean isMoengageCardAdded = false;
    private boolean isNewsLetterCardAdded = false;
    private boolean isWelcomeCardAdded = false;
    private final boolean homeTabZeroPosition = false;
    private int tabPosition = -1;
    private int lastSponAdPosition = 0;
    private int lastPhotoScreenAdPosition = 0;
    private int countFirstTwoAd = 2;
    boolean isSecondAd = true;
    private int sponseredAdCount = 0;
    private boolean isEmbedDone = false;
    String date = BuildConfig.FLAVOR;
    private String IS_ORIGIN_FROM_MOENGE_CONTINUE = BuildConfig.FLAVOR;
    private String origin = null;
    private Map<Long, PageAttributeDetails> pageAttributes = new HashMap();
    private boolean isRemoveTimestamp = false;
    private boolean isRemoveTimestampAlreadySet = false;
    int count = 0;
    private String tabName = BuildConfig.FLAVOR;

    static class AnonymousClass19 {
        static final int[] $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES;
        static final int[] $SwitchMap$com$htmedia$mint$utils$AppConstants$SECTION_TYPES;

        static {
            int[] iArr = new int[q.a0.values().length];
            $SwitchMap$com$htmedia$mint$utils$AppConstants$SECTION_TYPES = iArr;
            try {
                iArr[q.a0.TOPIC.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$SECTION_TYPES[q.a0.AUTHOR.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$htmedia$mint$utils$AppConstants$SECTION_TYPES[q.a0.COLOUM.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            int[] iArr2 = new int[PianoAppConstant.PIANO_STORY_TYPES.values().length];
            $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES = iArr2;
            try {
                iArr2[PianoAppConstant.PIANO_STORY_TYPES.PREMIUM_PAYWALL.ordinal()] = 1;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.METER_PAYWLL.ordinal()] = 2;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.FULL_STORY_WALL_TEMPLATE.ordinal()] = 3;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.ARTICLE_IN_TEMPLATE.ordinal()] = 4;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.SKIP_LOGIN_TEMPLATE.ordinal()] = 5;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.UNLOCK_ARTICLE.ordinal()] = 6;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                $SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[PianoAppConstant.PIANO_STORY_TYPES.FULL_STORY.ordinal()] = 7;
            } catch (NoSuchFieldError unused10) {
            }
        }
    }

    class AnonymousClass8 implements Runnable {
        final Content val$content;

        AnonymousClass8(Content content) {
            this.val$content = content;
        }

        public void lambda$run$0(View view, String str) {
            com.htmedia.mint.utils.o1.a("TAG", " tag " + view.getTag().toString());
            if (view.getTag().equals(str)) {
                int relativeTop = HomeFragment.this.getRelativeTop(view) - 500;
                com.htmedia.mint.utils.o1.a("TAG relativetop", relativeTop + BuildConfig.FLAVOR);
                HomeFragment.this.binding.c.scrollBy(0, relativeTop);
            }
        }

        @Override
        public void run() {
            ViewGroup viewGroup = (ViewGroup) HomeFragment.this.binding.c.getChildAt(0).getParent();
            for (int i = 0; i < viewGroup.getChildCount(); i++) {
                View childAt = viewGroup.getChildAt(i);
                final String str = "Bookmarked_image";
                final View findViewWithTag = this.val$content.getType().equalsIgnoreCase(j5.b.e.a()) ? childAt.findViewWithTag("lb_liveblog").findViewWithTag("Bookmarked_image") : childAt.findViewWithTag("Bookmarked_image");
                if (findViewWithTag != null) {
                    findViewWithTag.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                        @Override
                        public final void onGlobalLayout() {
                            HomeFragment.AnonymousClass8.this.lambda$run$0(findViewWithTag, str);
                        }
                    });
                    return;
                }
            }
        }
    }

    private void addBrandedStories(Context context) {
        if (!com.htmedia.mint.utils.n.p(context).equals("home") || getTag() == null || getTag().equalsIgnoreCase("mintLounge")) {
            return;
        }
        for (Map.Entry<Integer, Boolean> entry : this.brandStoryMap.entrySet()) {
            if (!entry.getValue().booleanValue() && this.list.size() > entry.getKey().intValue()) {
                Content content = new Content();
                content.setType(j5.b.D.a());
                content.setId(this.adsCounter);
                this.list.add(entry.getKey().intValue(), content);
                this.brandStoryMap.put(entry.getKey(), Boolean.TRUE);
            }
        }
    }

    private void addDescriptionToSection(ForyouPojo foryouPojo, ArrayList<Content> arrayList, Section section) {
        if (this.pageNo != 0 || foryouPojo == null || foryouPojo.getDescription() == null || TextUtils.isEmpty(foryouPojo.getDescription()) || section == null || !"TOPIC".equalsIgnoreCase(foryouPojo.getPageType())) {
            return;
        }
        Content content = new Content();
        content.setType(j5.b.A.a());
        content.setDescription(foryouPojo.getDescription());
        arrayList.add(content);
    }

    private String addHyperlink(String str) {
        return "<b><a href=\"" + str + " \">" + str + "</a></b>";
    }

    private Content addNewListFollowContent() {
        Content content = new Content();
        j5.b bVar = j5.b.r1;
        content.setType(bVar.a());
        content.setCardType(bVar);
        b6.b bVar2 = b6.b.a;
        content.setFollowedNewsList(bVar2.d());
        content.setRecommendedNewsList(bVar2.e());
        content.setNewsListHeaderTitle(bVar2.c());
        return content;
    }

    private void changeFirstItemHomePageWithNewDesign(ArrayList<Content> arrayList) {
        if (this.pageNo != 0 || !isHomePage() || arrayList == null || arrayList.size() <= 0) {
            return;
        }
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i) != null && !TextUtils.isEmpty(arrayList.get(i).getType()) && (arrayList.get(i).getType().equalsIgnoreCase(j5.b.b.a()) || arrayList.get(i).getType().equalsIgnoreCase(j5.b.e.a()))) {
                arrayList.get(i).setHomePageTopStory(true);
                return;
            }
        }
    }

    private void checkAndUpdateCounterForSkipLogin(Context context, Content content, Section section) {
        int i;
        j.q0 H;
        boolean isSubscribedUser = CheckSubscriptionFromLocal.isSubscribedUser(context);
        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) {
                            Toast.makeText(context, String.format("%1$s Free Premium article remaining", i2 + BuildConfig.FLAVOR), 0).show();
                        } else if (i2 == 0) {
                            Toast.makeText(context, "You’ve read your last free Premium Article", 0).show();
                        }
                        new n4.d().a(getActivity(), content, "deviceId", true);
                    } else {
                        int i3 = premiumViewed + 1;
                        o.setPremiumViewed(i3);
                        if (i3 <= premiumLimit) {
                            Toast.makeText(context, String.format("You’re reading %1$s free premium article", com.htmedia.mint.utils.f0.H2(i3)), 0).show();
                            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");
                int i4 = (d != Integer.MIN_VALUE ? d : 0) + 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());
                    }
                }
            }
        }
        setPaywallTypeInContent(content);
    }

    private void checkForStory9Story() {
        int i;
        Iterator<Content> it = this.list.iterator();
        while (it.hasNext()) {
            Content next = it.next();
            if (next.getType().equals(j5.b.b.a()) && (i = this.count) < 9) {
                this.count = i + 1;
                next.setTopStory(true);
            }
        }
    }

    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 boolean checkWatchListSubtypeExist(ArrayList<Content> arrayList) {
        for (int i = 0; i < arrayList.size(); i++) {
            Content content = arrayList.get(i);
            if (content != null && content.getSubType() != null && content.getSubType().equalsIgnoreCase(q.EnumC0038q.WATCH_LIST_ENTRY_POINT.a())) {
                return true;
            }
        }
        return false;
    }

    private void checkWhatsAppSubscription() {
        try {
            if (this.bundle.containsKey("CONTINUE_READ_ALL_KEY")) {
                Section section = new Section();
                section.setId(getString(2131951831));
                section.setDisplayName(getString(2131951831));
                section.setTemplate("card");
                section.setType("internal");
                ArrayList arrayList = new ArrayList();
                arrayList.add(section);
                this.binding.o.setEnabled(false);
                this.binding.o.setOnRefreshListener((SwipeRefreshLayout.OnRefreshListener) null);
                this.binding.o.setRefreshing(false);
                q4 q4Var = new q4(getActivity(), getActivity(), AppController.O.g(), this, section, arrayList, this, getArguments().getBoolean("PERSONALIZATION_LINK_STOP", false), false);
                this.recyclerViewAdapter = q4Var;
                this.binding.c.setAdapter(q4Var);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void closeButtonScrollListiner() {
        if (this.recyclerViewAdapter instanceof q7.h0) {
            Bundle arguments = getArguments();
            if (!arguments.containsKey("isFromViewPage") || (arguments.containsKey("isFromViewPage") && !arguments.getBoolean("isFromViewPage"))) {
                this.frameLayoutCloseButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        new Content();
                        int itemClicked = HomeFragment.this.scrollListinerForCloseButton.getItemClicked();
                        ArrayList<Content> arrayList = HomeFragment.this.list;
                        if (arrayList == null || arrayList.isEmpty()) {
                            return;
                        }
                        HomeFragment homeFragment = HomeFragment.this;
                        homeFragment.onCloseButtonClick(homeFragment.scrollListinerForCloseButton.getItemClicked(), HomeFragment.this.list.get(itemClicked));
                        HomeFragment.this.list.get(itemClicked).setSkip(false);
                    }
                });
            }
        }
        this.scrollListinerForCloseButton.setContentPojosList(this.list);
        this.scrollListinerForCloseButton.setPinnedArticleList(this.pinnedArticleList);
        this.scrollListinerForCloseButton.setIsPersonalizeCheck(this.isPersonalizeCheck);
    }

    private void collapseView(int i) {
        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);
            ((q7.h0) this.recyclerViewAdapter).p(this.list);
            this.layoutClose.setVisibility(4);
            this.binding.c.setAdapter(this.recyclerViewAdapter);
            this.recyclerViewAdapter.notifyItemChanged(i);
        }
    }

    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 expandView(int i) {
        if (this.list.size() > 0) {
            Content content = this.list.get(i);
            content.setCloseButtonSticky(false);
            content.setExpanded(false);
            this.layoutClose.setVisibility(4);
            this.recyclerViewAdapter.notifyItemChanged(i);
        }
    }

    private void fetchCDPNewsListData(Context context) {
        e6.b bVar;
        if (context == null || !isHomePage() || (bVar = this.newsListViewModel) == null) {
            return;
        }
        bVar.h().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                HomeFragment.this.lambda$fetchCDPNewsListData$6((CDPListDto) obj);
            }
        });
        this.newsListViewModel.i().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                HomeFragment.this.lambda$fetchCDPNewsListData$7((FollowAPIResponseDTO) obj);
            }
        });
    }

    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");
        com.htmedia.mint.utils.o1.a("HomeFragment", "***PremiumUnlockUrl***" + replace2);
        this.premiumStoryMeterPresenter.a(0, "PremiumStoryCounter", replace2, null, hashMap, false, false);
    }

    private void fetchSectionValuesForPiano(q.a0 a0Var, String str, Section section) {
        this.pianoSectionType = a0Var;
        this.pianoSectionUrl = str;
        this.pianoSection = section;
        Bundle arguments = getArguments();
        if (arguments == null || !arguments.containsKey("is_from_viewpager")) {
            setPianoExp();
        }
    }

    private void fetchStoryData(Section section, String str) {
        this.scrollListinerForCloseButton.setStoryDetailContentLoaded(false);
        this.scrollListinerForCloseButton.setItemClicked(this.premiumStoryMeterPresenter.c());
        String str2 = BuildConfig.FLAVOR;
        for (Section section2 : this.appController.g().getOthers()) {
            if (section2.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                str2 = section2.getUrl().contains("http") ? section2.getUrl() : this.serverUrl + section2.getUrl();
            }
        }
        String string = getArguments().getString("story_id");
        if (TextUtils.isEmpty(string) || !TextUtils.isEmpty(this.listUrl)) {
            string = str;
        }
        com.htmedia.mint.utils.o1.a("URL", str2 + string + "&elements=true");
        if (section == null || TextUtils.isEmpty(section.getType()) || !section.getType().equals("mintLounge")) {
            this.homePresenter.f(0, "HomeFragment", str2 + string + "&elements=true", null, this.headers, false, false);
            return;
        }
        if (this.appController.g().getMintLounge() == null || TextUtils.isEmpty(this.appController.g().getMintLounge().getDetailUrl())) {
            return;
        }
        this.homePresenter.f(0, "HomeFragment", this.appController.g().getMintLounge().getDetailUrl() + string, null, this.headers, false, false);
    }

    private void fetchStoryDetail(int i, Section section, Content content, String str) {
        Section section2;
        String string = (getArguments() == null || !getArguments().containsKey("story_id")) ? null : getArguments().getString("story_id");
        boolean z = !getArguments().containsKey("keyPremiumStrory") || getArguments().getBoolean("keyPremiumStrory");
        try {
            if (!TextUtils.isEmpty(string)) {
                Long.parseLong(string);
            }
        } catch (Exception unused) {
        }
        if (getArguments() != null && getArguments().containsKey("mintLounge") && getArguments().getBoolean("mintLounge")) {
            section2 = section == null ? new Section() : section;
            section2.setType("mintLounge");
        } else {
            section2 = section;
        }
        String str2 = BuildConfig.FLAVOR;
        if (content != null) {
            z = content.getMetadata().isPremiumStory();
            string = content.getId() + BuildConfig.FLAVOR;
        }
        if (TextUtils.isEmpty(string)) {
            return;
        }
        this.scrollListinerForCloseButton.setStoryDetailContentLoaded(false);
        this.scrollListinerForCloseButton.setItemClicked(i);
        if (z && checkPremiumCounterForUser(string)) {
            fetchDecisionForPremiumStories(i, section2, string, content);
            return;
        }
        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();
            }
        }
        com.htmedia.mint.utils.k.s(getActivity(), string);
        com.htmedia.mint.utils.o1.a("URL", str2 + string + "&elements=true");
        if (section2 == null || TextUtils.isEmpty(section2.getType()) || !section2.getType().equals("mintLounge")) {
            this.homePresenter.f(0, "HomeFragment", str2 + string + "&elements=true", null, this.headers, false, false);
            return;
        }
        if (this.appController.g().getMintLounge() == null || TextUtils.isEmpty(this.appController.g().getMintLounge().getDetailUrl())) {
            return;
        }
        this.homePresenter.f(0, "HomeFragment", this.appController.g().getMintLounge().getDetailUrl() + string, null, this.headers, 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 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;
            fetchSectionValuesForPiano(q.a0.TOPIC, str4, section);
            this.homePresenter.f(0, "HomeFragment", this.storyUrl, 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;
            fetchSectionValuesForPiano(q.a0.AUTHOR, format, section);
            this.homePresenter.f(0, "HomeFragment", this.storyUrl, 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);
                fetchSectionValuesForPiano(q.a0.COLOUM, this.storyUrl, section);
                this.homePresenter.f(0, "HomeFragment", this.storyUrl, null, hashMap, false, false);
                return;
            }
            return;
        }
        if (section.getType() != null && section.getType().equals(Labels.Android.WEBVIEW)) {
            openWebPage(section);
            this.binding.h.setVisibility(8);
            this.isEmbedDone = true;
            this.binding.j.setVisibility(8);
            return;
        }
        if (getURL(section) != null && 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());
            }
            this.lotameClass.c(null, this.storyUrl, BuildConfig.FLAVOR, section.getDisplayName());
        } 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());
            this.lotameClass.b(null, this.storyUrl, BuildConfig.FLAVOR);
        } 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());
            this.lotameClass.c(null, this.storyUrl, BuildConfig.FLAVOR, getURL(section));
            if (!getArguments().containsKey("is_from_viewpager")) {
                getActivity().e4(false, this.config.getAdsAndroidNew().getBottomStickyAd().getSectionAdId(), section);
            }
        }
        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);
        if ("foryou_page_analytics".equalsIgnoreCase(section.getId()) && this.config != null) {
            String str6 = this.storyUrl;
            if (str6 != null && !str6.contains("platform=") && !this.storyUrl.contains("personalisation=")) {
                this.storyUrl += "&personalisation=" + this.config.isAndroidPersonalisation() + "&platform=" + (!TextUtils.isEmpty(this.config.getAndroidPlatform()) ? this.config.getAndroidPlatform() : "app") + "&app_version=5.7.3&iseditordriven=" + com.htmedia.mint.utils.i2.e;
                this.homePresenter.i(section);
                com.htmedia.mint.utils.o1.a("Story URL", this.storyUrl);
            }
            hashMap.put("X-App-Version", "5.7.3");
            hashMap.put("X-Package-Name", "production");
            hashMap.put("X-Platform", "LM");
            hashMap.put("X-OS", "Android");
        }
        if (TextUtils.isEmpty(this.storyUrl) || !this.storyUrl.contains("/topic")) {
            fetchSectionValuesForPiano(q.a0.SECTION, this.storyUrl, section);
        } else {
            fetchSectionValuesForPiano(q.a0.TOPIC, this.storyUrl, section);
        }
        this.homePresenter.f(0, "HomeFragment", this.storyUrl, null, hashMap, false, true);
    }

    public ArrayList<Integer> findNewsListWidgetIndex(List<Content> list, NewsListItem newsListItem) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        if (list != null && !list.isEmpty()) {
            int size = list.size();
            for (int i = 0; i < size; i++) {
                Content content = list.get(i);
                if (content != null && j5.b.u1.a().equalsIgnoreCase(content.getType())) {
                    List<NewsListItem> listCollectionPrimaryPages = content.getListCollectionPrimaryPages();
                    List d = b6.b.a.d();
                    if (listCollectionPrimaryPages != null && !listCollectionPrimaryPages.isEmpty()) {
                        int size2 = listCollectionPrimaryPages.size();
                        if (size2 > 6) {
                            size2 = 6;
                        }
                        List<NewsListItem> subList = listCollectionPrimaryPages.subList(0, size2);
                        int size3 = subList.size();
                        for (int i2 = 0; i2 < size3; i2++) {
                            NewsListItem newsListItem2 = listCollectionPrimaryPages.get(i2);
                            if (newsListItem2 != null) {
                                if (newsListItem != null) {
                                    newsListItem2.setFollowed(newsListItem.isFollowed());
                                }
                                if (TextUtils.isEmpty(newsListItem2.getGridImage())) {
                                    newsListItem2.getGridImage(i2, i2 % 6);
                                }
                            }
                        }
                        content.setListCollectionPrimaryPages(d6.a.a.b(subList, d));
                    }
                    arrayList.add(Integer.valueOf(i));
                }
            }
        }
        return arrayList;
    }

    public int getActualPositionOfStory(Content content) {
        ArrayList<Content> arrayList = this.listWithoutAds;
        if (arrayList == null || arrayList.isEmpty()) {
            return 0;
        }
        return this.listWithoutAds.indexOf(content);
    }

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

    private Content getDailyDigestBannerContent() {
        DailyDigestBanner dailyDigestBanner = AppController.j().g().getDailyDigestBanner();
        if (dailyDigestBanner == null || !dailyDigestBanner.isEnableAndroid()) {
            return null;
        }
        Content content = new Content();
        content.setHeadline(BuildConfig.FLAVOR);
        content.setLastPublishedDate(BuildConfig.FLAVOR);
        content.setType(j5.b.F.a());
        return content;
    }

    private int getDailyDigestBannerPosition() {
        if (AppController.j().g() == null || AppController.j().g().getDailyDigestBanner() == null) {
            return -1;
        }
        return AppController.j().g().getDailyDigestBanner().getPosition();
    }

    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;
    }

    public void getDataForMarket() {
        try {
            int isMarketTickerShown = isMarketTickerShown();
            int isGainerLoserShown = isGainerLoserShown();
            int isWeekHighLowShown = isWeekHighLowShown();
            int isIndicesShown = isIndicesShown();
            int isMostActiveByVolumeShown = isMostActiveByVolumeShown();
            int isCommodityShown = isCommodityShown();
            com.htmedia.mint.utils.r1 r1Var = this.marketHelperClass;
            q.o oVar = q.o.NSE_GAINERLOSER;
            String y = r1Var.y(oVar);
            this.nseUrl = y;
            this.marketPresenter.a(0, "nse_gainer_loser", y, null, null, true, false);
            ArrayList<Content> arrayList = this.list;
            if (arrayList != null && isMarketTickerShown > 0 && !TextUtils.isEmpty(arrayList.get(isMarketTickerShown).getJsonSourceUrl())) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "Market Ticker Source Url" + this.list.get(isMarketTickerShown).getJsonSourceUrl());
                this.marketHelperClass.A(false);
                this.marketPresenter.d(0, "MarketTICKER", this.marketHelperClass.y(q.o.TICKER), null, this.headers, true, false);
                this.marketPresenter.b(0, "GoldTICKER", this.config.getHomeMarketCollection().getGold().getUrl() + this.date, null, null, true, false);
                this.marketPresenter.c(0, "SilverTICKER", this.config.getHomeMarketCollection().getSilver().getUrl() + this.date, null, null, true, false);
            }
            ArrayList<Content> arrayList2 = this.list;
            if (arrayList2 != null && isGainerLoserShown > 0 && !TextUtils.isEmpty(arrayList2.get(isGainerLoserShown).getJsonSourceUrl())) {
                com.htmedia.mint.utils.o1.a("Gainer Loser Source Url", this.list.get(isGainerLoserShown).getJsonSourceUrl());
                this.marketHelperClass.A(false);
                this.bseUrl = this.marketHelperClass.y(q.o.BSE_GAINERLOSER);
                this.nseUrl = this.marketHelperClass.y(oVar);
                if (this.isMarketGenieActive) {
                    this.marketPresenter.a(0, "bse_gainer_loser", this.bseUrl, null, null, true, false);
                    this.marketPresenter.a(0, "nse_gainer_loser", this.nseUrl, null, null, true, false);
                } else {
                    this.marketPresenter.a(0, "bse_gainer_loser", this.bseUrl, null, null, true, false);
                }
            }
            if (this.list != null && isWeekHighLowShown > 0) {
                String y2 = this.marketHelperClass.y(q.o.BSE_GAINERLOSER);
                com.htmedia.mint.utils.o1.a("Week High/Low Url", y2);
                if (!this.isMarketGenieActive) {
                    this.weekHighLowPresenter.a(0, "52_week_high_low_bse_gainer", y2, null, null, false, false);
                } else if (AppController.j().H()) {
                    this.marketHelperClass.a("BSE", "0", "5");
                    this.weekHighLowPresenter.a(0, "52_week_high_low_bse_gainer", y2, null, null, false, false);
                } else {
                    this.marketHelperClass.a("NSI", "0", "5");
                    this.weekHighLowPresenter.a(0, "52_week_high_low_nse_gainer", y2, null, null, false, false);
                }
            }
            if (this.list != null && isIndicesShown > 0) {
                this.marketHelperClass.A(false);
                String y3 = this.marketHelperClass.y(q.o.INDICES);
                com.htmedia.mint.utils.o1.a("Indices Url", y3);
                this.marketsGenericPresenter.a(0, "indices_url", y3, null, null, false, false);
            }
            if (this.list != null && isCommodityShown > 0) {
                String combined = this.appController.g().getMarkets().getCommodity().getCombined();
                com.htmedia.mint.utils.o1.a("Commodity Url", combined);
                this.commodityPresenter.a(0, "commodity_url", combined, null, null, false, false);
            }
            if (this.list != null && isMostActiveByVolumeShown > 0) {
                if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("isBseForMostActive", true)) {
                    String y4 = this.marketHelperClass.y(q.o.MOSTACTIVE_BSE);
                    com.htmedia.mint.utils.o1.a("most active bse Url", y4);
                    this.mostActiveByVolumePresenter.a(0, "most_active_by_volume_bse", y4, null, null, false, false);
                } else {
                    String y5 = this.marketHelperClass.y(q.o.MOSTACTIVE_NSE);
                    com.htmedia.mint.utils.o1.a("most active nse Url", y5);
                    this.mostActiveByVolumePresenter.a(0, "most_active_by_volume_nse", y5, null, null, false, false);
                }
            }
            AppController appController = this.appController;
            if (appController != null && appController.g() != null) {
                Config g = this.appController.g();
                Default meterDefaultValue = g.getMeterDefaultValue();
                String s = AppController.j().s();
                String G1 = com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null ? com.htmedia.mint.utils.f0.G1(getActivity(), "userClient") : null;
                if (TextUtils.isEmpty(s)) {
                    manageMeterModel(getActivity(), g, G1);
                } else if (s.equalsIgnoreCase(q.s.METER.a())) {
                    if (meterDefaultValue != null) {
                        manageMeterModel(getActivity(), g, G1);
                    } else {
                        manageMeterModel(getActivity(), g, G1);
                    }
                } else if (s.equalsIgnoreCase(q.s.DEEP_BI.a()) && meterDefaultValue != null && !meterDefaultValue.isDecision()) {
                    manageMeterModel(getActivity(), g, G1);
                }
            }
            this.lShapedAdsTimerCounter++;
            Thread.sleep(30000L);
            if (this.lShapedAdsTimerCounter == this.config.getLshaped().getLshapeImageUpdateCounter()) {
                updateLShapedAd();
                this.lShapedAdsTimerCounter = 0;
            }
            getDataForMarket();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    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 getIndexEpaper() {
        if (AppController.j().g() == null || AppController.j().g().getEpaper() == null) {
            return -1;
        }
        return AppController.j().g().getEpaper().getPosition() - 1;
    }

    private int getIndexNewsLetter() {
        if (AppController.j().g() == null || AppController.j().g().getNewsLetter() == null) {
            return -1;
        }
        NewsLetter newsLetter = AppController.j().g().getNewsLetter();
        boolean isSubscribedUser = CheckSubscriptionFromLocal.isSubscribedUser(getActivity());
        Config config = this.config;
        return (config == null || config.getSubscription() == null || !this.config.getSubscription().isSubscriptionEnable() || !isSubscribedUser) ? newsLetter.getPosition() : newsLetter.getSubscriberPosition();
    }

    private int getLastDataSize(ArrayList<Content> arrayList) {
        if (arrayList != null && arrayList.size() > 0) {
            int i = 0;
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                if (arrayList.get(size).getType() != null && arrayList.get(size).getType().equalsIgnoreCase(j5.b.r.a())) {
                    return i;
                }
                i++;
            }
        }
        return this.lastDataSize;
    }

    private void getMeterDataFromServer(Context context, String str, String str2, Subscription subscription) {
        String deepbi_meterModelUrl = subscription.getDeepbi_meterModelUrl();
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("fingerprint", f6.d.b(getActivity()));
        if (!TextUtils.isEmpty(str)) {
            hashMap.put(PaymentConstants.CLIENT_ID_CAMEL, str);
        }
        if (!TextUtils.isEmpty(str2)) {
            hashMap.put("testgroup", str2);
        }
        new k6.y0(context).g(0, "METER_MODEL", deepbi_meterModelUrl, hashMap, false, false);
    }

    private Content getMoengageCardsContent() {
        Date date = new Date(f6.l.j(getContext(), "app_install_date_key"));
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int i = Calendar.getInstance().get(6) - calendar.get(6);
        if ((AppController.j().l() != null && AppController.j().l().isSubscriptionActive()) || ((!com.htmedia.mint.utils.f0.O1() && !com.htmedia.mint.utils.f0.Q1()) || !this.config.getMoengageCardConfig().isShowJourney() || i < 0 || i >= this.config.getMoengageCardConfig().getDaysCount())) {
            return com.htmedia.mint.utils.t1.a(getActivity(), this.config, null, q.t.HOME);
        }
        Content content = new Content();
        content.setSubType("SEVEN_DAY_CARDS");
        content.setType(j5.b.f0.a());
        return content;
    }

    private DataItem getNewsLetterAvailableForThisSection(Section section) {
        ArrayList<DataItem> data;
        if (section != null && !TextUtils.isEmpty(section.getDisplayName())) {
            String displayName = section.getDisplayName();
            NewsLetterConfigResponse newsLetterConfigResponse = NewsLetterConfigSingleton.getInstance().getNewsLetterConfigResponse();
            if (newsLetterConfigResponse != null && (data = newsLetterConfigResponse.getData()) != null && !data.isEmpty()) {
                int size = data.size();
                for (int i = 0; i < size; i++) {
                    DataItem dataItem = data.get(i);
                    String sectionName = dataItem != null ? dataItem.getSectionName() : null;
                    if (!TextUtils.isEmpty(sectionName) && (displayName.equalsIgnoreCase(sectionName) || displayName.contains(sectionName))) {
                        return dataItem;
                    }
                }
            }
        }
        return null;
    }

    private Content getNewsLetterContent() {
        Content content = new Content();
        content.setType("jsonfeed");
        content.setSubType("newsletter_carausal");
        return content;
    }

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

    private void getStoryData(String str, Content content) {
        this.scrollListinerForCloseButton.setStoryDetailContentLoaded(false);
        this.scrollListinerForCloseButton.setItemClicked(this.premiumStoryMeterPresenter.c());
        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();
            }
        }
        com.htmedia.mint.utils.o1.a("URL", str2 + str + "&elements=true");
        this.homePresenter.f(0, "HomeFragment", str2 + str + "&elements=true", null, this.headers, 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 getTimeStampUrl(Config config) {
        if (config == null) {
            Intent intent = new Intent((Context) getActivity(), (Class<?>) SplashActivity.class);
            com.htmedia.mint.utils.f0.s(getContext(), intent);
            getActivity().startActivity(intent);
            getActivity().finish();
            return BuildConfig.FLAVOR;
        }
        for (Section section : config.getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[0])) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url;
                }
                return this.serverUrl + url;
            }
        }
        return BuildConfig.FLAVOR;
    }

    public java.lang.String getURL(com.htmedia.mint.pojo.config.Section r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.ui.fragments.HomeFragment.getURL(com.htmedia.mint.pojo.config.Section):java.lang.String");
    }

    private void iniAdapterByTemplate(int i, Section section) {
        boolean z;
        com.htmedia.mint.utils.o1.a("TAG", i + " click");
        if (i == 0) {
            q7.h0 h0Var = new q7.h0(getActivity(), this.list, this, this, getActivity(), section, this.linearLayoutManager, false, null, this.topicsList, this, getArguments().getString("MARKET_TAB_KEY"), false, this, this);
            this.recyclerViewAdapter = h0Var;
            h0Var.s(false);
            ((q7.h0) this.recyclerViewAdapter).u(isHomePage() ? j5.c.a : j5.c.c);
            setNewsWidgetClickListener();
            return;
        }
        if (i == 1) {
            if (getArguments().getBoolean("PERSONALIZATION_LINK_STOP", false)) {
                this.binding.e.setVisibility(8);
            }
            this.recyclerViewAdapter = new q4(getActivity(), getActivity(), this.list, this, section, this.topicsList, this, getArguments().getBoolean("PERSONALIZATION_LINK_STOP", false), this.isRemoveTimestamp);
            Bundle arguments = getArguments();
            if (arguments != null && arguments.containsKey("hideDate") && (z = arguments.getBoolean("hideDate", false))) {
                ((q4) this.recyclerViewAdapter).z(z);
            }
        } else if (i == 3) {
            this.recyclerViewAdapter = new s7(getActivity(), getActivity(), this.list, this, getArguments().getString("topicName"), this.forYouPojo);
        }
    }

    private void initObjects(Section section) {
        if (section != null) {
            int templeteIndex = section.getTemplate() != null ? getTempleteIndex(section.getTemplate()) : 1;
            if (section.getDesign() != null) {
                templeteIndex = getTempleteIndex(section.getDesign());
            }
            RecyclerView.Adapter adapter = this.recyclerViewAdapter;
            if (adapter == null) {
                iniAdapterByTemplate(templeteIndex, section);
                this.binding.c.setAdapter(this.recyclerViewAdapter);
            } else {
                this.binding.c.setAdapter(adapter);
            }
            if (this.scrollListinerForCloseButton != null) {
                this.binding.c.clearOnScrollListeners();
            }
            initScrollListiner();
            closeButtonScrollListiner();
            if (this.list.size() <= 0) {
                this.homePresenter = new k6.g0(getActivity(), this);
                initCall(section);
            } else {
                this.scrollListinerForCloseButton.setPreviousPageOnScrollListner(this.pageNo);
                this.binding.c.post(new Runnable() {
                    @Override
                    public void run() {
                        HomeFragment.this.recyclerViewAdapter.notifyItemInserted(r0.list.size() - 1);
                    }
                });
            }
        }
    }

    private boolean isAllPremiumPage() {
        Section section = this.section;
        return "premium_section".equalsIgnoreCase(section != null ? section.getId() : BuildConfig.FLAVOR);
    }

    private int isCommodityShown() {
        int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
        if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
            return -1;
        }
        int length = q.EnumC0038q.values().length;
        while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
            String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
            if (!TextUtils.isEmpty(subType)) {
                for (int i = 0; i < length; i++) {
                    if (subType.equalsIgnoreCase(q.EnumC0038q.MARKET_COMMODITY.a())) {
                        return findFirstVisibleItemPosition;
                    }
                }
            }
            findFirstVisibleItemPosition++;
        }
        return -1;
    }

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

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

    private int isGainerLoserShown() {
        int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
        if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
            return -1;
        }
        int length = q.EnumC0038q.values().length;
        while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
            String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
            if (!TextUtils.isEmpty(subType)) {
                for (int i = 0; i < length; i++) {
                    if (subType.equalsIgnoreCase(q.EnumC0038q.TOP_GAINER_LOSER.a())) {
                        return findFirstVisibleItemPosition;
                    }
                }
            }
            findFirstVisibleItemPosition++;
        }
        return -1;
    }

    private int isIndicesShown() {
        int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
        if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
            return -1;
        }
        int length = q.EnumC0038q.values().length;
        while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
            String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
            if (!TextUtils.isEmpty(subType)) {
                for (int i = 0; i < length; i++) {
                    if (subType.equalsIgnoreCase(q.EnumC0038q.MARKET_INDICES.a())) {
                        return findFirstVisibleItemPosition;
                    }
                }
            }
            findFirstVisibleItemPosition++;
        }
        return -1;
    }

    private boolean isListAlreadyAdded(ForyouPojo foryouPojo) {
        Iterator<Content> it;
        List<Content> contentList = foryouPojo.getContentList();
        ArrayList<Content> arrayList = this.list;
        if (arrayList != null && !arrayList.isEmpty() && contentList != null && !contentList.isEmpty() && (it = contentList.iterator()) != null) {
            int size = this.list.size();
            int i = size - 20;
            if (i < 0) {
                i = 0;
            }
            int i2 = size - 1;
            while (it.hasNext()) {
                Content next = it.next();
                if (next != null) {
                    int i3 = i2;
                    while (true) {
                        if (i3 >= i) {
                            Content content = this.list.get(i3);
                            if (content != null && content.getId() == next.getId()) {
                                it.remove();
                                break;
                            }
                            i3--;
                        } else {
                            break;
                        }
                    }
                }
            }
        }
        return false;
    }

    private int isMarketTickerShown() {
        try {
            int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
            int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
            if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
                return -1;
            }
            int length = q.EnumC0038q.values().length;
            while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
                String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
                if (!TextUtils.isEmpty(subType)) {
                    for (int i = 0; i < length; i++) {
                        if (subType.contains(q.EnumC0038q.MARKET_TICKER.a())) {
                            return findFirstVisibleItemPosition;
                        }
                    }
                }
                findFirstVisibleItemPosition++;
            }
            return -1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    private int isMostActiveByVolumeShown() {
        int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
        if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
            return -1;
        }
        int length = q.EnumC0038q.values().length;
        while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
            String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
            if (!TextUtils.isEmpty(subType)) {
                for (int i = 0; i < length; i++) {
                    if (subType.equalsIgnoreCase(q.EnumC0038q.MOST_ACTIVE_BY_VOLUME.a())) {
                        return findFirstVisibleItemPosition;
                    }
                }
            }
            findFirstVisibleItemPosition++;
        }
        return -1;
    }

    private boolean isOtherThanPhotoVedioAndCollection(String str) {
        return (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 isPageCollectionContain(List<Content> list) {
        if (list == null || list.isEmpty()) {
            return false;
        }
        for (Content content : list) {
            if (content != null && j5.b.u1.a().equalsIgnoreCase(content.getType())) {
                return true;
            }
        }
        return false;
    }

    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 isPremiumAllWSJEcoSelected() {
        Bundle arguments = getArguments();
        String string = (arguments == null || !arguments.containsKey("PREMIUM_TAB_KEY")) ? BuildConfig.FLAVOR : arguments.getString("PREMIUM_TAB_KEY");
        return !TextUtils.isEmpty(string) && ("All".equalsIgnoreCase(string) || "WSJ".equalsIgnoreCase(string) || "Economist".equalsIgnoreCase(string) || "Barron's".equalsIgnoreCase(string));
    }

    private boolean isPremiumTabSelected() {
        return getArguments() != null && getArguments().containsKey("PREMIUM_TAB_KEY") && getArguments().getString("PREMIUM_TAB_KEY").equalsIgnoreCase(Parameters.CW_ALL);
    }

    private boolean isRepeatHomePage(List<Content> list) {
        if (list != null && !list.isEmpty()) {
            Content content = list.get(0);
            ArrayList<Content> arrayList = this.list;
            if (arrayList != null && !arrayList.isEmpty() && content != null) {
                Iterator<Content> it = this.list.iterator();
                while (it.hasNext()) {
                    Content next = it.next();
                    if (next != null && content.getId() == next.getId()) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    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 && j5.b.b.a().equalsIgnoreCase(content.getType());
    }

    private int isWeekHighLowShown() {
        int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
        int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
        if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
            return -1;
        }
        int length = q.EnumC0038q.values().length;
        while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
            String subType = this.list.get(findFirstVisibleItemPosition).getSubType();
            if (!TextUtils.isEmpty(subType)) {
                for (int i = 0; i < length; i++) {
                    if (subType.equalsIgnoreCase(q.EnumC0038q.WEEK_HIGH_LOW_52.a())) {
                        return findFirstVisibleItemPosition;
                    }
                }
            }
            findFirstVisibleItemPosition++;
        }
        return -1;
    }

    public void lambda$fetchCDPNewsListData$6(CDPListDto cDPListDto) {
        List<NewsListItem> cdpList;
        if (cDPListDto == null || (cdpList = cDPListDto.getCdpList()) == null || cdpList.isEmpty()) {
            return;
        }
        updateListData(this.list, null);
    }

    public void lambda$fetchCDPNewsListData$7(FollowAPIResponseDTO followAPIResponseDTO) {
        if (followAPIResponseDTO != null) {
            if (followAPIResponseDTO.getLoading()) {
                if (getActivity() != null) {
                    DialogHelper.showProgressDialog(getActivity());
                }
            } else if (followAPIResponseDTO.getStatus()) {
                DialogHelper.dismissProgressDialog();
                updateListData(this.list, followAPIResponseDTO.getNewsListItem());
            } else if (getActivity() != null) {
                DialogHelper.dismissProgressDialog();
                com.htmedia.mint.utils.f0.L3(getActivity(), followAPIResponseDTO.getErrorMessage());
            }
        }
    }

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

    public void lambda$setMarketInsightHeader$5(int i, String str, String str2) {
        this.tabName = str2;
        String d = com.htmedia.mint.utils.h0.d(str);
        sendCollectionEvent(this.tabName, d);
        if (this.section == null || TextUtils.isEmpty(d)) {
            return;
        }
        this.section.setUrl(d);
        ShimmerLayout shimmerLayout = this.binding.A;
        if (shimmerLayout != null) {
            shimmerLayout.setVisibility(0);
            this.scrollListinerForCloseButton.resetState();
            this.binding.A.startShimmerAnimation();
        }
        onRefresh();
    }

    public boolean lambda$setStoryTemplateFromPageAttribute$1(Content content) {
        return content != null && (j5.b.b.a().equalsIgnoreCase(content.getType()) || j5.b.e.a().equalsIgnoreCase(content.getType())) && this.pageAttributes.containsKey(Long.valueOf(content.getId()));
    }

    public void lambda$setStoryTemplateFromPageAttribute$2(Content content) {
        PageAttributeDetails pageAttributeDetails = this.pageAttributes.get(Long.valueOf(content.getId()));
        if (pageAttributeDetails == null || pageAttributeDetails.getDesignType() == null) {
            return;
        }
        content.setStoryTemplate(pageAttributeDetails.getDesignType());
    }

    public void lambda$updateLShapedAd$3(Content content, View view) {
        com.htmedia.mint.utils.f0.T(content.getSubType() + "/sponsored_lshaped", ((AdsArray) HomeActivity.K0.get(this.lShapedAdsImageCounter)).getTargeturl(), String.valueOf(content.getId()), getContext());
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            String targeturl = ((AdsArray) HomeActivity.K0.get(this.lShapedAdsImageCounter)).getTargeturl();
            if (!targeturl.startsWith("http://") && !targeturl.startsWith("https://")) {
                targeturl = "http://" + targeturl;
            }
            intent.setData(Uri.parse(targeturl));
            getContext().startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void lambda$updateLShapedAd$4(View view) {
    }

    private void manageMeterModel(Context context, Config config, String str) {
        Subscription subscription = config.getSubscription();
        if (subscription == null || !subscription.isSubscriptionEnable() || TextUtils.isEmpty(subscription.getMeterModelUrl())) {
            return;
        }
        String s = AppController.j().s();
        if (TextUtils.isEmpty(s)) {
            getMeterDataFromServer(context, str, s, subscription);
        } else if (s.equalsIgnoreCase(q.s.METER.a())) {
            getMeterDataFromServer(context, str, s, subscription);
        } else if (s.equalsIgnoreCase(q.s.DEEP_BI.a())) {
            getMeterDataFromServer(context, str, s, subscription);
        }
    }

    private void openExternalWebPage(Section section) {
        String str;
        com.htmedia.mint.utils.j1.x0(2, getActivity());
        if (section.getUrl().contains("http")) {
            com.htmedia.mint.utils.o1.a("WebPage Url", BuildConfig.FLAVOR);
            str = section.getUrl();
        } else {
            str = this.serverUrl + section.getUrl();
            com.htmedia.mint.utils.o1.a("WebPage Url", str);
        }
        startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                com.htmedia.mint.utils.j1.x0(1, HomeFragment.this.getActivity());
            }
        }, 300L);
    }

    private void openOptionAccordingAction(Content content) {
        Bundle arguments = getArguments();
        FragmentActivity activity = getActivity();
        if (arguments == null || activity == null || content == null || !arguments.containsKey("story_action") || !this.section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[15])) {
            return;
        }
        String string = arguments.getString("story_action");
        if (TextUtils.isEmpty(string)) {
            return;
        }
        if (string.equalsIgnoreCase("sharing")) {
            arguments.remove("story_action");
            com.htmedia.mint.utils.v2.j(activity, content);
            return;
        }
        if (string.equalsIgnoreCase("bookmark")) {
            String str = content.getId() + BuildConfig.FLAVOR;
            arguments.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);
            } else {
                if (AppController.O.a(str)) {
                    return;
                }
                com.htmedia.mint.utils.f0.n(str, activity, "add", null, null, this.recyclerViewAdapter, false, this.list, content, null, false);
                this.recyclerViewAdapter.notifyItemChanged(0);
            }
        }
    }

    private void openQuickReadFragment(int i) {
        try {
            FragmentManager supportFragmentManager = getActivity().getSupportFragmentManager();
            QuickReadFragment quickReadFragment = new QuickReadFragment();
            Bundle bundle = new Bundle();
            bundle.putString("explore", "Topic clouds");
            bundle.putInt("pos", i);
            quickReadFragment.setArguments(bundle);
            supportFragmentManager.beginTransaction().add(2131429286, quickReadFragment, "quickreads").addToBackStack("quickreads").commit();
            getActivity().f4(false, "QUICK READS");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void openWebPage(Section section) {
        try {
            FragmentManager supportFragmentManager = getActivity().getSupportFragmentManager();
            WebFragment webFragment = new WebFragment();
            Bundle bundle = new Bundle();
            bundle.putParcelable("top_section_section", section);
            webFragment.setArguments(bundle);
            supportFragmentManager.beginTransaction().add(2131429286, webFragment, "web").addToBackStack("web").commit();
            getActivity().f4(false, section.getDisplayName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    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("GLOBAL") || 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);
            boolean isForYouURL = isForYouURL(section);
            if (getArguments().containsKey(com.htmedia.mint.utils.n.X)) {
                this.origin = getArguments().getString(com.htmedia.mint.utils.n.X);
            } else {
                this.origin = AppController.L;
            }
            String str5 = isForYouURL ? "home" : "topic_page";
            if (this.tabPosition == -1) {
                if (section.getId().equals("DAILY_DIGEST")) {
                    this.origin = com.htmedia.mint.utils.n.l0;
                }
                if (!getArguments().containsKey("isFromMarket") || !getArguments().getBoolean("isFromMarket")) {
                    if ("marketinsights".equalsIgnoreCase(section.getId()) || getArguments() == null || getArguments().containsKey("PREMIUM_TAB_KEY")) {
                        return;
                    }
                    com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.U0, str4, str5, null, this.origin);
                    return;
                }
                String string2 = getArguments().getString("name", BuildConfig.FLAVOR);
                String string3 = getArguments().getString("articleType", BuildConfig.FLAVOR);
                com.htmedia.mint.utils.n.c0(getActivity(), "market_dashboard/" + string2, "topic_page", string3, new String[0]);
            }
        }
    }

    private void refreshFlipBoolean() {
        if (isHomePage() || isAllPremiumPage()) {
            q7.d2.f.b(false);
        }
    }

    private void refreshList() {
        this.binding.c.post(new Runnable() {
            @Override
            public void run() {
                HomeFragment.this.recyclerViewAdapter.notifyItemInserted(r0.list.size() - 1);
            }
        });
    }

    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();
        }
        ArrayList<Content> arrayList2 = this.listWithoutAds;
        if (arrayList2 != null) {
            arrayList2.clear();
        }
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
        com.htmedia.mint.utils.l2 l2Var = this.scrollListinerForCloseButton;
        if (l2Var != null) {
            l2Var.resetState();
        }
        this.lastDataSize = 0;
        this.totalAddCounter = 0;
        this.pageNo = 0;
        u7.q.q0();
        q4.t();
        this.isDailyNewsLetterAdded = false;
        this.isEpaperAdded = false;
        this.isDailyDigestPopupAdded = false;
        this.isMoengageCardAdded = 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);
        }
    }

    private void runPianoOnAllPages(String str, String str2, String str3, q.a0 a0Var) {
        com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: URL : " + str);
        com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: subSection : " + str3);
        com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: Story Type : " + a0Var.name());
        HashMap hashMap = new HashMap();
        if (!TextUtils.isEmpty(str2)) {
            int i = AnonymousClass19.$SwitchMap$com$htmedia$mint$utils$AppConstants$SECTION_TYPES[a0Var.ordinal()];
            if (i == 1) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: topic : " + str2);
                hashMap.put("Topic", str2);
            } else if (i == 2) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: author : " + str2);
                hashMap.put("Author", str2);
            } else if (i != 3) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: section : " + str2);
                hashMap.put("Section", str2);
            } else {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: coloum : " + str2);
                hashMap.put("Column", str2);
            }
        }
        if (!TextUtils.isEmpty(str3)) {
            hashMap.put("SubSection", str3);
        }
        new PianoCallbacks(getActivity(), new PianoCallbackListener() {
            public void getPianoResponse(String str4, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: getPianoResponse :  URL : " + str4);
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: getPianoResponse : pianoResponse : " + pianoResponse.getExpName());
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: getPianoResponse : pianoResponse : " + pianoResponse.getPageName());
            }

            public void pianoError(String str4, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: pianoError :  URL : " + str4);
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: pianoError : pianoResponse : " + pianoResponse.getExpName());
                com.htmedia.mint.utils.o1.a("HomeFragment", "runPianoOnAllPages: pianoError : pianoResponse : " + pianoResponse.getPageName());
            }
        }).checkUserScope("mobileListing", (List) null, str, hashMap, (Content) null);
    }

    private void sendAnalyticEventForMarket() {
        if (getArguments() == null || getArguments().getString("MARKET_TAB_KEY") == null) {
            return;
        }
        if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("MARKET")) {
            com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.I2, "market/market_dashboard", null, BuildConfig.FLAVOR, getString(2131952186).toLowerCase());
        } else if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("STOCKS")) {
            com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.I2, "market/market_dashboard", null, BuildConfig.FLAVOR, getString(2131952569).toLowerCase());
        } else if (getArguments().getString("MARKET_TAB_KEY").equalsIgnoreCase("MUTUAL_FUNDS")) {
            com.htmedia.mint.utils.n.M(getActivity(), com.htmedia.mint.utils.n.I2, "market/market_dashboard", null, BuildConfig.FLAVOR, getString(2131952266).toLowerCase());
        }
    }

    private void sendCollectionEvent(String str, String str2) {
        StringBuilder sb2 = new StringBuilder();
        Section section = this.section;
        sb2.append(section != null ? section.getDisplayName() : BuildConfig.FLAVOR);
        sb2.append("/");
        sb2.append(str);
        com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.U0, str2, sb2.toString(), null, this.origin);
    }

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

    private void setAdapterWRTDesign(String str) {
        if (this.binding.c != null) {
            iniAdapterByTemplate(getTempleteIndex(str), this.section);
            this.binding.c.setAdapter(this.recyclerViewAdapter);
        }
    }

    private List<Content> setAds(List<Content> list) {
        int i;
        if (this.adsIndex <= 0) {
            return list;
        }
        int size = list.size();
        this.actualContentSize += size;
        ArrayList<Content> arrayList = new ArrayList<>();
        List<String> bannerAdIds = this.appController.g().getAdsAndroid().getBannerAdIds();
        if (this.section.getTemplate() != null) {
            getTempleteIndex(this.section.getTemplate());
        }
        if (this.section.getDesign() != null) {
            getTempleteIndex(this.section.getDesign());
        }
        boolean isHomePage = isHomePage();
        if (this.adsCounter >= 2 && isHomePage) {
            this.adsIndex = 3;
        }
        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;
            boolean z = com.htmedia.mint.utils.f0.O1() || !com.htmedia.mint.utils.f0.Q1() ? !com.htmedia.mint.utils.f0.P1() || this.totalAddCounter < 1 : this.totalAddCounter < 1;
            if (i3 % this.adsIndex == 0 && z) {
                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);
                ForyouPojo foryouPojo = this.forYouPojo;
                if (foryouPojo != null && !"photos".equalsIgnoreCase(foryouPojo.getName())) {
                    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++;
                this.totalAddCounter++;
            }
        }
        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 = getLastDataSize(arrayList);
        return arrayList;
    }

    private void setContentData(ForyouPojo foryouPojo, String str) {
        ArrayList<Content> arrayList;
        if (this.section.getId().equals("DAILY_DIGEST")) {
            this.section.setDisplayName(getString(2131951858));
        }
        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);
        if (this.list.size() > 0) {
            setTopicData(foryouPojo);
        } else {
            this.binding.b.setVisibility(8);
            this.binding.v.setVisibility(8);
        }
        if (!com.htmedia.mint.utils.f0.O1() && ((!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) || (AppController.j().l() != null && !AppController.j().l().isSubscriptionActive())) && !com.htmedia.mint.utils.f0.Q1())) {
            sponsoredAdsShow();
        }
        if (foryouPojo.getName() != null && this.forYouPojo.getName().equalsIgnoreCase("photos") && !this.list.isEmpty()) {
            String type = this.list.get(0).getType();
            j5.b bVar = j5.b.r;
            if (!type.equalsIgnoreCase(bVar.a()) && !com.htmedia.mint.utils.f0.O1() && !CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                Content content = new Content();
                content.setType(bVar.a());
                this.list.add(0, content);
            }
        }
        if (foryouPojo.getName() != null && this.forYouPojo.getName().equalsIgnoreCase("photos") && !com.htmedia.mint.utils.f0.O1() && !CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
            if (this.countFirstTwoAd > 0) {
                int i = 0;
                for (int i2 = this.lastPhotoScreenAdPosition; i2 < this.list.size(); i2++) {
                    if (this.list.get(i2).getType().equalsIgnoreCase(j5.b.d.a())) {
                        if (i == 4) {
                            this.countFirstTwoAd--;
                            this.lastPhotoScreenAdPosition = i2;
                            Content content2 = new Content();
                            content2.setType(j5.b.r.a());
                            this.list.add(i2, content2);
                            i = 0;
                        } else {
                            i++;
                        }
                    }
                }
            }
            if (this.countFirstTwoAd == 0) {
                this.isSecondAd = false;
            }
            if (!this.isSecondAd) {
                int i3 = 0;
                for (int i4 = this.lastPhotoScreenAdPosition; i4 < this.list.size(); i4++) {
                    if (this.list.get(i4).getType().equalsIgnoreCase(j5.b.d.a())) {
                        if (i3 == 3) {
                            this.lastPhotoScreenAdPosition = i4;
                            Content content3 = new Content();
                            content3.setType(j5.b.r.a());
                            this.list.add(this.lastPhotoScreenAdPosition, content3);
                            i3 = 0;
                        } else {
                            i3++;
                        }
                    }
                }
            }
        }
        if (Objects.equals(this.section.getId(), "1544430958545") || Objects.equals(this.section.getId(), "market_news")) {
            int i5 = 0;
            while (true) {
                if (i5 >= this.list.size()) {
                    break;
                }
                if (this.list.get(i5).getType().equalsIgnoreCase(j5.b.b.a())) {
                    Content content4 = new Content();
                    content4.setSubType("home_market_news");
                    content4.setType("home_market_news");
                    int i6 = i5 + 1;
                    if (!this.list.get(i6).getType().equalsIgnoreCase("home_market_news")) {
                        this.list.add(i6, content4);
                        break;
                    }
                    i5++;
                } else if (this.list.get(i5).getType().equalsIgnoreCase("home_market_news")) {
                    break;
                } else {
                    i5++;
                }
            }
        }
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter instanceof q7.h0) {
            ((q7.h0) adapter).p(this.list);
        }
        this.recyclerViewAdapter.notifyDataSetChanged();
        if (!this.section.getId().contains("foryou_tab") || this.section.getDisplayName().equalsIgnoreCase("Home") || getArguments().getBoolean("PERSONALIZATION_LINK_STOP", false) || (arrayList = this.list) == null || arrayList.isEmpty() || !this.list.get(0).getType().equalsIgnoreCase(j5.b.r.a())) {
            return;
        }
        this.list.remove(0);
    }

    private void setDeeplinkURLfromDL() {
        Bundle arguments = getArguments();
        String str = BuildConfig.FLAVOR;
        if (arguments == null || !arguments.containsKey("url")) {
            setDeeplinkURL(BuildConfig.FLAVOR);
            return;
        }
        String string = arguments.getString("url");
        if (!TextUtils.isEmpty(string)) {
            str = string;
        }
        setDeeplinkURL(str);
    }

    private void setIsRemoveTimeStamp(ForyouPojo foryouPojo) {
        if (this.recyclerViewAdapter instanceof q7.h0) {
            if (!this.isRemoveTimestampAlreadySet && foryouPojo != null && foryouPojo.getMetadata() != null) {
                this.isRemoveTimestamp = foryouPojo.getMetadata().isRemoveTimestamp();
                this.isRemoveTimestampAlreadySet = true;
            }
            ((q7.h0) this.recyclerViewAdapter).w(this.isRemoveTimestamp);
        }
    }

    private void setMarketInsightHeader(Content content, String str) {
        MarketInsightPojo marketInsightPojo;
        j8.b bVar = new j8.b(getActivity(), this.binding.r, content, new b.a.InterfaceC0120b() {
            @Override
            public final void a(int i, String str2, String str3) {
                HomeFragment.this.lambda$setMarketInsightHeader$5(i, str2, str3);
            }
        }, str);
        ArrayList<MarketInsightPojo> e = bVar.e();
        if (e != null && !e.isEmpty() && (marketInsightPojo = e.get(0)) != null) {
            this.tabName = marketInsightPojo.getName();
            String d = com.htmedia.mint.utils.h0.d(marketInsightPojo.getUrl());
            sendCollectionEvent(this.tabName, d);
            if (this.section != null && !TextUtils.isEmpty(d)) {
                this.section.setUrl(d);
            }
        }
        bVar.g();
    }

    private void setNewsWidgetClickListener() {
        u.a aVar = new u.a() {
            public void onNewsListItemClick(int i, boolean z, @Nullable NewsListItem newsListItem, Content content) {
                AppController activity = HomeFragment.this.getActivity();
                if (activity == null) {
                    activity = AppController.j();
                }
                AppController appController = activity;
                if (com.htmedia.mint.utils.f0.n2(appController)) {
                    if (HomeFragment.this.newsListViewModel != null) {
                        HomeFragment.this.newsListViewModel.d(appController, z, newsListItem, i, 0);
                    }
                } else if (HomeFragment.this.getActivity() != null) {
                    TempDataHolder tempDataHolder = TempDataHolder.INSTANCE;
                    tempDataHolder.setChildPosition(i);
                    tempDataHolder.setGroupPosition(0);
                    tempDataHolder.setNewsListItem(newsListItem);
                    g7.a.s(HomeFragment.this.getActivity(), 102, "Home", "Newslist", "Home Page List", BuildConfig.FLAVOR, BuildConfig.FLAVOR, null, content);
                }
            }
        };
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter == null || !(adapter instanceof q7.h0)) {
            return;
        }
        ((q7.h0) adapter).t(aVar);
    }

    private void setPaywallTypeInContent(Content content) {
        PianoResponse pianoResponse = PianoResponseSingleTon.getInstance().getPianoResponse();
        if (pianoResponse == null || content == null || !j5.b.b.a().equalsIgnoreCase(content.getType())) {
            return;
        }
        PianoAppConstant.PIANO_STORY_TYPES pianoStoryTypes = pianoResponse.getPianoStoryTypes();
        if (pianoStoryTypes != null) {
            switch (AnonymousClass19.$SwitchMap$com$htmedia$mint$piano$PianoAppConstant$PIANO_STORY_TYPES[pianoStoryTypes.ordinal()]) {
                case 1:
                    parseResponseForPaywall(content, pianoResponse);
                    break;
                case 2:
                    parseResponseForPaywall(content, pianoResponse);
                    break;
                case 3:
                    parseResponseForFullStoryTemplate(content, pianoResponse);
                    break;
                case 4:
                    parseResponseArticleInTemplate(content, pianoResponse);
                    break;
                case 5:
                    parseResponseSkipLoginTemplate(content, pianoResponse);
                    break;
                case 6:
                    parseResponseUnlockArticleTemplate(content, pianoResponse);
                    break;
            }
            content.setPianoStoryTypes(pianoStoryTypes);
        }
        n4.b.d = content.getMetadata() != null ? content.getMetadata().getSection() : BuildConfig.FLAVOR;
    }

    private List<Content> setPremiumUserAds(List<Content> list) {
        com.htmedia.mint.utils.o1.a("HomeFragment", "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("HomeFragment", "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 List<Content> setStoryTemplateFromPageAttribute(List<Content> list, ForyouPojo foryouPojo) {
        if (list != null && !list.isEmpty() && foryouPojo != null && foryouPojo.getPageAttribute() != null) {
            this.pageAttributes.putAll(foryouPojo.getPageAttribute());
            list.stream().filter(new Predicate() {
                @Override
                public final boolean test(Object obj) {
                    boolean lambda$setStoryTemplateFromPageAttribute$1;
                    lambda$setStoryTemplateFromPageAttribute$1 = HomeFragment.this.lambda$setStoryTemplateFromPageAttribute$1((Content) obj);
                    return lambda$setStoryTemplateFromPageAttribute$1;
                }
            }).forEach(new Consumer() {
                @Override
                public final void accept(Object obj) {
                    HomeFragment.this.lambda$setStoryTemplateFromPageAttribute$2((Content) obj);
                }
            });
        }
        return list;
    }

    private String setTitleAlongWithDeeplink(String str) {
        String deeplinkURL = getDeeplinkURL();
        if (TextUtils.isEmpty(deeplinkURL)) {
            return str;
        }
        return str + "#" + deeplinkURL;
    }

    private void setTopicData(ForyouPojo foryouPojo) {
        if (foryouPojo.getNavigation() == null || foryouPojo.getNavigation().size() <= 0) {
            Section section = this.section;
            if (section == null || TextUtils.isEmpty(section.getDisplayName()) || !this.section.getDisplayName().equalsIgnoreCase("Latest")) {
                getDefaultNavigationUrl(this.appController.g());
                this.sectionPresenter = new k6.u1(getActivity(), this);
            } else {
                getDefaultNavigationForLatestUrl(this.appController.g());
                this.sectionPresenter = new k6.u1(getActivity(), this);
            }
        }
    }

    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;
    }

    private void sponsoredAdsShow() {
        int i;
        while (this.lastSponAdPosition < this.list.size()) {
            try {
                if (this.list.get(this.lastSponAdPosition).getMetadata() != null && this.list.get(this.lastSponAdPosition).getMetadata().getDesign() != null && ((this.list.get(this.lastSponAdPosition).getMetadata().getDesign().equalsIgnoreCase("Design 5") || this.list.get(this.lastSponAdPosition).getMetadata().getDesign().equalsIgnoreCase("Design 2") || this.list.get(this.lastSponAdPosition).getMetadata().getDesign().equalsIgnoreCase("Design 6")) && (i = this.sponseredAdCount) < 2)) {
                    this.sponseredAdCount = i + 1;
                    if (this.list.get(this.lastSponAdPosition).getListCollectionStories() != null && !this.list.get(this.lastSponAdPosition).getListCollectionStories().isEmpty()) {
                        this.adsCounter++;
                        this.totalAddCounter++;
                        Content content = new Content();
                        content.setType(j5.b.D.a());
                        content.setId(this.adsCounter);
                        if (this.list.get(this.lastSponAdPosition).getListCollectionStories().size() >= 3) {
                            this.list.get(this.lastSponAdPosition).getListCollectionStories().add(3, content);
                        } else if (this.list.get(this.lastSponAdPosition).getListCollectionStories().size() == 2) {
                            this.list.get(this.lastSponAdPosition).getListCollectionStories().add(2, content);
                        }
                        this.recyclerViewAdapter.notifyDataSetChanged();
                    }
                }
            } catch (Exception e) {
                Log.i("HomeFragment", e.toString());
            }
            this.lastSponAdPosition++;
        }
    }

    private void startThreadForMarket() {
        if (this.marketThread == null) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    HomeFragment.this.getDataForMarket();
                }
            });
            this.marketThread = thread;
            thread.start();
        }
    }

    private void stopTheardForMarket() {
        Thread thread = this.marketThread;
        if (thread != null) {
            thread.interrupt();
            this.marketThread = null;
        }
    }

    private void updateLShapedAd() {
        boolean z;
        try {
            int findFirstVisibleItemPosition = this.linearLayoutManager.findFirstVisibleItemPosition();
            int findLastVisibleItemPosition = this.linearLayoutManager.findLastVisibleItemPosition();
            if (this.list.size() <= 0 || findFirstVisibleItemPosition < 0 || findLastVisibleItemPosition <= 0) {
                z = false;
            } else {
                z = false;
                while (findFirstVisibleItemPosition <= findLastVisibleItemPosition) {
                    final Content content = this.list.get(findFirstVisibleItemPosition);
                    LShapedViewHolder findViewHolderForAdapterPosition = this.binding.c.findViewHolderForAdapterPosition(findFirstVisibleItemPosition);
                    if ((findViewHolderForAdapterPosition instanceof LShapedViewHolder) && findViewHolderForAdapterPosition.binding.r.getVisibility() == 8) {
                        List list = HomeActivity.K0;
                        if (list == null) {
                            if (getActivity() instanceof HomeActivity) {
                                getActivity().S0();
                            }
                        } else if (!list.isEmpty()) {
                            findViewHolderForAdapterPosition.binding.g.setImageURI(((AdsArray) HomeActivity.K0.get(this.lShapedAdsImageCounter)).getSourceimg());
                            if (((AdsArray) HomeActivity.K0.get(this.lShapedAdsImageCounter)).getTargeturl().isEmpty()) {
                                findViewHolderForAdapterPosition.binding.g.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public final void onClick(View view) {
                                        HomeFragment.lambda$updateLShapedAd$4(view);
                                    }
                                });
                            } else {
                                findViewHolderForAdapterPosition.binding.g.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public final void onClick(View view) {
                                        HomeFragment.this.lambda$updateLShapedAd$3(content, view);
                                    }
                                });
                            }
                            z = true;
                        }
                    }
                    findFirstVisibleItemPosition++;
                }
            }
            if (z) {
                int i = this.lShapedAdsImageCounter + 1;
                this.lShapedAdsImageCounter = i;
                if (i == HomeActivity.K0.size()) {
                    this.lShapedAdsImageCounter = 0;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void updateListData(final List<Content> list, final NewsListItem newsListItem) {
        RecyclerView.Adapter adapter;
        if (list == null || list.isEmpty() || !isHomePage() || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                List list2 = list;
                if (list2 == null || list2.size() <= 0) {
                    return;
                }
                final Content content = (Content) list.get(0);
                if (content != null && j5.b.r1.a().equalsIgnoreCase(content.getType())) {
                    b6.b bVar = b6.b.a;
                    content.setFollowedNewsList(bVar.d());
                    content.setRecommendedNewsList(bVar.e());
                    content.setNewsListHeaderTitle(bVar.c());
                }
                final ArrayList findNewsListWidgetIndex = HomeFragment.this.findNewsListWidgetIndex(list, newsListItem);
                if (HomeFragment.this.handler != null) {
                    HomeFragment.this.handler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (content != null && j5.b.r1.a().equalsIgnoreCase(content.getType())) {
                                HomeFragment.this.recyclerViewAdapter.notifyItemChanged(0);
                            }
                            List list3 = findNewsListWidgetIndex;
                            if (list3 == null || list3.isEmpty()) {
                                return;
                            }
                            int size = list.size();
                            Iterator it = findNewsListWidgetIndex.iterator();
                            while (it.hasNext()) {
                                int intValue = ((Integer) it.next()).intValue();
                                if (intValue >= 0 && intValue < size) {
                                    HomeFragment.this.recyclerViewAdapter.notifyItemChanged(intValue);
                                }
                            }
                        }
                    });
                }
            }
        }).start();
    }

    private void watchListNewsApiCall() {
        if (!AppController.c0 || TextUtils.isEmpty(com.htmedia.mint.utils.f0.G1(getContext(), "userToken"))) {
            return;
        }
        String G1 = com.htmedia.mint.utils.f0.G1(getContext(), "mintgenieUserID");
        if (TextUtils.isEmpty(G1) || getContext() == null) {
            return;
        }
        y7.i3 i3Var = (y7.i3) new ViewModelProvider(this).get(y7.i3.class);
        i3Var.F0(com.htmedia.mint.utils.f0.r0());
        i3Var.r0(com.htmedia.mint.utils.f0.G1(getContext(), "userToken"), com.htmedia.mint.utils.f0.G1(getContext(), "userClient"));
        i3Var.H(G1);
        AppController.c0 = false;
    }

    public void checkTheme(boolean z) {
        if (getContext() != null) {
            wf wfVar = this.binding;
            if (wfVar.h != null) {
                if (z) {
                    wfVar.E.setTextColor(ContextCompat.getColor(getActivity() == null ? AppController.j() : getActivity(), 2131099995));
                    this.binding.h.setBackgroundColor(getContext().getResources().getColor(2131100969));
                    this.binding.v.setBackgroundColor(getContext().getResources().getColor(2131100945));
                    this.binding.c.setBackgroundColor(getContext().getResources().getColor(2131100969));
                    this.binding.i.setBackgroundColor(getContext().getResources().getColor(2131100969));
                    this.binding.G.setTextColor(getContext().getResources().getColor(2131101009));
                    this.binding.H.setTextColor(getContext().getResources().getColor(2131101009));
                    this.binding.A.setShimmerColor(getContext().getResources().getColor(2131100802));
                    this.binding.w.q.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.g.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.a.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.r.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.h.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.b.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.s.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.i.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.c.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.t.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.j.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.d.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.u.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.o.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.e.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.v.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.p.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.w.f.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.a.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.e.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.c.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.f.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.g.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.d.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.h.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.i.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.x.b.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.J.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.K.setBackgroundColor(getContext().getResources().getColor(2131100799));
                    this.binding.r.setBackgroundColor(getContext().getResources().getColor(2131099886));
                    this.binding.d.setBackgroundColor(getContext().getResources().getColor(2131099885));
                    return;
                }
                wfVar.E.setTextColor(ContextCompat.getColor(getActivity() == null ? AppController.j() : getActivity(), 2131099991));
                this.binding.h.setBackgroundColor(getContext().getResources().getColor(2131100968));
                this.binding.v.setBackgroundColor(getContext().getResources().getColor(2131100944));
                this.binding.c.setBackgroundColor(getContext().getResources().getColor(2131100968));
                this.binding.i.setBackgroundColor(getContext().getResources().getColor(2131100968));
                this.binding.G.setTextColor(getContext().getResources().getColor(2131101008));
                this.binding.H.setTextColor(getContext().getResources().getColor(2131101008));
                this.binding.A.setShimmerColor(getContext().getResources().getColor(2131100801));
                this.binding.w.q.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.g.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.a.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.r.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.h.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.b.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.s.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.i.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.c.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.t.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.j.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.d.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.u.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.o.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.e.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.v.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.p.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.w.f.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.a.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.e.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.c.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.f.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.g.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.d.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.h.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.i.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.x.b.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.J.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.K.setBackgroundColor(getContext().getResources().getColor(2131100798));
                this.binding.r.setBackgroundColor(getContext().getResources().getColor(2131099883));
                this.binding.d.setBackgroundColor(getContext().getResources().getColor(2131099884));
            }
        }
    }

    public void clearStoryIds() {
        com.htmedia.mint.utils.l2 l2Var;
        RecyclerView.Adapter adapter;
        if (!isHomePage() || (l2Var = this.scrollListinerForCloseButton) == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        l2Var.clearStoryTemplateList();
    }

    @Override
    public void fetchPremiumCounterMeter(PremiumStoryMeter premiumStoryMeter) {
        s6.c cVar = this.premiumStoryMeterPresenter;
        if (cVar == null) {
            Toast.makeText((Context) getActivity(), (CharSequence) getResources().getString(2131952559), 0).show();
        } else if (cVar.d() != null) {
            fetchStoryData(this.premiumStoryMeterPresenter.d(), this.premiumStoryMeterPresenter.e());
        } else {
            getStoryData(this.premiumStoryMeterPresenter.e(), this.premiumStoryMeterPresenter.b());
        }
    }

    @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());
        RecyclerView.Adapter adapter = this.recyclerViewAdapter;
        if (adapter != null) {
            if (adapter instanceof q7.h0) {
                ((q7.h0) adapter).o(this.contextualID);
                return;
            } else {
                if (adapter instanceof q4) {
                    ((q4) adapter).u(this.contextualID);
                    return;
                }
                return;
            }
        }
        q7.n0 n0Var = this.gainerLoserPagerAdapter;
        if (n0Var != null) {
            n0Var.f((ArrayList) this.contextualID);
            return;
        }
        q7.h hVar = this.pagerAdapter;
        if (hVar != null) {
            hVar.e((ArrayList) this.contextualID);
            return;
        }
        q7.y2 y2Var = this.mostActiveByVolumeAdapter;
        if (y2Var != null) {
            y2Var.h((ArrayList) this.contextualID);
            return;
        }
        n8 n8Var = this.weekHighLowPagerAdapter;
        if (n8Var != null) {
            n8Var.e((ArrayList) this.contextualID);
            return;
        }
        q7.f1 f1Var = this.indicesRecyclerViewAdapter;
        if (f1Var != null) {
            f1Var.l((ArrayList) this.contextualID);
        }
    }

    public String getDeeplinkURL() {
        return this.deeplinkURL;
    }

    @Override
    public void getFetchDicisionResult(Default r1) {
    }

    @Override
    public void getGoldSilverTicker(List<GoldSilverResponse> list, String str) {
        int isMarketTickerShown = isMarketTickerShown();
        if (isMarketTickerShown >= 0) {
            try {
                RecyclerView findViewById = ((LinearLayout) ((LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isMarketTickerShown).itemView.findViewById(2131429475)).findViewById(2131429477)).findViewById(2131430278);
                q7.z1 z1Var = (q7.z1) findViewById.getAdapter();
                if (z1Var != null) {
                    Table table = new Table();
                    if (list != null && !list.isEmpty()) {
                        table.setNETCHG(list.get(0).getChange24Cr());
                        table.setPrice(list.get(0).getPrice24Cr());
                    }
                    if (!str.contains("/" + "Gold".toLowerCase() + "/")) {
                        if (str.contains("/" + "Silver".toLowerCase() + "/") && list != null && !list.isEmpty()) {
                            for (Table table2 : z1Var.i()) {
                                if (table2.getINDEXNAME().contains("Silver")) {
                                    table2.setNETCHG(table.getNETCHG());
                                    table2.setPrice(table.getPrice());
                                }
                            }
                        }
                    } else if (list != null && !list.isEmpty()) {
                        for (Table table3 : z1Var.i()) {
                            if (table3.getINDEXNAME().contains("Gold")) {
                                table3.setNETCHG(table.getNETCHG());
                                table3.setPrice(table.getPrice());
                            }
                        }
                    }
                    z1Var.n(z1Var.i());
                    findViewById.getAdapter().notifyDataSetChanged();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void getLoserAndGainer(TickerPojo tickerPojo, String str) {
        int isGainerLoserShown = isGainerLoserShown();
        com.htmedia.mint.utils.o1.a("HomePresenter", str + "  after  parsing from home");
        com.htmedia.mint.utils.o1.a("gainer loser card pos", isGainerLoserShown + BuildConfig.FLAVOR);
        if (this.isMarketGenieActive && str.equalsIgnoreCase(this.nseUrl)) {
            this.nseLoser = tickerPojo.getNSELosers();
            List<GainerLoserPojo> nSEGainers = tickerPojo.getNSEGainers();
            this.nseGainer = nSEGainers;
            com.htmedia.mint.utils.f0.A3(nSEGainers, this.nseLoser);
        }
        if (isGainerLoserShown > 0) {
            if (!this.isMarketGenieActive) {
                this.list.get(isGainerLoserShown).getSourceBodyPojo().setTickerPojo(tickerPojo);
                this.bseLoserList = tickerPojo.getBSELosers();
                this.bseGainerList = tickerPojo.getBSEGainers();
                this.nseLoser = tickerPojo.getNSELosers();
                this.nseGainer = tickerPojo.getNSEGainers();
            } else if (str.equalsIgnoreCase(this.bseUrl)) {
                this.bseLoserList = tickerPojo.getBSELosers();
                this.bseGainerList = tickerPojo.getBSEGainers();
                TickerPojo tickerPojo2 = this.list.get(isGainerLoserShown).getSourceBodyPojo().getTickerPojo();
                tickerPojo2.setBSELosers(this.bseLoserList);
                tickerPojo2.setBSEGainers(this.bseGainerList);
                this.list.get(isGainerLoserShown).getSourceBodyPojo().setTickerPojo(tickerPojo);
            } else {
                this.nseLoser = tickerPojo.getNSELosers();
                this.nseGainer = tickerPojo.getNSEGainers();
                TickerPojo tickerPojo3 = this.list.get(isGainerLoserShown).getSourceBodyPojo().getTickerPojo();
                tickerPojo3.setNSELosers(this.nseLoser);
                tickerPojo3.setNSEGainers(this.nseGainer);
                this.list.get(isGainerLoserShown).getSourceBodyPojo().setTickerPojo(tickerPojo3);
            }
            LinearLayout linearLayout = (LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isGainerLoserShown).itemView.findViewById(2131427861);
            WrapContentHeightViewPager wrapContentHeightViewPager = (WrapContentHeightViewPager) linearLayout.findViewById(2131432023);
            RelativeLayout relativeLayout = (RelativeLayout) linearLayout.findViewById(2131430352);
            LinearLayout linearLayout2 = (LinearLayout) relativeLayout.findViewById(2131429300);
            TextView textView = (TextView) relativeLayout.findViewById(2131431517);
            this.gainerLoserPagerAdapter = (q7.n0) wrapContentHeightViewPager.getAdapter();
            if (!AppController.j().z()) {
                com.htmedia.mint.utils.o1.a("updating nse", "updating nse now");
                this.gainerLoserPagerAdapter.g(this.nseGainer, this.nseLoser);
                if (this.nseGainer.size() <= 0 || TextUtils.isEmpty(this.nseGainer.get(0).getUPDTIME())) {
                    return;
                }
                textView.setText("Update: " + this.nseGainer.get(0).getUPDTIME());
                return;
            }
            com.htmedia.mint.utils.o1.a("updating bse", "updating bse now");
            this.gainerLoserPagerAdapter.g(this.bseGainerList, this.bseLoserList);
            if (this.nseGainer.size() <= 0 || TextUtils.isEmpty(this.nseGainer.get(0).getUPDTIME()) || textView == null) {
                return;
            }
            textView.setText("Update: " + this.nseGainer.get(0).getUPDTIME());
        }
    }

    @Override
    public void getMarketTicker(TickerPojo tickerPojo, String str) {
        if (tickerPojo != null && tickerPojo.getTable() != null && tickerPojo.getTable().size() > 0) {
            tickerPojoObservableField.set(tickerPojo);
            int i = 0;
            while (true) {
                if (i < tickerPojo.getTable().size()) {
                    if (!TextUtils.isEmpty(tickerPojo.getTable().get(i).getINDEXNAME()) && tickerPojo.getTable().get(i).getINDEXNAME().contains("BSE SENSEX")) {
                        tableObservableField.set(tickerPojo.getTable().get(i));
                        break;
                    }
                    i++;
                } else {
                    break;
                }
            }
        }
        int isMarketTickerShown = isMarketTickerShown();
        if (isMarketTickerShown >= 0) {
            try {
                ArrayList<Content> arrayList = this.list;
                if (arrayList != null && arrayList.size() > isMarketTickerShown && this.list.get(isMarketTickerShown) != null) {
                    this.list.get(isMarketTickerShown).getSourceBodyPojo().getTickerPojo().setTable(tickerPojo.getTable());
                    this.list.get(isMarketTickerShown).getSourceBodyPojo().getTickerPojo().setTable1(tickerPojo.getTable1());
                }
                RecyclerView findViewById = ((LinearLayout) ((LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isMarketTickerShown).itemView.findViewById(2131429475)).findViewById(2131429477)).findViewById(2131430278);
                q7.z1 z1Var = (q7.z1) findViewById.getAdapter();
                ArrayList arrayList2 = new ArrayList(tickerPojo.getTable());
                if (tickerPojo.getTable1() != null) {
                    arrayList2.addAll(tickerPojo.getTable1());
                }
                z1Var.o(arrayList2);
                findViewById.getAdapter().notifyDataSetChanged();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void getMeterValue(MeterModel meterModel) {
    }

    public String getPageTittle() {
        return this.pageTittle;
    }

    public void getPianoResponse(String str, ForyouPojo foryouPojo, PianoResponse pianoResponse) {
        com.htmedia.mint.utils.o1.a("HomeFragment", "**PianoResponse**" + pianoResponse.getResponseVariableMap());
        setContentData(foryouPojo, str);
    }

    @Override
    public void getResponse(JSONObject jSONObject, String str) {
        if (jSONObject != null) {
            new Gson();
            if (str.equalsIgnoreCase("indices_url")) {
                IndicesPojo indicesPojo = (IndicesPojo) new com.htmedia.mint.utils.r1().r(q.o.INDICES, jSONObject, BuildConfig.FLAVOR);
                this.indicesList.clear();
                this.indicesList.addAll(indicesPojo.getTable());
                if (indicesPojo.getTable1() != null) {
                    this.indicesList.addAll(indicesPojo.getTable1());
                }
                int isIndicesShown = isIndicesShown();
                if (isIndicesShown > 0) {
                    ArrayList<Content> arrayList = this.list;
                    if (arrayList != null && arrayList.size() > isIndicesShown && this.list.get(isIndicesShown) != null) {
                        if (this.list.get(isIndicesShown).getSourceBodyPojo() == null) {
                            this.list.get(isIndicesShown).setSourceBodyPojo(new SourceBodyPojo());
                        }
                        this.list.get(isIndicesShown).getSourceBodyPojo().setIndicesPojo(indicesPojo);
                    }
                    q7.f1 f1Var = (q7.f1) ((LinearLayout) ((RelativeLayout) ((LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isIndicesShown).itemView.findViewById(2131429474)).findViewById(2131429338)).findViewById(2131429258)).findViewById(2131430273).getAdapter();
                    this.indicesRecyclerViewAdapter = f1Var;
                    f1Var.n(this.indicesList);
                }
            }
        }
    }

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

    @Override
    public void getSection(SectionData sectionData) {
        if (sectionData.getResult().size() > 0) {
            com.htmedia.mint.utils.o1.a("topics availabe", sectionData.getResult().size() + BuildConfig.FLAVOR);
        }
    }

    @Override
    public void getSectionAAndC(LeftDrawerResponseParent leftDrawerResponseParent) {
    }

    public void getStoryData(ForyouPojo foryouPojo) {
    }

    @Override
    public void getStoryData(ForyouPojo foryouPojo, String str) {
        setDataAfterApiCall(foryouPojo, str);
    }

    public void initCall(Section section) {
        showNoInternetBackGround(false);
        Section section2 = this.section;
        if (section2 != null) {
            if (section2.getTemplate() != null) {
                getTempleteIndex(this.section.getTemplate());
            }
            if (this.section.getDesign() != null) {
                getTempleteIndex(this.section.getDesign());
            }
            if (isHomePage()) {
                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();
            com.htmedia.mint.utils.l2 l2Var = this.scrollListinerForCloseButton;
            if (l2Var != null) {
                l2Var.resetState();
            }
            this.sponseredAdCount = 0;
            this.lastSponAdPosition = 0;
            this.lastPhotoScreenAdPosition = 0;
            this.countFirstTwoAd = 2;
            this.isEmbedDone = false;
            this.isSecondAd = true;
            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;
            findListingTemplate(hashMap, this.section);
        }
    }

    public void initScrollListiner() {
        if (getActivity() != null) {
            com.htmedia.mint.utils.l2 l2Var = new com.htmedia.mint.utils.l2(getActivity(), this.binding.getRoot(), this.binding.c, this.linearLayoutManager, this, isHomePage()) {
                @Override
                public void onLoadMore(int i, int i2) {
                    String str;
                    HomeFragment.this.pageNo = i;
                    HomeFragment homeFragment = HomeFragment.this;
                    if (homeFragment.isForYouOrPopularFromAnalytics(homeFragment.section)) {
                        StringBuilder sb2 = new StringBuilder();
                        HomeFragment homeFragment2 = HomeFragment.this;
                        sb2.append(homeFragment2.getURL(homeFragment2.section));
                        sb2.append("?offset=");
                        sb2.append(HomeFragment.this.pageNo * 10);
                        sb2.append("&limit=10&u=");
                        sb2.append(HomeFragment.this.userId);
                        str = sb2.toString();
                    } else if (HomeFragment.this.storyUrl.contains("?")) {
                        str = HomeFragment.this.storyUrl + "&page=" + HomeFragment.this.pageNo;
                    } else {
                        str = HomeFragment.this.storyUrl + "?page=" + HomeFragment.this.pageNo;
                    }
                    String str2 = str;
                    com.htmedia.mint.utils.o1.a("Load More Url", str2);
                    if (HomeFragment.this.section.getType() != null) {
                        HomeFragment.this.section.getType();
                    }
                    if (HomeFragment.this.getTag() == null || HomeFragment.this.getTag().equals("FOR YOU") || HomeFragment.this.section.getId().equals("foryou_tab") || HomeFragment.this.section.getId().equals("DAILY_DIGEST") || HomeFragment.this.section.getId().equals("freemium") || HomeFragment.this.section.getId().equals("popular_page")) {
                        return;
                    }
                    HomeFragment.this.homePresenter.f(0, "HomeFragment", str2, null, HomeFragment.this.headers, false, false);
                }

                @Override
                public void onScrolled(RecyclerView recyclerView, int i, int i2) {
                    super.onScrolled(recyclerView, i, i2);
                    if (HomeFragment.this.linearLayoutManager.findFirstVisibleItemPosition() == 0 && HomeFragment.this.tabPosition == 0 && AppController.a0) {
                        HomeFragment.this.getActivity().z4();
                    }
                }
            };
            this.scrollListinerForCloseButton = l2Var;
            l2Var.setType(getTag());
            this.scrollListinerForCloseButton.setSection(this.section);
            if (TextUtils.isEmpty(this.section.getTemplate())) {
                this.scrollListinerForCloseButton.setTemplate(this.section.getDesign());
            } else {
                this.scrollListinerForCloseButton.setTemplate(this.section.getTemplate());
            }
            this.scrollListinerForCloseButton.setHomePage(isHomePage());
            this.binding.c.addOnScrollListener(this.scrollListinerForCloseButton);
        }
    }

    @Override
    public boolean isFreemium() {
        Section section = this.section;
        if (section == null || TextUtils.isEmpty(section.getId())) {
            return false;
        }
        return this.section.getId().equalsIgnoreCase("freemium");
    }

    public boolean isHomePage() {
        Section section = this.section;
        return "foryou_page_analytics".equalsIgnoreCase(section != null ? section.getId() : BuildConfig.FLAVOR);
    }

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

    public void notifyNewsListItems(Context context) {
        ArrayList<Content> arrayList;
        e6.b bVar;
        if (context == null || !isHomePage() || (arrayList = this.list) == null || arrayList.size() <= 0) {
            return;
        }
        boolean isPageCollectionContain = isPageCollectionContain(this.list);
        Content content = this.list.get(0);
        if ((isPageCollectionContain || (content != null && j5.b.r1.a().equalsIgnoreCase(content.getType()))) && (bVar = this.newsListViewModel) != null) {
            bVar.g(context, false, false);
        }
    }

    public void onActivityCloseClick() {
        int itemClicked = this.scrollListinerForCloseButton.getItemClicked();
        onCloseButtonClick(this.scrollListinerForCloseButton.getItemClicked(), this.list.get(itemClicked));
        ArrayList<Content> arrayList = this.list;
        if (arrayList == null || arrayList.size() <= 0) {
            return;
        }
        this.list.get(itemClicked).setSkip(false);
    }

    @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();
            this.listWithoutAds.clear();
            initCall(this.section);
            return;
        }
        if (id2 != 2131431085) {
            return;
        }
        this.binding.C.setVisibility(8);
        this.binding.o.setRefreshing(true);
        reset();
        this.bannerAdsCounter = 0;
        com.htmedia.mint.utils.k.n();
        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());
        }
        collapseView(i);
        this.binding.c.scrollToPosition(i);
        if (getActivity() != null && getActivity().i0.a.q != null) {
            getActivity().i0.a.q.setExpanded(true, true);
        }
        if (getActivity() != null) {
            getActivity().y4();
        }
        if (u7.q.d != null && content.isExpanded()) {
            u7.q.d.notifyItemChanged(i);
        }
        com.htmedia.mint.utils.k1.r(getActivity());
    }

    @Override
    public void onCommodityResponse(CommodityPojo commodityPojo, String str) {
        int isCommodityShown;
        if (commodityPojo == null || (isCommodityShown = isCommodityShown()) <= 0) {
            return;
        }
        ArrayList<Content> arrayList = this.list;
        if (arrayList != null && arrayList.size() > isCommodityShown && this.list.get(isCommodityShown) != null) {
            if (this.list.get(isCommodityShown).getSourceBodyPojo() == null) {
                SourceBodyPojo sourceBodyPojo = new SourceBodyPojo();
                sourceBodyPojo.setCommodityPojo(commodityPojo);
                this.list.get(isCommodityShown).setSourceBodyPojo(sourceBodyPojo);
            } else {
                this.list.get(isCommodityShown).getSourceBodyPojo().setCommodityPojo(commodityPojo);
            }
        }
        this.pagerAdapter = (q7.h) ((WrapContentHeightViewPager) ((LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isCommodityShown).itemView.findViewById(2131427861)).findViewById(2131432023)).getAdapter();
        if (f6.l.a(getActivity(), "is_mcx_selected")) {
            this.pagerAdapter.f(commodityPojo.getMcxgainer().get(0), commodityPojo.getMcxloser().get(0), commodityPojo.getMcxvolume().get(0), commodityPojo.getMcxvalue().get(0));
        } else {
            this.pagerAdapter.f(commodityPojo.getNcdexgainer().get(0), commodityPojo.getNcdexloser().get(0), commodityPojo.getNcdexvolume().get(0), commodityPojo.getNcdexvalue().get(0));
        }
    }

    public void onConfigurationChanged(@NonNull Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    @Nullable
    public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        this.binding = wf.c(layoutInflater, viewGroup, false);
        this.date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        this.binding.C.setOnClickListener(this);
        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);
        this.marketPresenter = new k6.v0(getActivity(), this);
        this.marketsGenericPresenter = new k6.x0(getActivity(), this);
        this.weekHighLowPresenter = new k6.c2(getActivity(), this);
        this.commodityPresenter = new k6.k(getActivity(), this);
        this.mostActiveByVolumePresenter = new k6.e1(getActivity(), this);
        if (!AppController.R.isEmpty()) {
            this.IS_ORIGIN_FROM_MOENGE_CONTINUE = AppController.R;
            AppController.R = BuildConfig.FLAVOR;
        }
        showErrorBackGround(BuildConfig.FLAVOR);
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(getActivity());
        this.mLinearLayoutManager = linearLayoutManager2;
        linearLayoutManager2.setOrientation(0);
        this.binding.B.c.setLayoutManager(this.mLinearLayoutManager);
        checkTheme(AppController.j().E());
        this.meterModelTimer = new MeterModelTimer();
        this.lotameClass = new com.htmedia.mint.utils.q1(getActivity());
        this.marketHelperClass = new com.htmedia.mint.utils.r1();
        if (getArguments() != null) {
            this.newSection = (Section) getArguments().getParcelable("home_menu_section");
        }
        if (getActivity() != null) {
            getActivity().D3(new com.htmedia.mint.ui.activity.j1() {
                @Override
                public final void onRefresh() {
                    HomeFragment.this.lambda$onCreateView$0();
                }
            });
        }
        setDeeplinkURLfromDL();
        return this.binding.getRoot();
    }

    public void onDestroy() {
        RecyclerView recyclerView;
        super.onDestroy();
        ArrayList arrayList = HomeActivity.H0;
        if (arrayList != null && arrayList.size() > 0) {
            HomeActivity.H0.clear();
            HomeActivity.E0 = 0;
        }
        wf wfVar = this.binding;
        if (wfVar == null || (recyclerView = wfVar.c) == null) {
            return;
        }
        recyclerView.setAdapter((RecyclerView.Adapter) null);
    }

    public void onDestroyView() {
        this.binding.v.setAdapter((RecyclerView.Adapter) null);
        this.binding.B.c.setAdapter((RecyclerView.Adapter) null);
        this.binding.c.setAdapter((RecyclerView.Adapter) null);
        if (getActivity() != null) {
            getActivity().D3((com.htmedia.mint.ui.activity.j1) null);
        }
        super.onDestroyView();
    }

    @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 instanceof q7.h0) {
            ((q7.h0) adapter).q(true);
        } else {
            ((q4) adapter).C(true);
        }
        com.htmedia.mint.utils.l2 l2Var = this.scrollListinerForCloseButton;
        if (l2Var != null) {
            l2Var.backToPreviousScroll();
        }
        if (str2.contains("/search/story")) {
            this.recyclerViewAdapter.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();
            }
        }
        wf wfVar = this.binding;
        SwipeRefreshLayout swipeRefreshLayout = wfVar.o;
        if (swipeRefreshLayout != null && wfVar.A != null) {
            swipeRefreshLayout.setRefreshing(false);
            this.binding.A.setVisibility(8);
            this.binding.A.stopShimmerAnimation();
        }
        ArrayList<Content> arrayList = this.list;
        if (arrayList == null || arrayList.size() != 0) {
            return;
        }
        showErrorBackGround(str);
    }

    @Override
    public void onError(String str, String str2, String str3) {
    }

    @Override
    public void onListItemClick(int i, Content content, RecyclerView.Adapter adapter, Section section, ArrayList<Content> arrayList) {
        AppController.O.i(String.valueOf(content.getId()));
        content.setRead(true);
        if (adapter != null) {
            adapter.notifyItemChanged(i);
        }
        FragmentActivity activity = getActivity();
        StringBuilder sb2 = new StringBuilder();
        sb2.append(content.getId());
        String str = BuildConfig.FLAVOR;
        sb2.append(BuildConfig.FLAVOR);
        com.htmedia.mint.utils.k.s(activity, sb2.toString());
        Bundle bundle = new Bundle();
        new ArrayList();
        if (adapter != null) {
            arrayList = ((q4) adapter).o();
        }
        String str2 = com.htmedia.mint.utils.n.x2;
        if (section.getUrl() != null && section.getUrl().contains("mostpopular")) {
            str2 = "news/trending";
        } else if (section.getUrl() != null && section.getUrl().contains("latest")) {
            str2 = "news/latest";
        } else if (content.getPersonalisedSection() != null && content.getPersonalisedSection().equalsIgnoreCase(getString(2131951831))) {
            str2 = "My Mint-Continue reading";
        } else if (!this.IS_ORIGIN_FROM_MOENGE_CONTINUE.isEmpty() && this.IS_ORIGIN_FROM_MOENGE_CONTINUE.equalsIgnoreCase("MoEngage Cards-Continue reading")) {
            str2 = "MoEngage Cards-Continue reading";
        } else if (getArguments().containsKey("IS_FROM_MARKET_DASH_MARKET_NEWS") && getArguments().getBoolean("IS_FROM_MARKET_DASH_MARKET_NEWS")) {
            if (getArguments().getString("articleName", BuildConfig.FLAVOR).equalsIgnoreCase("Market News")) {
                str2 = "market_news_listing_page";
            } else if (getArguments().getString("articleName", BuildConfig.FLAVOR).equalsIgnoreCase("IPO news")) {
                str2 = "ipo_news_listing_page";
            } else if (getArguments().getString("articleName", BuildConfig.FLAVOR).equalsIgnoreCase("Market Insight")) {
                StringBuilder sb3 = new StringBuilder();
                sb3.append("Market Dashboard/");
                Section section2 = this.section;
                if (section2 != null) {
                    str = section2.getDisplayName();
                }
                sb3.append(str);
                sb3.append("/");
                sb3.append(this.tabName);
                str2 = sb3.toString();
            }
        } else if (getArguments().containsKey("PREMIUM_TAB_KEY") && getArguments().getBoolean("IS_FROM_PREMIUM_MINT_EXCLUSIVES")) {
            str2 = "mint_exclusive_listing_page";
        } else {
            Section section3 = this.section;
            if ("marketinsights".equalsIgnoreCase(section3 != null ? section3.getId() : BuildConfig.FLAVOR)) {
                StringBuilder sb4 = new StringBuilder();
                Section section4 = this.section;
                if (section4 != null) {
                    str = section4.getDisplayName();
                }
                sb4.append(str);
                sb4.append("/");
                sb4.append(this.tabName);
                str2 = sb4.toString();
            }
        }
        bundle.putString(com.htmedia.mint.utils.n.Y, str2);
        bundle.putInt("pos", i);
        g7.a.u(getActivity(), bundle, content, arrayList);
    }

    @Override
    public void onMostActiveByVolumeResponse(MostActivePojo mostActivePojo, String str) {
        if (mostActivePojo == null || mostActivePojo.getTable() == null || mostActivePojo.getTable().size() <= 0) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        int i = 0;
        while (true) {
            if (i >= (mostActivePojo.getTable().size() < 4 ? mostActivePojo.getTable().size() : 4)) {
                break;
            }
            arrayList.add(mostActivePojo.getTable().get(i));
            i++;
        }
        int isMostActiveByVolumeShown = isMostActiveByVolumeShown();
        if (isMostActiveByVolumeShown > 0) {
            RelativeLayout relativeLayout = (RelativeLayout) this.binding.c.findViewHolderForAdapterPosition(isMostActiveByVolumeShown).itemView.findViewById(2131429378);
            RecyclerView findViewById = relativeLayout.findViewById(2131430297);
            TextView textView = (TextView) relativeLayout.findViewById(2131431517);
            if (arrayList.size() > 0 && !TextUtils.isEmpty(mostActivePojo.getTable().get(0).getUPDTIME())) {
                textView.setText("Update: " + mostActivePojo.getTable().get(0).getUPDTIME());
            }
            q7.y2 y2Var = new q7.y2(getActivity(), arrayList, BuildConfig.FLAVOR, null, BuildConfig.FLAVOR);
            this.mostActiveByVolumeAdapter = y2Var;
            findViewById.setAdapter(y2Var);
        }
    }

    @Override
    public void onNudgeViewVisible(int i, Content content, ArrayList<Content> arrayList) {
        if (!isAdded() || isStateSaved() || getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        if (f6.l.j(getActivity(), "nudge_timestamp") == 0 || com.htmedia.mint.utils.f0.M0(f6.l.j(getActivity(), "nudge_timestamp"), System.currentTimeMillis()) >= 24) {
            if (content.getSourceBodyPojo().getMintRecommendationPojo().getSectionPreferences() == null || content.getSourceBodyPojo().getMintRecommendationPojo().getSectionPreferences().getSections() == null || content.getSourceBodyPojo().getMintRecommendationPojo().getSectionPreferences().getSections().size() <= 0) {
                NudgeFirstTimeBottomSheet nudgeFirstTimeBottomSheet = new NudgeFirstTimeBottomSheet();
                nudgeFirstTimeBottomSheet.show(getChildFragmentManager(), "nudgeFirstTime");
                nudgeFirstTimeBottomSheet.setCancelable(false);
            } else {
                UserInputNudgeTopicAdditionPillsBottomSheet newInstance = UserInputNudgeTopicAdditionPillsBottomSheet.newInstance(content);
                newInstance.show(getChildFragmentManager(), "userInputBottomSheet");
                newInstance.setCancelable(false);
            }
        }
    }

    public void onPause() {
        super.onPause();
        Analytics.notifyExitForeground();
        if (getContext() != null) {
            k9.a.a.f(getContext());
        }
    }

    @Override
    public void onPersonalisedHyperLinkClick(int i, Content content, Section section) {
        String str = this.config.getRevisedForYouUrl() + "?htfpId=" + com.htmedia.mint.utils.f0.I0(getContext()) + "&propertyId=lm&section=" + content.getPersonalisedSectionId() + "&numStories=40";
        com.htmedia.mint.utils.o1.a("**URL***", str);
        section.setUrl(str);
        section.setListUrl(str);
        section.setDisplayName(content.getPersonalisedSection());
        HomeFragment homeFragment = new HomeFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable("top_section_section", this.section);
        bundle.putParcelable("home_menu_section", section);
        bundle.putBoolean("is_from_left_nav", true);
        bundle.putBoolean("is_from_viewpager", true);
        bundle.putBoolean("PERSONALIZATION_LINK_STOP", true);
        try {
            bundle.putString(com.htmedia.mint.utils.n.X, "home - " + this.section.getDisplayName());
            bundle.putString(com.htmedia.mint.utils.n.Y, "home");
        } catch (Exception e) {
            e.printStackTrace();
        }
        homeFragment.setArguments(bundle);
        sendPreferenceTracker(content.getPersonalisedSection());
        try {
            getActivity().getSupportFragmentManager().beginTransaction().add(2131429286, homeFragment, "Tag_Section").addToBackStack("Tag_Section").commit();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void onPremiumMeterError(String str) {
        s6.c cVar = this.premiumStoryMeterPresenter;
        if (cVar == null || cVar.d() == null) {
            Toast.makeText((Context) getActivity(), (CharSequence) getResources().getString(2131952559), 0).show();
        } else {
            fetchStoryData(this.premiumStoryMeterPresenter.d(), this.premiumStoryMeterPresenter.e());
        }
    }

    @Override
    public void onRecycleItemClick(final int i, final Content content, final ArrayList<Content> arrayList, final boolean z) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                if (HomeFragment.this.getActivity() != null) {
                    HomeFragment.this.getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ArrayList arrayList2;
                            if (HomeFragment.this.getActivity() != null) {
                                if (i < HomeFragment.firstPageSize && (j5.b.b.a().equalsIgnoreCase(content.getType()) || j5.b.e.a().equalsIgnoreCase(content.getType()))) {
                                    Content content2 = content;
                                    String url = (content2 == null || content2.getMetadata() == null || content.getLeadMedia().getVideo() == null) ? BuildConfig.FLAVOR : content.getLeadMedia().getVideo().getUrl();
                                    FragmentActivity activity = HomeFragment.this.getActivity();
                                    AnonymousClass4 anonymousClass4 = AnonymousClass4.this;
                                    int i2 = i;
                                    Content content3 = content;
                                    String[] strArr = new String[3];
                                    strArr[0] = j5.i.a(content3);
                                    strArr[1] = "story_click";
                                    strArr[2] = !TextUtils.isEmpty(url) ? "video uploaded" : "not uploaded";
                                    j5.i.b(activity, "homepage_top_click", "home", LogConstants.DEFAULT_CHANNEL, i2, content3, strArr);
                                    Log.i("checkForEvent: EVENT", i + BuildConfig.FLAVOR + content.getType());
                                }
                                AnonymousClass4 anonymousClass42 = AnonymousClass4.this;
                                if (z) {
                                    AppController.O.i(String.valueOf(content.getId()));
                                    content.setRead(true);
                                }
                                AnonymousClass4 anonymousClass43 = AnonymousClass4.this;
                                HomeFragment.this.scrollListinerForCloseButton.setItemClicked(i);
                                AnonymousClass4 anonymousClass44 = AnonymousClass4.this;
                                HomeFragment.this.webPageId = content.getWebPageId();
                                Section section = HomeFragment.this.section;
                                if (section != null) {
                                    if (!TextUtils.isEmpty(section.getType()) && HomeFragment.this.section.getType().equals("mintLounge")) {
                                        Section section2 = HomeFragment.this.section;
                                        if (section2 != null) {
                                            section2.setType("mintLounge");
                                        }
                                    } else if (TextUtils.isEmpty(HomeFragment.this.section.getId()) || !HomeFragment.this.section.getId().equalsIgnoreCase("lounge")) {
                                        Section section3 = HomeFragment.this.section;
                                        if (section3 != null) {
                                            section3.setType(BuildConfig.FLAVOR);
                                        }
                                    } else {
                                        Section section4 = HomeFragment.this.section;
                                        if (section4 != null) {
                                            section4.setType("mintLounge");
                                        }
                                    }
                                } else if (section != null) {
                                    section.setType(BuildConfig.FLAVOR);
                                }
                                Bundle bundle = new Bundle();
                                if (!TextUtils.isEmpty(HomeFragment.this.origin) && !HomeFragment.this.origin.contains("home")) {
                                    HomeFragment.this.origin = com.htmedia.mint.utils.n.x2;
                                } else if (HomeFragment.this.getArguments().containsKey("IS_FROM_MARKET_DASH_MARKET_NEWS") && HomeFragment.this.getArguments().getBoolean("IS_FROM_MARKET_DASH_MARKET_NEWS") && HomeFragment.this.getArguments().getString("articleName", BuildConfig.FLAVOR) != null) {
                                    if (HomeFragment.this.getArguments().getString("articleName", BuildConfig.FLAVOR).equalsIgnoreCase("Market News")) {
                                        HomeFragment.this.origin = "market_news_listing_page";
                                    } else if (HomeFragment.this.getArguments().getString("articleName", BuildConfig.FLAVOR).equalsIgnoreCase("IPO news")) {
                                        HomeFragment.this.origin = "ipo_news_listing_page";
                                    }
                                }
                                Section section5 = HomeFragment.this.section;
                                if ("marketinsights".equalsIgnoreCase(section5 != null ? section5.getId() : BuildConfig.FLAVOR)) {
                                    FragmentActivity activity2 = HomeFragment.this.getActivity();
                                    String str = com.htmedia.mint.utils.n.c2;
                                    String url2 = content.getMetadata() != null ? content.getMetadata().getUrl() : BuildConfig.FLAVOR;
                                    String[] strArr2 = new String[4];
                                    Section section6 = HomeFragment.this.section;
                                    strArr2[0] = section6 != null ? section6.getDisplayName() : BuildConfig.FLAVOR;
                                    strArr2[1] = content.getTitle();
                                    strArr2[2] = BuildConfig.FLAVOR + (i + 1);
                                    strArr2[3] = HomeFragment.this.tabName;
                                    com.htmedia.mint.utils.n.H(activity2, str, url2, strArr2);
                                    HomeFragment homeFragment = HomeFragment.this;
                                    StringBuilder sb2 = new StringBuilder();
                                    Section section7 = HomeFragment.this.section;
                                    sb2.append(section7 != null ? section7.getDisplayName() : BuildConfig.FLAVOR);
                                    sb2.append("/");
                                    sb2.append(HomeFragment.this.tabName);
                                    homeFragment.origin = sb2.toString();
                                }
                                AnonymousClass4 anonymousClass45 = AnonymousClass4.this;
                                if (content != null && (arrayList2 = arrayList) != null && !arrayList2.isEmpty()) {
                                    int size = arrayList.size();
                                    AnonymousClass4 anonymousClass46 = AnonymousClass4.this;
                                    int i3 = i;
                                    if (size < i3 && ((Content) arrayList.get(i3)).getMetadata() != null) {
                                        AnonymousClass4 anonymousClass47 = AnonymousClass4.this;
                                        if (((Content) arrayList.get(i)).getMetadata().getDesign() != null) {
                                            AnonymousClass4 anonymousClass48 = AnonymousClass4.this;
                                            if (((Content) arrayList.get(i)).getMetadata().getDesign().equalsIgnoreCase("Design 18")) {
                                                FragmentActivity activity3 = HomeFragment.this.getActivity();
                                                String str2 = com.htmedia.mint.utils.n.c2;
                                                String str3 = HomeFragment.this.origin;
                                                Content content4 = content;
                                                AnonymousClass4 anonymousClass49 = AnonymousClass4.this;
                                                com.htmedia.mint.utils.n.N(activity3, str2, "home", str3, content4, null, "event_curation", content4.getTitle(), BuildConfig.FLAVOR + (i + 1), ((Content) arrayList.get(i)).getTitle());
                                            }
                                        }
                                    }
                                }
                                bundle.putString(com.htmedia.mint.utils.n.Y, HomeFragment.this.origin);
                                bundle.putInt("pos", i);
                                HomeActivity activity4 = HomeFragment.this.getActivity();
                                AnonymousClass4 anonymousClass410 = AnonymousClass4.this;
                                g7.a.u(activity4, bundle, content, arrayList);
                                FragmentActivity activity5 = HomeFragment.this.getActivity();
                                AnonymousClass4 anonymousClass411 = AnonymousClass4.this;
                                com.htmedia.mint.utils.k1.k(activity5, i, content, HomeFragment.this.section.getDisplayName(), true);
                                if (!content.getType().equalsIgnoreCase(j5.b.e.a())) {
                                    com.htmedia.mint.utils.n.X2 = true;
                                }
                                if (content.getActualIndex() < AppController.j().g().getTopVisibleWidgetsClickCount()) {
                                    if (content.getArticleType() != null && content.getArticleType().equalsIgnoreCase("story")) {
                                        AnonymousClass4 anonymousClass412 = AnonymousClass4.this;
                                        if (q7.h0.j(content, HomeFragment.this.isHomePage())) {
                                            String valueOf = String.valueOf(i - 1);
                                            FragmentActivity activity6 = HomeFragment.this.getActivity();
                                            String str4 = com.htmedia.mint.utils.n.c2;
                                            String str5 = HomeFragment.this.origin;
                                            Content content5 = content;
                                            AnonymousClass4 anonymousClass413 = AnonymousClass4.this;
                                            com.htmedia.mint.utils.n.Q(valueOf, activity6, str4, "home", str5, content5, null, "top collection", content5.getTitle(), String.valueOf(HomeFragment.this.getActualPositionOfStory(content)), content.getMetadata().getUrl());
                                            return;
                                        }
                                    }
                                    FragmentActivity activity7 = HomeFragment.this.getActivity();
                                    String str6 = com.htmedia.mint.utils.n.c2;
                                    String str7 = HomeFragment.this.origin;
                                    Content content6 = content;
                                    AnonymousClass4 anonymousClass414 = AnonymousClass4.this;
                                    com.htmedia.mint.utils.n.N(activity7, str6, "home", str7, content6, null, "top collection", content6.getTitle(), String.valueOf(HomeFragment.this.getActualPositionOfStory(content)), content.getMetadata().getUrl(), Html.fromHtml(content.getMetadata().getSection()).toString().trim(), Html.fromHtml(content.getMetadata().getSubSection()).toString().trim(), String.valueOf(content.getMetadata().isPremiumStory()));
                                }
                            }
                        }
                    });
                }
            }
        }).start();
    }

    public void onRefresh() {
        if (getActivity() != null) {
            notifyNewsListItems(getActivity());
            AppController.U = null;
            clearStoryIds();
            this.isWelcomeCardAdded = false;
            this.isNewsLetterCardAdded = false;
            this.isMoengageCardAdded = false;
            this.binding.C.setVisibility(8);
            reset();
            this.bannerAdsCounter = 0;
            com.htmedia.mint.utils.k.n();
            initCall(this.section);
            refreshFlipBoolean();
            com.htmedia.mint.utils.l2 l2Var = this.scrollListinerForCloseButton;
            if (l2Var != null) {
                l2Var.setMintSpecialCompleteVisible(false);
            }
        }
    }

    public void onResume() {
        Bundle bundle;
        Bundle extras;
        super.onResume();
        sendAnalyticEventForMarket();
        u7.q.g = false;
        getActivity().z1(true);
        if (getActivity() != null) {
            getActivity().D1();
            notifyNewsListItems(getActivity());
        }
        RecyclerView.Adapter adapter = u7.q.d;
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
        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);
                com.htmedia.mint.utils.l2 l2Var = this.scrollListinerForCloseButton;
                if (l2Var != null) {
                    l2Var.checkEventsForList();
                }
            }
        }
        if (getTag() != null) {
            com.htmedia.mint.utils.o1.a("TAG", getTag() + " b");
            boolean equalsIgnoreCase = getTag().equalsIgnoreCase("HOME");
            String str = BuildConfig.FLAVOR;
            if (equalsIgnoreCase) {
                getActivity().f4(true, BuildConfig.FLAVOR);
                if (f6.l.a(getActivity(), "is_first_time_refresh") && com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) > 10 && com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) < 30) {
                    this.binding.C.setVisibility(8);
                    f6.l.m(getActivity(), "new_article_visibility_timestamp", Long.valueOf(System.currentTimeMillis()));
                    f6.l.m(getActivity(), "is_first_time_refresh", Boolean.TRUE);
                } else if (com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) > 30) {
                    this.binding.C.setVisibility(8);
                    refreshHomePage();
                    f6.l.m(getActivity(), "new_article_visibility_timestamp", Long.valueOf(System.currentTimeMillis()));
                    f6.l.m(getActivity(), "is_first_time_refresh", Boolean.TRUE);
                }
            } else if (getTag().contains("android:switcher:") && this.bundle.getString("MARKET_TAB_KEY") == null) {
                getActivity().z1(false);
                if (getActivity().e && this.tabPosition == 0 && com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) > 10 && com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) < 30) {
                    this.binding.C.setVisibility(8);
                    f6.l.m(getActivity(), "new_article_visibility_timestamp", Long.valueOf(System.currentTimeMillis()));
                    getActivity().e = false;
                } else if (getActivity().e && this.tabPosition == 0 && com.htmedia.mint.utils.f0.B1(f6.l.j(getActivity(), "new_article_visibility_timestamp"), System.currentTimeMillis()) > 30) {
                    this.binding.C.setVisibility(8);
                    f6.l.m(getActivity(), "new_article_visibility_timestamp", Long.valueOf(System.currentTimeMillis()));
                    refreshHomePage();
                    getActivity().e = false;
                }
            } else if (getTag().equalsIgnoreCase("LATEST")) {
                getActivity().j4("LATEST", false);
            } else if (getTag().equalsIgnoreCase("NEWS")) {
                getActivity().j4("NEWS", false);
            } else if (getTag().equalsIgnoreCase("GLOBAL")) {
                getActivity().k4(getActivity().Q0(this.section).toUpperCase(Locale.ENGLISH), false, true);
            } else if (getTag().equalsIgnoreCase("TRENDING")) {
                getActivity().j4("TRENDING", false);
            } else if (getTag().equalsIgnoreCase("PREMIUM") || isPremiumTabSelected()) {
                getActivity().f4(false, "PREMIUM");
            } else if (getTag().equalsIgnoreCase("Top News")) {
                getActivity().f4(false, "Top News");
            } else if (getTag().equalsIgnoreCase("MY READS")) {
                getActivity().j4("MY READS", false);
            } else if (getTag().equalsIgnoreCase("Tag_Story_Detail")) {
                getActivity().f4(false, BuildConfig.FLAVOR);
            } else if (getTag().equalsIgnoreCase("NEWS_NUMBER_DETAIL_TAG")) {
                getActivity().f4(false, BuildConfig.FLAVOR);
            } else if (getTag().equalsIgnoreCase("Tag_Section")) {
                Section section = this.section;
                if (section != null) {
                    str = section.getDisplayName();
                }
                getActivity().f4(false, setTitleAlongWithDeeplink(str));
                com.htmedia.mint.utils.o1.a("TAG", getTag() + " b " + this.section.getDisplayName());
            } else if (getTag().equalsIgnoreCase("Tag_Indice_News_Detail")) {
                HomeActivity activity2 = getActivity();
                Section section2 = this.section;
                if (section2 != null) {
                    str = section2.getDisplayName();
                }
                activity2.f4(false, str);
                com.htmedia.mint.utils.o1.a("TAG", getTag() + " b " + this.section.getDisplayName());
            } else if (getTag().equalsIgnoreCase("mintLounge")) {
                HomeActivity activity3 = getActivity();
                Section section3 = this.section;
                if (section3 != null) {
                    str = section3.getDisplayName();
                }
                activity3.f4(false, str);
                com.htmedia.mint.utils.o1.a("TAG", getTag() + " b " + this.section.getDisplayName());
            } else if (getTag().equalsIgnoreCase("FOR YOU")) {
                HomeActivity activity4 = getActivity();
                Section section4 = this.section;
                activity4.f4(false, section4 != null ? section4.getDisplayName() : "My Mint");
            } else if (getTag().equalsIgnoreCase("MARKETS")) {
                getActivity().f4(false, getString(2131952183));
                getActivity().z1(false);
            } else if (getTag().contains("android:switcher:") && (bundle = this.bundle) != null && bundle.getString("MARKET_TAB_KEY") != null && (this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("STOCKS") || this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("MUTUAL_FUNDS") || this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("MARKET"))) {
                getActivity().z1(false);
            } else if (getTag().contains(getString(2131952291))) {
                getActivity().f4(true, getString(2131952291));
            } else if (getTag().equalsIgnoreCase("Mint_piller_view_all_TAG")) {
                getActivity().i0.a.b.setVisibility(8);
            } else if (getTag().equalsIgnoreCase("CONTINUE_READ_VIEWALL_TAG")) {
                getActivity().i0.a.b.setVisibility(8);
                getActivity().f4(false, getString(2131952543));
            } else if (!getArguments().containsKey("IS_FROM_MARKET_DASH_MARKET_NEWS") || !getArguments().getBoolean("IS_FROM_MARKET_DASH_MARKET_NEWS")) {
                if (getTag() != null && !TextUtils.isEmpty(getTag())) {
                    str = getTag().toUpperCase();
                }
                getActivity().f4(false, str);
            }
        }
        if (HomeActivity.D0) {
            HomeActivity.D0 = false;
            int size = this.list.size();
            for (int i = 0; i < size; i++) {
                Content content = this.list.get(i);
                content.setExpanded(false);
                content.setListElement(null);
                content.setDeepBiStoryStatus(q.e.DEFAULT.ordinal());
                content.setDeepBiStoryClickIndex(0);
                this.list.set(i, content);
            }
            updateAndRefreshList();
        }
        if (AppController.j().C()) {
            checkTheme(this.appController.E());
            RecyclerView.Adapter adapter2 = this.recyclerViewAdapter;
            if (adapter2 != null) {
                adapter2.notifyDataSetChanged();
            }
            if (this.binding.v.getAdapter() != null) {
                this.binding.v.getAdapter().notifyDataSetChanged();
            }
        }
        RecyclerView.Adapter adapter3 = this.recyclerViewAdapter;
        if (adapter3 != null) {
            adapter3.notifyDataSetChanged();
        }
    }

    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() {
                    HomeFragment.this.binding.c.scrollBy(0, i);
                }
            });
        }
    }

    public void onSectionListItemClick(int i, Content content) {
        com.htmedia.mint.utils.o1.a("TAG", content.getType() + " SectionItem");
    }

    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());
        }
        startThreadForMarket();
        com.htmedia.mint.utils.o1.a("SnowPlow Analytics", "on start called");
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                com.htmedia.mint.utils.l2 l2Var;
                HomeFragment homeFragment = HomeFragment.this;
                if (!(homeFragment.recyclerViewAdapter instanceof q7.h0) || (l2Var = homeFragment.scrollListinerForCloseButton) == null || homeFragment.binding.c == null) {
                    return;
                }
                l2Var.checkResumedPositionForCards(homeFragment.linearLayoutManager, HomeFragment.this.binding.c);
            }
        }, 2000L);
    }

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

    @Override
    public void onTopNavTopicClick(int i, int i2, Section section) {
        if (section.getUrl().contains("/podcasts")) {
            openExternalWebPage(section);
        } else if (section.getUrl().equalsIgnoreCase(com.htmedia.mint.utils.s0.MINT_LOUNGE.b()) || section.getUrl().equalsIgnoreCase(com.htmedia.mint.utils.s0.MINT_LOUNGE_BUSINESS.b()) || section.getUrl().equalsIgnoreCase(com.htmedia.mint.utils.s0.MINT_LOUNGE_FEATURE.b()) || section.getUrl().equalsIgnoreCase(com.htmedia.mint.utils.s0.MINT_LOUNGE_INDULGE.b()) || section.getUrl().equalsIgnoreCase(com.htmedia.mint.utils.s0.MINT_LOUNGE_ON_SUNDAY.b())) {
            section.setUrl(section.getUrl() + "?utm_source=lm_androidapp&utm_medium=referral&utm_campaign=lm_androidapptopnav");
            openExternalWebPage(section);
        } else if (section.getUrl().contains("/quickread")) {
            openQuickReadFragment(i2);
        } else {
            openSection(section);
        }
        boolean isForYouURL = isForYouURL(this.section);
        String str = isForYouURL ? "home" : "topic_page";
        if (isForYouURL) {
            return;
        }
        com.htmedia.mint.utils.n.N(getContext(), com.htmedia.mint.utils.n.Z1, str, com.htmedia.mint.utils.n.k(HomeActivity.G0), null, BuildConfig.FLAVOR, com.htmedia.mint.utils.n.F, this.topicsList.get(i2).getDisplayName(), String.valueOf(i2 + 1), String.valueOf(i), section.getUrl());
    }

    @Override
    public void onTopicListItemClick(int i, Content content) {
        boolean z;
        Section w1 = com.htmedia.mint.utils.f0.w1(this.appController.g());
        com.htmedia.mint.utils.o1.a("TAG", w1.getDisplayName() + " topic");
        try {
            FragmentManager supportFragmentManager = getActivity().getSupportFragmentManager();
            HomeFragment homeFragment = new HomeFragment();
            Bundle bundle = new Bundle();
            bundle.putString("story_id", String.valueOf(content.getId()));
            if (content.getMetadata() != null && !content.getMetadata().isPremiumStory()) {
                z = false;
                bundle.putBoolean("keyPremiumStrory", z);
                w1.setListUrl(this.storyUrl);
                bundle.putParcelable("top_section_section", com.htmedia.mint.utils.f0.w1(this.appController.g()));
                homeFragment.setArguments(bundle);
                supportFragmentManager.beginTransaction().add(2131429286, homeFragment, "Tag_Story_Detail").addToBackStack("Tag_Story_Detail").commit();
            }
            z = true;
            bundle.putBoolean("keyPremiumStrory", z);
            w1.setListUrl(this.storyUrl);
            bundle.putParcelable("top_section_section", com.htmedia.mint.utils.f0.w1(this.appController.g()));
            homeFragment.setArguments(bundle);
            supportFragmentManager.beginTransaction().add(2131429286, homeFragment, "Tag_Story_Detail").addToBackStack("Tag_Story_Detail").commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
        super.onViewCreated(view, bundle);
        if (getActivity() != null) {
            this.newsListViewModel = new ViewModelProvider(getActivity()).get(e6.b.class);
        }
        this.lastDataSize = 0;
        u7.q.q0();
        q4.t();
        LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(2131429271);
        this.layoutClose = linearLayout;
        linearLayout.setVisibility(4);
        this.frameLayoutCloseButton = (FrameLayout) getActivity().findViewById(2131428019);
        this.appController = getActivity().getApplication();
        Bundle arguments = getArguments();
        this.bundle = arguments;
        if (arguments != null && arguments.containsKey("home_tab_zero_position")) {
            this.tabPosition = this.bundle.getInt("home_tab_zero_position");
        }
        if (getActivity().i0.a.q != null) {
            getActivity().i0.a.q.setExpanded(true, true);
        }
        getActivity().F3(false);
        if (getActivity().i0.a.b.getVisibility() == 0) {
            if (getActivity().i0.a.x.getVisibility() == 0) {
                this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(100));
            } else {
                this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(50));
            }
        } else if (getActivity().i0.a.x.getVisibility() == 0) {
            this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(50));
        } 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")) {
            this.section = (Section) this.bundle.getParcelable("top_section_section");
            fetchCDPNewsListData(getActivity());
            if (this.section.getId().contains("marketinsights")) {
                Content content = (Content) this.bundle.getParcelable("top_section_content");
                String string = this.bundle.getString("on_market_widget_tab_type");
                this.binding.r.setVisibility(0);
                this.binding.d.setVisibility(0);
                setMarketInsightHeader(content, string);
            } else {
                this.binding.r.setVisibility(8);
                this.binding.d.setVisibility(8);
            }
            if (!this.section.getId().contains("foryou_tab") || this.section.getDisplayName().equalsIgnoreCase("Home")) {
                this.binding.e.setVisibility(8);
            } else {
                this.binding.e.setVisibility(0);
                if (!TextUtils.isEmpty(this.config.getRevisedForYouDesc())) {
                    this.binding.E.setText(this.config.getRevisedForYouDesc());
                }
                if (!TextUtils.isEmpty(this.config.getRevisedForYouClickText())) {
                    this.binding.D.setText(this.config.getRevisedForYouClickText());
                }
                if (com.htmedia.mint.utils.f0.Z1()) {
                    this.binding.E.setTextColor(ContextCompat.getColor(getActivity() == null ? AppController.j() : getActivity(), 2131099995));
                } else {
                    this.binding.E.setTextColor(ContextCompat.getColor(getActivity() == null ? AppController.j() : getActivity(), 2131099991));
                }
            }
            this.binding.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    Intent intent = new Intent((Context) HomeFragment.this.getActivity(), (Class<?>) PrefSettingsNewActivity.class);
                    intent.putExtra("prefOrigin", q.h0.l1_section.name());
                    HomeFragment.this.startActivity(intent);
                }
            });
            this.listUrl = this.section.getListUrl();
            this.isBookmarkDetail = this.bundle.getBoolean("is_bookmark_detail", false);
            Section section = this.section;
            if (section != null) {
                if (section.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(getString(2131951858));
                }
                if (this.section.getDisplayName() != null) {
                    this.pageTittle = this.section.getDisplayName();
                } else {
                    this.pageTittle = BuildConfig.FLAVOR;
                }
                Section section2 = this.section;
                if (section2 == null || !section2.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[15])) {
                    if (!this.section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[6])) {
                        if (this.bundle.getInt("pos", -1) == -1 && !getActivity().T1()) {
                            com.htmedia.mint.utils.k1.x(com.htmedia.mint.utils.k1.l(getActivity()), com.htmedia.mint.utils.f0.l1(this.pageTittle, this.section.getParentSectionName()));
                        }
                        com.htmedia.mint.utils.n.q0(getActivity(), this.pageTittle);
                        this.section.getId();
                        postScreenEvent(this.section);
                    } else 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);
                    }
                } else if (getArguments() == null || !getArguments().containsKey("story_tittle")) {
                    com.htmedia.mint.utils.n.q0(getActivity(), "Launch From : " + this.section.getPageType());
                } else {
                    String string3 = getArguments().getString("story_tittle");
                    com.htmedia.mint.utils.n.q0(getActivity(), "Launch From : " + this.section.getPageType() + ", Headline :  " + string3);
                }
                postDMPvalue();
                String id2 = this.section.getId();
                this.pageId = id2;
                String[] strArr = com.htmedia.mint.utils.q.d;
                if (id2.equalsIgnoreCase(strArr[6]) || this.pageId.equalsIgnoreCase(strArr[15])) {
                    this.binding.o.setEnabled(false);
                    this.binding.o.setRefreshing(false);
                }
                initObjects(this.section);
            }
        }
        refreshFlipBoolean();
        checkWhatsAppSubscription();
        watchListNewsApiCall();
        u7.q.d = null;
    }

    @Override
    public void onWeekHighLowResponse(WeekHighLowPojoNew weekHighLowPojoNew, String str) {
        int isWeekHighLowShown;
        if (weekHighLowPojoNew == null || (isWeekHighLowShown = isWeekHighLowShown()) <= 0) {
            return;
        }
        ArrayList<Content> arrayList = this.list;
        if (arrayList != null && arrayList.size() > isWeekHighLowShown && this.list.get(isWeekHighLowShown) != null) {
            this.list.get(isWeekHighLowShown).getSourceBodyPojo().setWeekHighLowPojo(weekHighLowPojoNew);
        }
        this.weekHighLowPagerAdapter = (n8) ((WrapContentHeightViewPager) ((LinearLayout) this.binding.c.findViewHolderForAdapterPosition(isWeekHighLowShown).itemView.findViewById(2131427861)).findViewById(2131432023)).getAdapter();
        if (AppController.j().H()) {
            this.weekHighLowPagerAdapter.f(weekHighLowPojoNew.getBSEHIGH().get(0), weekHighLowPojoNew.getBSELOW().get(0));
        } else {
            if (weekHighLowPojoNew.getNSEHIGH() == null || weekHighLowPojoNew.getNSELOW() == null) {
                return;
            }
            this.weekHighLowPagerAdapter.f(weekHighLowPojoNew.getNSEHIGH().get(0), weekHighLowPojoNew.getNSELOW().get(0));
        }
    }

    public void openSection(Section section) {
        try {
            FragmentManager supportFragmentManager = getActivity().getSupportFragmentManager();
            HomeFragment homeFragment = new HomeFragment();
            Bundle bundle = new Bundle();
            bundle.putParcelable("top_section_section", section);
            bundle.putBoolean("is_from_left_nav", true);
            homeFragment.setArguments(bundle);
            supportFragmentManager.beginTransaction().add(2131429286, homeFragment, "Tag_Section").addToBackStack("Tag_Section").commitAllowingStateLoss();
            getActivity().f4(false, (section == null || TextUtils.isEmpty(section.getDisplayName())) ? BuildConfig.FLAVOR : section.getDisplayName().toUpperCase());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void pauseAllPlayers() {
        RecyclerView recyclerView;
        RecyclerView.Adapter adapter;
        if (!isHomePage() || (recyclerView = this.binding.c) == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        ((q7.h0) adapter).m(recyclerView);
    }

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

    public void refreshAuthorItemList() {
        RecyclerView.Adapter adapter;
        ArrayList<Content> arrayList;
        if (!isHomePage() || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0) || (arrayList = this.list) == null || arrayList.size() <= 0) {
            return;
        }
        int i = 0;
        while (true) {
            if (i >= this.list.size()) {
                i = -1;
                break;
            } else if (this.list.get(i) != null && !TextUtils.isEmpty(this.list.get(i).getType()) && this.list.get(i).getType().equalsIgnoreCase(j5.b.f0.a()) && !TextUtils.isEmpty(this.list.get(i).getSubType()) && this.list.get(i).getSubType().equalsIgnoreCase("authors")) {
                break;
            } else {
                i++;
            }
        }
        if (i < 0 || i >= this.list.size()) {
            return;
        }
        this.recyclerViewAdapter.notifyItemChanged(i);
    }

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

    public void releaseAllPlayers() {
        RecyclerView recyclerView;
        RecyclerView.Adapter adapter;
        if (!isHomePage() || (recyclerView = this.binding.c) == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        ((q7.h0) adapter).n(recyclerView);
    }

    public void sendPreferenceTracker(String str) {
        com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.U0, str, "topic_page", null, "home");
    }

    public void sendStoryEvents() {
        com.htmedia.mint.utils.l2 l2Var;
        RecyclerView.Adapter adapter;
        if (!isHomePage() || (l2Var = this.scrollListinerForCloseButton) == null || (adapter = this.recyclerViewAdapter) == null || !(adapter instanceof q7.h0)) {
            return;
        }
        l2Var.checkItemForStoryTemplate();
        if (getActivity() != null) {
            notifyNewsListItems(getActivity());
        }
    }

    public void setCardListPadding() {
        if (getActivity() != null) {
            if (getActivity().i0.a.b.getVisibility() == 0) {
                if (getActivity().i0.a.x.getVisibility() == 0) {
                    this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(100));
                    return;
                } else {
                    this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(50));
                    return;
                }
            }
            if (getActivity().i0.a.x.getVisibility() == 0) {
                this.binding.c.setPadding(0, 0, 0, com.htmedia.mint.utils.f0.a0(50));
            } else {
                this.binding.c.setPadding(0, 0, 0, 0);
            }
        }
    }

    void setDataAfterApiCall(ForyouPojo foryouPojo, String str) {
        Section section;
        boolean z = true;
        if (foryouPojo != null) {
            try {
                if ("foryou_page_analytics".equalsIgnoreCase(this.pageId) && this.pageNo == 0) {
                    foryouPojo.getMetadata().setRemoveTimestamp(true);
                    if (isRepeatHomePage(foryouPojo.getContentList())) {
                        return;
                    }
                    ArrayList<Content> arrayList = (ArrayList) foryouPojo.getContentList();
                    com.htmedia.mint.utils.f0.o = arrayList;
                    com.htmedia.mint.utils.f0.p = arrayList != null ? arrayList.size() : 0;
                    com.htmedia.mint.utils.n.N(getActivity(), com.htmedia.mint.utils.n.f2, "home", "home", null, "home", "top collection");
                }
            } catch (Exception e) {
                e.printStackTrace();
                com.htmedia.mint.utils.o0.h(e, str, e.getMessage());
                return;
            }
        }
        this.forYouPojo = foryouPojo;
        com.htmedia.mint.utils.o1.a("HomeFragment", "**GET Story Data**" + str);
        Config g = AppController.j().g();
        setIsRemoveTimeStamp(foryouPojo);
        if ("section".equalsIgnoreCase(this.section.getId()) && getTag().equalsIgnoreCase("Tag_Section") && getArguments() != null && "deep".equalsIgnoreCase(getArguments().getString("mode", BuildConfig.FLAVOR))) {
            String name = foryouPojo != null ? foryouPojo.getName() : BuildConfig.FLAVOR;
            if (!TextUtils.isEmpty(name) && name.trim().contains(" ")) {
                this.section.setDisplayName(name);
                getActivity().f4(false, setTitleAlongWithDeeplink(name));
                com.htmedia.mint.utils.o1.a("TAG", getTag() + " b " + this.section.getDisplayName());
            }
        }
        if (!this.isEmbedDone && (section = this.newSection) != null && section.getType() != null && this.newSection.getType().equals("small_webview")) {
            Content content = (Content) new Gson().fromJson("{\"adErrorOccurred\":false,\"articleType\":\"element\",\"bookmarkImageId\":0,\"browserNotificationHeadline\":\"\",\"closeButtonSticky\":false,\"commentOnStory\":0,\"createdBy\":\"Chirag Dubey\",\"createdDate\":\"2022-01-24T05:36:15+0000\",\"deepBiStoryClickIndex\":0,\"deepBiStoryStatus\":0,\"domainId\":\"5aeab8eefc36f218b0e0866b\",\"embed\":{\"backgroundColor\":\"#ffffff\",\"body\":\"\\u003cdiv class\\u003d\\\"usiframe\\\"\\u003e \\u003ciframe src\\u003d\\\"https://hilviz.s3-ap-southeast-1.amazonaws.com/mint_budget_2021/index.html?budgetLiberalisedIndia\\\"  width\\u003d\\\"100%\\\" height\\u003d\\\"600px\\\"\\u003e\\u003c/iframe\\u003e \\u003c/div\\u003e\",\"body2\":\"\\u003cdiv class\\u003d\\\"usiframe\\\"\\u003e \\u003ciframe src\\u003d\\\"https://hilviz.s3-ap-southeast-1.amazonaws.com/mint_budget_2021/index.html?budgetLiberalisedIndia\\\" width\\u003d\\\"100%\\\" height\\u003d\\\"600px\\\"\\u003e\\u003c/iframe\\u003e \\u003c/div\\u003e\",\"fontColor\":\"#212121\",\"label\":{\"backgroundColor\":\"\",\"fontColor\":\"\",\"text\":\"\"},\"labelEnabled\":false,\"option\":{},\"title\":\"30 BUDGETS OF LIBERALISED INDIA\",\"url\":\"\"},\"expanded\":false,\"facebookHeadline\":\"\",\"firstPublishedDate\":\"2022-01-07T09:05:13+0000\",\"headline\":\"\",\"id\":11641546296420,\"introBody\":\"\",\"isBudgetStoryDetail\":false,\"isConvertedListicle\":false,\"isHomeCardView\":false,\"isMintLoungeStory\":false,\"isMostPopularBackFill\":false,\"isNonLoginUnlockArticle\":false,\"isPartnerStory\":false,\"isRead\":false,\"isRecommendedBackFill\":false,\"isSimilarBackFill\":false,\"isSkip\":false,\"isSoftLogin\":false,\"isSummaryExpanded\":false,\"isUnlockArticle\":false,\"jsonSourceUrl\":\"\",\"lastModifiedBy\":\"D110089\",\"lastModifiedDate\":\"2022-01-24T05:36:15+0000\",\"lastPublishedBy\":\"D110089\",\"lastPublishedDate\":\"2022-01-24T05:36:15+0000\",\"metadata\":{\"agency\":\"\",\"agencyByLine\":[],\"alternateSection\":[],\"audioSourceUrl\":\"\",\"authors\":[],\"bigStory\":false,\"breakingNews\":false,\"canonicalUrl\":\"\",\"charCount\":0,\"column\":\"\",\"design\":\"Design 1\",\"disclaimer\":\"\",\"editedBy\":[],\"externalUrl\":\"\",\"genericOpenStory\":false,\"handpicked\":false,\"keywords\":[],\"killed\":false,\"killedStatusCode\":0,\"location\":[],\"premiumStory\":false,\"redirectUrl\":\"\",\"reportedBy\":[],\"section\":\"\",\"sponsored\":false,\"sponsoredTitle\":\"\",\"status\":\"PUBLISHED\",\"subSection\":\"\",\"tags\":[],\"topic\":[],\"url\":\"\",\"wordCount\":0,\"writtenBy\":[]},\"mobileAppNotificationHeadline\":\"\",\"mobileHeadline\":\"\",\"oldUuid\":\"\",\"quickReadSummary\":\"\",\"showRelated\":true,\"social\":{},\"subType\":\"\",\"summary\":\"\",\"timeToRead\":1,\"title\":\"Budget Liberalized India \",\"twitterHeadline\":\"\",\"type\":\"embed\",\"urlHeadline\":\"\",\"webId\":\"\"}", Content.class);
            content.getEmbed().setBody(this.newSection.getIframe());
            content.getEmbed().setTitle(BuildConfig.FLAVOR);
            content.getEmbed().setBody2(this.newSection.getIframe());
            content.setSubType("small_webview");
            content.getEmbed().setLabelEnabled(false);
            foryouPojo.getContentList().add(0, content);
            this.isEmbedDone = true;
        }
        if (g == null || g.getPiano() == null || !g.getPiano().isPaywallExperience()) {
            z = false;
        }
        if (!z) {
            setContentData(foryouPojo, str);
        } else if (isStoryContentAndRunPiano(foryouPojo, str)) {
            runPianoExperience(str, foryouPojo);
        } else {
            setContentData(foryouPojo, str);
        }
    }

    public void setDeeplinkURL(String str) {
        this.deeplinkURL = str;
    }

    public void setPianoExp() {
        q.a0 a0Var = this.pianoSectionType;
        String str = this.pianoSectionUrl;
        Section section = this.pianoSection;
        String str2 = BuildConfig.FLAVOR;
        if (section == null) {
            runPianoOnAllPages(str, BuildConfig.FLAVOR, BuildConfig.FLAVOR, a0Var);
            return;
        }
        String parentSectionName = section.getParentSectionName();
        String displayName = section.getDisplayName();
        if (TextUtils.isEmpty(parentSectionName)) {
            parentSectionName = section.getDisplayName();
        } else {
            str2 = displayName;
        }
        runPianoOnAllPages(str, parentSectionName, str2, a0Var);
    }

    public void setPianoPager() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000L);
                    if (HomeFragment.this.pianoSection != null) {
                        HomeFragment.this.setPianoExp();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }

    public void setStoryData(ForyouPojo foryouPojo, String str) {
        ArrayList<Content> arrayList;
        Config config;
        char c;
        Content dailyNewsLetterContent;
        Content ePaperContent;
        ArrayList<Content> arrayList2;
        Content moengageCardsContent;
        DataItem newsLetterAvailableForThisSection;
        ArrayList<Content> arrayList3;
        ArrayList<Content> arrayList4;
        if (foryouPojo != null && foryouPojo.getContentList() != null && foryouPojo.getContentList().size() > 0) {
            setStoryTemplateFromPageAttribute(foryouPojo.getContentList(), this.forYouPojo);
            if (isHomePage() && this.pageNo == 0 && (arrayList4 = this.list) != null && arrayList4.isEmpty()) {
                Config config2 = this.config;
                if ((config2 == null || config2.getNewsListConfig() == null || this.config.getNewsListConfig().getHomeHeaderConfig() == null) ? false : this.config.getNewsListConfig().getHomeHeaderConfig().getShouldShowHeader().booleanValue()) {
                    this.list.add(addNewListFollowContent());
                }
                firstPageSize = foryouPojo.getContentList().size();
            }
            if (isListAlreadyAdded(foryouPojo)) {
                System.out.println("List already added");
                return;
            }
            this.listWithoutAds.addAll(foryouPojo.getContentList());
            changeFirstItemHomePageWithNewDesign(this.listWithoutAds);
            if (f6.l.d(getActivity(), "toastCount") > 0 && this.pageNo == 2 && str.contains("page=2") && (f6.l.j(getActivity(), "personalized_toast_timestamp") == 0 || com.htmedia.mint.utils.f0.M0(f6.l.j(getActivity(), "personalized_toast_timestamp"), System.currentTimeMillis()) >= 24)) {
                f6.l.m(getActivity(), "personalized_toast_timestamp", Long.valueOf(System.currentTimeMillis()));
            }
            boolean contains = str.contains("search=id:");
            String str2 = BuildConfig.FLAVOR;
            if ((contains || 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(this.scrollListinerForCloseButton.getItemClicked(), this.section, null, null);
                    }
                } else {
                    this.forYouPojo = foryouPojo;
                    final Content content = foryouPojo.getContentList().get(0);
                    if (this.isBookmarkDetail && this.bundle.containsKey("image_id")) {
                        long j = this.bundle.getLong("image_id");
                        com.htmedia.mint.utils.o1.a("TAG id", j + " ");
                        content.setBookmarkImageId(j);
                    }
                    Section section = this.section;
                    if (section != null && !TextUtils.isEmpty(section.getType()) && this.section.getType().equals("mintLounge")) {
                        content.setMintLoungeStory(true);
                    }
                    this.articleId = content.getId();
                    this.disqusPresenter = new k6.v(getActivity(), new k6.w() {
                        @Override
                        public void onDetailDisqus(DetailDisqusPojo detailDisqusPojo, String str3) {
                            if (detailDisqusPojo == null || detailDisqusPojo.getResponse() == null) {
                                return;
                            }
                            int posts = detailDisqusPojo.getResponse().getPosts();
                            content.setCommentOnStory(posts);
                            content.setThreadId(detailDisqusPojo.getResponse().getId());
                            if (HomeFragment.this.list.size() > 0) {
                                HomeFragment homeFragment = HomeFragment.this;
                                homeFragment.recyclerViewAdapter.notifyItemChanged(homeFragment.scrollListinerForCloseButton.getItemClicked());
                            } else {
                                HomeFragment.this.recyclerViewAdapter.notifyItemChanged(0);
                            }
                            com.htmedia.mint.utils.o1.a("DISQUS", "DATA SET IN CONTENT " + posts);
                        }

                        @Override
                        public void onDetailListing(DisqusMessagePojo disqusMessagePojo) {
                        }

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

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

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

                        @Override
                        public void remoteAuth(RemoteAuthPojo remoteAuthPojo) {
                        }
                    });
                    if (this.config.getDisqus() != null) {
                        this.disqusPresenter.f(this.articleId + BuildConfig.FLAVOR);
                    }
                    if (content.getMetadata() == null || content.getMetadata().getCanonicalUrl() == null) {
                        com.htmedia.mint.utils.f0.y(BuildConfig.FLAVOR, this.contextualTargetPresenter, this.config.getContextualTarget_url());
                    } else {
                        com.htmedia.mint.utils.f0.y(content.getMetadata().getCanonicalUrl(), this.contextualTargetPresenter, this.config.getContextualTarget_url());
                    }
                    this.lotameClass.b(content, BuildConfig.FLAVOR, BuildConfig.FLAVOR);
                    if (content.getType().equalsIgnoreCase(j5.b.b.a()) && content.getMetadata().getKeywords() != null && content.getMetadata().getKeywords().contains(this.config.getBudgetKeyword().getKeyword())) {
                        content.setBudgetStoryDetail(true);
                    }
                    if (content.getType().equalsIgnoreCase(j5.b.u.a())) {
                        content.setType(j5.b.G.a());
                        content.setConvertedListicle(true);
                    }
                    if (this.list.size() <= 0) {
                        if (this.list.size() <= 0) {
                            Content content2 = new Content();
                            content2.setType(j5.b.r.a());
                            if (CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) && this.config.getSponsoredBanner() != null && this.config.getSponsoredBanner().isSponsoredBanner()) {
                                this.list.add(content2);
                            } else if (!com.htmedia.mint.utils.f0.O1()) {
                                if (!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                                    this.list.add(content2);
                                } else if (AppController.j().l() != null && !AppController.j().l().isSubscriptionActive()) {
                                    this.list.add(content2);
                                }
                            }
                        }
                        this.list.add(content);
                        this.recyclerViewAdapter.notifyDataSetChanged();
                        openOptionAccordingAction(content);
                    } else if (this.list.size() - 1 >= this.scrollListinerForCloseButton.getItemClicked()) {
                        this.list.set(this.scrollListinerForCloseButton.getItemClicked(), content);
                        this.recyclerViewAdapter.notifyItemChanged(this.scrollListinerForCloseButton.getItemClicked());
                    }
                    if (isOtherThanPhotoVedioAndCollection(content.getType())) {
                        content.setCloseButtonSticky(true);
                        content.setExpanded(true);
                        content.setWebPageId(UUID.randomUUID().toString());
                        Tracker instance = Tracker.instance();
                        Section section2 = this.section;
                        String str3 = com.htmedia.mint.utils.q.c[0];
                        com.htmedia.mint.utils.k1.w(instance, content, section2, str3, str3, content.isExpanded(), -1, this.pinnedArticleList, this.isPersonalizeCheck);
                        com.htmedia.mint.utils.n.q0(getActivity(), "Story Detail :- Template : Card,  Section : " + this.pageTittle + ", Headline : " + content.getHeadline());
                        if (content.getMetadata() != null && content.getMetadata().getSection() != null) {
                            com.htmedia.mint.utils.o1.a("TAG", "storyPage " + content.getMetadata().getSection());
                        }
                        checkAndUpdateCounterForSkipLogin(getActivity(), content, this.section);
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    Thread.sleep(1000L);
                                    if (HomeFragment.this.getActivity() != null) {
                                        HomeFragment.this.getActivity().runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                HomeFragment homeFragment = HomeFragment.this;
                                                homeFragment.scrollListinerForCloseButton.setContentPojosList(homeFragment.list);
                                                HomeFragment homeFragment2 = HomeFragment.this;
                                                homeFragment2.scrollListinerForCloseButton.setPinnedArticleList(homeFragment2.pinnedArticleList);
                                                HomeFragment homeFragment3 = HomeFragment.this;
                                                homeFragment3.scrollListinerForCloseButton.setIsPersonalizeCheck(homeFragment3.isPersonalizeCheck);
                                                com.htmedia.mint.utils.l2 l2Var = HomeFragment.this.scrollListinerForCloseButton;
                                                if (l2Var.isLastVisibleItemCrossBaseLine(l2Var.getItemClicked())) {
                                                    com.htmedia.mint.utils.l2 l2Var2 = HomeFragment.this.scrollListinerForCloseButton;
                                                    if (l2Var2.isItemBiggerThanScreen(l2Var2.getItemClicked())) {
                                                        HomeFragment.this.layoutClose.setVisibility(0);
                                                        return;
                                                    }
                                                }
                                                HomeFragment.this.layoutClose.setVisibility(4);
                                            }
                                        });
                                    }
                                } catch (Exception e) {
                                    com.htmedia.mint.utils.o0.g(e, getClass().getSimpleName());
                                    e.printStackTrace();
                                }
                            }
                        }).start();
                    }
                    String id2 = this.section.getId();
                    String[] strArr = com.htmedia.mint.utils.q.d;
                    if (id2.equalsIgnoreCase(strArr[6]) || id2.equalsIgnoreCase(strArr[15])) {
                        this.section = this.appController.g().getBottomNav().get(com.htmedia.mint.utils.f0.E0(this.appController.g().getBottomNav().size()));
                        com.htmedia.mint.utils.k1.k(getActivity(), 0, content, this.section.getDisplayName(), true);
                    }
                }
            } else if (str.contains("search=id:") && foryouPojo.getContentList().size() == 1) {
                this.forYouPojo = foryouPojo;
                Content content3 = foryouPojo.getContentList().get(0);
                Config config3 = this.config;
                if (config3 != null && config3.getWsjForPremiumArticles() != null && !TextUtils.isEmpty(this.config.getWsjForPremiumArticles().getUrl()) && this.config.getWsjForPremiumArticles().getUrl().equalsIgnoreCase(str) && this.config.getWsjForPremiumArticles().isWsjActive()) {
                    int position = this.config.getWsjForPremiumArticles().getPosition();
                    if (!com.htmedia.mint.utils.f0.O1() && !CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                        position++;
                    }
                    if (this.recyclerViewAdapter instanceof q4) {
                        com.htmedia.mint.utils.o1.a("TAG", "NewsRecyclerViewAdapter");
                        ArrayList<Content> arrayList5 = this.list;
                        if (arrayList5.size() >= this.config.getWsjForPremiumArticles().getPosition() && !arrayList5.contains(content3)) {
                            com.htmedia.mint.utils.o1.a("TAG", "NewsRecyclerViewAdapter DATA CONTENT");
                            arrayList5.add(position, content3);
                            this.recyclerViewAdapter.notifyDataSetChanged();
                        }
                    }
                }
            } else {
                String design = !isHomePage() ? foryouPojo.getDesign() : BuildConfig.FLAVOR;
                if (TextUtils.isEmpty(design)) {
                    design = this.section.getTemplate();
                }
                if (TextUtils.isEmpty(design)) {
                    design = this.section.getDesign();
                }
                if (!TextUtils.isEmpty(design) && this.list.size() <= 0) {
                    setAdapterWRTDesign(design);
                }
                this.scrollListinerForCloseButton.setStoryDetailContentLoaded(true);
                this.scrollListinerForCloseButton.setIsPersonalizeCheck(this.isPersonalizeCheck);
                if (this.list.size() <= 0) {
                    Content content4 = new Content();
                    content4.setType(j5.b.r.a());
                    content4.setOldUuid(this.appController.g().getAdsAndroid().getTopBannerAdIds().get(0));
                    if (!isPremiumAllWSJEcoSelected()) {
                        boolean z = (com.htmedia.mint.utils.f0.O1() || this.config.getSponsoredBanner() == null || !this.config.getSponsoredBanner().isSponsoredBanner()) ? false : true;
                        if ((!com.htmedia.mint.utils.f0.O1() || com.htmedia.mint.utils.f0.P1()) && ((!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) && ((getTag() == null || !getTag().equalsIgnoreCase("PREMIUM")) && !isPremiumTabSelected())) || ((AppController.j().l() != null && !AppController.j().l().isSubscriptionActive() && ((getTag() == null || !getTag().equalsIgnoreCase("PREMIUM")) && !isPremiumTabSelected())) || (AppController.j().l() != null && AppController.j().l().isSubscriptionActive() && com.htmedia.mint.utils.f0.P1() && ((getTag() == null || !getTag().equalsIgnoreCase("PREMIUM")) && !isPremiumTabSelected()))))) {
                            z = true;
                        }
                        if (this.config == null) {
                            this.config = AppController.j().g();
                        }
                        Config config4 = this.config;
                        if (config4 != null) {
                            boolean z2 = config4.getSponsoredBanner() != null && this.config.getSponsoredBanner().isSponsoredBanner();
                            boolean isShowMastheadOnHome = this.config.isShowMastheadOnHome();
                            if (z && ((z2 || isShowMastheadOnHome) && isHomePage())) {
                                if (this.config != null) {
                                    this.list.add(content4);
                                }
                            } else if (z) {
                                this.list.add(content4);
                            }
                        }
                    }
                }
                addDescriptionToSection(foryouPojo, this.list, this.section);
                if (foryouPojo.getBodyElements() != null && foryouPojo.getBodyElements().size() > 0 && foryouPojo.getBodyElementStories() != null && foryouPojo.getBodyElementStories().size() > 0) {
                    Content content5 = new Content();
                    content5.setId(foryouPojo.getId());
                    content5.setType(j5.b.w.a());
                    if (getArguments().containsKey("topicName")) {
                        content5.setTitle(getArguments().getString("topicName"));
                    } else {
                        content5.setTitle(foryouPojo.getName());
                    }
                    if (foryouPojo.getTitle() == null || foryouPojo.getTitle().equalsIgnoreCase(BuildConfig.FLAVOR)) {
                        content5.setMobileHeadline(foryouPojo.getName());
                    } else {
                        content5.setMobileHeadline(foryouPojo.getTitle());
                    }
                    Metadata metadata = new Metadata();
                    metadata.setUrl(foryouPojo.getUrl());
                    content5.setMetadata(metadata);
                    if (foryouPojo.getBodyElementStories().get(0).getLastPublishedDate() == null || foryouPojo.getBodyElementStories().get(0).getLastPublishedDate().isEmpty()) {
                        content5.setLastPublishedDate(foryouPojo.getBodyElementStories().get(0).getFirstPublishedDate());
                    } else {
                        content5.setLastPublishedDate(foryouPojo.getBodyElementStories().get(0).getLastPublishedDate());
                    }
                    StringBuilder sb2 = new StringBuilder();
                    if (foryouPojo.getMetadata() == null || foryouPojo.getMetadata().getAuthors() == null || foryouPojo.getMetadata().getAuthors().length <= 0) {
                        sb2.append(addHyperlink(getString(2131952216)));
                    } else {
                        for (int i = 0; i < foryouPojo.getMetadata().getAuthors().length; i++) {
                            if (i != 0) {
                                sb2.append(", ");
                            }
                            sb2.append(addHyperlink(foryouPojo.getMetadata().getAuthors()[i]));
                        }
                    }
                    content5.setLastPublishedBy(sb2.toString());
                    content5.setElements(foryouPojo.getBodyElements());
                    content5.setListElement(foryouPojo.getBodyElementStories());
                    this.list.add(content5);
                }
                if (this.storyUrl.contains("/topic/us-presidential-elections-2020") && this.appController.g().getUsElectionIframe() != null && this.appController.g().getUsElectionIframe().getScript() != null && !TextUtils.isEmpty(this.appController.g().getUsElectionIframe().getScript())) {
                    Content content6 = new Content();
                    content6.setType(j5.b.q.a());
                    Embed embed = new Embed();
                    embed.setBackgroundColor(BuildConfig.FLAVOR);
                    embed.setTitle(BuildConfig.FLAVOR);
                    embed.setFontColor(BuildConfig.FLAVOR);
                    embed.setLabelEnabled(false);
                    String str4 = "<html><body style=\"padding: 0; margin: 0;\">" + this.appController.g().getUsElectionIframe().getScript() + "</body></html>";
                    embed.setBody(str4);
                    embed.setBody2(str4);
                    content6.setEmbed(embed);
                    this.list.add(content6);
                }
                Config config5 = this.config;
                if ((config5 == null || config5.isShowHomeAdsAndroid() || !isHomePage()) && ((getTag() == null || !getTag().equalsIgnoreCase("PREMIUM")) && !isPremiumTabSelected())) {
                    List<Content> contentList = foryouPojo.getContentList();
                    if (com.htmedia.mint.utils.f0.O1()) {
                        if (this.list.size() >= 10 || !com.htmedia.mint.utils.f0.P1()) {
                            this.list.addAll(filterListByStoryId(contentList));
                        } else {
                            this.list.addAll(setAds(filterListByStoryId(contentList)));
                        }
                    } else if (!CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity())) {
                        this.list.addAll(setAds(filterListByStoryId(contentList)));
                    } else if (AppController.j().l() != null && !AppController.j().l().isSubscriptionActive()) {
                        this.list.addAll(setAds(filterListByStoryId(contentList)));
                    } else if (this.list.size() >= 10 || (AppController.j().l() != null && AppController.j().l().isSubscriptionActive())) {
                        if (this.list.size() >= 10 || !com.htmedia.mint.utils.f0.P1()) {
                            this.list.addAll(filterListByStoryId(contentList));
                        } else {
                            this.list.addAll(setAds(filterListByStoryId(contentList)));
                        }
                    } else if (!com.htmedia.mint.utils.f0.Q1()) {
                        this.list.addAll(setPremiumUserAds(filterListByStoryId(contentList)));
                    }
                    if (this.origin.equalsIgnoreCase("home - Home")) {
                        checkForStory9Story();
                    }
                    if ((getTag() != null && getTag().equalsIgnoreCase("NEWS") && this.config.getNewsSectionCarousel() != null && this.config.getNewsSectionCarousel().size() > 0) || (getArguments() != null && ((getArguments().containsKey("NEWS_TAB_KEY") && getArguments().getString("NEWS_TAB_KEY").equalsIgnoreCase("Latest News")) || (getArguments().containsKey("NEWS_TAB_KEY") && getArguments().getString("NEWS_TAB_KEY").equalsIgnoreCase("Trending News"))))) {
                        for (int i2 = 0; i2 < this.config.getNewsSectionCarousel().size(); i2++) {
                            CarouselItem carouselItem = this.config.getNewsSectionCarousel().get(i2);
                            Content content7 = new Content();
                            String type = carouselItem.getType();
                            type.hashCode();
                            switch (type.hashCode()) {
                                case -405568764:
                                    if (type.equals("podcast")) {
                                        c = 0;
                                        break;
                                    }
                                    c = 65535;
                                    break;
                                case -179793190:
                                    if (type.equals("newsletters")) {
                                        c = 1;
                                        break;
                                    }
                                    c = 65535;
                                    break;
                                case 112833:
                                    if (type.equals("rfu")) {
                                        c = 2;
                                        break;
                                    }
                                    c = 65535;
                                    break;
                                default:
                                    c = 65535;
                                    break;
                            }
                            switch (c) {
                                case 0:
                                    content7.setType(j5.b.f0.a());
                                    q.EnumC0038q enumC0038q = q.EnumC0038q.PODCAST_CAROUSEL;
                                    content7.setSubType(enumC0038q.a());
                                    if (this.list.get(carouselItem.getPosition()).getSubType() == null || !this.list.get(carouselItem.getPosition()).getSubType().equals(enumC0038q.a())) {
                                        this.list.add(carouselItem.getPosition(), content7);
                                        break;
                                    } else {
                                        break;
                                    }
                                case 1:
                                    content7.setType(j5.b.f0.a());
                                    q.EnumC0038q enumC0038q2 = q.EnumC0038q.NEWSLETTER_CAROUSEL;
                                    content7.setSubType(enumC0038q2.a());
                                    if (this.list.get(carouselItem.getPosition()).getSubType() == null || !this.list.get(carouselItem.getPosition()).getSubType().equals(enumC0038q2.a())) {
                                        this.list.add(carouselItem.getPosition(), content7);
                                        break;
                                    } else {
                                        break;
                                    }
                                case 2:
                                    content7.setType(j5.b.f0.a());
                                    q.EnumC0038q enumC0038q3 = q.EnumC0038q.RFU_CAROUSEL;
                                    content7.setSubType(enumC0038q3.a());
                                    Metadata metadata2 = new Metadata();
                                    metadata2.setDesign("Design 1");
                                    content7.setMetadata(metadata2);
                                    if (this.list.get(carouselItem.getPosition()).getSubType() == null || !this.list.get(carouselItem.getPosition()).getSubType().equals(enumC0038q3.a())) {
                                        this.list.add(carouselItem.getPosition(), content7);
                                        break;
                                    } else {
                                        break;
                                    }
                            }
                        }
                    }
                    if (this.bundle.getString("MARKET_TAB_KEY") != null && ((this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("MARKET") || this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("STOCKS")) && (config = this.config) != null && config.getMywatchlist() != null && this.config.getMywatchlist().isEnableWatchistAndroid() && this.config.getMywatchlist().isMarketWatchistEntryEnableAndroid() && !checkWatchListSubtypeExist(this.list))) {
                        Content content8 = new Content();
                        content8.setType(j5.b.f0.a());
                        content8.setSubType(q.EnumC0038q.WATCH_LIST_ENTRY_POINT.a());
                        this.list.add(content8);
                    }
                    if (this.bundle.getString("MARKET_TAB_KEY") != null && this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("MARKET")) {
                        Content content9 = new Content();
                        Metadata metadata3 = new Metadata();
                        metadata3.setDesign("Design 99");
                        content9.setMetadata(metadata3);
                        content9.setType(j5.b.f0.a());
                        content9.setSubType(q.EnumC0038q.MARKET_NEWS.a());
                        this.list.add(content9);
                    } else if (this.bundle.getString("MARKET_TAB_KEY") != null && this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("MUTUAL_FUNDS")) {
                        Content content10 = new Content();
                        Metadata metadata4 = new Metadata();
                        metadata4.setDesign("Design 99");
                        content10.setMetadata(metadata4);
                        content10.setType(j5.b.f0.a());
                        content10.setSubType(q.EnumC0038q.MUTUAL_FUND_NEWS.a());
                        this.list.add(content10);
                    } else if (this.bundle.getString("MARKET_TAB_KEY") != null && this.bundle.getString("MARKET_TAB_KEY").equalsIgnoreCase("STOCKS")) {
                        Content content11 = new Content();
                        Metadata metadata5 = new Metadata();
                        metadata5.setDesign("Design 99");
                        content11.setMetadata(metadata5);
                        content11.setType(j5.b.f0.a());
                        content11.setSubType(q.EnumC0038q.STOCK_NEWS.a());
                        this.list.add(content11);
                    }
                } else {
                    Config config6 = this.config;
                    this.list.addAll(filterListByStoryId((config6 == null || config6.getWsjForPremiumArticles() == null) ? foryouPojo.getContentList() : foryouPojo.getContentList()));
                }
                if (!isForYouURL(this.section) && !this.isNewsLetterCardAdded && (newsLetterAvailableForThisSection = getNewsLetterAvailableForThisSection(this.section)) != null) {
                    Config config7 = this.config;
                    int parseInt = (config7 == null || TextUtils.isEmpty(config7.getNewsletterEntryPointAfterPos())) ? 0 : Integer.parseInt(this.config.getNewsletterEntryPointAfterPos());
                    if (parseInt > 0 && (arrayList3 = this.list) != null && arrayList3.size() > parseInt) {
                        this.isNewsLetterCardAdded = true;
                        Content content12 = new Content();
                        Section section3 = this.section;
                        if (section3 != null) {
                            str2 = section3.getDisplayName();
                        }
                        content12.setPersonalisedSection(str2);
                        content12.setDataItem(newsLetterAvailableForThisSection);
                        content12.setSubType("newsletterEndpoint");
                        content12.setType(j5.b.f0.a());
                        this.list.add(parseInt, content12);
                    }
                }
                if (!this.isMoengageCardAdded) {
                    if (isForYouURL(this.section)) {
                        if (this.config == null) {
                            this.config = AppController.j().g();
                        }
                        Config config8 = this.config;
                        if (config8 != null && config8.getMoengageCardConfig() != null && !TextUtils.isEmpty(this.config.getMoengageCardConfig().getWelcomeBannerExploreUrlAndroid()) && !this.isWelcomeCardAdded && this.pageNo == 0 && this.section.getId().equalsIgnoreCase("foryou_page_analytics") && (!f6.l.a(getContext(), "IS_FIRST_WELCOME_EXPLORE_OPEN") || AppController.N)) {
                            this.isWelcomeCardAdded = true;
                            Content content13 = new Content();
                            content13.setSubType("welcome_explore");
                            content13.setType(j5.b.f0.a());
                            this.list.add(0, content13);
                            AppController.N = true;
                            f6.l.m(getContext(), "IS_FIRST_WELCOME_EXPLORE_OPEN", Boolean.TRUE);
                        }
                        int c2 = com.htmedia.mint.utils.t1.c(q.t.HOME);
                        ArrayList<Content> arrayList6 = this.list;
                        if (arrayList6 != null && arrayList6.size() > 0 && this.list.get(0).getType().equalsIgnoreCase(j5.b.r.a())) {
                            c2++;
                        }
                        if (c2 >= 0 && isForYouURL(this.section) && c2 < this.list.size() && (moengageCardsContent = getMoengageCardsContent()) != null) {
                            this.isMoengageCardAdded = true;
                            this.list.add(c2, moengageCardsContent);
                        }
                    } else {
                        q.t tVar = q.t.SECTION;
                        int c3 = com.htmedia.mint.utils.t1.c(tVar);
                        if (c3 > -1) {
                            ArrayList<Content> arrayList7 = this.list;
                            if (arrayList7 != null && arrayList7.size() > 0 && this.list.get(0).getType().equalsIgnoreCase(j5.b.r.a())) {
                                c3++;
                            }
                            Content a = com.htmedia.mint.utils.t1.a(getActivity(), this.config, foryouPojo.getName(), tVar);
                            if (c3 >= 0 && c3 < this.list.size() && (arrayList2 = this.list) != null && arrayList2.size() > 0 && a != null) {
                                this.isMoengageCardAdded = true;
                                this.list.add(c3, a);
                            }
                        }
                    }
                }
                if (this.bundle.getString("PREMIUM_TAB_KEY") != null && this.bundle.getString("PREMIUM_TAB_KEY").equalsIgnoreCase("All") && this.config.getMintSpecialForPremiumArticles() != null && this.config.getMintSpecialForPremiumArticles().isMintSpecialActive() && (this.list.isEmpty() || (this.list.get(this.config.getMintSpecialForPremiumArticles().getPosition()).getSubType() != null && !this.list.get(this.config.getMintSpecialForPremiumArticles().getPosition()).getSubType().equalsIgnoreCase("mint_story_cards")))) {
                    Content content14 = new Content();
                    content14.setSubType("mint_story_cards");
                    content14.setType(j5.b.f0.a());
                    this.list.add(this.config.getMintSpecialForPremiumArticles().getPosition(), content14);
                }
                if (!this.isEpaperAdded) {
                    this.isEpaperAdded = true;
                    int indexEpaper = getIndexEpaper();
                    if (indexEpaper >= 0 && isForYouURL(this.section) && indexEpaper < this.list.size() && (ePaperContent = getEPaperContent()) != null) {
                        this.list.add(indexEpaper, ePaperContent);
                    }
                }
                if (!this.isDailyNewsLetterAdded) {
                    this.isDailyNewsLetterAdded = true;
                    int indexNewsLetter = getIndexNewsLetter();
                    if (indexNewsLetter >= 0 && isForYouURL(this.section) && indexNewsLetter < this.list.size() && (dailyNewsLetterContent = getDailyNewsLetterContent()) != null) {
                        this.list.add(indexNewsLetter, dailyNewsLetterContent);
                    }
                }
                if (this.recyclerViewAdapter instanceof q7.h0) {
                    com.htmedia.mint.utils.o1.a("TAG", "ForYouRecyclerViewAdapter");
                    ((q7.h0) this.recyclerViewAdapter).q(true);
                    ((q7.h0) this.recyclerViewAdapter).r(str);
                    ((q7.h0) this.recyclerViewAdapter).v(this.pageNo);
                } else {
                    com.htmedia.mint.utils.o1.a("TAG", "NewsRecyclerViewAdapter");
                    Section section4 = this.section;
                    if (section4 != null && !TextUtils.isEmpty(section4.getType()) && this.section.getType().equals("mintLounge")) {
                        ((q4) this.recyclerViewAdapter).G(true);
                    }
                    ((q4) this.recyclerViewAdapter).C(true);
                    ((q4) this.recyclerViewAdapter).E(str);
                    ((q4) this.recyclerViewAdapter).setPageNo(this.pageNo);
                }
                this.binding.c.post(new Runnable() {
                    @Override
                    public void run() {
                        HomeFragment.this.recyclerViewAdapter.notifyItemInserted(r0.list.size() - 1);
                        if (HomeFragment.this.pageNo == 0) {
                            HomeFragment.this.handler.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    HomeFragment.this.scrollListinerForCloseButton.checkEventsForList();
                                    HomeFragment homeFragment = HomeFragment.this;
                                    homeFragment.scrollListinerForCloseButton.isMintSpecialVisibleForFirstTime(homeFragment.binding.c, homeFragment.list);
                                }
                            }, 1000L);
                        }
                    }
                });
            }
            if (getActivity() != null) {
                getActivity().D1();
            }
            if (this.isBookmarkDetail && foryouPojo.getContentList() != null) {
                new Handler().postDelayed(new AnonymousClass8(foryouPojo.getContentList().get(0)), 1250L);
            }
            if (this.tabPosition == 0 && com.htmedia.mint.utils.f0.m) {
                long currentTimeMillis = System.currentTimeMillis();
                com.htmedia.mint.utils.f0.k = currentTimeMillis;
                long j2 = currentTimeMillis - com.htmedia.mint.utils.f0.j;
                boolean z3 = com.htmedia.mint.utils.f0.b;
                boolean z4 = com.htmedia.mint.utils.f0.b;
                com.htmedia.mint.utils.o1.a("Load Time - Home", String.valueOf(j2));
                com.htmedia.mint.utils.f0.m = false;
            }
            findNewsListWidgetIndex(foryouPojo.getContentList(), null);
        } else if (getArguments().getString("IF_FAIL_URL_KEY") == null || (arrayList = this.list) == null || !arrayList.isEmpty()) {
            RecyclerView.Adapter adapter = this.recyclerViewAdapter;
            if (adapter instanceof q7.h0) {
                ((q7.h0) adapter).q(true);
            } else {
                ((q4) adapter).C(true);
            }
            refreshList();
            if (this.list.size() <= 0) {
                showErrorBackGround("server not responding");
            }
        } else {
            try {
                getActivity().getSupportFragmentManager().popBackStack();
            } catch (Exception e) {
                e.printStackTrace();
            }
            com.htmedia.mint.utils.f0.z2(getContext(), com.htmedia.mint.utils.f0.v(getArguments().getString("IF_FAIL_URL_KEY"), getContext()));
        }
        if (com.htmedia.mint.utils.n.p(getContext()).equals("home")) {
            m7.g.p(AppController.V);
        }
        sendScreenLoadEvent();
    }

    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.binding.b;
            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")) {
            wf wfVar = this.binding;
            RecyclerView recyclerView3 = wfVar.c;
            if (recyclerView3 == null || wfVar.j == null) {
                return;
            }
            recyclerView3.setVisibility(0);
            LinearLayout linearLayout2 = this.binding.j;
            if (linearLayout2 != null) {
                linearLayout2.setVisibility(8);
                return;
            }
            return;
        }
        CardView cardView2 = this.binding.b;
        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) {
        if (!z) {
            this.binding.c.setVisibility(0);
            this.binding.j.setVisibility(8);
            return;
        }
        this.binding.c.setVisibility(8);
        this.binding.b.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 updateAndRefreshList() {
        ArrayList<Content> arrayList;
        RecyclerView.Adapter adapter;
        if (com.htmedia.mint.utils.f0.b || (arrayList = this.list) == null || arrayList.size() <= 0 || (adapter = this.recyclerViewAdapter) == null) {
            return;
        }
        adapter.notifyDataSetChanged();
    }

    public void updateUnlockArticleAndRefreshList(int i) {
        ArrayList<Content> arrayList;
        if (com.htmedia.mint.utils.f0.b || (arrayList = this.list) == null || arrayList.size() <= 0 || this.recyclerViewAdapter == null) {
            return;
        }
        this.list.get(i).setUnlockArticle(true);
        com.htmedia.mint.utils.o1.a("HomeFrgemnt", "TAG:::::::::::");
        this.recyclerViewAdapter.notifyDataSetChanged();
    }
}