导航菜单

页面标题

页面副标题

Vi App v10.18.0 - DetailsFragment.java 源代码

正在查看: Vi App v10.18.0 应用的 DetailsFragment.java JAVA 源代码文件

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


package com.yupptv.ott.fragments;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
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.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.airbnb.epoxy.EpoxyVisibilityTracker;
import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.yupptv.ott.FusionViliteMainActivity;
import com.yupptv.ott.OTTApplication;
import com.yupptv.ott.R;
import com.yupptv.ott.analytics.AnalyticsUtils;
import com.yupptv.ott.analytics.AnalyticsV2;
import com.yupptv.ott.analytics.MyRecoManager;
import com.yupptv.ott.controllers.RowController;
import com.yupptv.ott.enums.ButtonType;
import com.yupptv.ott.enums.DialogType;
import com.yupptv.ott.enums.PageType;
import com.yupptv.ott.enums.PosterType;
import com.yupptv.ott.enums.ScreenType;
import com.yupptv.ott.interfaces.AdapterCallbacks;
import com.yupptv.ott.interfaces.DialogListener;
import com.yupptv.ott.interfaces.FragmentHost;
import com.yupptv.ott.utils.APIUtils;
import com.yupptv.ott.utils.Constants;
import com.yupptv.ott.utils.CustomLog;
import com.yupptv.ott.utils.NavigationConstants;
import com.yupptv.ott.utils.NavigationUtils;
import com.yupptv.ott.utils.Preferences;
import com.yupptv.ott.utils.UiUtils;
import com.yupptv.ott.views.VerticalRecyclerView;
import com.yupptv.ott.widget.HeaderItemWithControls;
import com.yupptv.ott.widget.ListRowWithControls;
import com.yupptv.ottsdk.OttSDK;
import com.yupptv.ottsdk.managers.MediaCatalog.MediaCatalogManager;
import com.yupptv.ottsdk.managers.Payment.PaymentManager;
import com.yupptv.ottsdk.managers.User.UserManager;
import com.yupptv.ottsdk.model.Banner;
import com.yupptv.ottsdk.model.Card;
import com.yupptv.ottsdk.model.Content;
import com.yupptv.ottsdk.model.ContentPage;
import com.yupptv.ottsdk.model.DeeplinkInfo;
import com.yupptv.ottsdk.model.Error;
import com.yupptv.ottsdk.model.PageButtons;
import com.yupptv.ottsdk.model.PageData;
import com.yupptv.ottsdk.model.PageInfo;
import com.yupptv.ottsdk.model.Section;
import com.yupptv.ottsdk.model.ShareInfo;
import com.yupptv.ottsdk.model.Tabs;
import com.yupptv.ottsdk.model.User;
import com.yupptv.ottsdk.model.payments.OrderStatusResponse;
import com.yupptv.ottsdk.model.payments.packagefeature.PackageGeneric;
import com.yupptv.ottsdk.model.user.Configs;
import com.yupptv.ottsdk.rest.network.RestAdapter;
import com.yupptv.ottsdk.utils.OttLog;
import in.juspay.hyper.constants.LogSubCategory;
import io.github.inflationx.calligraphy3.CalligraphyUtils;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import okhttp3.ResponseBody;

