导航菜单

页面标题

页面副标题

Mint v5.7.3 - CompanyDetailsNew.java 源代码

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

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


package com.htmedia.mint.ui.fragments;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.htmedia.mint.AppController;
import com.htmedia.mint.pojo.Table;
import com.htmedia.mint.pojo.companies.financials.mintgeine.FinancialsMintGeinePojo;
import com.htmedia.mint.pojo.companydetailnew.AboutCompanyPojo;
import com.htmedia.mint.pojo.companydetailnew.KeyMetricsPojo;
import com.htmedia.mint.pojo.companydetailnew.MarketVolumePojo;
import com.htmedia.mint.pojo.companydetailnew.PriceRangePojo;
import com.htmedia.mint.pojo.companydetailnew.RecosPojo;
import com.taboola.android.global_components.eventsmanager.TBLEventType;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
import x4.we;

public class CompanyDetailsNew extends Fragment implements k6.q {
    String TAG;
    String TAG_PROFILE;
    we binding;
    private q7.q companyDetailTabLayoutAdapter;
    k6.p companyGenericPresenter;
    private Context context;
    String origin;
    private String companyCode = BuildConfig.FLAVOR;
    private String companyName = BuildConfig.FLAVOR;
    private String comapnyExchangeCode = BuildConfig.FLAVOR;
    String exchangeType = BuildConfig.FLAVOR;
    boolean openNews = false;
    TabLayout.OnTabSelectedListener onTabSelectedListener = new TabLayout.OnTabSelectedListener() {
        public void onTabReselected(TabLayout.Tab tab) {
        }

        public void onTabSelected(TabLayout.Tab tab) {
            CompanyDetailsNew.this.binding.j.setCurrentItem(tab.getPosition());
        }

        public void onTabUnselected(TabLayout.Tab tab) {
        }
    };

