正在查看: Mint v5.7.3 应用的 NudgeBottomSheet.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mint v5.7.3 应用的 NudgeBottomSheet.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.htmedia.mint.ui.fragments.nudge;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.viewpager2.widget.ViewPager2;
import com.htmedia.mint.AppController;
import com.htmedia.mint.htsubscription.planpagerewamp.ui.customviews.CustomPagerIndicator;
import com.htmedia.mint.pojo.config.nudge.PriorityActiveNudge;
import com.htmedia.mint.razorpay.JWTTokenBuilder;
import com.htmedia.mint.ui.activity.SubscriptionOffersActivity;
import com.htmedia.mint.utils.f0;
import com.htmedia.mint.utils.n;
import java.util.ArrayList;
import java.util.HashMap;
import k6.u0;
import k6.x0;
import org.json.JSONObject;
import q7.y4;
import x4.mi0;
public class NudgeBottomSheet extends AppCompatActivity {
private mi0 nudgeLayoutBinding;
private View[] viewArray;
private String ctaBgColor = "#F99D1C";
PriorityActiveNudge activeNudge = null;
private void addTabWithViewPager() {
this.nudgeLayoutBinding.c.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
public void onPageSelected(int i) {
super.onPageSelected(i);
?? r0 = NudgeBottomSheet.this;
CustomPagerIndicator.setCustomIndicatorForNudge((Activity) r0, r0.activeNudge.getData().getImages().size(), i, NudgeBottomSheet.this.viewArray, Color.parseColor(NudgeBottomSheet.this.ctaBgColor));
}
});
}
private void createCustomIndicator() {
PriorityActiveNudge priorityActiveNudge = this.activeNudge;
if (priorityActiveNudge == null || priorityActiveNudge.getData() == null || this.activeNudge.getData().getImages() == null || this.activeNudge.getData().getImages().size() <= 0 || this.viewArray != null) {
return;
}
int size = this.activeNudge.getData().getImages().size();
this.viewArray = new View[size];
for (int i = 0; i < size; i++) {
View inflate = ((LayoutInflater) getSystemService("layout_inflater")).inflate(2131624470, (ViewGroup) null);
this.viewArray[i] = inflate.findViewById(2131429061);
this.nudgeLayoutBinding.b.addView(inflate);
}
CustomPagerIndicator.setCustomIndicatorForNudge(this, this.activeNudge.getData().getImages().size(), 0, this.viewArray, Color.parseColor(this.ctaBgColor));
}
public void checkNightMode() {
setCTAColor(this.ctaBgColor);
if (AppController.j().E()) {
this.nudgeLayoutBinding.d.setBackground(getResources().getDrawable(2131231344));
this.nudgeLayoutBinding.f.setTextColor(-1);
this.nudgeLayoutBinding.a.setColorFilter(ContextCompat.getColor(this, 2131100019));
} else {
this.nudgeLayoutBinding.d.setBackground(getResources().getDrawable(2131231343));
this.nudgeLayoutBinding.f.setTextColor(-16777216);
this.nudgeLayoutBinding.a.setColorFilter(ContextCompat.getColor(this, 2131100021));
}
}
int getHeightBasedOnPercentage(int i) {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return (displayMetrics.heightPixels * i) / 100;
}
void offerAcknowledgement(String str) {
JSONObject jSONObject;
JSONObject jSONObject2;
String G1 = f0.G1(this, "userClient");
String G12 = f0.G1(this, "userEmail");
if (TextUtils.isEmpty(G1)) {
return;
}
String generateToken = JWTTokenBuilder.generateToken(G1 + "~" + G12);
if (AppController.j().g().getSubscription().getB2bOfferCoupons() == null || TextUtils.isEmpty(AppController.j().g().getSubscription().getB2bOfferCoupons().getOfferAck())) {
return;
}
String offerAck = AppController.j().g().getSubscription().getB2bOfferCoupons().getOfferAck();
HashMap hashMap = new HashMap();
hashMap.put("product", "LM");
hashMap.put("OfferAuth", generateToken);
JSONObject jSONObject3 = null;
try {
jSONObject2 = new JSONObject();
} catch (Exception unused) {
}
try {
jSONObject2.put("customerId", G1);
jSONObject2.put("customerEmail", G12);
jSONObject2.put("offerId", str);
jSONObject = jSONObject2;
} catch (Exception unused2) {
jSONObject3 = jSONObject2;
jSONObject = jSONObject3;
new x0(this, new u0() {
@Override
public void getResponse(JSONObject jSONObject4, String str2) {
}
@Override
public void onError(String str2) {
}
}).a(1, offerAck, offerAck, jSONObject, null, false, true);
}
new x0(this, new u0() {
@Override
public void getResponse(JSONObject jSONObject4, String str2) {
}
@Override
public void onError(String str2) {
}
}).a(1, offerAck, offerAck, jSONObject, null, false, true);
}
public void onCreate(Bundle bundle) {
super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
this.nudgeLayoutBinding = DataBindingUtil.setContentView(this, 2131625105);
PriorityActiveNudge priorityActiveNudge = (PriorityActiveNudge) getIntent().getParcelableExtra("activeNudge");
this.activeNudge = priorityActiveNudge;
if (priorityActiveNudge != null && priorityActiveNudge.getData() != null && this.activeNudge.getData().getImages() != null && this.activeNudge.getData().getImages().size() > 0) {
this.nudgeLayoutBinding.f.setText(this.activeNudge.getData().getTitle());
if (AppController.j().E()) {
this.ctaBgColor = TextUtils.isEmpty(this.activeNudge.getCtaDarkBgColor()) ? "#F99D1C" : this.activeNudge.getCtaDarkBgColor();
} else {
this.ctaBgColor = TextUtils.isEmpty(this.activeNudge.getCtaLightBgColor()) ? "#F99D1C" : this.activeNudge.getCtaLightBgColor();
}
if (TextUtils.isEmpty(this.activeNudge.getData().getTemplate()) || !this.activeNudge.getData().getTemplate().contains("Medium")) {
this.nudgeLayoutBinding.e.getLayoutParams().height = getHeightBasedOnPercentage(50);
} else {
this.nudgeLayoutBinding.e.getLayoutParams().height = getHeightBasedOnPercentage(30);
}
this.nudgeLayoutBinding.c.setAdapter(new y4(this, (ArrayList) this.activeNudge.getData().getImages()));
if (this.activeNudge.getData().getImages().size() == 1) {
this.nudgeLayoutBinding.b.setVisibility(8);
} else {
this.nudgeLayoutBinding.b.setVisibility(0);
createCustomIndicator();
addTabWithViewPager();
}
this.nudgeLayoutBinding.g.setText(this.activeNudge.getData().getCtaTitle());
this.nudgeLayoutBinding.g.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (NudgeBottomSheet.this.activeNudge.getType().equals("offer")) {
?? r0 = NudgeBottomSheet.this;
n.v(r0, r0.activeNudge.getData().getFallbackDeeplink(), NudgeBottomSheet.this.activeNudge.getType(), NudgeBottomSheet.this.activeNudge.getData().getCtaTitle(), NudgeBottomSheet.this.activeNudge.getData().getTemplate(), NudgeBottomSheet.this.activeNudge.getData().getTitle());
Intent intent = new Intent((Context) NudgeBottomSheet.this, (Class<?>) SubscriptionOffersActivity.class);
intent.putExtra(n.X, "nudge");
NudgeBottomSheet.this.startActivity(intent);
} else {
try {
?? r1 = NudgeBottomSheet.this;
n.v(r1, r1.activeNudge.getData().getImages().get(NudgeBottomSheet.this.nudgeLayoutBinding.c.getCurrentItem()).getDeeplink(), NudgeBottomSheet.this.activeNudge.getType(), NudgeBottomSheet.this.activeNudge.getData().getCtaTitle(), NudgeBottomSheet.this.activeNudge.getData().getTemplate(), NudgeBottomSheet.this.activeNudge.getData().getTitle());
NudgeBottomSheet.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(NudgeBottomSheet.this.activeNudge.getData().getImages().get(NudgeBottomSheet.this.nudgeLayoutBinding.c.getCurrentItem()).getDeeplink())));
} catch (ActivityNotFoundException e) {
Toast.makeText((Context) NudgeBottomSheet.this, (CharSequence) "No application can handle this request", 1).show();
e.printStackTrace();
}
}
NudgeBottomSheet.this.finish();
}
});
}
this.nudgeLayoutBinding.a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (NudgeBottomSheet.this.activeNudge.getType().equals("offer")) {
?? r0 = NudgeBottomSheet.this;
n.v(r0, r0.activeNudge.getData().getFallbackDeeplink(), NudgeBottomSheet.this.activeNudge.getType(), "close", NudgeBottomSheet.this.activeNudge.getData().getTemplate(), NudgeBottomSheet.this.activeNudge.getData().getTitle());
} else {
?? r62 = NudgeBottomSheet.this;
n.v(r62, r62.activeNudge.getData().getImages().get(NudgeBottomSheet.this.nudgeLayoutBinding.c.getCurrentItem()).getDeeplink(), NudgeBottomSheet.this.activeNudge.getType(), "close", NudgeBottomSheet.this.activeNudge.getData().getTemplate(), NudgeBottomSheet.this.activeNudge.getData().getTitle());
}
NudgeBottomSheet.this.finish();
}
});
if (this.activeNudge.getType().equals("offer")) {
offerAcknowledgement(this.activeNudge.getId());
}
checkNightMode();
n.w(this, this.activeNudge.getType(), this.activeNudge.getData().getCtaTitle(), this.activeNudge.getData().getTemplate(), this.activeNudge.getData().getTitle());
}
void setCTAColor(String str) {
int parseColor = Color.parseColor(str);
Drawable background = this.nudgeLayoutBinding.g.getBackground();
if (background instanceof ShapeDrawable) {
((ShapeDrawable) background).getPaint().setColor(ContextCompat.getColor(this, parseColor));
} else if (background instanceof GradientDrawable) {
((GradientDrawable) background).setColor(parseColor);
} else if (background instanceof ColorDrawable) {
((ColorDrawable) background).setColor(ContextCompat.getColor(this, parseColor));
}
}
}