CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030

以下内容为反编译后的 fx0.java 源代码,内容仅作参考


package org.telegram.messenger.p110;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import co.cheetah.gram.R;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.p110.o9;
import org.telegram.ui.ActionBar.i;

public class fx0 {
    private static org.telegram.ui.ActionBar.i a;

    public static void A(Context context, int i) {
        a.dismiss();
        if (i > o9.c(o9.f.RATE_DIALOG_MINIMUM)) {
            try {
                context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + context.getPackageName())));
            } catch (ActivityNotFoundException unused) {
                context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
            }
        }
        new i.C0142i(context).u(LocaleController.getString("RateApp", R.string.RateApp)).l(LocaleController.getString("ThanksForRating", R.string.ThanksForRating)).n(LocaleController.getString("OK", R.string.OK), null).C();
        o9.a(o9.f.RATE_DIALOG_RATED, true);
    }

    private static void B(Context context) {
        Intent intent;
        o9.f fVar = o9.f.UPDATE_URL;
        if (o9.k(fVar) == null || o9.k(fVar).isEmpty()) {
            Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName()));
            intent2.setFlags(268435456);
            if (n02.isPackageInstalled("com.android.vending", context.getPackageManager())) {
                intent2.setPackage("com.android.vending");
            }
            context.startActivity(intent2);
            return;
        }
        String k = o9.k(fVar);
        if (k.contains("http://") || k.contains("https://")) {
            intent = new Intent("android.intent.action.VIEW", Uri.parse(k));
            intent.setFlags(268435456);
        } else {
            intent = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + k));
            intent.setFlags(268435456);
            if (n02.isPackageInstalled("com.android.vending", context.getPackageManager())) {
                intent.setPackage("com.android.vending");
            }
        }
        context.startActivity(intent);
    }

    private static View i(Context context, String str, View.OnClickListener onClickListener) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(org.telegram.ui.ActionBar.w.r1("actionBarDefault"));
        gradientDrawable.setCornerRadius(AndroidUtilities.dp(5.0f));
        TextView textView = new TextView(context);
        textView.setText(str);
        textView.setTextSize(2, 16.0f);
        textView.setGravity(17);
        textView.setOnClickListener(onClickListener);
        textView.setBackground(gradientDrawable);
        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView.setTextColor(org.telegram.ui.ActionBar.w.r1("actionBarDefaultTitle"));
        return textView;
    }

    private static View j(Context context, String str, View.OnClickListener onClickListener) {
        TextView textView = new TextView(context);
        textView.setMinWidth(AndroidUtilities.dp(64.0f));
        textView.setTag(-2);
        textView.setTextSize(1, 14.0f);
        textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogButton"));
        textView.setGravity(17);
        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView.setEllipsize(TextUtils.TruncateAt.END);
        textView.setSingleLine(true);
        textView.setText(str);
        textView.setBackgroundDrawable(org.telegram.ui.ActionBar.w.P1(org.telegram.ui.ActionBar.w.r1("dialogButton")));
        textView.setOnClickListener(onClickListener);
        return textView;
    }

    public static void k(Context context, boolean z) {
        if (z || (o9.b(o9.f.RATE_DIALOG_ENABLED) && !o9.b(o9.f.RATE_DIALOG_RATED) && x())) {
            a = new i.C0142i(context).A(n(context)).a();
            if (!o9.b(o9.f.RATE_DIALOG_CANCELABLE)) {
                a.E0(false);
                a.setCanceledOnTouchOutside(false);
                a.setCancelable(false);
            }
            a.show();
            o9.g(o9.f.RATE_DIALOG_SHOWED_AT, System.currentTimeMillis());
        }
    }

    public static void l(Context context, boolean z) {
        if (!o9.b(o9.f.UPDATE_ENABLED) || (!y() && !z)) {
            if (z) {
                z(context);
            }
        } else {
            if (!o9.b(o9.f.UPDATE_FORCE_VERSION) && o9.c(o9.f.UPDATE_VERSION_CODE) <= m()) {
                if (z) {
                    z(context);
                    return;
                }
                return;
            }
            a = new i.C0142i(context).A(o(context)).a();
            if (!o9.b(o9.f.UPDATE_CANCELABLE)) {
                a.E0(false);
                a.setCanceledOnTouchOutside(false);
                a.setCancelable(false);
            }
            a.show();
            o9.g(o9.f.UPDATE_SHOWED_AT, System.currentTimeMillis());
        }
    }

    public static int m() {
        try {
            return s52.h().getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return 0;
        }
    }

    private static View n(final Context context) {
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(1);
        ImageView imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.ic_launcher));
        linearLayout.addView(imageView, g52.l(-1, 50, 17));
        TextView textView = new TextView(context);
        textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
        textView.setTextSize(1, 20.0f);
        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextLink"));
        textView.setText(LocaleController.getString("RateApp", R.string.RateApp));
        textView.setGravity(17);
        linearLayout.addView(textView);
        TextView textView2 = new TextView(context);
        textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
        textView2.setTextSize(1, 16.0f);
        textView2.setPadding(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(15.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(15.0f));
        textView2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView2.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
        textView2.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextLink"));
        o9.f fVar = o9.f.RATE_DIALOG_MESSAGE;
        textView2.setText((o9.k(fVar) == null || o9.k(fVar).length() == 0) ? LocaleController.getString("RateOurApp", R.string.RateOurApp) : o9.k(fVar));
        textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
        linearLayout.addView(textView2);
        linearLayout.addView(i(context, LocaleController.getString("RateVeryGood", R.string.RateVeryGood), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.A(context, 5);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        linearLayout.addView(i(context, LocaleController.getString("RateGood", R.string.RateGood), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.A(context, 4);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        linearLayout.addView(i(context, LocaleController.getString("RateNormal", R.string.RateNormal), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.A(context, 3);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        linearLayout.addView(i(context, LocaleController.getString("RateSlightlyBad", R.string.RateSlightlyBad), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.A(context, 2);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        linearLayout.addView(i(context, LocaleController.getString("RateBad", R.string.RateBad), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.A(context, 1);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        if (o9.b(o9.f.RATE_DIALOG_CANCELABLE)) {
            linearLayout.addView(j(context, LocaleController.getString("Cancel", R.string.Cancel), new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    fx0.u(view);
                }
            }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        }
        return linearLayout;
    }

    private static View o(final Context context) {
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(1);
        ImageView imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.ic_launcher));
        linearLayout.addView(imageView, g52.l(-1, 50, 17));
        TextView textView = new TextView(context);
        textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
        textView.setTextSize(1, 20.0f);
        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextLink"));
        textView.setText(LocaleController.getString("Update", R.string.Update));
        textView.setGravity(17);
        linearLayout.addView(textView);
        TextView textView2 = new TextView(context);
        textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
        textView2.setTextSize(1, 16.0f);
        textView2.setPadding(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(15.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(15.0f));
        textView2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        textView2.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
        textView2.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextLink"));
        o9.f fVar = o9.f.UPDATE_MESSAGE;
        textView2.setText((o9.k(fVar) == null || o9.k(fVar).isEmpty()) ? LocaleController.getString("AppUpdateInfo", R.string.AppUpdateInfo) : o9.k(fVar));
        textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
        linearLayout.addView(textView2);
        linearLayout.addView(i(context, LocaleController.getString("Update", R.string.Update), new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                fx0.v(context, view);
            }
        }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        if (o9.b(o9.f.UPDATE_CANCELABLE)) {
            linearLayout.addView(j(context, LocaleController.getString("Cancel", R.string.Cancel), new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    fx0.w(view);
                }
            }), g52.m(-1, 40, 17, 10, 10, 10, 0));
        }
        return linearLayout;
    }

    public static void u(View view) {
        a.dismiss();
    }

    public static void v(Context context, View view) {
        B(context);
        if (o9.b(o9.f.UPDATE_FORCE)) {
            return;
        }
        a.dismiss();
    }

    public static void w(View view) {
        a.dismiss();
    }

    private static boolean x() {
        return (!o9.b(o9.f.RATE_DIALOG_INSTALLTIME_CHECK) || o9.f(o9.f.APP_INSTALL_TIME) - System.currentTimeMillis() >= 18000) && System.currentTimeMillis() > o9.f(o9.f.RATE_DIALOG_SHOWED_AT) + ((long) (((o9.c(o9.f.RATE_DIALOG_SHOW_DELAY) * 60) * 60) * 1000));
    }

    private static boolean y() {
        return System.currentTimeMillis() > o9.f(o9.f.UPDATE_SHOWED_AT) + ((long) (((o9.c(o9.f.UPDATE_SHOW_DELAY) * 60) * 60) * 1000));
    }

    private static void z(Context context) {
        new i.C0142i(context).u(LocaleController.getString("Update", R.string.Update)).l(LocaleController.getString("UpdateNotFound", R.string.UpdateNotFound)).n(LocaleController.getString("OK", R.string.OK), null).C();
    }
}