    private void setTabData() {
        TabLayout tabLayout = this.binding.f;
        tabLayout.addTab(tabLayout.newTab().setText("Overview"));
        TabLayout tabLayout2 = this.binding.f;
        tabLayout2.addTab(tabLayout2.newTab().setText("Analysis"));
        TabLayout tabLayout3 = this.binding.f;
        tabLayout3.addTab(tabLayout3.newTab().setText("Technical Trend"));
        TabLayout tabLayout4 = this.binding.f;
        tabLayout4.addTab(tabLayout4.newTab().setText("Stock Health"));
        TabLayout tabLayout5 = this.binding.f;
        tabLayout5.addTab(tabLayout5.newTab().setText("News"));
        TabLayout tabLayout6 = this.binding.f;
        tabLayout6.addTab(tabLayout6.newTab().setText("Forecast"));
        TabLayout tabLayout7 = this.binding.f;
        tabLayout7.addTab(tabLayout7.newTab().setText("Financials"));
        TabLayout tabLayout8 = this.binding.f;
        tabLayout8.addTab(tabLayout8.newTab().setText("Technical"));
        TabLayout tabLayout9 = this.binding.f;
        tabLayout9.addTab(tabLayout9.newTab().setText("Peers"));
        TabLayout tabLayout10 = this.binding.f;
        tabLayout10.addTab(tabLayout10.newTab().setText("Shareholdings"));
        TabLayout tabLayout11 = this.binding.f;
        tabLayout11.addTab(tabLayout11.newTab().setText("About Company"));
        boolean z = false;
        if (!AppController.g0) {
            Toast.makeText(this.context, "Scroll to see Stock health", 0).show();
            AppController.g0 = true;
        }
        if (getArguments() != null && getArguments().getBoolean("GO_TO_MARKET_VISIBLE_KEY")) {
            z = getArguments().getBoolean("GO_TO_MARKET_VISIBLE_KEY");
        }
        boolean z2 = z;
        if (isAdded()) {
            q7.q qVar = new q7.q(getActivity(), getChildFragmentManager(), this.binding.f.getTabCount(), this.companyCode, this.companyName, this.exchangeType, this.openNews, z2);
            this.companyDetailTabLayoutAdapter = qVar;
            qVar.a(this.comapnyExchangeCode);
            we weVar = this.binding;
            weVar.j.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(weVar.f));
            this.binding.f.addOnTabSelectedListener(this.onTabSelectedListener);
            TabLayout.OnTabSelectedListener onTabSelectedListener = this.onTabSelectedListener;
            TabLayout tabLayout12 = this.binding.f;
            onTabSelectedListener.onTabSelected(tabLayout12.getTabAt(tabLayout12.getSelectedTabPosition()));
            if (this.openNews) {
                this.binding.j.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        CompanyDetailsNew.this.binding.j.setCurrentItem(4);
                    }
                }, 2000L);
            }
        }
    }

    @Override
    public void getAboutCompanyData(JSONObject jSONObject, String str) {
        if (str.equals(this.TAG)) {
            this.companyDetailTabLayoutAdapter.c((KeyMetricsPojo) new Gson().fromJson(jSONObject.toString(), KeyMetricsPojo.class));
            if (this.binding.j.getAdapter() != null) {
                this.companyDetailTabLayoutAdapter.notifyDataSetChanged();
                return;
            } else {
                this.binding.j.setAdapter(this.companyDetailTabLayoutAdapter);
                return;
            }
        }
        AboutCompanyPojo aboutCompanyPojo = (AboutCompanyPojo) new Gson().fromJson(jSONObject.toString(), AboutCompanyPojo.class);
        String str2 = BuildConfig.FLAVOR;
        String exchangeCodeBse = aboutCompanyPojo != null ? aboutCompanyPojo.getExchangeCodeBse() : BuildConfig.FLAVOR;
        this.comapnyExchangeCode = exchangeCodeBse;
        if (TextUtils.isEmpty(exchangeCodeBse)) {
            if (aboutCompanyPojo != null) {
                str2 = aboutCompanyPojo.getExchangeCodeNse();
            }
            this.comapnyExchangeCode = str2;
        }
        setTabData();
        this.companyDetailTabLayoutAdapter.b(aboutCompanyPojo.getMgIndustry());
        if (this.binding.j.getAdapter() != null) {
            this.companyDetailTabLayoutAdapter.notifyDataSetChanged();
        } else {
            this.binding.j.setAdapter(this.companyDetailTabLayoutAdapter);
        }
    }

    void getKeyMetricsData() {
        String str;
        if (k6.p.h[0] != null && (str = k6.p.r) != null && str.equals(this.companyCode)) {
            this.companyDetailTabLayoutAdapter.c(k6.p.h[0]);
            if (this.binding.j.getAdapter() != null) {
                this.companyDetailTabLayoutAdapter.notifyDataSetChanged();
                return;
            } else {
                this.binding.j.setAdapter(this.companyDetailTabLayoutAdapter);
                return;
            }
        }
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("mintgenie-client", TBLEventType.DEFAULT);
        String str2 = "https://api-mintgenie.livemint.com/api-gateway/fundamental/api/v2/webKeyMetricsRatios/" + this.companyCode;
        this.TAG = str2;
        this.companyGenericPresenter.k(0, str2, str2, null, hashMap, true, false);
    }

    @Override
    public void getPriceRangeResponse(PriceRangePojo priceRangePojo) {
        super.getPriceRangeResponse(priceRangePojo);
    }

    void getProfile() {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("mintgenie-client", TBLEventType.DEFAULT);
        String str = "https://api-mintgenie.livemint.com/api-gateway/fundamental/api/v2/companyProfile/" + this.companyCode;
        this.TAG_PROFILE = str;
        this.companyGenericPresenter.k(0, str, str, null, hashMap, true, false);
    }

    public void onActivityCreated(@Nullable Bundle bundle) {
        super.onActivityCreated(bundle);
        this.context = getActivity();
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        this.binding = DataBindingUtil.inflate(layoutInflater, 2131624293, viewGroup, false);
        k6.p.c();
        if (getArguments() != null) {
            if (getArguments().containsKey("indexCode")) {
                this.companyCode = getArguments().getString("indexCode");
            }
            if (getArguments().containsKey("companyName")) {
                this.companyName = getArguments().getString("companyName");
            }
            if (getArguments().containsKey("openNews")) {
                this.openNews = getArguments().getBoolean("openNews");
            }
            if (getArguments().containsKey("isBSE")) {
                if (getArguments().getBoolean("isBSE")) {
                    this.exchangeType = "BSE";
                } else {
                    this.exchangeType = "NSI";
                }
            }
            if (getArguments().containsKey("origin")) {
                this.origin = getArguments().getString("origin");
            } else {
                this.origin = "marketdashboard";
            }
            if (getArguments() == null || !getArguments().containsKey("GO_TO_MARKET_VISIBLE_KEY")) {
                com.htmedia.mint.utils.n.b0(getActivity(), "market-stats/company/" + this.companyName, "market_stocks_detail_page", this.companyName, this.origin);
            } else {
                com.htmedia.mint.utils.n.b0(getActivity(), "market-stats/company/" + this.companyName, "stock_detail", this.companyName, this.origin);
            }
        }
        if (!TextUtils.isEmpty(this.companyCode) && !TextUtils.isEmpty(this.companyName)) {
            Table table = new Table();
            table.setINDEXNAME(this.companyName);
            table.setIndexCode(this.companyCode);
            com.htmedia.mint.utils.f0.k(getContext(), table);
        }
        this.companyGenericPresenter = new k6.p(getActivity(), this, this.TAG);
        getKeyMetricsData();
        getProfile();
        this.binding.c(AppController.j().E());
        return this.binding.getRoot();
    }

    @Override
    public void onError(String str, String str2) {
        com.htmedia.mint.utils.o1.a("Market Issue", str + "....." + str2);
        if (TextUtils.isEmpty(this.TAG_PROFILE) || !this.TAG_PROFILE.equalsIgnoreCase(str2)) {
            return;
        }
        setTabData();
    }

    public void onPrepareOptionsMenu(@NonNull Menu menu) {
        super.onPrepareOptionsMenu(menu);
        if (com.htmedia.mint.utils.f0.G1(getActivity(), "userName") != null) {
            getActivity().g.setVisible(false);
            getActivity().h.setVisible(true);
        } else {
            getActivity().g.setVisible(true);
            getActivity().h.setVisible(false);
        }
    }

    public void onResume() {
        super.onResume();
        if (getActivity() != null) {
            getActivity().f4(false, BuildConfig.FLAVOR);
        }
    }

    @Override
    public void processMergedResponse(KeyMetricsPojo keyMetricsPojo, RecosPojo recosPojo, List list, AboutCompanyPojo aboutCompanyPojo, FinancialsMintGeinePojo financialsMintGeinePojo, PriceRangePojo priceRangePojo, MarketVolumePojo marketVolumePojo) {
        super.processMergedResponse(keyMetricsPojo, recosPojo, list, aboutCompanyPojo, financialsMintGeinePojo, priceRangePojo, marketVolumePojo);
    }
}