Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23

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


package com.perm.utils;

import android.content.DialogInterface;
import android.text.TextUtils;
import androidx.appcompat.app.AlertDialog;
import com.perm.kate.BaseActivity;
import com.perm.kate.Helper;
import com.perm.kate.R;
import java.io.BufferedInputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class RegistrationDate {
    public static void displayDialog(BaseActivity baseActivity, String str) {
        AlertDialog.Builder builder = new AlertDialog.Builder(baseActivity);
        builder.setTitle(R.string.registration_date).setMessage(str).setPositiveButton("OK", (DialogInterface.OnClickListener) null);
        AlertDialog create = builder.create();
        create.setCanceledOnTouchOutside(true);
        create.show();
    }

    public static void displayDialogOnUiThread(final String str, final BaseActivity baseActivity) {
        if (baseActivity.isFinishing()) {
            return;
        }
        baseActivity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                RegistrationDate.displayDialog(BaseActivity.this, str);
            }
        });
    }

    public static void getAndShow(final BaseActivity baseActivity, final String str) {
        if (baseActivity == null) {
            return;
        }
        baseActivity.showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                String serverResponse;
                try {
                    serverResponse = RegistrationDate.getServerResponse("https://vk.com/foaf.php?id=" + str);
                } finally {
                    try {
                    } finally {
                    }
                }
                if (!TextUtils.isEmpty(serverResponse)) {
                    String parseResponse = RegistrationDate.parseResponse(serverResponse);
                    if (!TextUtils.isEmpty(parseResponse)) {
                        RegistrationDate.displayDialogOnUiThread(Helper.sdf.format(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZ").parse(parseResponse)), baseActivity);
                    }
                }
            }
        }.start();
    }

    public static String getServerResponse(String str) {
        HttpURLConnection httpURLConnection;
        try {
            httpURLConnection = ProxyManager.getConnection(new URL(str));
            try {
                httpURLConnection.setConnectTimeout(5000);
                httpURLConnection.setReadTimeout(5000);
                UserAgent.set(httpURLConnection);
                if (httpURLConnection.getResponseCode() == -1) {
                    httpURLConnection.disconnect();
                    return null;
                }
                String convertStreamToString = Utils.convertStreamToString(new BufferedInputStream(httpURLConnection.getInputStream()));
                httpURLConnection.disconnect();
                return convertStreamToString;
            } catch (Throwable th) {
                th = th;
                try {
                    th.printStackTrace();
                    return null;
                } finally {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                }
            }
        } catch (Throwable th2) {
            th = th2;
            httpURLConnection = null;
        }
    }

    public static String parseResponse(String str) {
        Matcher matcher = Pattern.compile("ya:created dc:date=\"(.*?)\"").matcher(str);
        if (matcher.find()) {
            return matcher.group(1);
        }
        return null;
    }
}