导航菜单

页面标题

页面副标题

Mint v5.7.3 - d.java 源代码

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

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


package f8;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.formatter.IndexAxisValueFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.Utils;
import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.htmedia.mint.AppController;
import com.htmedia.mint.pojo.companydetailnew.ChartDataPojo;
import com.htmedia.mint.pojo.companydetailnew.PriceRangePojo;
import com.htmedia.mint.pojo.companydetailnew.Value;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.mintstockwidget.LiveDataResponse;
import com.htmedia.mint.pojo.mintstockwidget.MintStockDataSingleton;
import com.htmedia.mint.pojo.mintstockwidget.MintStockItem;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.ui.fragments.CompaniesDetails;
import com.htmedia.mint.ui.fragments.companydetailfragments.OverViewFragment;
import com.htmedia.mint.utils.f0;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import k7.v;
import k7.x;
import org.json.JSONArray;
import org.json.JSONObject;
import x4.o8;
import y7.w0;

public class d implements k6.q, AdapterView.OnItemSelectedListener {
    Runnable C;
    int E;
    MintStockItem F;
    private final x.a H;
    Activity a;
    Context b;
    o8 h;
    LayoutInflater i;
    k6.p j;
    ViewGroup p;
    String q;
    String r;
    PriceRangePojo u;
    String v;
    String w;
    Config y;
    private w0 z;
    int c = 0;
    int d = 0;
    float e = 0.0f;
    float f = 0.0f;
    ArrayList<Value> g = new ArrayList<>();
    String o = "ChartWidgetNew";
    String[] s = {"1D", "5D", "1M", "6M", "1Y", "5Y"};
    int t = 0;
    String x = BuildConfig.FLAVOR;
    boolean A = false;
    Handler B = new Handler();
    int D = 15000;
    LiveDataResponse G = MintStockDataSingleton.getInstance().getLiveDataResponse();

    class a implements Runnable {
        a() {
        }

        @Override
        public void run() {
            d.this.i();
            d dVar = d.this;
            dVar.B.postDelayed(dVar.C, dVar.D);
        }
    }

    class b extends IndexAxisValueFormatter {
        final ArrayList a;

        b(Collection collection, ArrayList arrayList) {
            super(collection);
            this.a = arrayList;
        }

