吉他调音器专业版 v2.30701.8版本的 MD5 值为:9d8c85f04999890638bf11bd08e611f4

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


package com.bafenyi.zh.bafenyilib;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationManagerCompat;
import com.bafenyi.zh.bafenyilib.BFYMethod;
import com.bafenyi.zh.bafenyilib.BFYMethodListener;
import com.bafenyi.zh.bafenyilib.activeWindow.BFYActiveWindow;
import com.bafenyi.zh.bafenyilib.activeWindow.BFYActivityWindowLifeCycle;
import com.bafenyi.zh.bafenyilib.activity.WebActivity;
import com.bafenyi.zh.bafenyilib.base.BFYBaseActivity;
import com.bafenyi.zh.bafenyilib.base.BFYBaseFragment;
import com.bafenyi.zh.bafenyilib.config.BFYConfig;
import com.bafenyi.zh.bafenyilib.request.BFYRequest;
import com.bafenyi.zh.bafenyilib.request.BFYRequestListener;
import com.bafenyi.zh.bafenyilib.request.http_config.AppConstant;
import com.bafenyi.zh.bafenyilib.util.Enum;
import com.bafenyi.zh.bafenyilib.util.PreferenceUtil;
import com.bafenyi.zh.bafenyilib.util.TenseCityUtil;
import com.blankj.utilcode.util.ToastUtils;
import com.ss.android.download.api.constant.BaseConstants;
import com.tencent.bugly.Bugly;
import com.xiaomi.mipush.sdk.Constants;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

public class BFYMethod {
    public static String[] feedbackPermissions = {"android.permission.CAMERA", "android.permission.WRITE_EXTERNAL_STORAGE"};

    @SuppressLint({"StaticFieldLeak"})
    public static View newMoreAppView;

    public static class AnonymousClass4 implements BFYRequestListener.ReportStatisticalResult {
        public final Activity val$activity;
        public final String val$type;

        public AnonymousClass4(Activity activity, String str) {
            this.val$activity = activity;
            this.val$type = str;
        }

        public static void a(boolean z, ArrayList arrayList) {
        }

        @Override
        public void onError() {
            PreferenceUtil.put("report_num", PreferenceUtil.getInt("report_num", 0) + 1);
            Looper.prepare();
            BFYMethod.report(this.val$activity, this.val$type);
            Looper.loop();
        }

        @Override
        public void onResult(boolean z) {
            if (!z) {
                PreferenceUtil.put("report_num", PreferenceUtil.getInt("report_num", 0) + 1);
                Looper.prepare();
                BFYMethod.report(this.val$activity, this.val$type);
                Looper.loop();
                return;
            }
            PreferenceUtil.put("report_num", 0);
            if (this.val$type.equals("init")) {
                BFYMethod.updateParams(this.val$type);
            }
            BFYRequest.getMoreAppPic(new BFYRequestListener.getMoreAppPicResult() {
                @Override
                public final void onResult(boolean z2, ArrayList arrayList) {
                    BFYMethod.AnonymousClass4.a(z2, arrayList);
                }
            });
        }
    }

    public static void a(BFYMethodListener.GetActiveWindowResult getActiveWindowResult, boolean z) {
        if (z) {
            getActiveWindowResult.onResult(BFYActiveWindow.isShowScoreOrShare());
            updateParams("");
        }
    }

    public static void a(boolean z, ArrayList arrayList) {
    }

    public static boolean access$000() {
        return isUpdate();
    }

    public static void b(Activity activity, String str, final boolean z, String str2) {
        if (z) {
            BFYRequest.reportStatistical(activity, str2, false, true, str, new BFYRequestListener.ReportStatisticalResult() {
                @Override
                public void onError() {
                    Log.i("report_error", "reportSplashAd: 激励广告上报失败");
                }

                @Override
                public void onResult(boolean z2) {
                    Log.i("report_error", "reportSplashAd: 激励广告上报 " + z);
                }
            });
        } else {
            Log.i("report_error", "reportSplashAd: 激励广告上报获取时间戳失败");
        }
    }

    public static void c(Activity activity, String str, final boolean z, String str2) {
        if (z) {
            BFYRequest.reportStatistical(activity, str2, true, false, str, new BFYRequestListener.ReportStatisticalResult() {
                @Override
                public void onError() {
                    Log.i("report_error", "reportSplashAd: 开屏广告上报失败");
                }

                @Override
                public void onResult(boolean z2) {
                    Log.i("report_error", "reportSplashAd: 开屏广告上报 " + z);
                }
            });
        } else {
            Log.i("report_error", "reportSplashAd: 开屏广告上报获取时间戳失败");
        }
    }

