导航菜单

页面标题

页面副标题

Mint v5.7.3 - MyReadsFragment.java 源代码

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

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


package com.htmedia.mint.ui.fragments;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableBoolean;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.comscore.Analytics;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.LoadAdError;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.CheckSubscriptionFromLocal;
import com.htmedia.mint.pojo.BookmarkIdpojo;
import com.htmedia.mint.pojo.BookmarkStatus;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.ForyouPojo;
import com.htmedia.mint.pojo.SectionData;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.Section;
import com.htmedia.mint.ui.activity.PhotoGalleryDetailActivity;
import com.htmedia.mint.ui.fragments.leftmenudrawer.model.LeftDrawerResponseParent;
import com.htmedia.mint.utils.k;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import io.supercharge.shimmerlayout.ShimmerLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONObject;
import q7.k7;
import q7.p3;
import t5.a;
import x4.gp0;
import x4.zt;

public class MyReadsFragment extends Fragment implements k6.s, k6.h0, p3.e, k7.b, k6.v1, View.OnClickListener, p3.c, k6.f {
    private static final String SCREEN_NAME = "My Reads";
    private static final String TAG = "MyReadsFragment";
    private AppController appController;
    private gp0 binding;
    private k6.r configPresenter;
    private ArrayList<Content> continueReadArrayList;
    private HashMap<String, String> headers;
    private k6.g0 homePresenter;
    private LinearLayoutManager horizontalLayoutManager;
    private LinearLayout layoutClose;
    private LinearLayout linearLayout;
    private LinearLayoutManager linearLayoutManager;
    private ProgressDialog mProgressDialog;
    private String origin;
    private int pageNo;
    private com.htmedia.mint.utils.l2 scrollListinerForCloseButton;
    private k6.u1 sectionPresenter;
    private q7.p3 sectionsListRecyclerViewAdapter;
    private k7 topNavTopicsAdapter;
    public List<Section> topicsList = new ArrayList();
    int errorFlag = 0;
    private String TAG1 = BuildConfig.FLAVOR;
    private final ArrayList<Content> contentListBookmark = new ArrayList<>();
    private final ArrayList<Content> contentListPhotoBookmark = new ArrayList<>();
    private final List<Content> initalcontentListPhotoBookmark = new ArrayList();
    private final ArrayList<Content> contentListHistory = new ArrayList<>();
    private final Hashtable<String, String> bookmarksPhotoIdMap = new Hashtable<>();
    private final Hashtable<String, Content> storywithContentTable = new Hashtable<>();
    private final Hashtable<String, Content> selectedbookmarksPhotoIdMap1 = new Hashtable<>();
    private final Set<String> storyIdSet = new HashSet();
    private int noOfApiCall = 0;

    private void addContinueReadItem() {
        if (getActivity() == null || this.continueReadArrayList.isEmpty() || this.contentListHistory.isEmpty() || this.contentListHistory.get(0).getType() == null || this.contentListHistory.get(0).getType().equalsIgnoreCase(getActivity().getResources().getString(2131951831))) {
            return;
        }
        Content content = new Content();
        content.setType(getActivity().getString(2131951831));
        content.setSubType(getActivity().getString(2131951831));
        content.setTitle(getActivity().getString(2131951831));
        this.contentListHistory.add(0, content);
    }

    private void dissmisProgressDialog() {
        try {
            ProgressDialog progressDialog = this.mProgressDialog;
            if (progressDialog != null) {
                progressDialog.dismiss();
            }
        } catch (Exception e) {
            e.printStackTrace();
            com.htmedia.mint.utils.o0.f(e);
        }
    }

