TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.troop.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.image.JpegExifReader;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.filemanager.util.FileManagerUtil;
import com.tencent.mobileqq.troop.data.TroopBarShortVideoUploadUtil;
import com.tencent.mobileqq.utils.FileUtils;
import com.tencent.mobileqq.utils.HexUtil;
import com.tencent.mobileqq.utils.StackBlur;
import com.tencent.mobileqq.webview.webso.HttpHeaders;
import com.tencent.open.base.http.HttpBaseUtil;
import com.tencent.qphone.base.util.QLog;
import cooperation.qzone.QZoneHttpUtil;
import java.util.ArrayList;
import java.util.zip.GZIPInputStream;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class TroopRewardUtil {
    public static final int f94130a = 200;
    public static final int f94131b = 200;

    public interface OnUploadImageListener {
        void a(int i);

        void a(String str);
    }

    public static TroopBarShortVideoUploadUtil.ApplyUploadRsp a(Bundle bundle, String str, String str2) {
        HttpResponse execute;
        TroopBarShortVideoUploadUtil.ApplyUploadRsp applyUploadRsp;
        String entityUtils;
        TroopBarShortVideoUploadUtil.ApplyUploadRsp applyUploadRsp2 = null;
        boolean z = false;
        long currentTimeMillis = System.currentTimeMillis();
        String string = bundle.getString("title");
        String string2 = bundle.getString(TroopBarShortVideoUploadUtil.f);
        String string3 = bundle.getString("vid");
        if (QLog.isColorLevel()) {
            QLog.d(TroopBarUtils.f32466a, 2, "applyUpload title = " + string + ", filePath = " + string2 + ", size = " + FileUtils.a(string2));
        }
        if (TextUtils.isEmpty(string2) || !FileUtils.m9176a(string2)) {
            if (QLog.isColorLevel()) {
                QLog.e(TroopBarUtils.f32466a, 2, "!!!!!!!applyUpload filePath = " + string2);
            }
        } else {
            HttpPost httpPost = new HttpPost("http://pay.qun.qq.com/cgi-bin/group_pay/reward/video_up_ready");
            httpPost.setHeader("Accept", "Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            httpPost.setHeader(HttpHeaders.f95143b, "utf-8;q=0.7,*;q=0.7");
            httpPost.setHeader("Accept-Encoding", "gzip, deflate");
            httpPost.setHeader(HttpHeaders.d, "zh-cn,zh;q=0.5");
            httpPost.setHeader("Connection", "keep-alive");
            httpPost.setHeader("Cookie", "skey=" + str2 + ";uin=" + str);
            ArrayList arrayList = new ArrayList();
            arrayList.add(new BasicNameValuePair("title", string));
            arrayList.add(new BasicNameValuePair("size", String.valueOf(FileUtils.a(string2))));
            arrayList.add(new BasicNameValuePair("sha", HexUtil.a(FileManagerUtil.m6591a(string2)).toLowerCase()));
            arrayList.add(new BasicNameValuePair("md5", HexUtil.a(FileManagerUtil.m6609c(string2)).toLowerCase()));
            arrayList.add(new BasicNameValuePair("bkn", "" + TroopUtils.b(str2)));
            if (QLog.isColorLevel()) {
                QLog.d(TroopBarUtils.f32466a, 2, "applyUpload() getMessageDigest time = " + (System.currentTimeMillis() - currentTimeMillis));
            }
            arrayList.add(new BasicNameValuePair("platform", "android"));
            if (!TextUtils.isEmpty(string3)) {
                arrayList.add(new BasicNameValuePair("vid", string3));
            }
            try {
                httpPost.setEntity(new UrlEncodedFormEntity(arrayList, "UTF-8"));
                execute = new DefaultHttpClient().execute(httpPost);
            } catch (Exception e) {
                if (QLog.isColorLevel()) {
                    QLog.d(TroopBarUtils.f32466a, 2, QLog.getStackTraceString(e));
                }
            }
            if (execute.getStatusLine().getStatusCode() == 200) {
                for (Header header : execute.getHeaders("Content-Encoding")) {
                    if (header.getValue().equals(QZoneHttpUtil.f70178c)) {
                        z = true;
                    }
                }
                HttpEntity entity = execute.getEntity();
                if (z) {
                    entityUtils = HttpBaseUtil.a(new GZIPInputStream(entity.getContent()));
                } else {
                    entityUtils = EntityUtils.toString(entity);
                }
                if (QLog.isColorLevel()) {
                    QLog.d(TroopBarUtils.f32466a, 2, "applyUpload result = " + entityUtils);
                }
                JSONObject jSONObject = new JSONObject(entityUtils);
                if (jSONObject.optInt("ec", -1) == 0) {
                    applyUploadRsp = new TroopBarShortVideoUploadUtil.ApplyUploadRsp(jSONObject);
                    applyUploadRsp2 = applyUploadRsp;
                    if (QLog.isColorLevel()) {
                        QLog.d(TroopBarUtils.f32466a, 2, "applyUpload time: " + (System.currentTimeMillis() - currentTimeMillis));
                    }
                }
            }
            applyUploadRsp = null;
            applyUploadRsp2 = applyUploadRsp;
            if (QLog.isColorLevel()) {
            }
        }
        return applyUploadRsp2;
    }

    public static int a(String str, QQAppInterface qQAppInterface) {
        return (str == null || qQAppInterface == null || !str.equals(qQAppInterface.getCurrentAccountUin())) ? 1 : 0;
    }

    public static final Bitmap a(Bitmap bitmap, int i, int i2, Matrix matrix) {
        if (bitmap == null) {
            return null;
        }
        float width = (float) ((i * 1.0d) / bitmap.getWidth());
        float height = (float) ((i2 * 1.0d) / bitmap.getHeight());
        float f = width > height ? height : width;
        if (f != 1.0f) {
            matrix.postScale(f, f);
        }
        try {
            Bitmap createBitmap = Bitmap.createBitmap(bitmap, 0, 0, (int) (bitmap.getWidth() * f), (int) (bitmap.getHeight() * f), matrix, true);
            if (f != 1.0f && createBitmap != bitmap && !bitmap.isRecycled()) {
                bitmap.recycle();
                return createBitmap;
            }
            return createBitmap;
        } catch (OutOfMemoryError e) {
            return null;
        } catch (Throwable th) {
            return null;
        }
    }

    public static final Bitmap a(String str, int i, int i2) {
        if (str == null) {
            return null;
        }
        BitmapFactory.Options options = new BitmapFactory.Options();
        Matrix matrix = new Matrix();
        try {
            switch (JpegExifReader.readOrientation(str)) {
                case 3:
                    matrix.postRotate(180.0f);
                    break;
                case 5:
                case 6:
                case 7:
                    matrix.postRotate(90.0f);
                    break;
                case 8:
                    matrix.postRotate(270.0f);
                    break;
            }
            options.inJustDecodeBounds = true;
            BitmapFactory.decodeFile(str, options);
            int i3 = options.outWidth / i;
            int i4 = options.outHeight / i2;
            if (i3 <= i4) {
                i3 = i4;
            }
            options.inSampleSize = i3;
            options.inJustDecodeBounds = false;
            return a(BitmapFactory.decodeFile(str, options), i, i2, matrix);
        } catch (OutOfMemoryError e) {
            if (QLog.isColorLevel()) {
                QLog.d(TroopBarUtils.f32466a, 2, "OutOfMemoryError! filePath = " + str + ", size = " + FileUtils.a(str));
                return null;
            }
            return null;
        }
    }

    public static final Bitmap a(Bitmap bitmap) {
        Bitmap bitmap2 = null;
        if (bitmap != null) {
            try {
                bitmap2 = bitmap.copy(Bitmap.Config.ARGB_8888, true);
                if (bitmap != null && !bitmap.isRecycled()) {
                    bitmap.recycle();
                }
                StackBlur.a(bitmap2, 16);
            } catch (OutOfMemoryError e) {
            }
        }
        return bitmap2;
    }
}