导航菜单

页面标题

页面副标题

Mint v5.7.3 - CommoditiesDetailFragment.java 源代码

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

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


package com.htmedia.mint.ui.fragments;

import android.R;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import com.htmedia.mint.marketwidget.MarketNewsWidget;
import com.htmedia.mint.pojo.CommoditiesPojo;
import com.htmedia.mint.pojo.CommoditiesTable;
import com.htmedia.mint.utils.q;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.ArrayList;
import java.util.HashMap;
import org.json.JSONObject;
import x4.qe;

public class CommoditiesDetailFragment extends Fragment implements k6.u0 {
    private qe binding;
    private com.htmedia.mint.utils.r1 marketHelperClass;
    private String origin;
    private String productName;

    private void setNewsData(qe qeVar) {
        new MarketNewsWidget(qeVar.i, getActivity(), getContext(), 4, (String) null, this.productName).init();
    }

    public void getCommodityDetail(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        String str2 = "https://www.livemint.com/api/cms/commodity/getcommodity/" + str;
        com.htmedia.mint.utils.n.b0(getActivity(), "/" + str2, "market_commodity_detail_page", str, this.origin);
        new k6.x0(getActivity(), this).a(0, str2, str2, null, null, false, true);
    }

    @Override
    public void getResponse(JSONObject jSONObject, String str) {
        if (jSONObject != null) {
            CommoditiesPojo commoditiesPojo = (CommoditiesPojo) this.marketHelperClass.r(q.o.COMMODITIES, jSONObject, BuildConfig.FLAVOR);
            final HashMap hashMap = new HashMap();
            for (int i = 0; i < commoditiesPojo.getTable().size(); i++) {
                hashMap.put(commoditiesPojo.getTable().get(i).getExpiry(), commoditiesPojo.getTable().get(i));
            }
            ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity().getApplicationContext(), R.layout.simple_spinner_dropdown_item, new ArrayList(hashMap.keySet())) {
                @Override
                @NonNull
                public View getView(int i2, @Nullable View view, @NonNull ViewGroup viewGroup) {
                    View inflate = LayoutInflater.from(CommoditiesDetailFragment.this.getActivity()).inflate(R.layout.simple_spinner_dropdown_item, (ViewGroup) null);
                    TextView textView = (TextView) inflate.findViewById(R.id.text1);
                    textView.setTypeface(ResourcesCompat.getFont(CommoditiesDetailFragment.this.getActivity(), 2131296270));
                    if (com.htmedia.mint.utils.f0.Z1()) {
                        textView.setTextColor(ContextCompat.getColor(CommoditiesDetailFragment.this.getActivity(), 2131100599));
                    } else {
                        textView.setTextColor(ContextCompat.getColor(CommoditiesDetailFragment.this.getActivity(), 2131100598));
                    }
                    return super.getView(i2, inflate, viewGroup);
                }
            };
            arrayAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
            this.binding.j.setAdapter(arrayAdapter);
            this.binding.j.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> adapterView, View view, int i2, long j) {
                    CommoditiesDetailFragment commoditiesDetailFragment = CommoditiesDetailFragment.this;
                    commoditiesDetailFragment.setCommoditiesData((CommoditiesTable) hashMap.get(commoditiesDetailFragment.binding.j.getSelectedItem()));
                }

                @Override
                public void onNothingSelected(AdapterView<?> adapterView) {
                }
            });
            if (com.htmedia.mint.utils.f0.Z1()) {
                this.binding.j.setBackgroundDrawable(ContextCompat.getDrawable(getActivity(), 2131233992));
            } else {
                this.binding.j.setBackgroundDrawable(ContextCompat.getDrawable(getActivity(), 2131234003));
            }
            setNewsData(this.binding);
        }
    }

    @Nullable
    public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
        super.onCreateView(layoutInflater, viewGroup, bundle);
        qe inflate = DataBindingUtil.inflate(layoutInflater, 2131624290, (ViewGroup) null, false);
        this.binding = inflate;
        inflate.d(Boolean.valueOf(com.htmedia.mint.utils.f0.Z1()));
        return this.binding.getRoot();
    }

    @Override
    public void onError(String str) {
    }

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

    public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.marketHelperClass = new com.htmedia.mint.utils.r1();
        this.productName = getArguments().getString("COMMODITY_PRODUCT_NAME", BuildConfig.FLAVOR);
        this.origin = getArguments().getString(com.htmedia.mint.utils.n.X, BuildConfig.FLAVOR);
        getCommodityDetail(this.productName);
    }

    public void setCommoditiesData(CommoditiesTable commoditiesTable) {
        this.binding.c(commoditiesTable);
    }
}