正在查看: Mint v5.7.3 应用的 w1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mint v5.7.3 应用的 w1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package d8;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.htmedia.mint.AppController;
import com.htmedia.mint.marketRevamp.marketUtils.MarketUtils;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.IndicesNew;
import com.htmedia.mint.pojo.companydetailnew.PriceRangePojo;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.mywatchlist.MintGenieResponse;
import com.htmedia.mint.ui.activity.HomeActivity;
import com.htmedia.mint.ui.activity.LoginFlowActivity;
import com.htmedia.mint.utils.q;
import com.htmedia.sso.network.ApiClient;
import com.htmedia.sso.network.ApiServices;
import com.taboola.android.global_components.eventsmanager.TBLEventType;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import in.juspay.hypersdk.core.PaymentConstants;
import java.util.HashMap;
import org.json.JSONObject;
import x4.bx;
public class w1 implements k6.q {
private final AppCompatActivity b;
private final Context c;
private final String d;
private final ViewGroup e;
private final LayoutInflater f;
private final IndicesNew g;
private final long h;
private final int i;
private final Content j;
private final int o;
private k6.p q;
private bx r;
private String s;
Config t;
private String u;
String w;
private y7.w0 x;
private final String a = "StockWidget";
private final String p = null;
private String v = BuildConfig.FLAVOR;
boolean y = false;
public w1(AppCompatActivity appCompatActivity, Context context, String str, LayoutInflater layoutInflater, ViewGroup viewGroup, IndicesNew indicesNew, long j, int i, Content content, int i2) {
this.b = appCompatActivity;
this.c = context;
this.d = str;
this.e = viewGroup;
this.f = layoutInflater;
this.g = indicesNew;
this.h = j;
this.i = i;
this.j = content;
this.o = i2;
}
private void g() {
HomeActivity homeActivity = HomeActivity.G0;
if (homeActivity != null) {
if (this.x == null) {
this.x = (y7.w0) new ViewModelProvider(homeActivity).get(y7.w0.class);
}
this.y = this.x.R1(this.u);
this.c.getDrawable(2131232771);
Drawable drawable = com.htmedia.mint.utils.f0.Z1() ? this.c.getDrawable(2131232772) : this.c.getDrawable(2131232771);
if (this.y) {
this.r.a.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null);
this.r.a.setText(this.c.getString(2131951679));
} else {
this.r.a.setText(this.c.getString(2131951676));
this.r.a.setCompoundDrawablesWithIntrinsicBounds(drawable, (Drawable) null, (Drawable) null, (Drawable) null);
}
}
}
public void j(View view) {
AppCompatActivity appCompatActivity = this.b;
com.htmedia.mint.utils.n.N(appCompatActivity, com.htmedia.mint.utils.n.Z1, com.htmedia.mint.utils.n.m0, com.htmedia.mint.utils.n.k(appCompatActivity), this.j, BuildConfig.FLAVOR, "stock_on_story_detail", this.g.getName(), "more_information", String.valueOf(this.o + 1), BuildConfig.FLAVOR, null, null, null, null);
if (TextUtils.isEmpty(this.u) || TextUtils.isEmpty(this.g.getName())) {
return;
}
MarketUtils.INSTANCE.openStockDetails(this.b, BuildConfig.FLAVOR + this.u, this.g.getName(), AppController.j().D(), false, BuildConfig.FLAVOR, Boolean.FALSE);
}
public void k(MintGenieResponse mintGenieResponse) throws Exception {
com.htmedia.mint.utils.f0.W3(this.b, "mintgenieUserID", mintGenieResponse.getUserId());
e(this.w);
}
public void m(PriceRangePojo priceRangePojo, View view) {
String G1 = com.htmedia.mint.utils.f0.G1(this.b, "userToken");
this.w = G1;
if (TextUtils.isEmpty(G1)) {
Intent intent = new Intent((Context) this.b, (Class<?>) LoginFlowActivity.class);
intent.putExtra("origin", "market/market_dashboard");
intent.putExtra("referer", "market/market_dashboard");
intent.putExtra("ssoReason", "stock");
intent.setFlags(603979776);
this.b.startActivityForResult(intent, 102);
return;
}
String str = this.y ? "added" : "removed";
AppCompatActivity appCompatActivity = this.b;
String str2 = com.htmedia.mint.utils.n.F0;
String p = com.htmedia.mint.utils.n.p(appCompatActivity);
String k = com.htmedia.mint.utils.n.k(this.b);
Content content = this.j;
com.htmedia.mint.utils.n.N(appCompatActivity, str2, p, k, content, content.getUrlHeadline(), "add_to_watch_list", priceRangePojo.getDisplayName());
AppCompatActivity appCompatActivity2 = this.b;
com.htmedia.mint.utils.n.N(appCompatActivity2, com.htmedia.mint.utils.n.b1, com.htmedia.mint.utils.n.p(appCompatActivity2), com.htmedia.mint.utils.n.k(this.b), this.j, BuildConfig.FLAVOR, str, priceRangePojo.getDisplayName());
e(this.w);
}
private void o(final PriceRangePojo priceRangePojo) {
if (priceRangePojo != null) {
if (!TextUtils.isEmpty(priceRangePojo.getDisplayName())) {
this.r.t.setText(priceRangePojo.getDisplayName());
}
this.r.s.setText(com.htmedia.mint.utils.f0.H0(priceRangePojo.getPrice()));
this.r.o.setText(com.htmedia.mint.utils.f0.H0(priceRangePojo.getHigh()));
this.r.p.setText(com.htmedia.mint.utils.f0.H0(priceRangePojo.getLow()));
this.r.u.setText(com.htmedia.mint.utils.f0.H0(priceRangePojo.getVolume()));
if (priceRangePojo.getNetChange().contains("-")) {
this.r.r.setText(h(priceRangePojo.getNetChange(), priceRangePojo.getPercentChange()));
this.r.r.setTextColor(this.b.getResources().getColor(2131100766));
} else {
this.r.r.setText(h(priceRangePojo.getNetChange(), priceRangePojo.getPercentChange()));
this.r.r.setTextColor(this.b.getResources().getColor(2131100223));
}
String F0 = com.htmedia.mint.utils.f0.F0(priceRangePojo.getTime(), "HH:mm:ss", "HH:mm aa");
try {
this.r.j.setText("Updated -" + priceRangePojo.getDate() + " " + F0);
} catch (Exception e) {
e.printStackTrace();
}
Config config = this.t;
if (config == null || config.getMywatchlist() == null || !this.t.getMywatchlist().isEnableWatchistAndroid()) {
this.r.a.setVisibility(8);
} else {
this.r.a.setVisibility(0);
}
this.r.a.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
w1.this.m(priceRangePojo, view);
}
});
g();
}
}
void e(String str) {
String addstock;
Config r0 = com.htmedia.mint.utils.f0.r0();
String G1 = com.htmedia.mint.utils.f0.G1(this.b, "mintgenieUserID");
this.c.getDrawable(2131232771);
Drawable drawable = com.htmedia.mint.utils.f0.Z1() ? this.c.getDrawable(2131232772) : this.c.getDrawable(2131232771);
if (r0 == null || r0.getMywatchlist() == null || TextUtils.isEmpty(r0.getMywatchlist().getAddstock()) || TextUtils.isEmpty(G1)) {
if (TextUtils.isEmpty(G1)) {
f();
return;
}
return;
}
if (this.y) {
this.y = false;
this.r.a.setText(this.c.getString(2131951676));
this.r.a.setCompoundDrawablesWithIntrinsicBounds(drawable, (Drawable) null, (Drawable) null, (Drawable) null);
addstock = r0.getMywatchlist().getDeletestock();
} else {
this.y = true;
this.r.a.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null);
this.r.a.setText(this.c.getString(2131951679));
addstock = r0.getMywatchlist().getAddstock();
}
this.v = addstock + "?tickerId=" + this.u + "&userId=" + G1 + "&type=STOCK";
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("Authorization", str);
hashMap.put("Content-Type", "application/json");
k6.p pVar = this.q;
String str2 = this.v;
pVar.k(1, str2, str2, null, hashMap, false, false);
}
public void f() {
String G1 = com.htmedia.mint.utils.f0.G1(this.b, "userName");
String G12 = com.htmedia.mint.utils.f0.G1(this.b, "userClient");
String F1 = com.htmedia.mint.utils.f0.F1(this.b);
String G13 = com.htmedia.mint.utils.f0.G1(this.b, "userPhoneNumber");
if (TextUtils.isEmpty(G12)) {
return;
}
if (TextUtils.isEmpty(G1)) {
G1 = BuildConfig.FLAVOR;
}
if (TextUtils.isEmpty(F1)) {
F1 = BuildConfig.FLAVOR;
}
n(G1, F1, G13, G12);
}
@Override
public void getAboutCompanyData(JSONObject jSONObject, String str) {
if (jSONObject != null) {
if (!str.equalsIgnoreCase(this.v)) {
o((PriceRangePojo) new Gson().fromJson(jSONObject.toString(), PriceRangePojo.class));
return;
}
try {
String obj = jSONObject.get("message").toString();
AppCompatActivity appCompatActivity = this.b;
if (obj == null) {
obj = BuildConfig.FLAVOR;
}
Toast.makeText((Context) appCompatActivity, (CharSequence) obj, 1).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public String h(String str, String str2) {
String str3 = "+";
if (str != null) {
try {
StringBuilder sb2 = new StringBuilder();
sb2.append(Float.parseFloat(str) > 0.0f ? "+" : BuildConfig.FLAVOR);
sb2.append(String.format("%.2f", Float.valueOf(Float.parseFloat(str))));
str = sb2.toString();
} catch (Exception e) {
e.printStackTrace();
return BuildConfig.FLAVOR;
}
}
if (str2 != null && !str2.trim().equalsIgnoreCase(BuildConfig.FLAVOR)) {
StringBuilder sb3 = new StringBuilder();
if (Float.parseFloat(str2) <= 0.0f) {
str3 = BuildConfig.FLAVOR;
}
sb3.append(str3);
sb3.append(String.format("%.2f", Float.valueOf(Float.parseFloat(str2))));
str2 = sb3.toString();
}
return str + " (" + str2 + "%)";
}
public void i() {
String str;
this.t = AppController.j().g();
this.q = new k6.p(this.b, this, "StockWidget");
this.r = DataBindingUtil.inflate(this.f, 2131624572, (ViewGroup) null, false);
IndicesNew indicesNew = this.g;
if (indicesNew != null && !TextUtils.isEmpty(indicesNew.getCode())) {
String code = this.g.getCode();
this.u = code;
if (k6.p.p[0] == null || (str = k6.p.r) == null || !str.equals(code)) {
String str2 = "https://api-mintgenie.livemint.com/api-gateway/fundamental/markets-data/live-price/v2?tickerId=" + this.g.getCode() + "&exchangeCode=" + this.g.getMarketName();
this.s = str2;
this.q.d(str2);
} else {
o(k6.p.p[0]);
}
this.r.h.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
w1.this.j(view);
}
});
this.r.c(AppController.j().E());
this.r.getRoot().setTag(q.e0.MARKET_TYPE.a());
}
this.e.addView(this.r.getRoot());
}
public void n(String str, String str2, String str3, String str4) {
String saveuser = this.t.getMywatchlist().getSaveuser();
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("email", str2);
jsonObject.addProperty("mobileNo", str3);
jsonObject.addProperty("cellNumber", BuildConfig.FLAVOR);
jsonObject.addProperty("name", str);
jsonObject.addProperty("token", this.w);
jsonObject.addProperty(PaymentConstants.CLIENT_ID_CAMEL, str4);
jsonObject.addProperty("registrationPlatform", TBLEventType.DEFAULT);
HashMap hashMap = new HashMap();
hashMap.put("Mintgenie-client", "LM-MOBILE");
((ApiServices) ApiClient.getClient().create(ApiServices.class)).saveUserOnMintGenie(saveuser, hashMap, jsonObject).g(sg.a.b()).d(ag.a.a()).e(new dg.e() {
public final void accept(Object obj) {
w1.this.k((MintGenieResponse) obj);
}
}, new dg.e() {
public final void accept(Object obj) {
((Throwable) obj).printStackTrace();
}
});
}
@Override
public void onError(String str, String str2) {
if (str2 == null || !str2.equalsIgnoreCase(this.v)) {
return;
}
Toast.makeText((Context) this.b, (CharSequence) "Stock is already added in Watchlist", 1).show();
}
}