    public static String getRelyVersion(String[] strArr) {
        String str = "";
        String str2 = str;
        String str3 = str2;
        String str4 = str3;
        String str5 = str4;
        for (String str6 : strArr) {
            if (str6.contains("Android_BafenyiSdk_cn")) {
                str = str6.replace("'", "").split(Constants.COLON_SEPARATOR)[2];
            } else if (str6.contains("Android_BafenyiAd_cn")) {
                str4 = str6.replace("'", "").split(Constants.COLON_SEPARATOR)[2];
            } else if (str6.contains("Android_BafenyiPay_cn")) {
                str2 = str6.replace("'", "").split(Constants.COLON_SEPARATOR)[2];
            } else if (str6.contains("Android_BafenyiLocalPay_cn")) {
                str3 = str6.replace("'", "").split(Constants.COLON_SEPARATOR)[2];
            } else if (str6.contains("Android_BafenyiNews")) {
                str5 = str6.replace("'", "").split(Constants.COLON_SEPARATOR)[2];
            }
        }
        String str7 = str.isEmpty() ? "" : "Build" + str;
        if (!str2.isEmpty()) {
            str7 = str7 + "-hp" + str2;
        }
        if (!str3.isEmpty()) {
            str7 = str7 + "-lp" + str3;
        }
        if (!str4.isEmpty()) {
            str7 = str7 + "-a" + str4;
        }
        if (str5.isEmpty()) {
            return str7;
        }
        return str7 + "-i" + str5;
    }

    public static void getTenseCity(final String str, final String str2, String str3, final BFYMethodListener.ITenseCityCallback iTenseCityCallback) {
        if (!str3.equals("dahanghai") && !str3.contains("juliang")) {
            if (PreferenceUtil.getString("needCityRequest", "").equals(Bugly.SDK_IS_DEV)) {
                BFYConfig.setTenseCity(false);
                iTenseCityCallback.onShowResult(true, false, "null", "");
                return;
            } else {
                BFYRequest.getTimeStamp(new BFYRequestListener.TimeStampResult() {
                    @Override
                    public void onResult(boolean z, String str4) {
                        if (!z) {
                            BFYConfig.setTenseCity(true);
                            BFYMethodListener.ITenseCityCallback.this.onShowResult(false, true, "", "网络错误");
                        } else {
                            TenseCityUtil.requestTenseCity(str, str2, str4, BFYMethodListener.ITenseCityCallback.this);
                        }
                    }
                });
                return;
            }
        }
        BFYConfig.setTenseCity(false);
        iTenseCityCallback.onShowResult(true, false, "null", "");
    }

