红果免费短剧 v6.2.3.32版本的 MD5 值为:a6b05492607eab2c8a25f26d2f238ae0

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


package com.dragon.read.social.reward.widget.font;

import android.net.Uri;
import com.dragon.read.app.App;
import com.dragon.read.base.util.LogHelper;
import com.dragon.read.social.util.w;
import com.dragon.read.util.av;
import com.ss.android.socialbase.downloader.depend.AbsDownloadListener;
import com.ss.android.socialbase.downloader.downloader.Downloader;
import com.ss.android.socialbase.downloader.exception.BaseException;
import com.ss.android.socialbase.downloader.model.DownloadInfo;
import com.ss.android.socialbase.downloader.model.DownloadTask;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;

public final class a {

    public static final a f88925a = new a();

    public static final LogHelper f88926b = w.b("NumberFont");

    public static final String f88927c = String.valueOf(App.context().getCacheDir());
    public static final HashMap<Character, String> d = new HashMap<>();

    private a() {
    }

    public final Map<Character, String> a() {
        return d;
    }

    public static final class b<V> implements Callable<Boolean> {

        final String f88929a;

        b(String str) {
            this.f88929a = str;
        }

        @Override
        public final Boolean call() {
            String str = a.f88927c + "/file_reward_value_font";
            a.f88925a.b(str);
            if (a.d.size() < 12) {
                File file = new File(a.f88927c);
                if (!file.exists()) {
                    file.mkdirs();
                }
                av.a(a.f88927c, this.f88929a);
                a.f88925a.b(str);
            }
            return true;
        }
    }

    public final void b() {
        try {
            Uri uri = Uri.parse("http://lf3-reading.fqnovelpic.com/obj/novel-common/file_reward_value_font.zip");
            if (StringsKt.endsWith$default((String) StringsKt.split$default((CharSequence) "http://lf3-reading.fqnovelpic.com/obj/novel-common/file_reward_value_font.zip", new char[]{'?'}, false, 0, 6, (Object) null).get(0), ".zip", false, 2, (Object) null)) {
                DownloadTask savePath = Downloader.with(App.context()).url("http://lf3-reading.fqnovelpic.com/obj/novel-common/file_reward_value_font.zip").name(uri.getLastPathSegment()).savePath(App.context().getCacheDir().getAbsolutePath());
                Intrinsics.checkNotNullExpressionValue(uri, "uri");
                savePath.mainThreadListener(new C3408a(uri)).asyncDownload(null);
            }
        } catch (Exception e) {
            f88926b.e(e.toString(), new Object[0]);
        }
    }

    public static final class C3408a extends AbsDownloadListener {

        private final Uri f88928a;

        public C3408a(Uri uri) {
            Intrinsics.checkNotNullParameter(uri, "uri");
            this.f88928a = uri;
        }

        @Override
        public void onSuccessed(DownloadInfo downloadInfo) {
            a.f88926b.d("download resource success", new Object[0]);
            a.f88925a.a(App.context().getCacheDir().getAbsolutePath() + '/' + this.f88928a.getLastPathSegment());
        }

        @Override
        public void onFailed(DownloadInfo downloadInfo, BaseException baseException) {
            a.f88926b.e("download resource failed, error msg is " + baseException, new Object[0]);
        }
    }

    public static final class c<T, R> implements Function<Throwable, Boolean> {

        public static final c<T, R> f88930a = new c<>();

        c() {
        }

        @Override
        public final Boolean apply(Throwable throwable) {
            Intrinsics.checkNotNullParameter(throwable, "throwable");
            a.f88926b.e("resolveFontRes error: %s", throwable.getMessage());
            return false;
        }
    }

    public final void a(String str) {
        Observable.fromCallable(new b(str)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).onErrorReturn(c.f88930a).subscribe();
    }

    public final void b(String str) {
        HashMap<Character, String> hashMap = d;
        hashMap.clear();
        if (!new File(str).exists()) {
            return;
        }
        File file = new File(str, "zero.png");
        if (file.exists()) {
            String absolutePath = file.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath, "fontZero.absolutePath");
            hashMap.put('0', absolutePath);
        }
        File file2 = new File(str, "one.png");
        if (file2.exists()) {
            String absolutePath2 = file2.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath2, "fontOne.absolutePath");
            hashMap.put('1', absolutePath2);
        }
        File file3 = new File(str, "two.png");
        if (file3.exists()) {
            String absolutePath3 = file3.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath3, "fontTwo.absolutePath");
            hashMap.put('2', absolutePath3);
        }
        File file4 = new File(str, "three.png");
        if (file4.exists()) {
            String absolutePath4 = file4.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath4, "fontThree.absolutePath");
            hashMap.put('3', absolutePath4);
        }
        File file5 = new File(str, "four.png");
        if (file5.exists()) {
            String absolutePath5 = file5.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath5, "fontFour.absolutePath");
            hashMap.put('4', absolutePath5);
        }
        File file6 = new File(str, "five.png");
        if (file6.exists()) {
            String absolutePath6 = file6.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath6, "fontFive.absolutePath");
            hashMap.put('5', absolutePath6);
        }
        File file7 = new File(str, "six.png");
        if (file7.exists()) {
            String absolutePath7 = file7.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath7, "fontSix.absolutePath");
            hashMap.put('6', absolutePath7);
        }
        File file8 = new File(str, "seven.png");
        if (file8.exists()) {
            String absolutePath8 = file8.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath8, "fontSeven.absolutePath");
            hashMap.put('7', absolutePath8);
        }
        File file9 = new File(str, "eight.png");
        if (file9.exists()) {
            String absolutePath9 = file9.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath9, "fontEight.absolutePath");
            hashMap.put('8', absolutePath9);
        }
        File file10 = new File(str, "nine.png");
        if (file10.exists()) {
            String absolutePath10 = file10.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath10, "fontNine.absolutePath");
            hashMap.put('9', absolutePath10);
        }
        File file11 = new File(str, "point.png");
        if (file11.exists()) {
            String absolutePath11 = file11.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath11, "fontPoint.absolutePath");
            hashMap.put('.', absolutePath11);
        }
        File file12 = new File(str, "ten_thousand.png");
        if (file12.exists()) {
            String absolutePath12 = file12.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath12, "fontTenThousand.absolutePath");
            hashMap.put((char) 19975, absolutePath12);
        }
    }
}