Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23
以下内容为反编译后的 Yodo1MasPrivacyDialogHelper.java 源代码,内容仅作参考
package com.yodo1.mas.helper;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
import com.yodo1.mas.R;
import com.yodo1.mas.Yodo1MasLog;
import com.yodo1.mas.helper.model.Yodo1MasUserPrivacyConfig;
import com.yodo1.mas.ui.seekbar.OnRangeChangedListener;
import com.yodo1.mas.ui.seekbar.RangeSeekBar;
import com.yodo1.mas.utils.RR;
import com.yodo1.mas.utils.Yodo1MasAgePopUtil;
public class Yodo1MasPrivacyDialogHelper {
private static final int DEFAULT_AGE = 0;
private static final String TAG = "PrivacyDialogHelper";
private static Yodo1MasPrivacyDialogHelper instance;
private boolean clickedPrivacy = false;
private boolean clickedTerms = false;
public interface Yodo1MasPrivacyCallback {
void onResult(int i);
}
private Yodo1MasPrivacyDialogHelper() {
}
public static Yodo1MasPrivacyDialogHelper getInstance() {
if (instance == null) {
instance = new Yodo1MasPrivacyDialogHelper();
}
return instance;
}
public void showPrivacyDialog(final Activity activity, int i, final String str, final String str2, final Yodo1MasUserPrivacyConfig yodo1MasUserPrivacyConfig, final Yodo1MasPrivacyCallback yodo1MasPrivacyCallback) {
if (i > 0) {
return;
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Yodo1MasPrivacyDialogHelper.this.showPrivacyDialogDetail(activity, str, str2, yodo1MasUserPrivacyConfig, yodo1MasPrivacyCallback);
}
});
}
public void showPrivacyDialogDetail(final Context context, final String str, final String str2, Yodo1MasUserPrivacyConfig yodo1MasUserPrivacyConfig, final Yodo1MasPrivacyCallback yodo1MasPrivacyCallback) {
int i;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View inflate = LayoutInflater.from(context).inflate(RR.layout(context, "yodo1_mas_games_dialog_usercontent"), (ViewGroup) null);
final TextView textView = (TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_year"));
TextView textView2 = (TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_msg"));
final TextView textView3 = (TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_confirm"));
context.getResources().getColor(R.color.yodo1_mas_lite_blue);
if (yodo1MasUserPrivacyConfig != null) {
TextView textView4 = (TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_title"));
Yodo1MasAgePopUtil.setBackroundColor(textView4, yodo1MasUserPrivacyConfig.getTitleBackgroundColor());
Yodo1MasAgePopUtil.setTextColor(textView4, yodo1MasUserPrivacyConfig.getTitleTextColor());
Yodo1MasAgePopUtil.setBackroundColor(inflate, yodo1MasUserPrivacyConfig.getContentBackgroundColor());
Yodo1MasAgePopUtil.setTextColor(textView, yodo1MasUserPrivacyConfig.getContentTextColor());
Yodo1MasAgePopUtil.setTextColor((TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_year_suffix")), yodo1MasUserPrivacyConfig.getContentTextColor());
Yodo1MasAgePopUtil.setTextColor((TextView) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_prompt")), yodo1MasUserPrivacyConfig.getContentTextColor());
Yodo1MasAgePopUtil.setTextColor(textView2, yodo1MasUserPrivacyConfig.getContentTextColor());
if (yodo1MasUserPrivacyConfig.getButtonBackgroundColor() != 0) {
DrawableCompat.setTint(DrawableCompat.wrap(textView3.getBackground()), yodo1MasUserPrivacyConfig.getButtonBackgroundColor());
}
Yodo1MasAgePopUtil.setTextColor(textView3, yodo1MasUserPrivacyConfig.getButtonTextColor());
}
final AlertDialog create = builder.create();
create.show();
create.getWindow().setContentView(inflate);
create.getWindow().setGravity(17);
create.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
create.setCancelable(false);
textView3.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return Yodo1MasPrivacyDialogHelper.lambda$showPrivacyDialogDetail$0(textView3, view, motionEvent);
}
});
textView3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (textView.getText().toString().equals("0")) {
Context context2 = context;
Toast.makeText(context2, RR.stringTo(context2, "yodo1_mas_string_uc_select_age"), 0).show();
} else {
create.dismiss();
yodo1MasPrivacyCallback.onResult(Integer.parseInt(textView.getText().toString()));
}
}
});
textView.setText(String.valueOf(0));
RangeSeekBar rangeSeekBar = (RangeSeekBar) inflate.findViewById(RR.id(context, "yodo1_mas_dialog_uc_seekbar"));
rangeSeekBar.setProgress(0.0f);
rangeSeekBar.setTickMarkTextColor(ViewCompat.MEASURED_STATE_MASK);
rangeSeekBar.setOnRangeChangedListener(new OnRangeChangedListener() {
@Override
public void onStartTrackingTouch(RangeSeekBar rangeSeekBar2, boolean z) {
}
@Override
public void onStopTrackingTouch(RangeSeekBar rangeSeekBar2, boolean z) {
}
@Override
public void onRangeChanged(RangeSeekBar rangeSeekBar2, float f, float f2, boolean z) {
textView.setText(String.valueOf(Math.round(f)));
}
});
String stringTo = RR.stringTo(context, "yodo1_mas_string_uc_msg");
String trim = RR.stringTo(context, "yodo1_mas_string_protocol_term").trim();
String trim2 = RR.stringTo(context, "yodo1_mas_string_protocol_privacy").trim();
String[] split = stringTo.split(trim);
String str3 = split[0];
String[] split2 = split[1].split(trim2);
String str4 = split2[0];
String str5 = split2.length > 1 ? split2[1] : "";
textView2.setText(str3);
final int color = context.getResources().getColor(R.color.yodo1_mas_privacy_dialog_button_default);
final int color2 = context.getResources().getColor(R.color.yodo1_mas_cashier_color_text);
final String defaultPrivacyLink = getDefaultPrivacyLink(context);
if (TextUtils.isEmpty(str)) {
i = 33;
} else {
SpannableString spannableString = new SpannableString(trim);
i = 33;
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
Yodo1MasPrivacyDialogHelper.this.clickedTerms = true;
Yodo1MasPrivacyDialogHelper.this.goWebView(context, str);
}
@Override
public void updateDrawState(TextPaint textPaint) {
textPaint.setColor(Yodo1MasPrivacyDialogHelper.this.clickedTerms ? color2 : color);
textPaint.setFlags(8);
textPaint.setAntiAlias(true);
}
}, 0, spannableString.length(), 33);
textView2.append(spannableString);
textView2.append(new SpannableString(str4));
}
SpannableString spannableString2 = new SpannableString(trim2);
spannableString2.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
String str6 = TextUtils.isEmpty(str2) ? defaultPrivacyLink : str2;
Yodo1MasPrivacyDialogHelper.this.clickedPrivacy = true;
Yodo1MasPrivacyDialogHelper.this.goWebView(context, str6);
}
@Override
public void updateDrawState(TextPaint textPaint) {
textPaint.setColor(Yodo1MasPrivacyDialogHelper.this.clickedPrivacy ? color2 : color);
textPaint.setFlags(8);
textPaint.setAntiAlias(true);
}
}, 0, spannableString2.length(), i);
textView2.append(spannableString2);
if (!TextUtils.isEmpty(str5)) {
textView2.append(str5);
}
textView2.setMovementMethod(LinkMovementMethod.getInstance());
textView2.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
return true;
}
});
}
public static boolean lambda$showPrivacyDialogDetail$0(TextView textView, View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == 0) {
DrawableCompat.wrap(textView.getBackground()).setAlpha(204);
return false;
}
if (motionEvent.getAction() != 1) {
return false;
}
DrawableCompat.wrap(textView.getBackground()).setAlpha(255);
return false;
}
public void goWebView(Context context, String str) {
if (context == null || TextUtils.isEmpty(str)) {
return;
}
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
if (context.getPackageManager().queryIntentActivities(intent, 0).size() > 0) {
context.startActivity(intent);
} else {
Yodo1MasLog.d(TAG, "Failed to view private information");
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String getDefaultPrivacyLink(Context context) {
if (context == null) {
return null;
}
String currentLaguage = Yodo1MasAgePopUtil.getCurrentLaguage(context);
String packageName = Yodo1MasHelper.getInstance().getPackageName(context);
if (TextUtils.isEmpty(currentLaguage)) {
return "https://www.ads-txt.site/privacy/android/" + packageName;
}
return "https://www.ads-txt.site/privacy/android/" + packageName + "/" + currentLaguage;
}
}