    private void fetchBookmarkData() {
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userToken") != null) {
            if (this.appController == null) {
                this.appController = AppController.j();
            }
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("Authorization", com.htmedia.mint.utils.f0.G1(getActivity(), "userToken"));
            com.htmedia.mint.utils.o1.a("TAG", com.htmedia.mint.utils.f0.G1(getActivity(), "userToken"));
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("siteId", "LM");
            } catch (Exception e) {
                com.htmedia.mint.utils.o0.g(e, getClass().getSimpleName());
            }
            this.TAG1 = "Bookmark";
            String ssoBaseUrl = this.appController.g().getSso().getSsoBaseUrl();
            com.htmedia.mint.utils.o1.a("Bookmark Url", ssoBaseUrl + this.appController.g().getBookmark().getFetchBookmark() + "0");
            this.homePresenter.f(1, this.TAG1, ssoBaseUrl + this.appController.g().getBookmark().getFetchBookmark() + "0", jSONObject, hashMap, false, false);
        }
    }

    private void fetchId() {
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userToken") != null) {
            com.htmedia.mint.utils.f0.f0(getActivity(), "getAllIds", this);
        }
    }

    private String getOtherUrl(Config config, String str) {
        for (Section section : config.getOthers()) {
            if (section.getId().equalsIgnoreCase(str)) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url;
                }
                return config.getServerUrl() + url;
            }
        }
        return BuildConfig.FLAVOR;
    }

    private void getPhotoListData(String str) {
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userToken") != null) {
            String storyList = getStoryList(this.appController.g());
            this.TAG1 = "Photo_Bookmark";
            com.htmedia.mint.utils.o1.a("TAG", storyList + str + "&elements=true");
            this.homePresenter.f(0, this.TAG1, storyList + str + "&elements=true", null, this.headers, false, false);
        }
    }

    private Section getStoryDetailSection() {
        for (Section section : this.appController.g().getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[6])) {
                return section;
            }
        }
        return null;
    }

    private static Section getStoryDetailSection(Config config) {
        for (Section section : config.getOthers()) {
            if (section.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                return section;
            }
        }
        return null;
    }

    private String getStoryList(Config config) {
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        String str = BuildConfig.FLAVOR;
        for (Section section : this.appController.g().getOthers()) {
            if (section.getId().equals(com.htmedia.mint.utils.q.d[6])) {
                str = section.getUrl().contains("http") ? section.getUrl() : config.getServerUrl() + section.getUrl();
            }
        }
        return str;
    }

    private void initScrollListiner() {
        if (getActivity() == null || this.scrollListinerForCloseButton != null) {
            return;
        }
        com.htmedia.mint.utils.l2 l2Var = new com.htmedia.mint.utils.l2(getActivity(), this.binding.getRoot(), this.binding.h, this.linearLayoutManager) {
            @Override
            public void onLoadMore(int i, int i2) {
                if (MyReadsFragment.this.contentListBookmark == null || MyReadsFragment.this.contentListBookmark.size() <= 0 || MyReadsFragment.this.linearLayoutManager.getItemCount() != 1) {
                    MyReadsFragment.this.pageNo = i;
                    MyReadsFragment myReadsFragment = MyReadsFragment.this;
                    myReadsFragment.getHistoryData(i, myReadsFragment.getActivity(), 2);
                } else if (MyReadsFragment.this.scrollListinerForCloseButton != null) {
                    MyReadsFragment.this.scrollListinerForCloseButton.resetState();
                }
            }
        };
        this.scrollListinerForCloseButton = l2Var;
        l2Var.setTemplate(com.htmedia.mint.utils.q.c[1]);
        this.binding.h.addOnScrollListener(this.scrollListinerForCloseButton);
    }

    private void makeApiCall() {
        ArrayList arrayList = new ArrayList(this.storyIdSet);
        int size = arrayList.size();
        com.htmedia.mint.utils.o1.a("TAG", "API call  Photo  " + size);
        if (size <= 0) {
            ArrayList<Content> arrayList2 = this.contentListHistory;
            if (arrayList2 == null || arrayList2.size() != 0) {
                return;
            }
            getHistoryData(0, getActivity(), 6);
            initScrollListiner();
            return;
        }
        for (int i = 0; i < size; i++) {
            if (!this.storywithContentTable.containsKey(arrayList.get(i))) {
                getPhotoListData((String) arrayList.get(i));
                com.htmedia.mint.utils.o1.a("TAG", "NO KEY AND NOT VALUE");
            } else if (this.storywithContentTable.get(arrayList.get(i)) == null) {
                getPhotoListData((String) arrayList.get(i));
                com.htmedia.mint.utils.o1.a("TAG", "HAVE KEY BUT NOT VALUE");
            } else {
                com.htmedia.mint.utils.o1.a("TAG", "HAVE KEY AND VALUE");
            }
        }
    }

    private void makeContentPhotoBookmark() {
        ArrayList<Content> arrayList;
        if (this.noOfApiCall == this.storyIdSet.size()) {
            for (Map.Entry<String, String> entry : this.bookmarksPhotoIdMap.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();
                com.htmedia.mint.utils.o1.a("TAG", key + " " + value);
                Iterator<Map.Entry<String, Content>> it = this.storywithContentTable.entrySet().iterator();
                while (true) {
                    if (it.hasNext()) {
                        Map.Entry<String, Content> next = it.next();
                        if (next.getKey().equals(value)) {
                            Content content = (Content) com.htmedia.mint.utils.f0.S(next.getValue());
                            com.htmedia.mint.utils.o1.a("TAG now1", next.getValue().toString() + " " + content.toString());
                            next.getValue().setBookmarkImageId(Long.parseLong(entry.getKey()));
                            this.selectedbookmarksPhotoIdMap1.put(entry.getKey(), content);
                            break;
                        }
                    }
                }
            }
            for (Map.Entry<String, Content> entry2 : this.selectedbookmarksPhotoIdMap1.entrySet()) {
                entry2.getValue().setBookmarkImageId(Long.parseLong(entry2.getKey()));
                com.htmedia.mint.utils.o1.a("TAG now", entry2.getValue().toString());
                this.contentListPhotoBookmark.add(entry2.getValue());
            }
            dissmisProgressDialog();
            com.htmedia.mint.utils.o1.a("TAG", this.selectedbookmarksPhotoIdMap1 + " ");
            addContinueReadItem();
            this.sectionsListRecyclerViewAdapter.notifyDataSetChanged();
            ArrayList<Content> arrayList2 = this.contentListHistory;
            if (arrayList2 != null && arrayList2.size() == 0) {
                getHistoryData(0, getActivity(), 4);
                initScrollListiner();
            }
            if (this.contentListBookmark.size() == 0 && this.contentListHistory.size() == 0 && (arrayList = this.contentListPhotoBookmark) != null && arrayList.size() == 0 && this.errorFlag > 0) {
                showNoDataAvailableErrorPage();
            } else {
                this.errorFlag = 1;
            }
        }
        com.htmedia.mint.utils.o1.a("TAG bookmarkimage after", this.contentListPhotoBookmark.size() + " ");
    }

    public static void onListItemClick(int i, Content content, ArrayList<Content> arrayList, Activity activity) {
        try {
            g7.a.u((AppCompatActivity) activity, null, content, arrayList);
        } catch (Exception unused) {
        }
    }

    public static void sendOnItemClickWidgetEvent(Context context, String str, Content content) {
        String str2 = "/mymint/" + str + "/bookmarks";
        a.a aVar = t5.a.a;
        String str3 = com.htmedia.mint.utils.n.c2;
        String[] strArr = new String[3];
        strArr[0] = "bookmarks";
        strArr[1] = (content == null || TextUtils.isEmpty(content.getHeadline())) ? !TextUtils.isEmpty(content.getMobileHeadline()) ? content.getMobileHeadline() : BuildConfig.FLAVOR : content.getHeadline();
        strArr[2] = "my mint";
        aVar.h(context, str3, BuildConfig.FLAVOR, str2, content, strArr);
    }

    public static void sendOnUnBookMarkWidgetEvent(Context context, String str, Content content) {
        String str2 = "/mymint/" + str + "/bookmarks";
        a.a aVar = t5.a.a;
        String str3 = com.htmedia.mint.utils.n.c2;
        String[] strArr = new String[4];
        strArr[0] = "bookmarks";
        strArr[1] = "unbookmark";
        strArr[2] = "my mint";
        strArr[3] = (content == null || TextUtils.isEmpty(content.getHeadline())) ? BuildConfig.FLAVOR : content.getHeadline();
        aVar.h(context, str3, BuildConfig.FLAVOR, str2, content, strArr);
    }

    private void setAd() {
        AppController appController;
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        if (CheckSubscriptionFromLocal.isAdFreeSubscribedUser(getActivity()) || (appController = this.appController) == null || appController.g() == null) {
            this.binding.c.setVisibility(8);
            return;
        }
        View d = com.htmedia.mint.utils.m.d(getActivity(), null, new AdSize[]{AdSize.BANNER, AdSize.LARGE_BANNER}, com.htmedia.mint.utils.k.g(k.c.MASTHEAD, com.htmedia.mint.utils.k.l(getActivity())), com.htmedia.mint.utils.m.b(getActivity(), null, SCREEN_NAME, "My Reads listing"));
        d.setAdListener(new AdListener() {
            public void onAdFailedToLoad(LoadAdError loadAdError) {
                super.onAdFailedToLoad(loadAdError);
                com.htmedia.mint.utils.f0.o3(MyReadsFragment.this.binding.c, MyReadsFragment.this.getActivity());
            }

            public void onAdImpression() {
                super.onAdImpression();
            }

            public void onAdLoaded() {
                super.onAdLoaded();
            }
        });
        if (!this.appController.g().getAdsAndroidNew().getMastheadAd().getEnableForWithoutBottomBar()) {
            this.binding.c.setVisibility(8);
        } else {
            this.binding.c.addView(d);
            this.binding.c.setVisibility(0);
        }
    }

    @RequiresApi(api = 21)
    public static void setBodyCollection(LinearLayout linearLayout, final List<Content> list, final Context context, final AppCompatActivity appCompatActivity, final q7.p3 p3Var, final ArrayList<Content> arrayList, final ArrayList<Content> arrayList2, final MyReadsFragment myReadsFragment) {
        View view;
        TextView textView;
        ImageView imageView;
        LinearLayout linearLayout2 = linearLayout;
        linearLayout.removeAllViews();
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService("layout_inflater");
        if (list != null) {
            int size = list.size() < 6 ? list.size() : 6;
            boolean z = false;
            int i = 0;
            while (i < size) {
                final Content content = arrayList.get(i);
                final Content content2 = list.get(i);
                CardView inflate = layoutInflater.inflate(2131624443, linearLayout2, z);
                CardView findViewById = inflate.findViewById(2131427861);
                SimpleDraweeView findViewById2 = inflate.findViewById(2131428893);
                TextView textView2 = (TextView) inflate.findViewById(2131430927);
                ImageView imageView2 = (ImageView) inflate.findViewById(2131428881);
                TextView textView3 = (TextView) inflate.findViewById(2131430911);
                ImageView imageView3 = (ImageView) inflate.findViewById(2131428873);
                LayoutInflater layoutInflater2 = layoutInflater;
                TextView textView4 = (TextView) inflate.findViewById(2131431696);
                int i2 = size;
                TextView textView5 = (TextView) inflate.findViewById(2131431641);
                View view2 = (CardView) inflate.findViewById(2131430104);
                ImageView imageView4 = (ImageView) inflate.findViewById(2131431930);
                ImageView imageView5 = (ImageView) inflate.findViewById(2131428925);
                ImageView imageView6 = (ImageView) inflate.findViewById(2131430151);
                if (AppController.j().E()) {
                    textView = textView5;
                    view = view2;
                    com.htmedia.mint.utils.j.q0(findViewById, context.getResources().getColor(2131101012));
                    textView2.setTextColor(context.getResources().getColor(2131100599));
                    textView3.setTextColor(context.getResources().getColor(2131100907));
                    textView4.setTextColor(context.getResources().getColor(2131100907));
                } else {
                    view = view2;
                    textView = textView5;
                    com.htmedia.mint.utils.j.q0(findViewById, context.getResources().getColor(2131101002));
                    textView2.setTextColor(context.getResources().getColor(2131100598));
                    textView3.setTextColor(context.getResources().getColor(2131100905));
                    textView4.setTextColor(context.getResources().getColor(2131100905));
                }
                if (content2.getMetadata() != null && content2.getMetadata().getAgency() != null && content2.getMetadata().getAgency().equalsIgnoreCase("wsj")) {
                    imageView5.setVisibility(0);
                    if (AppController.j().E()) {
                        imageView5.setImageResource(2131234373);
                    } else {
                        imageView5.setImageResource(2131234366);
                    }
                } else if (content2.getMetadata() != null && content2.getMetadata().getAgency() != null && content2.getMetadata().getAgency().equalsIgnoreCase("Economist")) {
                    imageView5.setVisibility(0);
                    imageView5.setImageResource(2131231809);
                } else if (content2.getMetadata() == null || content2.getMetadata().getAgency() == null || !content2.getMetadata().getAgency().equalsIgnoreCase("Barrons")) {
                    imageView5.setVisibility(4);
                } else {
                    imageView5.setVisibility(0);
                    if (AppController.j().E()) {
                        imageView5.setImageResource(2131231354);
                    } else {
                        imageView5.setImageResource(2131231355);
                    }
                }
                if (imageView6 != null) {
                    if (list.get(i).getType().equalsIgnoreCase(j5.b.d.a()) || list.get(i).getType().equalsIgnoreCase(j5.b.g.a()) || content2.getMetadata() == null || !content2.getMetadata().isPremiumStory()) {
                        imageView6.setVisibility(8);
                    } else {
                        imageView6.setVisibility(0);
                    }
                }
                if (content2.getLeadMedia() != null && content2.getLeadMedia().getImage() != null && content2.getLeadMedia().getImage().getImages() != null && content2.getLeadMedia().getImage().getImages().getFullImage() != null) {
                    findViewById2.setImageURI(content2.getLeadMedia().getImage().getImages().getFullImage());
                }
                if (content2.getMobileHeadline() == null || content2.getMobileHeadline().length() <= 0) {
                    textView2.setText(Html.fromHtml(Html.fromHtml(content2.getHeadline()).toString().trim()));
                } else {
                    textView2.setText(Html.fromHtml(Html.fromHtml(content2.getMobileHeadline()).toString().trim()));
                }
                if (content2.getTimeToRead() != 0) {
                    textView4.setVisibility(0);
                    imageView3.setVisibility(0);
                    textView4.setText(content2.getTimeToRead() + " min read");
                } else {
                    textView4.setVisibility(8);
                    imageView3.setVisibility(8);
                }
                textView3.setText(com.htmedia.mint.utils.f0.y1(content2.getLastPublishedDate(), com.htmedia.mint.utils.f0.r1()));
                if (content2.getMetadata() != null && content2.getMetadata().isRemoveTimestamp()) {
                    textView3.setVisibility(8);
                    imageView3.setVisibility(8);
                } else {
                    textView3.setVisibility(0);
                    imageView3.setVisibility(0);
                }
                if (content2.getType().equals(j5.b.b.a()) || content2.getType().equals(j5.b.e.a()) || content2.getType().equals(j5.b.o.a())) {
                    imageView4.setVisibility(8);
                    view.setVisibility(8);
                    inflate.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view3) {
                            Bundle bundle = new Bundle();
                            bundle.putString("origin", MyReadsFragment.this.origin + "-Bookmark");
                            bundle.putString(com.htmedia.mint.utils.n.Y, com.htmedia.mint.utils.n.x2);
                            g7.a.u(appCompatActivity, bundle, content2, list);
                            com.htmedia.mint.utils.n.A(appCompatActivity, com.htmedia.mint.utils.n.U0, null, com.htmedia.mint.utils.n.m0, content2, MyReadsFragment.this.origin + "-Bookmark");
                        }
                    });
                } else if (content2.getId() > 0 && "infographic".equalsIgnoreCase(content2.getType())) {
                    inflate.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view3) {
                            g7.a.r(appCompatActivity, content2.getId());
                        }
                    });
                } else if (content2.getType().equals(j5.b.d.a())) {
                    imageView4.setVisibility(8);
                    view.setVisibility(0);
                    if (content2.getElements() != null) {
                        textView.setText(content2.getElements().size() + " Photos");
                    }
                    inflate.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view3) {
                            Intent intent = new Intent(context, (Class<?>) PhotoGalleryDetailActivity.class);
                            intent.putExtra("story_id", content2.getId() + BuildConfig.FLAVOR);
                            intent.putExtra("story_tittle", content2.getHeadline());
                            context.startActivity(intent);
                        }
                    });
                } else {
                    View view3 = view;
                    if (content2.getType().equals(j5.b.g.a())) {
                        imageView4.setVisibility(0);
                        view3.setVisibility(8);
                        inflate.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view4) {
                                com.htmedia.mint.utils.f0.l3(context, content2);
                            }
                        });
                    }
                }
                if (AppController.j().E()) {
                    imageView = imageView2;
                    imageView.setImageResource(2131232312);
                } else {
                    imageView = imageView2;
                    imageView.setImageResource(2131231597);
                }
                final ImageView imageView7 = imageView;
                imageView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view4) {
                        com.htmedia.mint.utils.f0.n(Content.this.getId() + BuildConfig.FLAVOR, context, "remove", imageView7, null, p3Var, false, arrayList, null, null, true);
                        arrayList.remove(content);
                        if (arrayList.size() > 0 || arrayList2.size() > 0) {
                            return;
                        }
                        myReadsFragment.showNoDataAvailableErrorPage();
                    }
                });
                linearLayout2 = linearLayout;
                linearLayout2.addView(inflate);
                i++;
                layoutInflater = layoutInflater2;
                size = i2;
                z = false;
            }
        }
    }

    @androidx.annotation.RequiresApi(api = 21)
    public static void setBodyCollectionForPhoto(android.widget.LinearLayout r26, java.util.List<com.htmedia.mint.pojo.Content> r27, final android.content.Context r28, final androidx.appcompat.app.AppCompatActivity r29, final q7.p3 r30, final java.util.ArrayList<com.htmedia.mint.pojo.Content> r31, final java.util.ArrayList<com.htmedia.mint.pojo.Content> r32, final com.htmedia.mint.ui.fragments.MyReadsFragment r33) {
        throw new UnsupportedOperationException("Method not decompiled: com.htmedia.mint.ui.fragments.MyReadsFragment.setBodyCollectionForPhoto(android.widget.LinearLayout, java.util.List, android.content.Context, androidx.appcompat.app.AppCompatActivity, q7.p3, java.util.ArrayList, java.util.ArrayList, com.htmedia.mint.ui.fragments.MyReadsFragment):void");
    }

    @RequiresApi(api = 21)
    public static void setBodyCollectionMyMint(LinearLayout linearLayout, List<Content> list, final Context context, final AppCompatActivity appCompatActivity, final q7.p3 p3Var, final List<Content> list2, final k6.f fVar, ObservableBoolean observableBoolean, final String str, boolean z) {
        List<Content> list3 = list;
        linearLayout.removeAllViews();
        if (list3 != null) {
            int size = list.size() < 6 ? list.size() : 6;
            ?? r12 = 0;
            int i = 0;
            while (i < size) {
                final Content content = list2.get(i);
                final Content content2 = list3.get(i);
                final zt inflate = DataBindingUtil.inflate(appCompatActivity.getLayoutInflater(), 2131624527, (ViewGroup) null, (boolean) r12);
                inflate.c(observableBoolean);
                if (content2.getMetadata() != null && content2.getMetadata().getAgency() != null && content2.getMetadata().getAgency().equalsIgnoreCase("wsj")) {
                    inflate.e.setVisibility(r12);
                    if (AppController.j().E()) {
                        inflate.e.setImageResource(2131234373);
                    } else {
                        inflate.e.setImageResource(2131234366);
                    }
                } else if (content2.getMetadata() != null && content2.getMetadata().getAgency() != null && content2.getMetadata().getAgency().equalsIgnoreCase("Economist")) {
                    inflate.e.setVisibility(r12);
                    inflate.e.setImageResource(2131231809);
                } else if (content2.getMetadata() == null || content2.getMetadata().getAgency() == null || !content2.getMetadata().getAgency().equalsIgnoreCase("Barrons")) {
                    inflate.e.setVisibility(4);
                } else {
                    inflate.e.setVisibility(r12);
                    if (AppController.j().E()) {
                        inflate.e.setImageResource(2131231354);
                    } else {
                        inflate.e.setImageResource(2131231355);
                    }
                }
                if (inflate.g != null) {
                    if (list3.get(i).getType().equalsIgnoreCase(j5.b.d.a()) || list3.get(i).getType().equalsIgnoreCase(j5.b.g.a()) || content2.getMetadata() == null || !content2.getMetadata().isPremiumStory()) {
                        inflate.g.setVisibility(8);
                    } else {
                        inflate.g.setVisibility(r12);
                    }
                }
                if (content2.getLeadMedia() != null && content2.getLeadMedia().getImage() != null && content2.getLeadMedia().getImage().getImages() != null && content2.getLeadMedia().getImage().getImages().getFullImage() != null) {
                    inflate.d.setImageURI(content2.getLeadMedia().getImage().getImages().getFullImage());
                }
                if (content2.getMobileHeadline() == null || content2.getMobileHeadline().length() <= 0) {
                    inflate.j.setText(Html.fromHtml(Html.fromHtml(content2.getHeadline()).toString().trim()));
                } else {
                    inflate.j.setText(Html.fromHtml(Html.fromHtml(content2.getMobileHeadline()).toString().trim()));
                }
                if (content2.getTimeToRead() != 0) {
                    inflate.p.setVisibility(r12);
                    inflate.b.setVisibility(r12);
                    inflate.p.setText(content2.getTimeToRead() + " min read");
                } else {
                    inflate.p.setVisibility(8);
                    inflate.b.setVisibility(8);
                }
                inflate.h.setText(com.htmedia.mint.utils.f0.y1(content2.getLastPublishedDate(), com.htmedia.mint.utils.f0.r1()));
                if (z) {
                    inflate.h.setVisibility(8);
                    inflate.b.setVisibility(8);
                } else {
                    inflate.h.setVisibility(r12);
                    inflate.b.setVisibility(r12);
                }
                if (content2.getType().equals(j5.b.b.a()) || content2.getType().equals(j5.b.e.a()) || content2.getType().equals(j5.b.o.a())) {
                    inflate.q.setVisibility(8);
                    inflate.f.setVisibility(8);
                    final int i2 = i;
                    inflate.a.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MyReadsFragment.sendOnItemClickWidgetEvent(context, str, content2);
                            MyReadsFragment.onListItemClick(i2, content2, (ArrayList<Content>) list2, (Activity) appCompatActivity);
                        }
                    });
                } else if (content2.getId() > 0 && "infographic".equalsIgnoreCase(content2.getType())) {
                    inflate.a.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            MyReadsFragment.sendOnItemClickWidgetEvent(context, str, content2);
                            g7.a.r(appCompatActivity, content2.getId());
                        }
                    });
                } else if (content2.getType().equals(j5.b.d.a())) {
                    inflate.q.setVisibility(8);
                    inflate.f.setVisibility(r12);
                    if (content2.getElements() != null) {
                        inflate.o.setText(content2.getElements().size() + " Photos");
                    }
                    inflate.a.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent = new Intent(context, (Class<?>) PhotoGalleryDetailActivity.class);
                            intent.putExtra("story_id", content2.getId() + BuildConfig.FLAVOR);
                            intent.putExtra("story_tittle", content2.getHeadline());
                            context.startActivity(intent);
                        }
                    });
                } else if (content2.getType().equals(j5.b.g.a())) {
                    inflate.q.setVisibility(r12);
                    inflate.f.setVisibility(8);
                    inflate.a.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            com.htmedia.mint.utils.f0.l3(context, content2);
                        }
                    });
                }
                inflate.c.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Content.this == null || context == null) {
                            return;
                        }
                        com.htmedia.mint.utils.f0.M2(Content.this.getId() + BuildConfig.FLAVOR, context, "remove", inflate.c, null, p3Var, false, (ArrayList) list2, null, null, true, fVar);
                        list2.remove(content);
                        AppController.O.e(Content.this.getId() + BuildConfig.FLAVOR);
                        MyReadsFragment.sendOnUnBookMarkWidgetEvent(context, str, Content.this);
                    }
                });
                linearLayout.addView(inflate.a);
                i++;
                list3 = list;
                r12 = 0;
            }
        }
    }

    private void setTopicData() {
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        ArrayList<Content> arrayList = this.contentListBookmark;
        if (arrayList == null || arrayList.size() <= 0) {
            this.binding.i.setVisibility(8);
            return;
        }
        this.binding.i.setVisibility(0);
        HashMap<String, String> hashMap = new HashMap<>();
        this.headers = hashMap;
        hashMap.put("Authorization", com.htmedia.mint.utils.q.a);
        String otherUrl = getOtherUrl(this.appController.g(), com.htmedia.mint.utils.q.d[11]);
        k6.u1 u1Var = new k6.u1(getActivity(), this);
        this.sectionPresenter = u1Var;
        u1Var.a(0, "LeftMenuFragment", otherUrl, this.headers, false, false);
    }

    public void showNoDataAvailableErrorPage() {
        this.binding.h.setVisibility(8);
        this.binding.f.setVisibility(0);
        this.binding.d.setImageResource(2131233748);
        this.binding.q.setVisibility(0);
        this.binding.q.setText(2131952310);
        this.binding.r.setText(2131952309);
        this.binding.a.setVisibility(8);
    }

    private void showProgressDialog() {
        try {
            ProgressDialog progressDialog = new ProgressDialog(getActivity());
            this.mProgressDialog = progressDialog;
            progressDialog.setMessage("Please wait!");
            this.mProgressDialog.setIndeterminate(false);
            this.mProgressDialog.setCancelable(false);
            this.mProgressDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
            com.htmedia.mint.utils.o0.f(e);
        }
    }

    public void checkNightMode(boolean z) {
        if (z) {
            this.binding.h.setBackgroundColor(getContext().getResources().getColor(2131099871));
            this.binding.i.setBackgroundColor(getContext().getResources().getColor(2131099871));
            com.htmedia.mint.utils.j.q0(this.binding.b, getResources().getColor(2131099871));
            this.binding.e.setBackgroundColor(getResources().getColor(2131101012));
            this.binding.q.setTextColor(getResources().getColor(2131101009));
            this.binding.r.setTextColor(getResources().getColor(2131101009));
            this.binding.p.setShimmerColor(getResources().getColor(2131100802));
            this.binding.j.q.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.g.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.a.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.r.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.h.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.b.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.s.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.i.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.c.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.t.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.j.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.d.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.u.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.o.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.e.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.v.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.p.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.j.f.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.g.a.setBackgroundColor(getResources().getColor(2131100799));
            this.binding.g.b.setBackgroundColor(getResources().getColor(2131100799));
        } else {
            this.binding.h.setBackgroundColor(getContext().getResources().getColor(2131099870));
            this.binding.i.setBackgroundColor(getContext().getResources().getColor(2131099870));
            com.htmedia.mint.utils.j.q0(this.binding.b, getResources().getColor(2131099870));
            this.binding.e.setBackgroundColor(getResources().getColor(2131101002));
            this.binding.q.setTextColor(getResources().getColor(2131101008));
            this.binding.r.setTextColor(getResources().getColor(2131101008));
            this.binding.p.setShimmerColor(getResources().getColor(2131100801));
            this.binding.j.q.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.g.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.a.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.r.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.h.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.b.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.s.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.i.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.c.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.t.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.j.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.d.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.u.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.o.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.e.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.v.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.p.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.j.f.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.g.a.setBackgroundColor(getResources().getColor(2131100798));
            this.binding.g.b.setBackgroundColor(getResources().getColor(2131100798));
        }
        addContinueReadItem();
        if (this.binding.i.getAdapter() != null) {
            this.binding.i.getAdapter().notifyDataSetChanged();
        }
        if (this.binding.h.getAdapter() != null) {
            this.binding.h.getAdapter().notifyDataSetChanged();
        }
    }

    public void getBookmarkAndHistoryData() {
        super.onStart();
        ArrayList<Content> arrayList = this.contentListHistory;
        if (arrayList != null && arrayList.size() > 0 && this.binding.p.getVisibility() == 0) {
            hideShimmer(this.binding.p);
        }
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        AppController appController = this.appController;
        if (appController == null || appController.g() == null) {
            k6.r rVar = new k6.r(getActivity(), this);
            this.configPresenter = rVar;
            rVar.e(0, TAG, "https://images.livemint.com/apps/v3/deviceconfig.json", true, false);
        } else {
            if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
                fetchBookmarkData();
                return;
            }
            ArrayList<Content> arrayList2 = this.contentListHistory;
            if (arrayList2 == null || arrayList2.size() != 0) {
                return;
            }
            getHistoryData(0, getActivity(), 0);
            initScrollListiner();
        }
    }

    @Override
    public void getBookmarkIdResponse(BookmarkIdpojo bookmarkIdpojo, String str) {
        if (bookmarkIdpojo == null || bookmarkIdpojo.getResult() == null || !str.equals("getAllIds")) {
            return;
        }
        for (String str2 : bookmarkIdpojo.getResult()) {
            if (str2.contains("-")) {
                String[] split = str2.split("-");
                this.bookmarksPhotoIdMap.put(split[1], split[0]);
                this.storyIdSet.add(split[0]);
                com.htmedia.mint.utils.o1.a("TAG  photo", split[1]);
            }
        }
        makeApiCall();
    }

    @Override
    public void getBookmarkResponse(BookmarkStatus bookmarkStatus) {
    }

    @Override
    public void getConfig(Config config) {
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        this.appController.L(config);
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
            fetchBookmarkData();
        } else {
            ArrayList<Content> arrayList = this.contentListHistory;
            if (arrayList != null && arrayList.size() == 0) {
                getHistoryData(0, getActivity(), 1);
                initScrollListiner();
            }
        }
        setTopicData();
    }

    void getHistoryData(int i, Context context, int i2) {
        String str;
        this.TAG1 = "History";
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        if (com.htmedia.mint.utils.f0.G1(context, "userName") != null) {
            String otherUrl = getOtherUrl(this.appController.g(), com.htmedia.mint.utils.q.d[10]);
            if (otherUrl.contains("?")) {
                str = otherUrl + "&page=" + i + "&u=" + com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
            } else {
                str = otherUrl + "?page=" + i + "&u=" + com.htmedia.mint.utils.f0.G1(getActivity(), "userClient");
            }
        } else {
            String otherUrl2 = getOtherUrl(this.appController.g(), com.htmedia.mint.utils.q.d[10]);
            if (otherUrl2.contains("?")) {
                str = otherUrl2 + "&page=" + i + "&u=" + f6.d.b(getActivity());
            } else {
                str = otherUrl2 + "?page=" + i + "&u=" + f6.d.b(getActivity());
            }
            this.errorFlag = 1;
        }
        String str2 = str;
        com.htmedia.mint.utils.o1.a("History Url", str2);
        if (str2.contains("http")) {
            this.homePresenter.f(0, TAG, str2, null, null, false, false);
            return;
        }
        this.homePresenter.f(0, TAG, this.appController.g().getServerUrl() + str2, null, null, false, false);
    }

    @Override
    public void getSection(SectionData sectionData) {
        if (sectionData.getResult().size() > 0) {
            com.htmedia.mint.utils.o1.a("topics availabe", sectionData.getResult().size() + BuildConfig.FLAVOR);
            this.binding.i.setVisibility(0);
            this.topicsList.clear();
            this.topicsList.addAll(sectionData.getResult());
            addContinueReadItem();
            this.topNavTopicsAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public void getSectionAAndC(LeftDrawerResponseParent leftDrawerResponseParent) {
    }

    public void getStoryData(ForyouPojo foryouPojo) {
    }

    @Override
    public void getStoryData(ForyouPojo foryouPojo, String str) {
        ArrayList<Content> arrayList;
        ArrayList<Content> arrayList2;
        if (foryouPojo == null || foryouPojo.getContentList() == null) {
            showNoDataAvailableErrorPage();
        }
        String str2 = this.TAG1;
        str2.hashCode();
        switch (str2) {
            case "History":
                if (foryouPojo.getContentList() != null && foryouPojo.getContentList().size() > 0) {
                    com.htmedia.mint.utils.o1.a("TAG history", str + " " + TAG);
                    this.contentListHistory.addAll(foryouPojo.getContentList());
                    this.sectionsListRecyclerViewAdapter.notifyDataSetChanged();
                } else if (str.contains("0") && this.contentListHistory.size() == 0) {
                    ArrayList arrayList3 = new ArrayList();
                    arrayList3.add(new Content());
                    com.htmedia.mint.utils.o1.a("TAG history", str + " " + TAG);
                    this.contentListHistory.addAll(arrayList3);
                    this.sectionsListRecyclerViewAdapter.notifyDataSetChanged();
                }
                hideShimmer(this.binding.p);
                if (this.contentListBookmark.size() == 0 && this.contentListHistory.size() == 0 && (arrayList = this.contentListPhotoBookmark) != null && arrayList.size() == 0 && this.errorFlag > 0) {
                    showNoDataAvailableErrorPage();
                } else {
                    this.errorFlag = 1;
                }
                addContinueReadItem();
                break;
            case "Photo_Bookmark":
                com.htmedia.mint.utils.o1.a("TAG url", str + " " + this.TAG1);
                StringBuilder sb2 = new StringBuilder();
                sb2.append(foryouPojo.getContentList().size());
                sb2.append(" ");
                com.htmedia.mint.utils.o1.a("TAG bookmarkimage", sb2.toString());
                if (foryouPojo.getContentList() != null) {
                    Content content = foryouPojo.getContentList().get(0);
                    this.storywithContentTable.put(content.getId() + BuildConfig.FLAVOR, content);
                    com.htmedia.mint.utils.o1.a("TAG after", this.bookmarksPhotoIdMap.size() + " " + this.storywithContentTable.size());
                }
                this.noOfApiCall++;
                makeContentPhotoBookmark();
                break;
            case "Bookmark":
                this.contentListBookmark.clear();
                this.contentListBookmark.addAll(foryouPojo.getContentList());
                this.sectionsListRecyclerViewAdapter.n(this.contentListBookmark);
                this.sectionsListRecyclerViewAdapter.notifyDataSetChanged();
                setTopicData();
                fetchId();
                addContinueReadItem();
                if (this.contentListBookmark.size() == 0 && (arrayList2 = this.contentListPhotoBookmark) != null && arrayList2.size() == 0 && this.errorFlag > 0) {
                    ArrayList<Content> arrayList4 = this.contentListHistory;
                    if (arrayList4 != null && arrayList4.size() > 0) {
                        hideShimmer(this.binding.p);
                        break;
                    } else {
                        getHistoryData(0, getActivity(), 0);
                        break;
                    }
                } else {
                    this.errorFlag = 1;
                    break;
                }
                break;
        }
    }

    void hideShimmer(ShimmerLayout shimmerLayout) {
        if (shimmerLayout == null || shimmerLayout.getVisibility() != 0) {
            return;
        }
        shimmerLayout.setVisibility(8);
        shimmerLayout.stopShimmerAnimation();
    }

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

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

    @RequiresApi(api = 21)
    public void onActivityCreated(@Nullable Bundle bundle) {
        super.onActivityCreated(bundle);
        checkNightMode(AppController.j().E());
        LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(2131429271);
        this.layoutClose = linearLayout;
        linearLayout.setVisibility(4);
        this.homePresenter = new k6.g0(getActivity(), this);
        q7.p3 p3Var = new q7.p3(getActivity(), this.contentListHistory, this.contentListBookmark, this.contentListPhotoBookmark, this, getActivity(), this, this, this.continueReadArrayList);
        this.sectionsListRecyclerViewAdapter = p3Var;
        this.binding.h.setAdapter(p3Var);
        this.binding.a.setOnClickListener(this);
        getBookmarkAndHistoryData();
        if (getArguments() != null) {
            this.origin = getArguments().getString(com.htmedia.mint.utils.n.X);
        }
        com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.U0, SCREEN_NAME, "topic_page", null, this.origin);
    }

    @Override
    public void onAdd(Content content, ImageView imageView, q7.p3 p3Var) {
        com.htmedia.mint.utils.f0.n(content.getId() + BuildConfig.FLAVOR, getActivity(), "add", imageView, null, p3Var, false, this.contentListBookmark, content, null, true);
        this.contentListBookmark.add(0, content);
    }

    @Override
    public void onBookmarkError(String str) {
        Toast.makeText((Context) getActivity(), (CharSequence) ("Action failed, " + str), 1).show();
    }

    @Override
    public void onClick(View view) {
        if (com.htmedia.mint.utils.m0.a(getActivity())) {
            showErrorBackGround(BuildConfig.FLAVOR);
            if (this.appController == null) {
                this.appController = AppController.j();
            }
            AppController appController = this.appController;
            if (appController == null || appController.g() == null) {
                k6.r rVar = new k6.r(getActivity(), this);
                this.configPresenter = rVar;
                rVar.e(0, TAG, "https://images.livemint.com/apps/v3/deviceconfig.json", true, false);
                return;
            }
            if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
                fetchBookmarkData();
            } else {
                ArrayList<Content> arrayList = this.contentListHistory;
                if (arrayList != null && arrayList.size() == 0) {
                    getHistoryData(0, getActivity(), 5);
                    initScrollListiner();
                }
            }
            setTopicData();
        }
    }

    @Nullable
    public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        this.binding = gp0.c(layoutInflater, viewGroup, false);
        this.appController = AppController.j();
        this.continueReadArrayList = AppController.O.g();
        this.binding.p.setVisibility(0);
        this.binding.p.startShimmerAnimation();
        if (getActivity().g != null && getActivity().h != null) {
            if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
                getActivity().g.setVisible(false);
                getActivity().h.setVisible(true);
            } else {
                getActivity().g.setVisible(true);
                getActivity().h.setVisible(false);
            }
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        this.linearLayoutManager = linearLayoutManager;
        this.binding.h.setLayoutManager(linearLayoutManager);
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(getActivity(), 0, false);
        this.horizontalLayoutManager = linearLayoutManager2;
        this.binding.i.setLayoutManager(linearLayoutManager2);
        k7 k7Var = new k7(getActivity(), this.topicsList, this, 0);
        this.topNavTopicsAdapter = k7Var;
        this.binding.i.setAdapter(k7Var);
        com.htmedia.mint.utils.k1.x(com.htmedia.mint.utils.k1.l(getContext()), "/" + "MY READS".replace(' ', '-'));
        setAd();
        return this.binding.getRoot();
    }

    @Override
    public void onError(String str) {
    }

    @Override
    public void onError(String str, String str2) {
        hideShimmer(this.binding.p);
        if (this.TAG1.equals("Bookmark")) {
            ArrayList<Content> arrayList = this.contentListHistory;
            if (arrayList == null || arrayList.size() != 0) {
                return;
            }
            getHistoryData(0, getActivity(), 3);
            return;
        }
        if (this.TAG1.equals("Photo_Bookmark")) {
            this.noOfApiCall++;
            makeContentPhotoBookmark();
        } else if (this.contentListBookmark.size() == 0 && this.contentListHistory.size() == 0) {
            showErrorBackGround(str);
        }
    }

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

    @Override
    public void onListItemClick(int i, Content content, Section section, ArrayList<Content> arrayList) {
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        if (this.appController != null) {
            AppController.O.i(String.valueOf(content.getId()));
            content.setRead(true);
            com.htmedia.mint.utils.k.s(getActivity(), content.getId() + BuildConfig.FLAVOR);
            Bundle bundle = new Bundle();
            bundle.putString(com.htmedia.mint.utils.n.Y, "My reads-Continue reading");
            bundle.putInt("pos", i);
            AppCompatActivity activity = getActivity();
            if (arrayList == null || arrayList.size() <= 0) {
                arrayList = null;
            }
            g7.a.u(activity, bundle, content, arrayList);
        }
    }

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

    @Override
    public void onRemove(Content content, ImageView imageView, q7.p3 p3Var) {
        com.htmedia.mint.utils.f0.n(content.getId() + BuildConfig.FLAVOR, getActivity(), "remove", imageView, null, p3Var, false, this.contentListBookmark, content, null, true);
        for (int i = 0; i < this.contentListBookmark.size(); i++) {
            if ((this.contentListBookmark.get(i).getId() + BuildConfig.FLAVOR).equals(content.getId() + BuildConfig.FLAVOR)) {
                this.contentListBookmark.remove(i);
            }
        }
    }

    public void onResume() {
        super.onResume();
        Analytics.notifyEnterForeground();
        if (this.appController == null) {
            this.appController = AppController.j();
        }
        if (getTag() != null && getTag().equalsIgnoreCase("MY READS")) {
            Config g = AppController.j().g();
            if (g == null || !g.isShowPremiumSection()) {
                getActivity().j4("MY READS", false);
            } else {
                getActivity().f4(false, "MY READS");
            }
        }
        com.htmedia.mint.utils.n.q0(getActivity(), SCREEN_NAME);
        if (this.appController.C()) {
            checkNightMode(this.appController.E());
        }
    }

    @Override
    public void onSectionListItemClick(int i, Content content, ArrayList<Content> arrayList) {
        Section storyDetailSection = getStoryDetailSection();
        if (storyDetailSection != null) {
            com.htmedia.mint.utils.n.A(getActivity(), com.htmedia.mint.utils.n.U0, null, com.htmedia.mint.utils.n.m0, content, this.origin + " - " + SCREEN_NAME);
            ArrayList<Content> arrayList2 = this.contentListHistory;
            if (arrayList2 != null && !arrayList2.isEmpty() && i >= 0 && i < this.contentListHistory.size()) {
                Tracker instance = Tracker.instance();
                Content content2 = this.contentListHistory.get(i);
                String str = com.htmedia.mint.utils.q.c[1];
                com.htmedia.mint.utils.k1.w(instance, content2, storyDetailSection, str, str, true, -1, null, BuildConfig.FLAVOR);
            }
            Bundle bundle = new Bundle();
            bundle.putString(com.htmedia.mint.utils.n.Y, com.htmedia.mint.utils.n.x2);
            bundle.putString("origin", this.origin + "-" + SCREEN_NAME);
            AppCompatActivity activity = getActivity();
            if (arrayList == null || arrayList.size() <= 0) {
                arrayList = null;
            }
            g7.a.u(activity, bundle, content, arrayList);
        }
    }

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

    public void openSection(Section section) {
        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").commit();
        getActivity().f4(false, section.getDisplayName().toUpperCase());
    }

    public void showErrorBackGround(String str) {
        if (str.equalsIgnoreCase("server not responding") || str.equalsIgnoreCase("JSONEXPECTION")) {
            this.binding.h.setVisibility(8);
            this.binding.i.setVisibility(8);
            this.binding.f.setVisibility(0);
            this.binding.d.setImageResource(2131232480);
            this.binding.q.setVisibility(8);
            this.binding.r.setText(2131952025);
            this.binding.a.setVisibility(0);
            return;
        }
        if (!str.equalsIgnoreCase("Network not available")) {
            this.binding.h.setVisibility(0);
            this.binding.i.setVisibility(0);
            this.binding.f.setVisibility(8);
            return;
        }
        this.binding.h.setVisibility(8);
        this.binding.i.setVisibility(8);
        this.binding.f.setVisibility(0);
        this.binding.d.setImageResource(2131232697);
        this.binding.q.setVisibility(8);
        this.binding.r.setText(2131952314);
        this.binding.a.setVisibility(0);
    }

    void showShimmer(ShimmerLayout shimmerLayout) {
        shimmerLayout.setVisibility(0);
        shimmerLayout.startShimmerAnimation();
    }
}