public class DetailsFragment extends RowFragment implements AdapterCallbacks {
    private TextView availableInLangTv;
    private TextView availableLabelTv;
    private AppCompatImageView avatarImageView;
    private List<Banner> bannerList;
    private List<Content.Elements> buttonList;
    private RecyclerView buttonRecyclerView;
    private ContentPage contentPage;
    private FragmentActivity context;
    private TextView description;
    private RelativeLayout descriptionLayout;
    private View detailView;
    private RelativeLayout detailsExtraButtonsLayout;
    private ImageView details_add_watch_list_btn;
    private View details_extra_buttons_divider;
    private View details_extra_buttons_divider1;
    private LinearLayout details_rental_info;
    private TextView details_rental_info_text;
    private ImageView details_share_btn;
    private LinearLayout details_start_over_layout;
    private LinearLayout details_watch_list_layout;
    private LinearLayout errorLayout;
    private FragmentHost fragmentHost;
    private GridLayoutManager gridLayoutManager;
    public PageButtons.Record mChannelRecordObject;
    private TabLayout mMenuTab;
    private FragmentPagerAdapter mPagerAdapter;
    private FragmentPartnerPagerAdapter mPartnerPagerAdapter;
    private ProgressBar mPaymentProgressBar;
    private NestedScrollView main_content;
    private TabLayout partnerTabLayout;
    private TextView recordButton;
    private int resumeProgress;
    private RowController rowController;
    private List<Section> sectionsInfo;
    private ShareInfo shareInfo;
    private LinearLayout share_layout;
    private ImageView start_over_icon;
    private TabLayout tabLayout;
    private String title;
    private LinearLayoutManager verticalLayoutManager;
    private VerticalRecyclerView verticalRecyclerView;
    private ViewPager viewPager;
    private TextView watchlistTextTv;
    private String TAG = getClass().getSimpleName();
    private long TIME_OUT_DURATION = 45000;
    private long TIME_INTERVAL = 10000;
    private String savedSubSourceDetails = "";
    private boolean isDynamicName = false;
    private String savedSourceDetails = "";
    private List<ListRowWithControls> listRows = new ArrayList();
    private RecyclerView.RecycledViewPool recycledViewPool = new RecyclerView.RecycledViewPool();
    private List<Section> loadMoreSections = new ArrayList();
    private int MAX_SECTIONS = 3;
    private int mRowCount = 0;
    private String targetPage = "details";
    private String targetPath = "";
    private String screenSource = "";
    private boolean isMenuTabsAvailable = false;
    private HashMap<String, List<Section>> tabsMap = new HashMap<>();
    private List<Tabs> mTabsList = new ArrayList();
    private List<Card> mPartnerMenuTabList = new ArrayList();
    private int selectedMainMenuTab = -1;
    private String mContentType = "";
    private int pageSectionContentCount = 10;
    private long transactionStatuCheckDuration = 0;
    public final Handler handler = new Handler();
    private String orderId = "";
    private boolean isTransactionDone = false;
    private boolean isTransactionalPack = false;
    public String mTitle = "";
    public String mCast = "";
    private String imageUrl = "";
    private boolean isButtonClicked = false;
    private String distroAnalyticsUrl = "";
    private boolean isDistroVideoImpressionSent = false;
    private final String DISTRO_EVENT_PAGE_VIEW = "ff";
    private final Runnable transactionAction = new Runnable() {
        @Override
        public void run() {
            OttLog.error(DetailsFragment.this.TAG, "checking order status " + DetailsFragment.this.transactionStatuCheckDuration);
            if (DetailsFragment.this.getActivity() == null) {
                DetailsFragment.this.isTransactionDone = true;
                DetailsFragment.this.showProgress(false);
                DetailsFragment.this.handler.removeCallbacks(this);
                return;
            }
            if (DetailsFragment.this.isTransactionDone || DetailsFragment.this.transactionStatuCheckDuration >= DetailsFragment.this.TIME_OUT_DURATION) {
                DetailsFragment.this.isTransactionDone = false;
                DetailsFragment.this.handler.removeCallbacks(this);
                if (DetailsFragment.this.transactionStatuCheckDuration >= DetailsFragment.this.TIME_OUT_DURATION) {
                    DetailsFragment.this.isTransactionDone = true;
                    return;
                }
                return;
            }
            DetailsFragment detailsFragment = DetailsFragment.this;
            detailsFragment.getOrderStatus(detailsFragment.orderId);
            DetailsFragment detailsFragment2 = DetailsFragment.this;
            detailsFragment2.transactionStatuCheckDuration = DetailsFragment.this.TIME_INTERVAL + detailsFragment2.transactionStatuCheckDuration;
            DetailsFragment detailsFragment3 = DetailsFragment.this;
            detailsFragment3.handler.postDelayed(this, detailsFragment3.TIME_INTERVAL);
        }
    };
    public PaymentManager.PaymentCallback<PackageGeneric> callBack = new PaymentManager.PaymentCallback<PackageGeneric>() {
        @Override
        public void onFailure(Error error) {
            DetailsFragment.this.showPaymentProgress(false);
            if (DetailsFragment.this.getActivity() == null) {
                return;
            }
            NavigationUtils.logKibanaError("DetailsFragment", "API", "/package/api/v2/packages/for/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, com.yupptv.ott.epg.a.a(error, DetailsFragment.this.getActivity(), 1, "")), error.getMessage());
        }

        @Override
        public void onSuccess(PackageGeneric packageGeneric) {
            DetailsFragment.this.showPaymentProgress(false);
            if (packageGeneric == null || packageGeneric.getPackageResponse().size() < 1) {
                return;
            }
            HashMap hashMap = new HashMap();
            if (packageGeneric.getPackageResponse().get(0).getPackageInfo() == null || packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages() == null || packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().size() <= 0) {
                return;
            }
            String name = packageGeneric.getPackageResponse().get(0).getPackageInfo().getMaster().getName();
            String name2 = packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().get(0).getName();
            Integer id = packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().get(0).getId();
            id.intValue();
            Integer packageMasterId = packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().get(0).getPackageMasterId();
            packageMasterId.intValue();
            String code = packageGeneric.getPackageResponse().get(0).getSupportedGateway().get(0).getCode();
            Double salePrice = packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().get(0).getSalePrice();
            salePrice.doubleValue();
            Long expiryDate = packageGeneric.getPackageResponse().get(0).getPackageInfo().getPackages().get(0).getExpiryDate();
            expiryDate.longValue();
            hashMap.put(NavigationConstants.TITLE, name);
            hashMap.put(NavigationConstants.INPUT_STRING, name2);
            hashMap.put(NavigationConstants.PURCHASE_VALUE, salePrice);
            hashMap.put(NavigationConstants.PURCHASE_GATEWAY, code);
            hashMap.put(NavigationConstants.PACK_ID, id);
            hashMap.put(NavigationConstants.MASTER_PACK_ID, packageMasterId);
            hashMap.put(NavigationConstants.WEB_URL, DetailsFragment.this.imageUrl);
            hashMap.put(NavigationConstants.EXPIRY_DATE, expiryDate);
            if (OttSDK.getInstance() == null || com.yupptv.ott.adapters.s.a() != null) {
                NavigationUtils.loadScreenActivityForResult(DetailsFragment.this.getActivity(), ScreenType.PAYMENTS, NavigationConstants.NAV_FROM_DETAILS, DetailsFragment.this.targetPath, 20, false, DetailsFragment.this.isTransactionalPack, hashMap);
            } else {
                DetailsFragment.this.showSigninSignupPopup("rent", hashMap);
            }
        }
    };

    public class AnonymousClass5 implements View.OnClickListener {
        public AnonymousClass5() {
        }

        @Override
        public void onClick(View view) {
            String format;
            if (OttSDK.getInstance() != null && OttSDK.getInstance().getPreferenceManager() != null && com.yupptv.ott.adapters.s.a() == null) {
                Toast.makeText((Context) DetailsFragment.this.context, (CharSequence) DetailsFragment.this.context.getResources().getString(R.string.recording_signin_toadd), 1).show();
                return;
            }
            PageButtons.Record record = DetailsFragment.this.mChannelRecordObject;
            if (record != null) {
                final int i2 = 0;
                if (record.getIsRecorded().booleanValue()) {
                    CustomLog.e("DetailsFragment", "Channel object is recorded , showing stoprec");
                    format = String.format(DetailsFragment.this.getActivity().getResources().getString(R.string.channel_stoprecord_confirmation), DetailsFragment.this.title != null ? DetailsFragment.this.title : "");
                } else {
                    CustomLog.e("DetailsFragment", "Channel object is not recorded , showing Record");
                    format = String.format(DetailsFragment.this.getActivity().getResources().getString(R.string.channel_record_confirmation), DetailsFragment.this.title != null ? DetailsFragment.this.title : "");
                    i2 = 1;
                }
                HashMap hashMap = new HashMap();
                hashMap.put("msg2", i2 == 1 ? "record" : "stoprecord");
                hashMap.put("msg1", format);
                NavigationUtils.showDialog(DetailsFragment.this.getActivity(), DialogType.RECORD, hashMap, new DialogListener() {
                    @Override
                    public void itemClicked(boolean z, int i3, int i4) {
                    }

                    @Override
                    public void itemClicked(boolean z, int i3, HashMap hashMap2) {
                        if (i3 == 0) {
                            return;
                        }
                        DetailsFragment.this.showProgress(true);
                        OttSDK.getInstance().getMediaManager().updateRecording("3", DetailsFragment.this.mChannelRecordObject.getChannelId(), "" + i2, new MediaCatalogManager.MediaCatalogCallback<String>() {
                            @Override
                            public void onFailure(Error error) {
                                DetailsFragment.this.showProgress(false);
                                if (DetailsFragment.this.getActivity() == null || DetailsFragment.this.getActivity().isFinishing()) {
                                    return;
                                }
                                NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/auth/dvr/record", "NA", "NA", "NA", com.yupptv.ott.f.a(error, com.yupptv.ott.epg.a.a(error, DetailsFragment.this.getActivity(), 1, "")), error.getMessage());
                            }

                            @Override
                            public void onSuccess(String str) {
                                DetailsFragment.this.showProgress(false);
                                DetailsFragment.this.mChannelRecordObject.setIsRecorded(Boolean.valueOf(!r4.getIsRecorded().booleanValue()));
                                DetailsFragment.this.getActivity().doSectionsRefresh = true;
                                DetailsFragment.this.getActivity().doEPGCacheRefresh = true;
                                DetailsFragment.this.getActivity().doListRefresh = true;
                                AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
                                if (i2 == 0) {
                                    DetailsFragment.this.showRecordButton(true);
                                    if (OTTApplication.getInstance().getRecordDataTracker() != null) {
                                        OTTApplication.getInstance().getRecordDataTracker().put(DetailsFragment.this.contentPage.getPageInfo().getPath(), 0);
                                    }
                                } else {
                                    DetailsFragment.this.showRecordButton(false);
                                    if (OTTApplication.getInstance().getRecordDataTracker() != null) {
                                        OTTApplication.getInstance().getRecordDataTracker().put(DetailsFragment.this.contentPage.getPageInfo().getPath(), 1);
                                    }
                                }
                                RestAdapter.enableCache(false);
                                DetailsFragment.this.getNextPageResponse();
                            }
                        });
                    }
                });
            }
        }
    }

    public class ButtonViewHolder extends RecyclerView.ViewHolder {
        public Context context;
        public TextView detailButton;
        public LinearLayout detail_button_layout;
        public ProgressBar details_resume_btn_progress;
        private ImageView iv_play;

        public ButtonViewHolder(Context context, View view, FusionViliteMainActivity.ItemClickListener itemClickListener, List list) {
            super(view);
            this.detail_button_layout = (LinearLayout) view.findViewById(R.id.detail_button_layout);
            this.detailButton = (TextView) view.findViewById(R.id.detail_button);
            this.details_resume_btn_progress = (ProgressBar) view.findViewById(R.id.details_resume_btn_progress);
            this.iv_play = (ImageView) view.findViewById(R.id.iv_play);
            this.context = context;
        }
    }

    public class DetailViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
        public Context context;
        public List mList;
        private FusionViliteMainActivity.ItemClickListener onItemClickListener;

        public DetailViewAdapter(Context context, List list) {
            this.context = context;
            this.mList = list;
        }

        public int getItemCount() {
            return this.mList.size();
        }

        public int getItemViewType(int i2) {
            if (this.mList.get(i2) instanceof Content.Elements) {
                return 0;
            }
            return super.getItemViewType(i2);
        }

        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i2) {
            if (viewHolder instanceof ButtonViewHolder) {
                ButtonViewHolder buttonViewHolder = (ButtonViewHolder) viewHolder;
                Content.Elements elements = (Content.Elements) this.mList.get(i2);
                buttonViewHolder.detailButton.setText(elements.getData());
                if (elements.getData().toLowerCase().contains("watch") || b.a(elements, "resume")) {
                    buttonViewHolder.iv_play.setVisibility(0);
                } else {
                    buttonViewHolder.iv_play.setVisibility(8);
                }
                if (this.mList.size() <= 1 || !b.a(elements, "rent")) {
                    LinearLayout linearLayout = buttonViewHolder.detail_button_layout;
                    Resources resources = DetailsFragment.this.getResources();
                    int i3 = R.drawable.action_background_black_onfocus;
                    linearLayout.setBackground(resources.getDrawable(i3));
                    buttonViewHolder.detailButton.setBackground(DetailsFragment.this.getResources().getDrawable(i3));
                } else {
                    LinearLayout linearLayout2 = buttonViewHolder.detail_button_layout;
                    Resources resources2 = DetailsFragment.this.getResources();
                    int i4 = R.drawable.action_background_offfocus;
                    linearLayout2.setBackground(resources2.getDrawable(i4));
                    buttonViewHolder.detailButton.setBackground(DetailsFragment.this.getResources().getDrawable(i4));
                }
                if (b.a(elements, "resume")) {
                    buttonViewHolder.details_resume_btn_progress.setVisibility(0);
                    if (DetailsFragment.this.resumeProgress != 0) {
                        buttonViewHolder.details_resume_btn_progress.setProgress(DetailsFragment.this.resumeProgress);
                    }
                }
                buttonViewHolder.detailButton.setTextColor(ContextCompat.getColor(this.context, R.color.button_text_color));
                View.OnClickListener onClickListener = new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (DetailsFragment.this.isButtonClicked) {
                            return;
                        }
                        DetailsFragment.this.isButtonClicked = true;
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                DetailsFragment.this.isButtonClicked = false;
                            }
                        }, 1000L);
                        DetailsFragment.this.fetchLatestUserinfo();
                        Content.Elements elements2 = (Content.Elements) DetailViewAdapter.this.mList.get(i2);
                        if (elements2.getElementType().equalsIgnoreCase("button")) {
                            if (elements2.getProperties() != null && elements2.getProperties().getIsDeeplinking() != null && elements2.getProperties().getIsDeeplinking().trim().length() > 0 && elements2.getProperties().getIsDeeplinking().trim().equalsIgnoreCase("true")) {
                                if (elements2.getTarget() == null || elements2.getTarget().trim().length() <= 0) {
                                    return;
                                }
                                DetailsFragment.this.fetchDeepLinkInfo(elements2, elements2.getTarget());
                                return;
                            }
                            DetailViewAdapter detailViewAdapter = DetailViewAdapter.this;
                            DetailsFragment.this.trackEvents(AnalyticsUtils.EVENT_PAGE_DETAILS, ((Content.Elements) detailViewAdapter.mList.get(i2)).getData(), ScreenType.DETAILS);
                            if (((Content.Elements) DetailViewAdapter.this.mList.get(i2)).getElementSubtype().equalsIgnoreCase("signin")) {
                                ((FusionViliteMainActivity) DetailViewAdapter.this.context).launchSigninPage(false, -1);
                                return;
                            }
                            if (((Content.Elements) DetailViewAdapter.this.mList.get(i2)).getElementSubtype().equalsIgnoreCase("signup")) {
                                return;
                            }
                            if (elements2.getElementSubtype().equalsIgnoreCase("subscribe")) {
                                String path = DetailsFragment.this.contentPage.getPageInfo().getPath();
                                FusionViliteMainActivity fusionViliteMainActivity = (FusionViliteMainActivity) DetailViewAdapter.this.context;
                                fusionViliteMainActivity.selectHomeOnPopFromWebView = true;
                                fusionViliteMainActivity.launchWebviewPlansPage(path, null, "content watch now");
                                return;
                            }
                            if (elements2.getElementSubtype().equalsIgnoreCase("rent")) {
                                DetailsFragment.this.getPackageListFromServer(elements2.getElementSubtype());
                                return;
                            }
                        }
                        if (b.a(elements2, "resume")) {
                            DetailsFragment.this.getActivity().setButtonType(ButtonType.RESUME);
                        }
                        if (b.a(elements2, "trailer")) {
                            DetailsFragment.this.getActivity().setButtonType(ButtonType.TRAILER);
                        }
                        NavigationUtils.launchNavigationFragment(((Content.Elements) DetailViewAdapter.this.mList.get(i2)).getTarget(), DetailViewAdapter.this.context);
                    }
                };
                buttonViewHolder.detail_button_layout.setOnClickListener(onClickListener);
                buttonViewHolder.detailButton.setOnClickListener(onClickListener);
            }
        }

        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i2) {
            if (i2 != 0) {
                return null;
            }
            View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.detail_button_item, viewGroup, false);
            DetailsFragment detailsFragment = DetailsFragment.this;
            return detailsFragment.new ButtonViewHolder(detailsFragment.getActivity(), inflate, this.onItemClickListener, this.mList);
        }
    }

    public class FragmentPagerAdapter extends FragmentStatePagerAdapter {
        public FragmentPagerAdapter(FragmentManager fragmentManager) {
            super(fragmentManager);
        }

        public void destroyItem(ViewGroup viewGroup, int i2, Object obj) {
            super.destroyItem(viewGroup, i2, obj);
            DetailsFragment.this.tabLayout.setTabMode(0);
            Fragment fragment = (Fragment) obj;
            FragmentManager fragmentManager = fragment.getFragmentManager();
            if (fragmentManager != null) {
                FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
                beginTransaction.remove(fragment);
                beginTransaction.commitAllowingStateLoss();
            }
        }

        public int getCount() {
            return (DetailsFragment.this.isMenuTabsAvailable ? (List) DetailsFragment.this.tabsMap.get(((Tabs) DetailsFragment.this.mTabsList.get(DetailsFragment.this.selectedMainMenuTab)).getCode()) : DetailsFragment.this.sectionsInfo).size();
        }

        public Fragment getItem(int i2) {
            OttLog.error("position", "++++++++++" + i2);
            Bundle bundle = new Bundle();
            LinearFragment linearFragment = new LinearFragment();
            bundle.putParcelable(NavigationConstants.SECTIONDATA, (Section) (DetailsFragment.this.isMenuTabsAvailable ? (List) DetailsFragment.this.tabsMap.get(((Tabs) DetailsFragment.this.mTabsList.get(DetailsFragment.this.selectedMainMenuTab)).getCode()) : DetailsFragment.this.sectionsInfo).get(i2));
            bundle.putString(NavigationConstants.PAGEPATH, DetailsFragment.this.contentPage.getPageInfo().getPath());
            if (DetailsFragment.this.title != null) {
                bundle.putString(NavigationConstants.TITLE, DetailsFragment.this.title);
            }
            bundle.putString(NavigationConstants.PAGE_TYPE, PageType.Details.getValue());
            bundle.putString(NavigationConstants.NAV_FROM_PATH, AnalyticsV2.EVENT_DETAILSTAB + AnalyticsV2.VALUE_DELIMETER + DetailsFragment.this.getTitle(i2));
            linearFragment.setArguments(bundle);
            return linearFragment;
        }

        public int getItemPosition(Object obj) {
            return -2;
        }

        public CharSequence getPageTitle(int i2) {
            return DetailsFragment.this.getTitle(i2);
        }
    }

    public class FragmentPartnerPagerAdapter extends FragmentStatePagerAdapter {
        public FragmentPartnerPagerAdapter(FragmentManager fragmentManager) {
            super(fragmentManager);
        }

        public void destroyItem(ViewGroup viewGroup, int i2, Object obj) {
            super.destroyItem(viewGroup, i2, obj);
            DetailsFragment.this.tabLayout.setTabMode(0);
            Fragment fragment = (Fragment) obj;
            FragmentManager fragmentManager = fragment.getFragmentManager();
            if (fragmentManager != null) {
                FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
                beginTransaction.remove(fragment);
                beginTransaction.commitAllowingStateLoss();
            }
        }

        public int getCount() {
            if (DetailsFragment.this.mPartnerMenuTabList == null) {
                return 0;
            }
            return DetailsFragment.this.mPartnerMenuTabList.size();
        }

        public Fragment getItem(int i2) {
            return NavigationUtils.getHomeScreenFragment(((Card) DetailsFragment.this.mPartnerMenuTabList.get(i2)).getDisplay().getTitle(), ((Card) DetailsFragment.this.mPartnerMenuTabList.get(i2)).getTarget().getPath(), i2);
        }

        public int getItemPosition(Object obj) {
            return -2;
        }

        public CharSequence getPageTitle(int i2) {
            return ((Card) DetailsFragment.this.mPartnerMenuTabList.get(i2)).getDisplay().getTitle();
        }
    }

    public void dynamicRequestSectionData(List<Section.SectionInfo> list, List<Section.SectionData> list2) {
        if (list2 == null || list2.size() < 1) {
            return;
        }
        Section section = new Section();
        for (int i2 = 0; i2 < list2.size(); i2++) {
            section.setSectionData(list2.get(i2));
            if (this.loadMoreSections.size() > 0) {
                int i3 = -1;
                int i4 = 0;
                while (true) {
                    if (i4 >= this.loadMoreSections.size()) {
                        break;
                    }
                    if (this.loadMoreSections.get(i4).getSectionData().getSection().equals(section.getSectionData().getSection())) {
                        i3 = i4;
                        break;
                    }
                    i4++;
                }
                if (i3 >= 0) {
                    String myRecoTrackingId = (this.loadMoreSections.get(i3).getSectionData() == null || this.loadMoreSections.get(i3).getSectionData().getMyRecoTrackingId() == null) ? "" : this.loadMoreSections.get(i3).getSectionData().getMyRecoTrackingId();
                    if (list2.get(i2) != null && list2.get(i2).getMyRecoTrackingId() != null) {
                        myRecoTrackingId = list2.get(i2).getMyRecoTrackingId();
                    }
                    String str = myRecoTrackingId;
                    String name = (list == null || list.size() <= 0) ? this.loadMoreSections.get(i3).getSectionInfo().getName() : list.get(i2).getName();
                    List<Section.SubSectionInfo> subSectionInfo = this.loadMoreSections.get(i3).getSubSectionInfo();
                    Section.SectionInfo sectionInfo = this.loadMoreSections.get(i3).getSectionInfo();
                    ListRowWithControls listRowWithControls = new ListRowWithControls("section", new HeaderItemWithControls(sectionInfo != null ? sectionInfo.getSectionPresentation() : "", subSectionInfo, i3, name, this.targetPage, sectionInfo.getDataType(), this.loadMoreSections.get(i3).getSectionControls(), sectionInfo.getIconUrl(), str, sectionInfo.getBannerImage(), sectionInfo), list2.get(i2).getCards());
                    if (sectionInfo.getSectionPresentation().equalsIgnoreCase("tabbed_display") && subSectionInfo != null && !subSectionInfo.isEmpty()) {
                        this.listRows.add(listRowWithControls);
                    } else if (getActivity() != null && getActivity().isExploreSection(sectionInfo) && !list2.get(i2).getCards().isEmpty()) {
                        this.listRows.add(listRowWithControls);
                    } else if (!list2.get(i2).getCards().isEmpty()) {
                        this.listRows.add(listRowWithControls);
                    }
                }
            }
        }
        CustomLog.e(this.TAG, "listrowsize=" + this.listRows.size());
        List<Section> list3 = this.loadMoreSections;
        if (list3 != null && list3.size() > 0 && this.mRowCount < this.loadMoreSections.size()) {
            this.rowController.setData(this.listRows, Boolean.TRUE);
        }
        CustomLog.e(this.TAG, "copyofmodels size = " + this.rowController.getAdapter().getCopyOfModels().size());
        showRecyclerView();
        List<ListRowWithControls> list4 = this.listRows;
        if (list4 == null || list4.size() + 1 != this.rowController.getAdapter().getCopyOfModels().size()) {
            return;
        }
        CustomLog.e(this.TAG, "copyofmodels size = " + this.rowController.getAdapter().getCopyOfModels().size());
        this.rowController.setData(this.listRows, Boolean.FALSE);
    }

    private void eventCTCarouselClicked(java.lang.Object r21, java.lang.String r22) {
        throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.fragments.DetailsFragment.eventCTCarouselClicked(java.lang.Object, java.lang.String):void");
    }

    public void fetchDeepLinkInfo(final Content.Elements elements, final String str) {
        OttSDK.getInstance().getMediaManager().getDeeplinkInfo(str, new MediaCatalogManager.MediaCatalogCallback<DeeplinkInfo>() {
            @Override
            public void onFailure(Error error) {
                if (error != null) {
                    CustomLog.e("detailsFragmentDeepLinkError", " " + error.getMessage());
                    if (error.getCode().equals(404)) {
                        Toast.makeText(DetailsFragment.this.getContext(), "" + error.getMessage(), 0).show();
                    }
                }
                NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/v1/page/deeplink", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(DeeplinkInfo deeplinkInfo) {
                if (deeplinkInfo == null || deeplinkInfo.getContentCode() == null || deeplinkInfo.getContentCode().trim().length() <= 0 || deeplinkInfo.getPartnerCode() == null) {
                    return;
                }
                HashMap hashMap = new HashMap();
                hashMap.put("value", "1");
                NavigationUtils.sendRecoEvents(DetailsFragment.this.getActivity(), hashMap);
                NavigationUtils.startNewActivity(elements, DetailsFragment.this.getContext(), deeplinkInfo, 0, str);
            }
        });
    }

    public void getOrderStatus(String str) {
        showProgress(true);
        OttSDK.getInstance().getPaymentManager().getOrderStatus(str, new PaymentManager.PaymentCallback<OrderStatusResponse>() {
            @Override
            public void onFailure(Error error) {
                DetailsFragment.this.showProgress(false);
                DetailsFragment.this.isTransactionDone = true;
                if (DetailsFragment.this.getActivity() != null) {
                    Toast.makeText((Context) DetailsFragment.this.getActivity(), R.string.sry_transaction_failed, 1).show();
                    NavigationUtils.logKibanaError("DetailsFragment", "API", "/payment/api/v1/order/status", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                } else {
                    DetailsFragment.this.isTransactionDone = true;
                    DetailsFragment.this.showProgress(false);
                    DetailsFragment detailsFragment = DetailsFragment.this;
                    detailsFragment.handler.removeCallbacks(detailsFragment.transactionAction);
                }
            }

            @Override
            public void onSuccess(OrderStatusResponse orderStatusResponse) {
                if (DetailsFragment.this.getActivity() == null) {
                    DetailsFragment.this.isTransactionDone = true;
                    DetailsFragment.this.showProgress(false);
                    DetailsFragment detailsFragment = DetailsFragment.this;
                    detailsFragment.handler.removeCallbacks(detailsFragment.transactionAction);
                }
                String upperCase = orderStatusResponse.getStatus().toUpperCase();
                upperCase.getClass();
                switch (upperCase) {
                    case "F":
                        DetailsFragment.this.showProgress(false);
                        DetailsFragment.this.isTransactionDone = true;
                        DetailsFragment detailsFragment2 = DetailsFragment.this;
                        Handler handler = detailsFragment2.handler;
                        if (handler != null) {
                            handler.removeCallbacks(detailsFragment2.transactionAction);
                        }
                        Toast.makeText((Context) DetailsFragment.this.getActivity(), (CharSequence) orderStatusResponse.getMessage(), 1).show();
                        break;
                    case "P":
                        DetailsFragment.this.isTransactionDone = false;
                        Toast.makeText((Context) DetailsFragment.this.getActivity(), (CharSequence) orderStatusResponse.getMessage(), 1).show();
                        break;
                    case "S":
                        DetailsFragment.this.isTransactionDone = true;
                        DetailsFragment detailsFragment3 = DetailsFragment.this;
                        Handler handler2 = detailsFragment3.handler;
                        if (handler2 != null) {
                            handler2.removeCallbacks(detailsFragment3.transactionAction);
                        }
                        Toast.makeText((Context) DetailsFragment.this.getActivity(), (CharSequence) orderStatusResponse.getMessage(), 1).show();
                        RestAdapter.enableCache(false);
                        DetailsFragment.this.getNextPageResponse();
                        break;
                }
            }
        });
    }

    public void getPackageListFromServer(String str) {
        if (OttSDK.getInstance() != null) {
            if (com.yupptv.ott.adapters.s.a() == null) {
                if (str.equalsIgnoreCase("rent")) {
                    OttSDK.getInstance().getPaymentManager().getPackagesForContentV2(this.targetPath, 2, this.callBack);
                    return;
                } else {
                    NavigationUtils.loadScreenActivityForResult(getActivity(), ScreenType.SIGNIN, NavigationConstants.NAV_FROM_DETAILS, this.targetPath, 20, false, this.isTransactionalPack);
                    return;
                }
            }
            if (OttSDK.getInstance().getPreferenceManager().getLoggedUser().getActionCode() != null && (OttSDK.getInstance().getPreferenceManager().getLoggedUser().getActionCode().intValue() == 1 || OttSDK.getInstance().getPreferenceManager().getLoggedUser().getActionCode().intValue() == 2 || OttSDK.getInstance().getPreferenceManager().getLoggedUser().getActionCode().intValue() == 3 || OttSDK.getInstance().getPreferenceManager().getLoggedUser().getActionCode().intValue() == 4)) {
                NavigationUtils.loadScreenActivityForResult(getActivity(), ScreenType.OTP_VERIFY, NavigationConstants.NAV_FROM_DETAILS, this.targetPath, 20, false, this.isTransactionalPack);
                return;
            }
            showPaymentProgress(true);
            if (str.equalsIgnoreCase("rent")) {
                OttSDK.getInstance().getPaymentManager().getPackagesForContentV2(this.targetPath, 2, this.callBack);
            } else {
                NavigationUtils.loadScreenActivityForResult(getActivity(), ScreenType.PAYMENTS, NavigationConstants.NAV_FROM_DETAILS, this.targetPath, 20, false, this.isTransactionalPack);
            }
        }
    }

    private String getStoreUrl() {
        return "https://play.google.com/store/apps/details?id=com.vilite";
    }

    public String getTitle(int i2) {
        return this.isMenuTabsAvailable ? this.tabsMap.get(this.mTabsList.get(this.selectedMainMenuTab).getCode()).get(i2).getSectionInfo().getName() : this.sectionsInfo.get(i2).getSectionInfo().getName();
    }

    private void handleDistroPixelAnalytics(String str) {
        FragmentActivity activity = getActivity() instanceof FusionViliteMainActivity ? getActivity() : null;
        if (activity == null) {
            return;
        }
        Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(activity.getApplicationContext());
        this.distroAnalyticsUrl = "";
        if (utilAppConfigurations != null) {
            if (!TextUtils.isEmpty(utilAppConfigurations.getDistroPixelUrl())) {
                this.distroAnalyticsUrl = utilAppConfigurations.getDistroPixelUrl();
            }
            if (TextUtils.isEmpty(this.distroAnalyticsUrl)) {
                return;
            }
            if (this.distroAnalyticsUrl.contains("<partner_name>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<partner_name>", Constants.DISTRO_PARTNER_NAME);
            }
            if (this.distroAnalyticsUrl.contains("<event_name>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<event_name>", str);
            }
            if (this.distroAnalyticsUrl.contains("<random>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<random>", "" + System.currentTimeMillis());
            }
            if (this.distroAnalyticsUrl.contains("<advertising_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<advertising_id>", Preferences.instance(activity).getStringPreference("pref_key_advertising_id"));
            }
            if (this.distroAnalyticsUrl.contains("<playback_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<playback_id>", str);
            }
            if (this.distroAnalyticsUrl.contains("<encoded_video_url>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<encoded_video_url>", URLEncoder.encode(getStoreUrl()));
            }
            if (this.distroAnalyticsUrl.contains("<content_provider_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<content_provider_id>", "");
            }
            if (this.distroAnalyticsUrl.contains("<show_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<show_id>", "");
            }
            if (this.distroAnalyticsUrl.contains("<episode_id>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<episode_id>", "");
            }
            if (this.distroAnalyticsUrl.contains("<device_category>")) {
                this.distroAnalyticsUrl = this.distroAnalyticsUrl.replace("<device_category>", Constants.DISTRO_DEVICE_CATEGORY);
            }
            CustomLog.d("DEBUG", "distroAnalyticsUrl " + this.distroAnalyticsUrl);
            APIUtils.getmMediaManager(activity.getApplicationContext()).sendDistroPixelAnalyticEvents(this.distroAnalyticsUrl, new MediaCatalogManager.MediaCatalogCallback<ResponseBody>() {
                @Override
                public void onFailure(Error error) {
                    if (error == null || error.getMessage() == null) {
                        return;
                    }
                    CustomLog.e("DistroPixelAnalytics", " error: " + error.getMessage());
                    NavigationUtils.logKibanaError("DetailsFragment", "API", "sendDistroPixelAnalyticEvents", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                }

                @Override
                public void onSuccess(ResponseBody responseBody) {
                    CustomLog.e("DistroPixelAnalytics", " responseBody: " + responseBody);
                }
            });
        }
    }

    public void lambda$onCreateView$0(EpoxyVisibilityTracker epoxyVisibilityTracker, NestedScrollView nestedScrollView, final int i2, final int i3, int i4, int i5) {
        List<ListRowWithControls> list;
        epoxyVisibilityTracker.requestVisibilityCheck();
        if (nestedScrollView.getChildAt(nestedScrollView.getChildCount() - 1) != null) {
            if (i3 >= nestedScrollView.getChildAt(nestedScrollView.getChildCount() - 1).getMeasuredHeight() - nestedScrollView.getMeasuredHeight() && i3 > i5) {
                CustomLog.e("load data", "load data");
                if (this.mRowCount < this.loadMoreSections.size()) {
                    this.rowController.setData(this.listRows, Boolean.TRUE);
                    processSectionData(true);
                } else if (this.rowController != null && (list = this.listRows) != null && !list.isEmpty()) {
                    this.rowController.setData(this.listRows, Boolean.FALSE);
                }
            }
            NestedScrollView nestedScrollView2 = this.main_content;
            if (nestedScrollView2.getChildAt(nestedScrollView2.getChildCount() - 1).getBottom() - (this.main_content.getScrollY() + this.main_content.getHeight()) == 0) {
                this.verticalRecyclerView.smoothScrollToPosition(this.listRows.size() - 1);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        DetailsFragment.this.main_content.scrollTo(i2, i3 - 10);
                    }
                }, 100L);
            }
        }
    }

    private void processSectionData(boolean z) {
        String str = "";
        int i2 = 0;
        String str2 = "";
        while (true) {
            int size = this.loadMoreSections.size();
            int i3 = this.MAX_SECTIONS;
            if (size < i3) {
                i3 = this.loadMoreSections.size();
            }
            if (i2 >= i3) {
                break;
            }
            if (this.mRowCount < this.loadMoreSections.size()) {
                str2 = str2.concat(this.loadMoreSections.get(this.mRowCount).getSectionInfo().getCode() + ",");
                if (this.loadMoreSections.get(this.mRowCount).getSectionInfo().getParams() != null && this.loadMoreSections.get(this.mRowCount).getSectionInfo().getParams().getHasDynamicName() != null) {
                    str = str.concat(this.loadMoreSections.get(this.mRowCount).getSectionInfo().getParams().getHasDynamicName() + ",");
                }
            }
            i2++;
            this.mRowCount++;
        }
        if (str.contains("true")) {
            this.isDynamicName = true;
        } else {
            this.isDynamicName = false;
        }
        if (!str2.isEmpty()) {
            requestSectionData(str2, z);
            return;
        }
        RowController rowController = this.rowController;
        if (rowController != null) {
            rowController.setData(this.listRows, Boolean.FALSE);
        }
    }

    private void requestSectionData(String str, boolean z) {
        if (z) {
            if (this.isDynamicName) {
                OttSDK.getInstance().getMediaManager().getPageSectionContent(this.targetPath, str, -1, this.pageSectionContentCount, null, null, this.isDynamicName, new MediaCatalogManager.MediaCatalogCallback<List<PageData>>() {
                    @Override
                    public void onFailure(Error error) {
                        DetailsFragment.this.showProgress(false);
                        if (DetailsFragment.this.rowController != null && DetailsFragment.this.listRows != null && !DetailsFragment.this.listRows.isEmpty()) {
                            DetailsFragment.this.rowController.setData(DetailsFragment.this.listRows, Boolean.FALSE);
                        }
                        CustomLog.e(DetailsFragment.this.TAG, "on failure");
                        NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/v1/section/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                    }

                    @Override
                    public void onSuccess(List<PageData> list) {
                        if (list == null || list.size() < 1) {
                            return;
                        }
                        ArrayList arrayList = new ArrayList();
                        ArrayList arrayList2 = new ArrayList();
                        for (int i2 = 0; i2 < list.size(); i2++) {
                            arrayList2.add(list.get(i2).getSection().getSectionData());
                            arrayList.add(list.get(i2).getSection().getSectionInfo());
                        }
                        DetailsFragment.this.dynamicRequestSectionData(arrayList, arrayList2);
                    }
                });
            } else {
                OttSDK.getInstance().getMediaManager().getPageSectionContent(this.targetPath, str, -1, this.pageSectionContentCount, null, null, new MediaCatalogManager.MediaCatalogCallback<List<Section.SectionData>>() {
                    @Override
                    public void onFailure(Error error) {
                        DetailsFragment.this.showProgress(false);
                        if (DetailsFragment.this.rowController != null && DetailsFragment.this.listRows != null && !DetailsFragment.this.listRows.isEmpty()) {
                            DetailsFragment.this.rowController.setData(DetailsFragment.this.listRows, Boolean.FALSE);
                        }
                        CustomLog.e(DetailsFragment.this.TAG, "on failure");
                        NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/v1/section/data", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                    }

                    @Override
                    public void onSuccess(List<Section.SectionData> list) {
                        DetailsFragment.this.dynamicRequestSectionData(null, list);
                    }
                });
            }
        }
    }

    private void setBannersData() {
        List<Banner> list = this.bannerList;
        if (list == null || list.size() <= 0 || !isAdded()) {
            return;
        }
        CustomLog.e(this.TAG, "Banner List :" + this.listRows.toString());
        ListRowWithControls listRowWithControls = new ListRowWithControls(new HeaderItemWithControls("", null, -1L, "banner", NavigationConstants.BANNER_HEADER_CODE, PosterType.BANNER.getValue(), null, "", "", "", null), this.bannerList);
        List<ListRowWithControls> list2 = this.listRows;
        if (list2 != null) {
            list2.add(0, listRowWithControls);
            List<Section> list3 = this.loadMoreSections;
            if (list3 == null || list3.size() <= 0 || this.mRowCount >= this.loadMoreSections.size()) {
                this.rowController.setData(this.listRows, Boolean.FALSE);
            } else {
                this.rowController.setData(this.listRows, Boolean.TRUE);
            }
        }
    }

    public void setDetailsHeadData() {
        if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
            getActivity().updateToolBarTheme(0, false);
        }
        this.detailsExtraButtonsLayout.setVisibility(0);
        this.mTitle = "";
        this.mCast = "";
        if (this.fragmentHost != null) {
            ContentPage contentPage = this.contentPage;
            if (contentPage != null && contentPage.getPageData() != null) {
                int i2 = 0;
                while (true) {
                    if (i2 >= this.contentPage.getPageData().size()) {
                        break;
                    }
                    if (this.contentPage.getPageData().get(i2).getPaneType().equalsIgnoreCase("content")) {
                        this.mTitle = this.contentPage.getPageData().get(i2).getContent().getTitle();
                        this.fragmentHost.showBottomBar(false);
                        this.imageUrl = APIUtils.getAbsoluteImagePath(this.context.getApplicationContext(), this.contentPage.getPageData().get(i2).getContent().getBackgroundImage());
                        break;
                    }
                    i2++;
                }
            }
            ContentPage contentPage2 = this.contentPage;
            if (contentPage2 != null) {
                PageInfo pageInfo = contentPage2.getPageInfo();
                if (pageInfo != null && pageInfo.getAttributes() != null && pageInfo.getAttributes().getContentType() != null) {
                    this.mContentType = pageInfo.getAttributes().getContentType();
                }
                String str = this.mContentType;
                if (str != null && (str.equalsIgnoreCase("channel") || this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK))) {
                    this.fragmentHost.expandToolBar(false);
                    List<Card> list = this.mPartnerMenuTabList;
                    if (list != null && list.size() > 0) {
                        this.verticalRecyclerView.setVisibility(8);
                    }
                    this.buttonRecyclerView.setVisibility(8);
                    this.descriptionLayout.setVisibility(8);
                    if (this.mContentType.equalsIgnoreCase("tvshowdetails")) {
                        this.fragmentHost.showBottomBar(false);
                        this.detailsExtraButtonsLayout.setVisibility(8);
                    }
                    if (this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK)) {
                        if (getActivity() != null && (getActivity() instanceof FusionViliteMainActivity)) {
                            getActivity().updateToolBarTheme(0, false);
                        }
                        List<Card> list2 = this.mPartnerMenuTabList;
                        if (list2 != null && list2.size() > 0) {
                            this.tabLayout.setBackgroundColor(getActivity().getResources().getColor(R.color.black));
                            this.tabLayout.setBackground(getActivity().getResources().getDrawable(R.drawable.tab_partner_bg));
                            this.tabLayout.setSelectedTabIndicatorColor(getActivity().getResources().getColor(R.color.rm_theme_color));
                        }
                        if (pageInfo != null && pageInfo.getCode() != null && pageInfo.getCode().equalsIgnoreCase("distro") && !this.isDistroVideoImpressionSent) {
                            this.isDistroVideoImpressionSent = true;
                            handleDistroPixelAnalytics("ff");
                        }
                    }
                    this.fragmentHost.updateDetailHeader(this.contentPage, 0);
                    this.fragmentHost.expandToolBar(true);
                    this.detailsExtraButtonsLayout.setVisibility(8);
                    return;
                }
            }
            this.fragmentHost.updateDetailHeader(this.contentPage, 0);
            this.fragmentHost.expandToolBar(true);
            this.fragmentHost.showBottomBar(false);
            this.verticalRecyclerView.setVisibility(0);
            this.buttonRecyclerView.setVisibility(0);
            this.descriptionLayout.setVisibility(0);
        }
    }

    public void setDetailsTailData() {
        List<Card> list;
        String str;
        String str2;
        this.buttonList = new ArrayList();
        List<Section> list2 = this.sectionsInfo;
        if (list2 != null) {
            list2.clear();
        }
        PageButtons.Record record = this.contentPage.getPageButtons().getRecord();
        this.mChannelRecordObject = record;
        boolean z = true;
        int i2 = 0;
        if (record != null && record.getIsRecorded() != null) {
            if (this.mChannelRecordObject.getIsRecorded().booleanValue()) {
                showRecordButton(false);
            } else {
                showRecordButton(true);
            }
        }
        ContentPage contentPage = this.contentPage;
        if (contentPage != null) {
            if (contentPage.getPageButtons() != null && this.contentPage.getPageButtons().getShowFavouriteButton().booleanValue()) {
                this.details_watch_list_layout.setVisibility(0);
                updateWatchListIcon();
                showExtraButtonsDividers();
            }
            if (this.contentPage.getShareInfo() != null && this.contentPage.getShareInfo().getIsSharingAllowed().booleanValue()) {
                this.shareInfo = this.contentPage.getShareInfo();
                this.share_layout.setVisibility(0);
                showExtraButtonsDividers();
            }
            if (this.contentPage.getPageInfo() != null && this.contentPage.getPageInfo().getAttributes() != null && this.contentPage.getPageInfo().getAttributes().getWatchedPosition() != null && !this.contentPage.getPageInfo().getAttributes().getWatchedPosition().trim().isEmpty()) {
                this.resumeProgress = (int) (Float.valueOf(this.contentPage.getPageInfo().getAttributes().getWatchedPosition()).floatValue() * 100.0f);
            }
            PageInfo pageInfo = this.contentPage.getPageInfo();
            if (pageInfo != null && pageInfo.getAttributes() != null && pageInfo.getAttributes().getContentType() != null) {
                this.mContentType = pageInfo.getAttributes().getContentType();
            }
        }
        this.isTransactionalPack = false;
        this.bannerList = this.contentPage.getBanners();
        List<ListRowWithControls> list3 = this.listRows;
        if (list3 != null) {
            list3.clear();
        }
        int i3 = 0;
        while (i3 < this.contentPage.getPageData().size()) {
            if (this.contentPage.getPageData().get(i3).getPaneType().equalsIgnoreCase("content")) {
                Content content = this.contentPage.getPageData().get(i3).getContent();
                this.title = content.getTitle();
                for (int i4 = i2; i4 < content.getDataRows().size(); i4++) {
                    if (content.getDataRows().get(i4).getRowDataType().equalsIgnoreCase("content")) {
                        for (int i5 = i2; i5 < content.getDataRows().get(i4).getElements().size(); i5++) {
                            Content.Elements elements = this.contentPage.getPageData().get(i3).getContent().getDataRows().get(i4).getElements().get(i5);
                            if (elements.getElementSubtype().equalsIgnoreCase("languageDisplayText") && !elements.getData().isEmpty()) {
                                this.availableInLangTv.setVisibility(i2);
                                this.availableLabelTv.setVisibility(i2);
                                this.availableInLangTv.setText(getContext().getResources().getString(R.string.available_in) + " : " + elements.getData());
                            }
                            if (elements.getElementType().equalsIgnoreCase("description") && !elements.getData().isEmpty()) {
                                this.descriptionLayout.setVisibility(i2);
                                this.description.setText(elements.getData());
                                UiUtils.makeTextViewResizable(this.detailView.getContext(), this.description, 4, getActivity().getResources().getString(R.string.txt_expand), z);
                            } else if (elements.getElementSubtype() != null && elements.getElementSubtype().equalsIgnoreCase("rentalinfo") && !elements.getData().isEmpty()) {
                                this.details_rental_info.setVisibility(i2);
                                this.details_rental_info_text.setText(elements.getData());
                            } else if (elements.getElementType().equalsIgnoreCase("image") && !elements.getData().isEmpty() && (str2 = this.mContentType) != null && str2.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK)) {
                                getActivity().updateToolBarLogo(elements.getData());
                            }
                        }
                    }
                    if (content.getDataRows().get(i4).getRowDataType().equalsIgnoreCase("button")) {
                        for (int i6 = i2; i6 < content.getDataRows().get(i4).getElements().size(); i6++) {
                            Content.Elements elements2 = this.contentPage.getPageData().get(i3).getContent().getDataRows().get(i4).getElements().get(i6);
                            if (elements2.getElementType().equalsIgnoreCase("button")) {
                                if (elements2.getElementSubtype().equalsIgnoreCase("startover")) {
                                    this.details_start_over_layout.setVisibility(i2);
                                    this.start_over_icon.setTag(elements2.getTarget());
                                    showExtraButtonsDividers();
                                } else {
                                    this.buttonList.add(elements2);
                                }
                            }
                        }
                    }
                }
                GridLayoutManager gridLayoutManager = new GridLayoutManager(this.detailView.getContext(), (int) (this.buttonList.size() < 2 ? z : 2));
                this.gridLayoutManager = gridLayoutManager;
                this.buttonRecyclerView.setLayoutManager(gridLayoutManager);
                this.buttonRecyclerView.setAdapter(new DetailViewAdapter(this.context, this.buttonList));
            } else if (this.contentPage.getPageData().get(i3).getPaneType().equalsIgnoreCase("section")) {
                if (this.contentPage.getPageData().get(i3).getSection().getSectionData().getCards().size() > 0) {
                    Section.SectionInfo sectionInfo = this.contentPage.getPageData().get(i3).getSection().getSectionInfo();
                    if (this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK) && sectionInfo.getDataType().equalsIgnoreCase("button")) {
                        this.mPartnerMenuTabList.addAll(this.contentPage.getPageData().get(i3).getSection().getSectionData().getCards());
                    } else if (this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK) && sectionInfo.getDataType().equalsIgnoreCase("button")) {
                        this.mPartnerMenuTabList.addAll(this.contentPage.getPageData().get(i3).getSection().getSectionData().getCards());
                    } else {
                        if (sectionInfo.getCode().equalsIgnoreCase("Recommendations") && OttSDK.getInstance() != null && OttSDK.getInstance().getPreferenceManager() != null && OttSDK.getInstance().getPreferenceManager().getConfigurationData() != null && OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs() != null) {
                            String str3 = this.mContentType;
                            if (str3 == null || !str3.equalsIgnoreCase("movie") || OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs().getMovieDetailsRecommendationText() == null) {
                                String str4 = this.mContentType;
                                if (str4 == null || !str4.equalsIgnoreCase("tvshowdetails") || OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs().getTvshowPlayerRecommendationText() == null) {
                                    this.contentPage.getPageData().get(i3).getSection().getSectionInfo().setName(OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs().getChannelRecommendationText());
                                } else {
                                    this.contentPage.getPageData().get(i3).getSection().getSectionInfo().setName(OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs().getTvshowDetailsRecommendationText());
                                }
                            } else {
                                this.contentPage.getPageData().get(i3).getSection().getSectionInfo().setName(OttSDK.getInstance().getPreferenceManager().getConfigurationData().getConfigs().getMovieDetailsRecommendationText());
                            }
                        }
                        String str5 = this.mContentType;
                        if (str5 != null && (!str5.equalsIgnoreCase("tvshowdetails") || (!sectionInfo.getCode().equalsIgnoreCase("Cast & Crew") && !sectionInfo.getCode().equalsIgnoreCase("grouplist_content_actors") && !sectionInfo.getCode().equalsIgnoreCase("playlist_content_actors") && !sectionInfo.getCode().equalsIgnoreCase("content_actors") && !sectionInfo.getCode().equalsIgnoreCase("movie_actors")))) {
                            this.sectionsInfo.add(this.contentPage.getPageData().get(i3).getSection());
                        }
                        ListRowWithControls listRowWithControls = new ListRowWithControls(this.contentPage.getPageData().get(i3).getPaneType(), new HeaderItemWithControls(sectionInfo.getSectionPresentation() != null ? sectionInfo.getSectionPresentation() : "", this.contentPage.getPageData().get(i3).getSection().getSubSectionInfo(), i3, sectionInfo.getName(), "", sectionInfo.getDataType(), this.contentPage.getPageData().get(i3).getSection().getSectionControls(), sectionInfo.getIconUrl(), "", "", sectionInfo), this.contentPage.getPageData().get(i3).getSection().getSectionData().getCards());
                        if (!this.isTransactionalPack && (str = this.mContentType) != null && str.equalsIgnoreCase("movie") && this.contentPage.getPageInfo() != null && this.contentPage.getPageInfo().getAttributes() != null && this.contentPage.getPageInfo().getAttributes().getIsTransactional() != null) {
                            if (this.contentPage.getPageInfo().getAttributes().getIsTransactional().equalsIgnoreCase("true")) {
                                this.isTransactionalPack = true;
                            } else {
                                this.isTransactionalPack = false;
                            }
                        }
                        ContentPage contentPage2 = this.contentPage;
                        if (contentPage2 == null || contentPage2.getTabsInfo() == null || !this.contentPage.getTabsInfo().getShowTabs().booleanValue() || (this.mContentType.equalsIgnoreCase("tvshowdetails") && (sectionInfo.getCode().equalsIgnoreCase("Cast & Crew") || sectionInfo.getCode().equalsIgnoreCase("grouplist_content_actors") || sectionInfo.getCode().equalsIgnoreCase("playlist_content_actors") || sectionInfo.getCode().equalsIgnoreCase("content_actors") || sectionInfo.getCode().equalsIgnoreCase("movie_actors")))) {
                            this.listRows.add(listRowWithControls);
                        }
                    }
                } else if (this.contentPage.getPageData().get(i3).getSection().getSectionData().getHasMoreData().booleanValue()) {
                    this.loadMoreSections.add(this.contentPage.getPageData().get(i3).getSection());
                }
            }
            i3++;
            z = true;
            i2 = 0;
        }
        setBannersData();
        String str6 = this.mContentType;
        if (str6 != null && str6.equalsIgnoreCase("tvshowdetails") && this.listRows.size() > 0) {
            List<Section> list4 = this.loadMoreSections;
            if (list4 == null || list4.size() <= 0 || this.mRowCount >= this.loadMoreSections.size()) {
                this.rowController.setData(this.listRows, Boolean.FALSE);
            } else {
                this.rowController.setData(this.listRows, Boolean.TRUE);
                processSectionData(true);
            }
            List<ListRowWithControls> list5 = this.listRows;
            if (list5 != null && list5.size() + 1 == this.rowController.getAdapter().getCopyOfModels().size() && this.loadMoreSections.size() < 1) {
                this.rowController.setData(this.listRows, Boolean.FALSE);
            }
            RecyclerView recyclerView = this.verticalRecyclerView;
            if (recyclerView != null) {
                recyclerView.setVisibility(0);
                this.viewPager.setVisibility(8);
                this.tabLayout.setVisibility(8);
                this.errorLayout.setVisibility(8);
                this.avatarImageView.setVisibility(8);
                this.verticalRecyclerView.setAdapter(this.rowController.getAdapter());
            }
        }
        ContentPage contentPage3 = this.contentPage;
        if (contentPage3 != null && contentPage3.getTabsInfo() != null && this.contentPage.getTabsInfo().getShowTabs().booleanValue()) {
            List<Section> list6 = this.sectionsInfo;
            if (list6 == null || list6.size() <= 0) {
                this.viewPager.setVisibility(8);
                this.tabLayout.setVisibility(8);
                this.errorLayout.setVisibility(0);
                this.avatarImageView.setVisibility(0);
                return;
            }
            this.viewPager.setVisibility(0);
            this.tabLayout.setVisibility(0);
            this.errorLayout.setVisibility(8);
            this.avatarImageView.setVisibility(8);
            OttLog.error(this.TAG, "viewpager set adapter ");
            this.isMenuTabsAvailable = false;
            this.mMenuTab.setVisibility(8);
            FragmentPagerAdapter fragmentPagerAdapter = new FragmentPagerAdapter(getChildFragmentManager());
            this.mPagerAdapter = fragmentPagerAdapter;
            this.viewPager.setAdapter(fragmentPagerAdapter);
            return;
        }
        String str7 = this.mContentType;
        if (str7 != null && str7.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK) && (list = this.mPartnerMenuTabList) != null && list.size() > 0) {
            List<ListRowWithControls> list7 = this.listRows;
            if (list7 == null || list7.size() <= 0) {
                this.viewPager.setVisibility(8);
                this.tabLayout.setVisibility(8);
                this.errorLayout.setVisibility(0);
                this.avatarImageView.setVisibility(0);
                return;
            }
            this.viewPager.setVisibility(0);
            this.tabLayout.setVisibility(0);
            this.errorLayout.setVisibility(8);
            this.avatarImageView.setVisibility(8);
            OttLog.error(this.TAG, "viewpager set adapter ");
            this.isMenuTabsAvailable = false;
            this.mMenuTab.setVisibility(8);
            FragmentPartnerPagerAdapter fragmentPartnerPagerAdapter = new FragmentPartnerPagerAdapter(getChildFragmentManager());
            this.mPartnerPagerAdapter = fragmentPartnerPagerAdapter;
            this.viewPager.setAdapter(fragmentPartnerPagerAdapter);
            return;
        }
        if (this.listRows.size() > 0) {
            List<Section> list8 = this.loadMoreSections;
            if (list8 == null || list8.size() <= 0 || this.mRowCount >= this.loadMoreSections.size()) {
                this.rowController.setData(this.listRows, Boolean.FALSE);
            } else {
                this.rowController.setData(this.listRows, Boolean.TRUE);
                processSectionData(true);
            }
            List<ListRowWithControls> list9 = this.listRows;
            if (list9 != null && list9.size() + 1 == this.rowController.getAdapter().getCopyOfModels().size() && this.loadMoreSections.size() < 1) {
                this.rowController.setData(this.listRows, Boolean.FALSE);
            }
            RecyclerView recyclerView2 = this.verticalRecyclerView;
            if (recyclerView2 != null) {
                recyclerView2.setVisibility(0);
                this.viewPager.setVisibility(8);
                this.tabLayout.setVisibility(8);
                this.errorLayout.setVisibility(8);
                this.avatarImageView.setVisibility(8);
                this.verticalRecyclerView.setAdapter(this.rowController.getAdapter());
            }
        }
    }

    private void setupUIElements() {
        setDetailsTailData();
        showProgress(false);
    }

    private void showExtraButtonsDividers() {
        if (this.details_start_over_layout.getVisibility() == 0 && this.details_watch_list_layout.getVisibility() == 0 && this.share_layout.getVisibility() == 0) {
            this.details_extra_buttons_divider.setVisibility(0);
            this.details_extra_buttons_divider1.setVisibility(0);
        } else if (this.details_start_over_layout.getVisibility() == 0 && (this.details_watch_list_layout.getVisibility() == 0 || this.share_layout.getVisibility() == 0)) {
            this.details_extra_buttons_divider.setVisibility(0);
        } else if (this.details_watch_list_layout.getVisibility() == 0 && this.share_layout.getVisibility() == 0) {
            this.details_extra_buttons_divider1.setVisibility(0);
        }
    }

    public void showPaymentProgress(boolean z) {
        ProgressBar progressBar = this.mPaymentProgressBar;
        if (progressBar != null) {
            progressBar.setVisibility(z ? 0 : 8);
        }
    }

    private void showRecyclerView() {
        showContentLayout(true);
        showProgress(false);
    }

    public void showSigninSignupPopup(final String str, final HashMap hashMap) {
        fetchLatestUserinfo();
        if (OttSDK.getInstance().getPreferenceManager().getLoggedUser() != null || getActivity() == null || getActivity().isFinishing() || getActivity().signinPopupVisible) {
            return;
        }
        HashMap hashMap2 = new HashMap();
        hashMap2.put("msg1", getResources().getString(R.string.player_signin_popup_title));
        hashMap2.put("msg2", getResources().getString(R.string.player_signin_popup_subtitle));
        NavigationUtils.showDialog(getActivity(), DialogType.SIGNIN_SIGNUP_INFO_DIALOG, hashMap2, new DialogListener() {
            @Override
            public void itemClicked(boolean z, int i2, HashMap hashMap3) {
                DetailsFragment.this.context.signinPopupVisible = false;
                if (DetailsFragment.this.context == null || i2 == 0) {
                    return;
                }
                if (str.equals("AddToWatchList")) {
                    if (i2 == 1) {
                        NavigationUtils.loadScreenActivityForResult(DetailsFragment.this.context, ScreenType.SIGNIN, NavigationConstants.NAV_FROM_DETAILS, DetailsFragment.this.targetPath, 20, false, DetailsFragment.this.isTransactionalPack);
                    } else if (i2 == 2) {
                        NavigationUtils.loadScreenActivityForResult(DetailsFragment.this.context, ScreenType.SIGNUP2, NavigationConstants.NAV_FROM_DETAILS, DetailsFragment.this.targetPath, 20, false, DetailsFragment.this.isTransactionalPack);
                    }
                }
                if (str.equals("rent")) {
                    if (i2 == 1) {
                        NavigationUtils.loadScreenActivityForResult(DetailsFragment.this.context, ScreenType.SIGNIN, NavigationConstants.NAV_FROM_DETAILS, DetailsFragment.this.targetPath, 20, false, DetailsFragment.this.isTransactionalPack, hashMap);
                    } else if (i2 == 2) {
                        NavigationUtils.loadScreenActivityForResult(DetailsFragment.this.context, ScreenType.SIGNUP2, NavigationConstants.NAV_FROM_DETAILS, DetailsFragment.this.targetPath, 20, false, DetailsFragment.this.isTransactionalPack, hashMap);
                    }
                }
            }

            @Override
            public void itemClicked(boolean z, int i2, int i3) {
                DetailsFragment.this.getActivity().signinPopupVisible = false;
            }
        });
    }

    private void trackEvents(java.lang.Object r9, java.lang.String r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.yupptv.ott.fragments.DetailsFragment.trackEvents(java.lang.Object, java.lang.String):void");
    }

    public void updateWatchList() {
        ContentPage contentPage = this.contentPage;
        if (contentPage == null || contentPage.getPageButtons() == null) {
            return;
        }
        if (contentPage.getPageButtons().getIsFavourite().booleanValue()) {
            OttSDK.getInstance().getUserManager().removeUserFavourite(contentPage.getPageInfo().getPath(), new UserManager.UserCallback<String>() {
                @Override
                public void onEmptySuccess() {
                    com.yupptv.ottsdk.managers.User.a.a(this);
                }

                @Override
                public void onFailure(Error error) {
                    if (DetailsFragment.this.getActivity() == null) {
                        return;
                    }
                    NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/auth/user/favourite/item", "NA", "NA", "NA", com.yupptv.ott.f.a(error, com.yupptv.ott.epg.a.a(error, DetailsFragment.this.getActivity(), 1, "")), error.getMessage());
                }

                @Override
                public void onSuccess(String str) {
                    if (DetailsFragment.this.getActivity() == null) {
                        return;
                    }
                    DetailsFragment.this.contentPage.getPageButtons().setIsFavourite(Boolean.FALSE);
                    DetailsFragment.this.updateWatchListIcon();
                    Toast.makeText((Context) DetailsFragment.this.getActivity(), (CharSequence) str, 1).show();
                }
            });
        } else {
            OttSDK.getInstance().getUserManager().addUserFavourite(contentPage.getPageInfo().getPath(), new UserManager.UserCallback<String>() {
                @Override
                public void onEmptySuccess() {
                    com.yupptv.ottsdk.managers.User.a.a(this);
                }

                @Override
                public void onFailure(Error error) {
                    if (DetailsFragment.this.getActivity() == null) {
                        return;
                    }
                    CustomLog.e("Content not available", error.getMessage());
                    NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/auth/user/favourite/item", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
                }

                @Override
                public void onSuccess(String str) {
                    if (DetailsFragment.this.getActivity() == null) {
                        return;
                    }
                    DetailsFragment.this.contentPage.getPageButtons().setIsFavourite(Boolean.TRUE);
                    DetailsFragment.this.updateWatchListIcon();
                    Toast.makeText((Context) DetailsFragment.this.getActivity(), (CharSequence) str, 1).show();
                }
            });
        }
    }

    public void updateWatchListIcon() {
        ContentPage contentPage = this.contentPage;
        if (contentPage == null || contentPage.getPageButtons() == null || !this.contentPage.getPageButtons().getIsFavourite().booleanValue()) {
            this.details_add_watch_list_btn.setImageResource(R.drawable.heart);
            this.watchlistTextTv.setText(getActivity().getResources().getString(R.string.favourite));
        } else {
            this.details_add_watch_list_btn.setImageResource(R.drawable.heart_selected);
            this.watchlistTextTv.setText(getActivity().getResources().getString(R.string.favourited));
        }
    }

    public void changeFontInViewGroup(ViewGroup viewGroup, String str) {
        for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
            View childAt = viewGroup.getChildAt(i2);
            if (TextView.class.isAssignableFrom(childAt.getClass())) {
                CalligraphyUtils.applyFontToTextView(childAt.getContext(), (TextView) childAt, str);
            } else if (ViewGroup.class.isAssignableFrom(childAt.getClass())) {
                changeFontInViewGroup((ViewGroup) viewGroup.getChildAt(i2), str);
            }
        }
    }

    public void fetchLatestUserinfo() {
        OttSDK.getInstance().getUserManager().getUserInfo(new UserManager.UserCallback<User>() {
            @Override
            public void onEmptySuccess() {
                com.yupptv.ottsdk.managers.User.a.a(this);
            }

            @Override
            public void onFailure(Error error) {
                NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/auth/user/info", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(User user) {
            }
        });
    }

    public ContentPage getContentPageObject() {
        return this.contentPage;
    }

    public void getNextPageResponse() {
        OttSDK.getInstance().getMediaManager().cancelAll();
        OttSDK.getInstance().getMediaManager().getPageContent(this.targetPath, new MediaCatalogManager.MediaCatalogCallback<ContentPage>() {
            @Override
            public void onFailure(Error error) {
                if (DetailsFragment.this.getActivity() == null || DetailsFragment.this.getActivity().isFinishing()) {
                    return;
                }
                NavigationUtils.logKibanaError("DetailsFragment", "API", "/service/api/v1/page/content", "NA", "NA", "NA", com.yupptv.ott.f.a(error, new StringBuilder("")), error.getMessage());
            }

            @Override
            public void onSuccess(ContentPage contentPage) {
                CustomLog.e("details", "got page response");
                if (DetailsFragment.this.getActivity() == null || DetailsFragment.this.contentPage == null) {
                    return;
                }
                if (DetailsFragment.this.contentPage != null) {
                    DetailsFragment.this.contentPage = null;
                }
                DetailsFragment.this.contentPage = contentPage;
                DetailsFragment.this.setDetailsHeadData();
                DetailsFragment.this.setDetailsTailData();
            }
        });
    }

    public String getSavedSourceDetails() {
        return this.savedSourceDetails;
    }

    public String getSavedSubSourceDetails() {
        return this.savedSubSourceDetails;
    }

    public void hideRecordButton() {
        this.recordButton.setVisibility(8);
    }

    @Override
    public void onActionItemClicked(Object obj, int i2, View view, int i3, boolean z) {
    }

    public void onActivityCreated(@Nullable Bundle bundle) {
        super.onActivityCreated(bundle);
        Bundle arguments = getArguments();
        if (arguments != null && arguments.getString(NavigationConstants.TARGET_PAGE) != null) {
            this.targetPath = arguments.getString(NavigationConstants.TARGET_PAGE);
        }
        if (arguments != null && arguments.getString(NavigationConstants.SCREENSOURCE) != null) {
            this.screenSource = arguments.getString(NavigationConstants.SCREENSOURCE);
        }
        if (arguments != null && arguments.containsKey(NavigationConstants.TITLE)) {
            this.title = arguments.getString(NavigationConstants.TITLE);
        }
        try {
            if (arguments.getString(NavigationConstants.CONTENT_PAGE_PATH_STRING) != null && arguments.getString(NavigationConstants.CONTENT_PAGE_PATH_STRING).trim().length() > 0 && OTTApplication.getInstance().getPageDataTracker() != null && OTTApplication.getInstance().getPageDataTracker().containsKey(arguments.getString(NavigationConstants.CONTENT_PAGE_PATH_STRING))) {
                this.contentPage = (ContentPage) new Gson().fromJson(OTTApplication.getInstance().getPageDataTracker().get(arguments.getString(NavigationConstants.CONTENT_PAGE_PATH_STRING)), ContentPage.class);
            } else if (arguments.getParcelable(NavigationConstants.CONTENT_PAGE) != null) {
                this.contentPage = (ContentPage) arguments.getParcelable(NavigationConstants.CONTENT_PAGE);
            }
        } catch (Exception unused) {
            this.contentPage = null;
        }
        showProgress(true);
        if (this.contentPage != null) {
            setupUIElements();
        } else {
            showProgress(false);
            LinearLayout linearLayout = this.errorLayout;
            if (linearLayout != null) {
                linearLayout.setVisibility(0);
            }
        }
        changeFontInViewGroup(this.tabLayout, String.valueOf(R.font.font_style_gotham_regular));
        trackEvents(AnalyticsUtils.EVENT_PAGE_NETWORK, ScreenType.DETAILS, this.mTitle);
    }

    public void onAttach(Activity activity) {
        super.onAttach(activity);
        this.fragmentHost = (FragmentHost) activity;
    }

    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        this.context = getActivity();
        this.title = "";
        this.isDistroVideoImpressionSent = false;
    }

    @Override
    @Nullable
    public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        super.onCreateView(layoutInflater, viewGroup, bundle);
        this.detailView = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.fragment_detail, (ViewGroup) null);
        setRetainInstance(true);
        initBasicViews(this.detailView);
        this.main_content = this.detailView.findViewById(R.id.main_content);
        this.sectionsInfo = new ArrayList();
        TextView textView = (TextView) getActivity().findViewById(R.id.toolbar_record);
        this.recordButton = textView;
        textView.setVisibility(8);
        this.description = (TextView) this.detailView.findViewById(R.id.detail_description);
        View view = this.detailView;
        int i2 = R.id.available_tv;
        this.availableInLangTv = (TextView) view.findViewById(i2);
        this.availableLabelTv = (TextView) this.detailView.findViewById(i2);
        this.descriptionLayout = (RelativeLayout) this.detailView.findViewById(R.id.desc_layout);
        this.detailsExtraButtonsLayout = (RelativeLayout) this.detailView.findViewById(R.id.details_extra_buttons_layout);
        this.buttonRecyclerView = this.detailView.findViewById(R.id.button_rv);
        this.details_rental_info = (LinearLayout) this.detailView.findViewById(R.id.details_rental_info);
        this.details_rental_info_text = (TextView) this.detailView.findViewById(R.id.details_rental_info_text);
        this.verticalRecyclerView = (VerticalRecyclerView) this.detailView.findViewById(R.id.detail_recycler_view);
        this.viewPager = this.detailView.findViewById(R.id.details_suggestions_pager);
        this.tabLayout = this.detailView.findViewById(R.id.tabs);
        this.partnerTabLayout = this.detailView.findViewById(R.id.partnertabs);
        this.tabLayout.setupWithViewPager(this.viewPager);
        this.partnerTabLayout.setupWithViewPager(this.viewPager);
        this.mMenuTab = this.detailView.findViewById(R.id.menu_tab);
        this.mPaymentProgressBar = (ProgressBar) this.detailView.findViewById(R.id.payment_progress);
        LinearLayout linearLayout = (LinearLayout) this.detailView.findViewById(R.id.errorLayout1);
        this.errorLayout = linearLayout;
        linearLayout.setVisibility(8);
        this.avatarImageView = this.detailView.findViewById(R.id.sadavatar_imageview);
        OttSDK ottSDK = OttSDK.getInstance();
        if (ottSDK == null || ottSDK.getApplicationManager() == null || ottSDK.getApplicationManager().getAppConfigurations() == null || ottSDK.getApplicationManager().getAppConfigurations().getSectionPageCount() == null) {
            this.pageSectionContentCount = 10;
        } else {
            this.pageSectionContentCount = ottSDK.getApplicationManager().getAppConfigurations().getSectionPageCount().intValue();
        }
        if (getActivity() instanceof FusionViliteMainActivity) {
            getActivity().isDetailsFragment = true;
        }
        Typeface font = ResourcesCompat.getFont(getActivity(), R.font.font_style_gotham_bold);
        Typeface font2 = ResourcesCompat.getFont(getActivity(), R.font.font_style_gotham_regular);
        ((TextView) this.detailView.findViewById(R.id.des_title)).setTypeface(font);
        this.description.setTypeface(font2);
        this.gridLayoutManager = new GridLayoutManager(this.detailView.getContext(), 1);
        this.verticalLayoutManager = new LinearLayoutManager(getActivity(), 1, false);
        this.buttonRecyclerView.setLayoutManager(this.gridLayoutManager);
        this.verticalRecyclerView.setLayoutManager(this.verticalLayoutManager);
        this.verticalRecyclerView.setHasFixedSize(false);
        this.verticalRecyclerView.setRecycledViewPool(this.recycledViewPool);
        this.verticalRecyclerView.setNestedScrollingEnabled(true);
        final EpoxyVisibilityTracker epoxyVisibilityTracker = new EpoxyVisibilityTracker();
        epoxyVisibilityTracker.attach(this.verticalRecyclerView);
        RowController rowController = new RowController(this, this.recycledViewPool, NavigationConstants.ROW_ITEM, "other", -1, -1);
        this.rowController = rowController;
        rowController.setFilterDuplicates(true);
        getActivity().enableToolBarLogo(false);
        this.main_content.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
            public final void onScrollChange(NestedScrollView nestedScrollView, int i3, int i4, int i5, int i6) {
                DetailsFragment.this.lambda$onCreateView$0(epoxyVisibilityTracker, nestedScrollView, i3, i4, i5, i6);
            }
        });
        this.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            public ViewGroup vg;

            {
                this.vg = (ViewGroup) DetailsFragment.this.tabLayout.getChildAt(0);
            }

            public void onTabReselected(TabLayout.Tab tab) {
            }

            public void onTabSelected(TabLayout.Tab tab) {
                if (DetailsFragment.this.mContentType == null || !DetailsFragment.this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK)) {
                    return;
                }
                ViewGroup viewGroup2 = (ViewGroup) this.vg.getChildAt(tab.getPosition());
                int childCount = viewGroup2.getChildCount();
                for (int i3 = 0; i3 < childCount; i3++) {
                    View childAt = viewGroup2.getChildAt(i3);
                    if (childAt instanceof TextView) {
                        ((TextView) childAt).setTextColor(DetailsFragment.this.getActivity().getResources().getColor(R.color.white));
                    }
                }
            }

            public void onTabUnselected(TabLayout.Tab tab) {
                if (DetailsFragment.this.mContentType == null || !DetailsFragment.this.mContentType.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK)) {
                    return;
                }
                ViewGroup viewGroup2 = (ViewGroup) this.vg.getChildAt(tab.getPosition());
                int childCount = viewGroup2.getChildCount();
                for (int i3 = 0; i3 < childCount; i3++) {
                    View childAt = viewGroup2.getChildAt(i3);
                    if (childAt instanceof TextView) {
                        ((TextView) childAt).setTextColor(DetailsFragment.this.getActivity().getResources().getColor(R.color.taupegray));
                    }
                }
            }
        });
        this.mMenuTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            public ViewGroup vg;

            {
                this.vg = (ViewGroup) DetailsFragment.this.mMenuTab.getChildAt(0);
            }

            public void onTabReselected(TabLayout.Tab tab) {
            }

            public void onTabSelected(TabLayout.Tab tab) {
                DetailsFragment.this.selectedMainMenuTab = tab.getPosition();
                ViewGroup viewGroup2 = (ViewGroup) this.vg.getChildAt(tab.getPosition());
                this.vg.getChildAt(tab.getPosition()).setBackgroundColor(DetailsFragment.this.getActivity().getResources().getColor(R.color.background_login));
                int childCount = viewGroup2.getChildCount();
                for (int i3 = 0; i3 < childCount; i3++) {
                    View childAt = viewGroup2.getChildAt(i3);
                    if (childAt instanceof TextView) {
                        ((TextView) childAt).setTextColor(DetailsFragment.this.getActivity().getResources().getColor(R.color.prussinblue));
                    }
                }
                if (DetailsFragment.this.tabsMap == null || DetailsFragment.this.mTabsList == null || DetailsFragment.this.tabsMap.size() <= 0) {
                    DetailsFragment.this.tabLayout.setVisibility(8);
                    DetailsFragment.this.errorLayout.setVisibility(8);
                    DetailsFragment.this.avatarImageView.setVisibility(8);
                } else if ((DetailsFragment.this.tabsMap.get(((Tabs) DetailsFragment.this.mTabsList.get(DetailsFragment.this.selectedMainMenuTab)).getCode()) != null ? ((List) DetailsFragment.this.tabsMap.get(((Tabs) DetailsFragment.this.mTabsList.get(DetailsFragment.this.selectedMainMenuTab)).getCode())).size() : 0) == 0) {
                    DetailsFragment.this.tabLayout.setVisibility(8);
                    DetailsFragment.this.errorLayout.setVisibility(0);
                    DetailsFragment.this.avatarImageView.setVisibility(0);
                } else {
                    DetailsFragment.this.tabLayout.setVisibility(0);
                    DetailsFragment.this.errorLayout.setVisibility(8);
                    DetailsFragment.this.avatarImageView.setVisibility(8);
                }
                if (DetailsFragment.this.mPagerAdapter != null) {
                    DetailsFragment.this.mPagerAdapter.notifyDataSetChanged();
                }
            }

            public void onTabUnselected(TabLayout.Tab tab) {
                ViewGroup viewGroup2 = (ViewGroup) this.vg.getChildAt(tab.getPosition());
                this.vg.getChildAt(tab.getPosition()).setBackgroundResource(0);
                int childCount = viewGroup2.getChildCount();
                for (int i3 = 0; i3 < childCount; i3++) {
                    View childAt = viewGroup2.getChildAt(i3);
                    if (childAt instanceof TextView) {
                        ((TextView) childAt).setTextColor(DetailsFragment.this.getActivity().getResources().getColor(R.color.dimgray));
                    }
                }
            }
        });
        this.recordButton.setOnClickListener(new AnonymousClass5());
        this.details_extra_buttons_divider1 = this.detailView.findViewById(R.id.details_extra_buttons_divider1);
        this.share_layout = (LinearLayout) this.detailView.findViewById(R.id.share_layout);
        ImageView imageView = (ImageView) this.detailView.findViewById(R.id.details_share_btn);
        this.details_share_btn = imageView;
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                String str;
                if (DetailsFragment.this.shareInfo != null) {
                    Configs utilAppConfigurations = APIUtils.getUtilAppConfigurations(DetailsFragment.this.context.getApplicationContext());
                    str = "";
                    String siteURL = (utilAppConfigurations == null || utilAppConfigurations.getSiteURL() == null) ? "" : utilAppConfigurations.getSiteURL();
                    FragmentActivity activity = DetailsFragment.this.getActivity();
                    StringBuilder sb = new StringBuilder();
                    sb.append(DetailsFragment.this.shareInfo.getDescription());
                    sb.append(" ");
                    if (siteURL.length() > 1) {
                        StringBuilder a = com.yupptv.ott.a.a(siteURL);
                        a.append(siteURL.endsWith("/") ? "" : "/");
                        a.append(DetailsFragment.this.contentPage.getPageInfo().getPath());
                        str = a.toString();
                    }
                    sb.append(str);
                    UiUtils.prepareShareIntent(activity, null, sb.toString());
                }
            }
        });
        this.details_extra_buttons_divider = this.detailView.findViewById(R.id.details_extra_buttons_divider);
        this.details_watch_list_layout = (LinearLayout) this.detailView.findViewById(R.id.details_watch_list_layout);
        this.watchlistTextTv = (TextView) this.detailView.findViewById(R.id.watchlistText_tv);
        this.details_add_watch_list_btn = (ImageView) this.detailView.findViewById(R.id.details_add_watch_list_btn);
        this.details_watch_list_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                DetailsFragment.this.showSigninSignupPopup("AddToWatchList", null);
                DetailsFragment.this.updateWatchList();
            }
        });
        this.details_start_over_layout = (LinearLayout) this.detailView.findViewById(R.id.details_start_over_layout);
        ImageView imageView2 = (ImageView) this.detailView.findViewById(R.id.details_start_over_icon);
        this.start_over_icon = imageView2;
        imageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                DetailsFragment.this.getActivity().setButtonType(ButtonType.START_OVER);
                if (view2 == null || view2.getTag() == null || DetailsFragment.this.context == null) {
                    return;
                }
                NavigationUtils.launchNavigationFragment(view2.getTag().toString(), DetailsFragment.this.context);
            }
        });
        return this.detailView;
    }

    public void onDestroy() {
        super.onDestroy();
        Handler handler = this.handler;
        if (handler != null) {
            handler.removeCallbacks(this.transactionAction);
        }
    }

    public void onDestroyView() {
        super.onDestroyView();
        FragmentHost fragmentHost = this.fragmentHost;
        if (fragmentHost != null) {
            fragmentHost.expandToolBar(false);
        }
        hideRecordButton();
        this.recycledViewPool.clear();
        getActivity().updateToolBarTheme(1, true);
        FusionViliteMainActivity fusionViliteMainActivity = this.context;
        if (fusionViliteMainActivity instanceof FusionViliteMainActivity) {
            fusionViliteMainActivity.isDetailsFragment = false;
        }
    }

    @Override
    public void onHeaderClicked(Object obj, int i2) {
        trackEvents(obj, this.mTitle + AnalyticsUtils.EVENT_PAGE_NETWORK_POSTFIX);
        NavigationUtils.performHeaderNavigation("", getActivity(), PageType.Details, obj);
        FragmentHost fragmentHost = this.fragmentHost;
        if (fragmentHost != null) {
            fragmentHost.expandToolBar(false);
        }
    }

    @Override
    public void onItemClicked(String str, Object obj, int i2) {
        String str2;
        FusionViliteMainActivity activity = getActivity();
        if (activity.isClicked()) {
            return;
        }
        activity.setClicked(true);
        activity.clickHandler.postDelayed(activity.isClickedRunnable, 1000L);
        if (obj instanceof Card) {
            MyRecoManager.getInstance().setTAB_NAME("details");
            eventCTCarouselClicked(obj, "");
        }
        String str3 = this.mContentType;
        if (str3 != null && str3.equalsIgnoreCase(LogSubCategory.ApiCall.NETWORK) && (str2 = this.mTitle) != null && str2.trim().length() > 0) {
            trackEvents(obj, this.mTitle + AnalyticsUtils.EVENT_PAGE_NETWORK_POSTFIX);
        }
        NavigationUtils.performItemClickNavigation(this, getActivity(), obj, AnalyticsUtils.ATTRIBUTE_VALUE_SOURCE_NETWORK_PAGE, "");
    }

    public void onResume() {
        super.onResume();
        if (getActivity() != null && getActivity() != null) {
            getActivity().updateToolBar(false, "", false);
        }
        setDetailsHeadData();
    }

    public void setSavedSourceDetails(String str) {
        this.savedSourceDetails = str;
    }

    public void setSavedSubSourceDetails(String str) {
        this.savedSubSourceDetails = str;
    }

    @Override
    public void showContentLayout(boolean z) {
        showErrorView(!z);
        RecyclerView recyclerView = this.verticalRecyclerView;
        if (recyclerView != null) {
            recyclerView.setVisibility(z ? 0 : 8);
        }
    }

    public void showRecordButton(boolean z) {
        this.recordButton.setVisibility(0);
        if (z) {
            this.recordButton.setText(getResources().getString(R.string.rec));
            this.recordButton.setBackgroundColor(getResources().getColor(R.color.badge_bg_color));
        } else {
            this.recordButton.setText(getResources().getString(R.string.stoprec));
            this.recordButton.setBackgroundColor(getResources().getColor(R.color.greyish));
        }
        this.recordButton.setVisibility(0);
    }

    public void updateDataWithRecordState() {
        getActivity().doSectionsRefresh = true;
        getActivity().doEPGCacheRefresh = true;
        getActivity().doListRefresh = true;
        RestAdapter.enableCache(false);
        getNextPageResponse();
    }

    private void trackEvents(String str, ScreenType screenType, String str2) {
        try {
            HashMap hashMap = new HashMap();
            if (str2 != null && str2.trim().length() > 1) {
                hashMap.put(AnalyticsUtils.ATTRIBUTE_EPISODE_NAME, str2);
            }
            CustomLog.e(this.TAG, "#ATTRIBUTE_EPISODE_NAME : " + str2);
            AnalyticsUtils.getInstance().trackAnalyticsEvent(screenType, null, null, null, str, this.screenSource, hashMap);
        } catch (NullPointerException unused) {
        }
    }

    public void trackEvents(String str, String str2, ScreenType screenType) {
        try {
            HashMap hashMap = new HashMap();
            hashMap.put(AnalyticsUtils.ATTRIBUTE_DETAILS_CONTROLS, str2);
            CustomLog.e(this.TAG, "#ATTRIBUTE_DETAILS_CONTROLS : " + str2);
            AnalyticsUtils.getInstance().trackAnalyticsEvent(screenType, null, null, null, str, this.screenSource, hashMap);
        } catch (NullPointerException unused) {
        }
    }
}