    public static void getUpdateType(final boolean z, final boolean z2, final BFYMethodListener.GetUpdateResult getUpdateResult) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                if (BFYMethod.access$000()) {
                    if (z2) {
                        getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeUpdate);
                        return;
                    }
                    if (BFYConfig.getNewForceUpdate().equals("on")) {
                        getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeForceUpdate);
                        return;
                    }
                    if (z) {
                        if (!PreferenceUtil.getString("main_update_date", "").equals("") && PreferenceUtil.getGapCount(PreferenceUtil.getString("main_update_date", ""), simpleDateFormat.format(Long.valueOf(System.currentTimeMillis()))) < 10) {
                            getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeNone);
                            return;
                        } else {
                            PreferenceUtil.put("main_update_date", simpleDateFormat.format(Long.valueOf(System.currentTimeMillis())));
                            getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeUpdate);
                            return;
                        }
                    }
                    if (!PreferenceUtil.getString("update_date", "").equals("") && PreferenceUtil.getGapCount(PreferenceUtil.getString("update_date", ""), simpleDateFormat.format(Long.valueOf(System.currentTimeMillis()))) < 10) {
                        getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeNone);
                        return;
                    } else {
                        PreferenceUtil.put("update_date", simpleDateFormat.format(Long.valueOf(System.currentTimeMillis())));
                        getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeUpdate);
                        return;
                    }
                }
                PreferenceUtil.put("update_date", "");
                PreferenceUtil.put("main_update_date", "");
                getUpdateResult.onResult(Enum.ShowUpdateType.ShowUpdateTypeNone);
            }
        }, 1000L);
    }

    public static boolean isReviewState() {
        if (BFYConfig.getIsAppMarket()) {
            return PreferenceUtil.getBoolean("isAudit", true) || Integer.parseInt(BFYConfig.getAppVersionCode()) > Integer.parseInt(BFYConfig.getUpdateVersion());
        }
        return false;
    }

    public static boolean isShowAdState() {
        return BFYConfig.getOtherParamsForKey("isShowAd", "").equals("on");
    }

    public static boolean isShowNotification(Context context) {
        if (NotificationManagerCompat.from(context).areNotificationsEnabled()) {
            return false;
        }
        long firstSetNotificationDate = PreferenceUtil.getFirstSetNotificationDate();
        if (firstSetNotificationDate != 0 && PreferenceUtil.getTimeExpend(firstSetNotificationDate) < 10) {
            return false;
        }
        PreferenceUtil.setFirstSetNotificationDate(System.currentTimeMillis());
        return true;
    }

    public static boolean isUpdate() {
        return Integer.parseInt(BFYConfig.getUpdateVersion()) > Integer.parseInt(BFYConfig.getAppVersionCode());
    }

    public static void openUrl(final BFYBaseActivity bFYBaseActivity, Enum.UrlType urlType) {
        String str;
        bFYBaseActivity.permissionsLinsten = new BFYBaseActivity.PermissionsLinsten() {
            @Override
            public final void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
                BFYMethod.a(BFYBaseActivity.this, i2, strArr, iArr);
            }
        };
        if (urlType == Enum.UrlType.UrlTypeFeedBack) {
            str = "https://platform.8fenyi.cn/h5-chat?appId=" + BFYConfig.getStaticticalAppid() + "&deviceId=" + Settings.System.getString(bFYBaseActivity.getContentResolver(), "android_id") + "&lang=cn";
        } else if (urlType == Enum.UrlType.UrlTypeMoreApp) {
            str = "https://m.8fenyi.cn/index.html?language=cn&system=android&packages=" + BFYConfig.getPkgName();
        } else if (urlType == Enum.UrlType.UrlTypeUserAgreement) {
            str = "https://h5.8fenyi.cn/privacy/service-protocol.html";
        } else if (urlType == Enum.UrlType.UrlTypePrivacy) {
            str = "https://h5.8fenyi.cn/privacy/index-cn.html?appId=" + BFYConfig.getStaticticalAppid();
        } else {
            str = "";
        }
        Intent intent = new Intent(bFYBaseActivity, (Class<?>) WebActivity.class);
        intent.putExtra("url", str);
        bFYBaseActivity.startActivity(intent);
    }

    public static void report(final Activity activity, final String str) {
        if (PreferenceUtil.getInt("report_num", 0) == 0 || PreferenceUtil.getInt("report_num", 0) == 1) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    BFYRequest.getTimeStamp(new BFYRequestListener.TimeStampResult() {
                        @Override
                        public final void onResult(boolean z, String str2) {
                            BFYMethod.a(r1, r2, z, str2);
                        }
                    });
                }
            }, 0);
            return;
        }
        PreferenceUtil.put("report_num", 0);
        if (str.equals("init")) {
            BFYMethodListener.AdCallBackForInit adCallBackForInit = BFYConfig.adCallBackForInit;
            if (adCallBackForInit != null) {
                adCallBackForInit.onSuccess(BFYConfig.getOtherParamsForKey("adJson", ""));
            }
            BFYMethodListener.AdCallBackForSplash adCallBackForSplash = BFYConfig.adCallBackForSplash;
            if (adCallBackForSplash != null) {
                adCallBackForSplash.onSuccess(isReviewState(), BFYConfig.getAdServer(), BFYConfig.getOtherParamsForKey("adJson", ""));
            }
        }
        BFYRequest.getMoreAppPic(new BFYRequestListener.getMoreAppPicResult() {
            @Override
            public final void onResult(boolean z, ArrayList arrayList) {
                BFYMethod.a(z, arrayList);
            }
        });
    }

    public static void reportRewardVideoAd(final Activity activity, final String str) {
        BFYRequest.getTimeStamp(new BFYRequestListener.TimeStampResult() {
            @Override
            public final void onResult(boolean z, String str2) {
                BFYMethod.b(activity, str, z, str2);
            }
        });
    }

    public static void reportSplashAd(final Activity activity, final String str) {
        BFYRequest.getTimeStamp(new BFYRequestListener.TimeStampResult() {
            @Override
            public final void onResult(boolean z, String str2) {
                BFYMethod.c(activity, str, z, str2);
            }
        });
    }

    public static void score(Context context) {
        try {
            if ("samsung".equals(Build.BRAND)) {
                Uri parse = Uri.parse("http://www.samsungapps.com/appquery/appDetail.as?appId=" + BFYConfig.getPkgName());
                Intent intent = new Intent();
                intent.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main");
                intent.setData(parse);
                context.startActivity(intent);
            } else {
                Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(BaseConstants.MARKET_PREFIX + BFYConfig.getPkgName()));
                intent2.addFlags(268435456);
                context.startActivity(intent2);
            }
        } catch (Exception e2) {
            Toast.makeText(context, "未安装应用市场", 0).show();
            e2.printStackTrace();
        }
    }

    public static void setDomainAddress(String str) {
        AppConstant.Service_DOMAIN = str;
    }

    public static void setPhoneState(boolean z) {
        PreferenceUtil.put("read_phone_state", z);
    }

    public static void setShowMoreApp(View view) {
        if (view != null) {
            newMoreAppView = view;
        }
        if (newMoreAppView != null) {
            if (isReviewState()) {
                newMoreAppView.setVisibility(8);
            } else if (BFYConfig.getNewMoreApp().toLowerCase().contains("off")) {
                newMoreAppView.setVisibility(8);
            } else {
                newMoreAppView.setVisibility(0);
            }
        }
    }

    public static void share(Context context) {
        Intent intent = new Intent("android.intent.action.SEND");
        intent.setType("text/plain");
        intent.putExtra("android.intent.extra.TEXT", "我正在使用" + BFYConfig.getAppName() + ",快来试试吧!" + BFYConfig.getMarketUrl());
        context.startActivity(Intent.createChooser(intent, "Share"));
    }

    public static void showScoreOrShare(AppCompatActivity appCompatActivity, BFYBaseFragment bFYBaseFragment, final BFYMethodListener.GetActiveWindowResult getActiveWindowResult) {
        BFYActivityWindowLifeCycle bFYActivityWindowLifeCycle = new BFYActivityWindowLifeCycle(appCompatActivity, getActiveWindowResult);
        if (bFYBaseFragment != null) {
            bFYBaseFragment.is_hidden(new BFYBaseFragment.FragmentHiddenListener() {
                @Override
                public final void onResult(boolean z) {
                    BFYMethod.a(BFYMethodListener.GetActiveWindowResult.this, z);
                }
            });
            bFYBaseFragment.getLifecycle().addObserver(bFYActivityWindowLifeCycle);
        } else {
            appCompatActivity.getLifecycle().addObserver(bFYActivityWindowLifeCycle);
        }
    }

    public static void splashReportStatistical(final BFYBaseActivity bFYBaseActivity, BFYMethodListener.AdCallBackForInit adCallBackForInit, BFYMethodListener.AdCallBackForSplash adCallBackForSplash) {
        BFYConfig.adCallBackForInit = adCallBackForInit;
        BFYConfig.adCallBackForSplash = adCallBackForSplash;
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                BFYMethod.report(BFYBaseActivity.this, "init");
            }
        }, 800L);
    }

    public static void updateApk(Context context) {
        if (!BFYConfig.getUpdateApk().isEmpty()) {
            try {
                try {
                    context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(BFYConfig.getUpdateApk())));
                    return;
                } catch (Exception e2) {
                    Toast.makeText(context, "未安装应用市场", 0).show();
                    e2.printStackTrace();
                    return;
                }
            } catch (Exception unused) {
                if ("samsung".equals(Build.BRAND)) {
                    Uri parse = Uri.parse("http://www.samsungapps.com/appquery/appDetail.as?appId=" + BFYConfig.getPkgName());
                    Intent intent = new Intent();
                    intent.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main");
                    intent.setData(parse);
                    context.startActivity(intent);
                } else {
                    Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(BaseConstants.MARKET_PREFIX + BFYConfig.getPkgName()));
                    intent2.addFlags(268435456);
                    context.startActivity(intent2);
                }
                return;
            }
        }
        try {
            if ("samsung".equals(Build.BRAND)) {
                Uri parse2 = Uri.parse("http://www.samsungapps.com/appquery/appDetail.as?appId=" + BFYConfig.getPkgName());
                Intent intent3 = new Intent();
                intent3.setClassName("com.sec.android.app.samsungapps", "com.sec.android.app.samsungapps.Main");
                intent3.setData(parse2);
                context.startActivity(intent3);
            } else {
                Intent intent4 = new Intent("android.intent.action.VIEW", Uri.parse(BaseConstants.MARKET_PREFIX + BFYConfig.getPkgName()));
                intent4.addFlags(268435456);
                context.startActivity(intent4);
            }
        } catch (Exception e3) {
            Toast.makeText(context, "未安装应用市场", 0).show();
            e3.printStackTrace();
        }
    }

    public static void updateParams(final String str) {
        if (PreferenceUtil.getInt("updateParamsNum", 0) >= 2) {
            PreferenceUtil.put("updateParamsNum", 0);
            ToastUtils.d("网络异常,请检查网络连接是否通畅。");
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    BFYMethod.b(str);
                }
            });
            return;
        }
        BFYRequest.getTimeStamp(new BFYRequestListener.TimeStampResult() {
            @Override
            public final void onResult(boolean z, String str2) {
                BFYMethod.a(str, z, str2);
            }
        });
    }

    public static void a(BFYBaseActivity bFYBaseActivity, int i2, String[] strArr, int[] iArr) {
        if (i2 == 1314) {
            if (iArr.length > 0 && iArr[0] == 0) {
                String str = "https://platform.8fenyi.cn/h5-chat?appId=" + BFYConfig.getStaticticalAppid() + "&deviceId=" + Settings.System.getString(bFYBaseActivity.getContentResolver(), "android_id") + "&lang=cn";
                Intent intent = new Intent(bFYBaseActivity, (Class<?>) WebActivity.class);
                intent.putExtra("url", str);
                bFYBaseActivity.startActivity(intent);
                return;
            }
            ToastUtils.d("当前功能需要获取权限");
        }
    }

    public static void b(String str) {
        if (str.equals("init")) {
            BFYMethodListener.AdCallBackForInit adCallBackForInit = BFYConfig.adCallBackForInit;
            if (adCallBackForInit != null) {
                adCallBackForInit.onSuccess(BFYConfig.getOtherParamsForKey("adJson", ""));
            }
            BFYMethodListener.AdCallBackForSplash adCallBackForSplash = BFYConfig.adCallBackForSplash;
            if (adCallBackForSplash != null) {
                adCallBackForSplash.onSuccess(isReviewState(), BFYConfig.getAdServer(), BFYConfig.getOtherParamsForKey("adJson", ""));
            }
        }
    }

    public static void a(Activity activity, String str, boolean z, String str2) {
        if (z) {
            BFYRequest.reportStatistical(activity, str2, new AnonymousClass4(activity, str));
            return;
        }
        PreferenceUtil.put("report_num", PreferenceUtil.getInt("report_num", 0) + 1);
        Looper.prepare();
        report(activity, str);
        Looper.loop();
    }

    public static void a(final String str, boolean z, String str2) {
        if (!z) {
            PreferenceUtil.put("updateParamsNum", PreferenceUtil.getInt("updateParamsNum", 0) + 1);
            updateParams(str);
        } else {
            BFYRequest.getParams(str2, BFYConfig.getLastUpdateTime(), new BFYRequestListener.GetParamsResult() {
                @Override
                public final void onResult(boolean z2) {
                    BFYMethod.a(str, z2);
                }
            });
        }
    }

    public static void a(final String str, boolean z) {
        if (!z) {
            PreferenceUtil.put("updateParamsNum", PreferenceUtil.getInt("updateParamsNum", 0) + 1);
            updateParams(str);
        } else {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    BFYMethod.a(str);
                }
            });
            PreferenceUtil.put("updateParamsNum", 0);
        }
    }

    public static void a(String str) {
        setShowMoreApp(null);
        if (str.equals("init")) {
            BFYMethodListener.AdCallBackForInit adCallBackForInit = BFYConfig.adCallBackForInit;
            if (adCallBackForInit != null) {
                adCallBackForInit.onSuccess(BFYConfig.getOtherParamsForKey("adJson", ""));
            }
            BFYMethodListener.AdCallBackForSplash adCallBackForSplash = BFYConfig.adCallBackForSplash;
            if (adCallBackForSplash != null) {
                adCallBackForSplash.onSuccess(isReviewState(), BFYConfig.getAdServer(), BFYConfig.getOtherParamsForKey("adJson", ""));
            }
        }
    }
}