        public String getFormattedValue(float f) {
            Log.e("getFormattedValue: ", "---->>" + f);
            int i = ((int) f) + (-1);
            if (this.a.size() > i) {
                try {
                    return d.this.g.get(i).getFormattedDate();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return BuildConfig.FLAVOR;
        }
    }

    class c implements OnChartValueSelectedListener {
        c() {
        }

        public void onNothingSelected() {
        }

        public void onValueSelected(Entry entry, Highlight highlight) {
            try {
                d dVar = d.this;
                d.this.h.a.setMarker(new v7.d(dVar.b, 2131625275, BuildConfig.FLAVOR, dVar.h.e.getSelectedTabPosition(), d.this.h.a, null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    class ViewOnTouchListenerC0080d implements View.OnTouchListener {
        ViewOnTouchListenerC0080d() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (d.this.h.a.isFullyZoomedOut()) {
                return false;
            }
            int action = motionEvent.getAction();
            if (action != 0) {
                if (action != 1) {
                    if (action != 2) {
                        if (action != 3) {
                            return false;
                        }
                    }
                }
                CompaniesDetails.companiesRecyclerView.requestDisallowInterceptTouchEvent(true);
                return false;
            }
            CompaniesDetails.companiesRecyclerView.requestDisallowInterceptTouchEvent(true);
            return false;
        }
    }

    class e implements TabLayout.OnTabSelectedListener {
        e() {
        }

        public void onTabReselected(TabLayout.Tab tab) {
        }

        public void onTabSelected(TabLayout.Tab tab) {
            d.this.e(tab, true);
            try {
                d.this.t = tab.getPosition();
                Log.e("onTabSelected: ", "--->" + d.this.t);
                d.this.h();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public void onTabUnselected(TabLayout.Tab tab) {
            d.this.e(tab, false);
        }
    }

    public d(Activity activity, MintStockItem mintStockItem, ViewGroup viewGroup, Context context, String str, String str2, String str3, String str4, int i, x.a aVar) {
        this.r = BuildConfig.FLAVOR;
        this.a = activity;
        this.b = context;
        this.p = viewGroup;
        this.q = str;
        this.r = str2;
        this.v = str3;
        this.w = str4;
        this.E = i;
        this.F = mintStockItem;
        this.H = aVar;
        Log.e("ChartWidgetNew: ", str + " -- " + str2 + " --" + str3 + " --" + str4 + "--" + i);
    }

    private void c(ChartDataPojo chartDataPojo) {
    }

    public void e(TabLayout.Tab tab, boolean z) {
        ((TextView) this.h.e.getTabAt(tab.getPosition()).getCustomView().findViewById(2131430754)).setTextColor(this.b.getResources().getColor(z ? 2131100872 : 2131100625));
    }

    private void g() {
        HomeActivity homeActivity = HomeActivity.G0;
        if (homeActivity != null) {
            if (this.z == null) {
                this.z = (w0) new ViewModelProvider(homeActivity).get(w0.class);
            }
            this.A = this.z.R1(this.q);
        }
    }

    private void l() {
        try {
            Handler handler = this.B;
            a aVar = new a();
            this.C = aVar;
            handler.postDelayed(aVar, this.D);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void m(Boolean bool) {
        if (bool.booleanValue()) {
            this.B.removeCallbacks(this.C);
            OverViewFragment.onPauseFragment.setValue(Boolean.FALSE);
        }
    }

    public void n(View view) {
        this.H.o();
    }

    private void o(ChartDataPojo chartDataPojo) {
        Typeface font;
        String str;
        c(chartDataPojo);
        try {
            font = ResourcesCompat.getFont(this.a, 2131296270);
        } catch (Exception e2) {
            e2.printStackTrace();
            return;
        }
        if (chartDataPojo != null && ((chartDataPojo.getResult() == null || chartDataPojo.getResult().get(0) != null || chartDataPojo.getResult().get(0).getValues() != null) && chartDataPojo.getResult().get(0).getValues().size() > 0)) {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            this.h.a.clear();
            this.g = chartDataPojo.getResult().get(0).getValues();
            int i = 0;
            while (true) {
                str = "hh:mm";
                if (i >= chartDataPojo.getResult().get(0).getValues().size()) {
                    break;
                }
                Value value = chartDataPojo.getResult().get(0).getValues().get(i);
                arrayList.add(new Entry(i + 1.0f, (float) value.getClose(), value));
                try {
                    if (value.getTimeStamp() == null || value.getTimeStamp().equalsIgnoreCase(BuildConfig.FLAVOR)) {
                        arrayList2.add("\n");
                    } else {
                        arrayList2.add(BuildConfig.FLAVOR + f0.F0(value.getTimeStamp(), "yyyy-MM-dd HH:mm:ss", "hh:mm") + "\n");
                    }
                } catch (Exception e3) {
                    e3.printStackTrace();
                    arrayList2.add(BuildConfig.FLAVOR);
                }
                i++;
                e2.printStackTrace();
                return;
            }
            String str2 = this.s[this.t];
            if (!str2.equals("1D")) {
                if (!str2.equals("5D") && !str2.equals("1M")) {
                    if (!str2.equals("6M") && !str2.equals("1Y")) {
                        str = "yyyy";
                    }
                    str = "MMM yy";
                }
                str = "dd MMM";
            }
            for (int i2 = 0; i2 < this.g.size(); i2++) {
                Value value2 = this.g.get(i2);
                try {
                    if (value2.getTimeStamp() == null || value2.getTimeStamp().equalsIgnoreCase(BuildConfig.FLAVOR)) {
                        this.g.get(i2).setFormattedDate(BuildConfig.FLAVOR);
                    } else {
                        this.g.get(i2).setFormattedDate(BuildConfig.FLAVOR + f0.F0(value2.getTimeStamp(), "yyyy-MM-dd HH:mm:ss", str));
                    }
                } catch (Exception e4) {
                    e4.printStackTrace();
                    this.g.get(i2).setFormattedDate(BuildConfig.FLAVOR);
                }
            }
            if (this.h.a.getData() != null && this.h.a.getData().getDataSetCount() > 0) {
                LineDataSet dataSetByIndex = this.h.a.getData().getDataSetByIndex(0);
                dataSetByIndex.setValueTypeface(font);
                dataSetByIndex.setEntries(arrayList);
                this.h.a.getData().notifyDataChanged();
                this.h.a.notifyDataSetChanged();
                return;
            }
            LineDataSet lineDataSet = new LineDataSet(arrayList, "Sample Data");
            lineDataSet.setDrawIcons(false);
            lineDataSet.setColor(Color.parseColor("#7FAF1F"));
            lineDataSet.setLineWidth(1.0f);
            lineDataSet.setHighLightColor(2131099970);
            lineDataSet.disableDashedLine();
            lineDataSet.setDrawCircles(false);
            lineDataSet.setValueTextSize(0.0f);
            lineDataSet.setDrawFilled(true);
            lineDataSet.setFormLineWidth(1.0f);
            lineDataSet.setDrawValues(true);
            lineDataSet.setFormSize(15.0f);
            lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
            lineDataSet.setHighlightEnabled(true);
            if (Utils.getSDKInt() >= 18) {
                lineDataSet.setFillDrawable(ContextCompat.getDrawable(this.b, 2131233447));
            } else {
                lineDataSet.setFillColor(-12303292);
            }
            this.h.a.getXAxis().setAvoidFirstLastClipping(false);
            this.h.a.getXAxis().setDrawGridLines(false);
            this.h.a.getAxisRight().setEnabled(false);
            this.h.a.getAxisLeft().setValueFormatter(new v());
            this.h.a.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
            this.h.a.getAxisLeft().setDrawAxisLine(false);
            this.h.a.getAxisLeft().setDrawAxisLine(false);
            if (AppController.j().E()) {
                this.h.a.getAxisLeft().setTextColor(this.b.getResources().getColor(2131101002));
                this.h.a.getXAxis().setTextColor(this.b.getResources().getColor(2131101002));
            } else {
                this.h.a.getAxisLeft().setTextColor(this.b.getResources().getColor(2131101012));
                this.h.a.getXAxis().setTextColor(this.b.getResources().getColor(2131101012));
            }
            this.h.a.getAxisLeft().setTypeface(font);
            this.h.a.getXAxis().setTypeface(font);
            this.h.a.getXAxis();
            this.h.a.getXAxis().setValueFormatter(new b(arrayList2, arrayList2));
            float dimensionPixelSize = (int) (this.b.getResources().getDimensionPixelSize(2131166332) / this.b.getResources().getDisplayMetrics().scaledDensity);
            this.h.a.getXAxis().setTextSize(dimensionPixelSize);
            this.h.a.getAxisLeft().setTextSize(dimensionPixelSize);
            this.h.a.getXAxis().setGranularityEnabled(true);
            this.h.a.getLegend().setEnabled(true);
            this.h.a.getXAxis().setGranularity(1.0f);
            this.h.a.setExtraOffsets(0.0f, 0.0f, 0.0f, 10.0f);
            this.h.a.getXAxis().setLabelCount(4);
            this.h.a.getLegend().setEnabled(false);
            this.h.a.setOnChartValueSelectedListener(new c());
            this.h.a.setHighlightPerTapEnabled(true);
            this.h.a.setScaleEnabled(false);
            this.h.a.getDescription().setEnabled(false);
            ArrayList arrayList3 = new ArrayList();
            arrayList3.add(lineDataSet);
            this.h.a.setData(new LineData(arrayList3));
            this.h.a.setOnTouchListener(new ViewOnTouchListenerC0080d());
            this.h.a.notifyDataSetChanged();
            return;
        }
        this.h.a.clear();
        this.h.a.setNoDataText("No data available");
        this.h.a.invalidate();
    }

    private void q() {
        try {
            String[] strArr = this.s;
            int length = strArr.length;
            boolean z = true;
            int i = 0;
            while (i < length) {
                String str = strArr[i];
                TabLayout tabLayout = this.h.e;
                tabLayout.addTab(tabLayout.newTab().setCustomView(j(z, str)));
                i++;
                z = false;
            }
            this.h.e.addOnTabSelectedListener(new e());
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    void f(boolean z) {
    }

    @Override
    public void getAboutCompanyData(JSONObject jSONObject, String str) {
        if (str.equals("https://api-mintgenie.livemint.com/api-gateway/fundamental/api/v3/charts")) {
            o((ChartDataPojo) new Gson().fromJson(jSONObject.toString(), ChartDataPojo.class));
            return;
        }
        if (!str.equalsIgnoreCase(this.x)) {
            PriceRangePojo priceRangePojo = (PriceRangePojo) new Gson().fromJson(jSONObject.toString(), PriceRangePojo.class);
            this.u = priceRangePojo;
            priceRangePojo.getNetChange().contains("-");
            return;
        }
        try {
            String obj = jSONObject.get("message").toString();
            Context context = this.b;
            if (obj == null) {
                obj = BuildConfig.FLAVOR;
            }
            Toast.makeText(context, obj, 1).show();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    void h() {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("mintgenie-client", "LM-MOBILE");
        hashMap.put("mContent-Type", "application/json");
        try {
            JSONObject jSONObject = new JSONObject();
            JSONArray jSONArray = new JSONArray();
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("days", this.s[this.t]);
            jSONObject2.put("tickerId", this.q);
            jSONObject2.put("tickerType", this.r);
            jSONArray.put(jSONObject2);
            jSONObject.put("stockFilters", jSONArray);
            this.j.k(1, "https://api-mintgenie.livemint.com/api-gateway/fundamental/api/v3/charts", "https://api-mintgenie.livemint.com/api-gateway/fundamental/api/v3/charts", jSONObject, hashMap, false, false);
        } catch (Exception unused) {
        }
    }

    void i() {
        String str = "https://api-mintgenie.livemint.com/api-gateway/fundamental/markets-data/live-price/v2?tickerId=" + this.q + "&exchangeCode=" + this.r + "&=";
        this.j.k(0, str, str, null, null, false, false);
    }

    public View j(boolean z, String str) {
        View inflate = LayoutInflater.from(this.b).inflate(2131624205, (ViewGroup) null);
        TextView textView = (TextView) inflate.findViewById(2131430754);
        textView.setText(BuildConfig.FLAVOR + str);
        textView.setTextColor(this.b.getResources().getColor(z ? 2131100872 : 2131100625));
        return inflate;
    }

    public void k() {
        ArrayAdapter arrayAdapter;
        this.p.removeAllViews();
        this.y = f0.r0();
        this.i = LayoutInflater.from(this.b);
        l();
        o8 inflate = DataBindingUtil.inflate(this.i, 2131624127, (ViewGroup) null, false);
        this.h = inflate;
        inflate.c(f0.Z1());
        this.j = new k6.p(this.a, this, this.o);
        if (AppController.j().E()) {
            this.h.c(true);
            this.h.d.setBackgroundTintList(ContextCompat.getColorStateList(this.a, 2131101002));
            arrayAdapter = new ArrayAdapter(this.b, 2131625224, this.s);
        } else {
            this.h.c(false);
            this.h.d.setBackgroundTintList(ContextCompat.getColorStateList(this.a, 2131099901));
            arrayAdapter = new ArrayAdapter(this.b, 2131625223, this.s);
        }
        arrayAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
        this.h.d.setAdapter((SpinnerAdapter) arrayAdapter);
        this.h.d.setOnItemSelectedListener(this);
        q();
        f(this.r.equalsIgnoreCase("BSE"));
        h();
        i();
        this.p.addView(this.h.getRoot());
        g();
        OverViewFragment.onPauseFragment.observe(this.a, new Observer() {
            public final void onChanged(Object obj) {
                d.this.m((Boolean) obj);
            }
        });
        this.h.c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                d.this.n(view);
            }
        });
    }

    @Override
    public void onError(String str, String str2) {
        if (str2 == null || !str2.equalsIgnoreCase(this.x)) {
            return;
        }
        Toast.makeText(this.b, "Stock is already added in Watchlist", 1).show();
    }

    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
        try {
            Log.e("onItemSelected: ", "--->" + i);
            p(this.E, "mini stock widget", this.s[i], "overview");
            this.t = i;
            h();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void onNothingSelected(AdapterView<?> adapterView) {
    }

    public void p(int i, String str, String str2, String str3) {
        Bundle bundle = new Bundle();
        bundle.putString("widget_position", BuildConfig.FLAVOR + i);
        com.htmedia.mint.utils.n.L(this.a, com.htmedia.mint.utils.n.Z1, com.htmedia.mint.utils.n.n0, null, BuildConfig.FLAVOR, bundle, str, str2, str3);
    }
}