正在查看: Mint v5.7.3 应用的 s.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mint v5.7.3 应用的 s.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package f8;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.IndexAxisValueFormatter;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.MPPointF;
import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.htmedia.mint.AppController;
import com.htmedia.mint.pojo.ShareHoldingCategory;
import com.htmedia.mint.pojo.ShareHoldingPieChartData;
import com.htmedia.mint.pojo.ShareHoldingTrendData;
import com.htmedia.mint.pojo.ShareHoldingTrendPojo;
import com.htmedia.mint.pojo.ShareholdingPieChartPojo;
import com.htmedia.mint.utils.f0;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
import x4.mu0;
public class s implements k6.q {
private final Activity b;
private final Context c;
private final ViewGroup d;
private final String e;
private final String f;
private LayoutInflater g;
private mu0 h;
private k6.p i;
private String j;
private String o;
private ShareHoldingTrendPojo s;
private d t;
private final String a = "shareholding";
float p = 0.02f;
float q = 0.55f;
float r = 0.2f;
class a implements View.OnClickListener {
a() {
}
@Override
public void onClick(View view) {
if (s.this.t != null) {
s.this.t.c();
}
}
}
class b implements TabLayout.OnTabSelectedListener {
b() {
}
public void onTabReselected(TabLayout.Tab tab) {
}
public void onTabSelected(TabLayout.Tab tab) {
if (s.this.s == null || s.this.s.getResult() == null || tab == null || tab.getPosition() >= s.this.s.getResult().size()) {
return;
}
s sVar = s.this;
sVar.j(sVar.h.a, s.this.s.getResult().get(tab.getPosition()).getCategoryName(), tab.getPosition());
com.htmedia.mint.utils.n.M(s.this.b, com.htmedia.mint.utils.n.J2, "market_stocks_detail_page", null, "market_dashboard/stock/Shareholding", s.this.s.getResult().get(tab.getPosition()).getCategoryName());
}
public void onTabUnselected(TabLayout.Tab tab) {
}
}
class c implements OnChartValueSelectedListener {
c() {
}
public void onNothingSelected() {
}
public void onValueSelected(Entry entry, Highlight highlight) {
s.this.h.b.setMarker(new v7.d(s.this.b, 2131625275, BuildConfig.FLAVOR, 0, null, s.this.h.b));
}
}
public interface d {
void c();
}
public s(Activity activity, ViewGroup viewGroup, Context context, String str, String str2) {
this.b = activity;
this.c = context;
this.d = viewGroup;
this.e = str;
this.f = str2;
}
private ArrayList<String> f(int i) {
List<ShareHoldingCategory> categories;
ArrayList<String> arrayList = new ArrayList<>();
ShareHoldingTrendPojo shareHoldingTrendPojo = this.s;
if (shareHoldingTrendPojo != null && !shareHoldingTrendPojo.getResult().isEmpty() && i < this.s.getResult().size() && (categories = this.s.getResult().get(i).getCategories()) != null && !categories.isEmpty()) {
int size = categories.size();
for (int i2 = 0; i2 < size; i2++) {
arrayList.add(f0.F0(categories.get(i2).getHoldingDate(), "yyyy-mm-dd", "ddMMMyy"));
}
}
return arrayList;
}
public void j(BarChart barChart, String str, int i) {
ArrayList arrayList = new ArrayList();
ShareHoldingTrendPojo shareHoldingTrendPojo = this.s;
if (shareHoldingTrendPojo == null || shareHoldingTrendPojo.getResult().isEmpty()) {
return;
}
List<ShareHoldingCategory> categories = this.s.getResult().get(i).getCategories();
for (int i2 = 0; i2 < categories.size(); i2++) {
ShareHoldingCategory shareHoldingCategory = categories.get(i2);
if (shareHoldingCategory != null) {
try {
String percentage = shareHoldingCategory.getPercentage();
if (TextUtils.isEmpty(percentage)) {
percentage = "0";
}
arrayList.add(new BarEntry(i2, Float.parseFloat(percentage)));
} catch (Exception e) {
e.printStackTrace();
}
}
}
int color = ContextCompat.getColor(this.c, 2131099916);
IBarDataSet barDataSet = new BarDataSet(arrayList, str);
barDataSet.setColor(color);
if (f0.Z1()) {
barDataSet.setValueTextColor(-1);
} else {
barDataSet.setValueTextColor(-16777216);
}
BarData barData = new BarData(new IBarDataSet[]{barDataSet});
barChart.setData(barData);
XAxis xAxis = barChart.getXAxis();
barChart.getAxisRight().setEnabled(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
xAxis.setAxisMinimum(barData.getXMin() - 0.5f);
xAxis.setGranularity(1.0f);
xAxis.setGranularityEnabled(true);
xAxis.setCenterAxisLabels(true);
xAxis.setAxisMaximum(barData.getXMax() + 0.25f);
barChart.getDescription().setEnabled(false);
ArrayList<String> f = f(i);
xAxis.setValueFormatter(new IndexAxisValueFormatter(f));
barChart.getBarData().setBarWidth(this.r);
barChart.getLegend().setForm(Legend.LegendForm.CIRCLE);
barChart.getLegend().setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
barChart.getLegend().setTextSize(14.0f);
xAxis.setLabelCount(f.size());
barChart.setFitBars(true);
if (AppController.j().E()) {
barChart.getAxisLeft().setTextColor(ContextCompat.getColor(this.c, 2131100599));
barChart.getXAxis().setTextColor(ContextCompat.getColor(this.c, 2131100599));
barChart.getLegend().setTextColor(ContextCompat.getColor(this.c, 2131100599));
} else {
barChart.getAxisLeft().setTextColor(ContextCompat.getColor(this.c, 2131101012));
barChart.getXAxis().setTextColor(ContextCompat.getColor(this.c, 2131101012));
barChart.getLegend().setTextColor(ContextCompat.getColor(this.c, 2131100353));
}
barChart.setScaleEnabled(false);
barChart.invalidate();
}
private void m() {
n(this.s);
if (AppController.j().E()) {
this.h.e.setTabTextColors(Color.parseColor("#eeeeee"), Color.parseColor("#f99d1c"));
} else {
this.h.e.setTabTextColors(Color.parseColor("#424242"), Color.parseColor("#f99d1c"));
}
this.h.e.addOnTabSelectedListener(new b());
ShareHoldingTrendPojo shareHoldingTrendPojo = this.s;
String categoryName = (shareHoldingTrendPojo == null || shareHoldingTrendPojo.getResult() == null || this.s.getResult().isEmpty()) ? BuildConfig.FLAVOR : this.s.getResult().get(0).getCategoryName();
if (TextUtils.isEmpty(categoryName)) {
categoryName = "Shareholding Trend";
}
j(this.h.a, categoryName, 0);
com.htmedia.mint.utils.n.M(this.b, com.htmedia.mint.utils.n.J2, "market_stocks_detail_page", null, "market_dashboard/stock/Shareholding", categoryName);
}
private void n(ShareHoldingTrendPojo shareHoldingTrendPojo) {
ArrayList<ShareHoldingTrendData> result;
int size;
if (shareHoldingTrendPojo == null || shareHoldingTrendPojo.getResult() == null || shareHoldingTrendPojo.getResult().isEmpty() || (size = (result = shareHoldingTrendPojo.getResult()).size()) <= 0) {
return;
}
for (int i = 0; i < size; i++) {
ShareHoldingTrendData shareHoldingTrendData = result.get(i);
String str = BuildConfig.FLAVOR;
String categoryName = shareHoldingTrendData != null ? result.get(i).getCategoryName() : BuildConfig.FLAVOR;
String[] split = !TextUtils.isEmpty("categoryName") ? result.get(i).getCategoryName().split(" ") : null;
if (split != null && split.length > 0) {
str = split[0];
} else if (!TextUtils.isEmpty(categoryName)) {
str = categoryName;
}
TabLayout tabLayout = this.h.e;
tabLayout.addTab(tabLayout.newTab().setText(str));
}
}
public void g(String str) {
String str2 = "https://api-mintgenie.livemint.com/api-gateway/fundamental/v2/getShareHoldingsDetailByTickerIdAndType?type=PieChartDetails&tickerId=" + str;
this.j = str2;
this.i.n(str2);
}
@Override
public void getAboutCompanyData(JSONObject jSONObject, String str) {
if (jSONObject != null) {
if (!str.equalsIgnoreCase(this.j)) {
if (str.equalsIgnoreCase(this.o)) {
this.s = (ShareHoldingTrendPojo) new Gson().fromJson(jSONObject.toString(), ShareHoldingTrendPojo.class);
m();
return;
}
return;
}
l(((ShareholdingPieChartPojo) new Gson().fromJson(jSONObject.toString(), ShareholdingPieChartPojo.class)).getResult());
this.h.d.setText(this.f + " Shareholdings");
}
}
public void h(String str) {
String str2;
if (k6.p.s[0] != null && (str2 = k6.p.r) != null && str2.equals(str)) {
ShareHoldingTrendPojo shareHoldingTrendPojo = new ShareHoldingTrendPojo();
this.s = shareHoldingTrendPojo;
shareHoldingTrendPojo.setResult(new ArrayList<>(k6.p.s[0]));
m();
return;
}
String str3 = "https://api-mintgenie.livemint.com/api-gateway/fundamental/v2/getShareHoldingsDetailByTickerIdAndType?type=TrendDetails&tickerId=" + str;
this.o = str3;
this.i.o(str3);
}
public void i() {
this.d.removeAllViews();
LayoutInflater from = LayoutInflater.from(this.c);
this.g = from;
this.h = DataBindingUtil.inflate(from, 2131625335, (ViewGroup) null, false);
this.i = new k6.p(this.b, this, "shareholding");
g(this.e);
h(this.e);
this.h.c(Boolean.valueOf(AppController.j().E()));
this.h.h.setOnClickListener(new a());
this.d.addView(this.h.getRoot());
}
public void k(d dVar) {
this.t = dVar;
}
public void l(ArrayList<ShareHoldingPieChartData> arrayList) {
ArrayList arrayList2 = new ArrayList();
HashMap hashMap = new HashMap();
if (arrayList != null) {
try {
if (arrayList.size() > 3) {
ShareHoldingPieChartData shareHoldingPieChartData = arrayList.get(1);
String str = "0";
if (shareHoldingPieChartData != null && !TextUtils.isEmpty(shareHoldingPieChartData.getCategory())) {
String percentage = shareHoldingPieChartData.getPercentage();
if (TextUtils.isEmpty(percentage)) {
percentage = "0";
}
hashMap.put(shareHoldingPieChartData.getCategory(), Float.valueOf(percentage));
}
ShareHoldingPieChartData shareHoldingPieChartData2 = arrayList.get(2);
if (shareHoldingPieChartData2 != null && !TextUtils.isEmpty(shareHoldingPieChartData2.getCategory())) {
String percentage2 = shareHoldingPieChartData2.getPercentage();
if (!TextUtils.isEmpty(percentage2)) {
str = percentage2;
}
hashMap.put(shareHoldingPieChartData.getCategory(), Float.valueOf(str));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (hashMap.isEmpty()) {
return;
}
ArrayList arrayList3 = new ArrayList();
arrayList3.add(Integer.valueOf(Color.parseColor("#1070ca")));
arrayList3.add(Integer.valueOf(Color.parseColor("#e4b106")));
for (String str2 : hashMap.keySet()) {
arrayList2.add(new PieEntry(((Float) hashMap.get(str2)).floatValue(), str2));
}
PieDataSet pieDataSet = new PieDataSet(arrayList2, BuildConfig.FLAVOR);
pieDataSet.setDrawIcons(false);
pieDataSet.setSliceSpace(0.0f);
pieDataSet.setIconsOffset(new MPPointF(0.0f, 0.0f));
pieDataSet.setSelectionShift(5.0f);
pieDataSet.setColors(arrayList3);
pieDataSet.setValueTextSize(0.0f);
pieDataSet.setValueTextColor(-16777216);
PieData pieData = new PieData(pieDataSet);
pieData.setValueFormatter(new PercentFormatter());
this.h.b.setData(pieData);
this.h.b.getDescription().setEnabled(false);
this.h.b.setDrawSlicesUnderHole(false);
this.h.b.setDrawHoleEnabled(true);
this.h.b.setHoleColor(0);
this.h.b.setTransparentCircleRadius(0.0f);
this.h.b.setEntryLabelColor(0);
this.h.b.highlightValues((Highlight[]) null);
this.h.b.setCenterText(BuildConfig.FLAVOR);
this.h.b.setEntryLabelTextSize(0.0f);
this.h.b.getLegend().setTextSize(16.0f);
this.h.b.getLegend().setForm(Legend.LegendForm.CIRCLE);
this.h.b.getLegend().setFormSize(13.0f);
if (f0.Z1()) {
this.h.b.getLegend().setTextColor(Color.parseColor("#eeeeee"));
} else {
this.h.b.getLegend().setTextColor(Color.parseColor("#131313"));
}
this.h.b.getLegend().setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
this.h.b.getLegend().setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
this.h.b.getLegend().setTypeface(ResourcesCompat.getFont(this.c, 2131296286));
this.h.b.getLegend().setOrientation(Legend.LegendOrientation.VERTICAL);
this.h.b.getLegend().setDrawInside(false);
this.h.b.invalidate();
this.h.b.setOnChartValueSelectedListener(new c());
}
@Override
public void onError(String str, String str2) {
}
}