CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 k5.java 源代码,内容仅作参考
package ak.im.utils;
import ak.application.AKApplication;
import ak.event.k7;
import ak.im.BuildConfig;
import ak.im.module.ChatMessage;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.modelmsg.WXWebpageObject;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import java.io.ByteArrayOutputStream;
import org.jivesoftware.smackx.xhtmlim.XHTMLText;
public class k5 implements ak.im.listener.u {
private static IWXAPI a;
private Activity f3698b;
private Context f3699c;
private String f3700d;
private String f3701e;
private Bitmap f;
private int g;
public k5(Activity activity, Context context) {
this.g = 0;
this.f3698b = activity;
this.f3699c = context;
}
private byte[] a(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 30, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
try {
byteArrayOutputStream.close();
} catch (Exception e2) {
e2.printStackTrace();
}
return byteArray;
}
private boolean b() {
IWXAPI iwxapi = a;
if (iwxapi == null || !iwxapi.isWXAppInstalled()) {
j4.sendEvent(k7.newToastEvent(ak.im.b2.no_install_wx));
return false;
}
return true;
}
public void d(WXMediaMessage wXMediaMessage, Bitmap bitmap, int i) {
wXMediaMessage.thumbData = a(bitmap);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = ChatMessage.CHAT_SHARE_WEB;
req.message = wXMediaMessage;
req.scene = i;
getIWXAPI().sendReq(req);
}
private void e(boolean z, String str) {
String appName = AKApplication.getAppName();
this.f3701e = String.format(this.f3699c.getString(ak.im.b2.share_content_asimid), appName) + String.format(this.f3699c.getString(ak.im.b2.share_content_qzone_asim), appName);
new ak.im.ui.view.h2(this.f3698b, this).showAtLocation(this.f3698b.getWindow().getDecorView(), 80, 0, 0);
}
private void f(int i) {
WXImageObject wXImageObject = new WXImageObject(this.f);
WXMediaMessage wXMediaMessage = new WXMediaMessage();
wXMediaMessage.mediaObject = wXImageObject;
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(this.f, 100, 100, true);
this.f.recycle();
wXMediaMessage.thumbData = a(createScaledBitmap);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = XHTMLText.IMG;
req.message = wXMediaMessage;
req.scene = i;
getIWXAPI().sendReq(req);
}
private void g(String str, String str2, String str3, final int i, final Bitmap bitmap) {
WXWebpageObject wXWebpageObject = new WXWebpageObject();
wXWebpageObject.webpageUrl = str;
final WXMediaMessage wXMediaMessage = new WXMediaMessage(wXWebpageObject);
wXMediaMessage.title = str2;
wXMediaMessage.description = str3;
new Thread(new Runnable() {
@Override
public final void run() {
k5.this.d(wXMediaMessage, bitmap, i);
}
}).start();
}
public static IWXAPI getIWXAPI() {
if (a == null) {
a = initSocializeSharePlatform();
}
return a;
}
public static IWXAPI initSocializeSharePlatform() {
return null;
}
@Override
public void performShare(int i) {
int i2 = this.g;
if (i2 == 0) {
performShareApp(i);
} else if (i2 == 1) {
performShareInviteCode(i);
}
}
public void performShareApp(int i) {
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(((BitmapDrawable) ak.im.o1.get().getResources().getDrawable(BuildConfig.SHARE_LOGO)).getBitmap(), 100, 100, true);
String appName = AKApplication.getAppName();
if (i == 1) {
this.f3700d = this.f3701e;
} else {
this.f3700d = appName;
}
if (b()) {
g("http://a.app.qq.com/o/simple.jsp?pkgname=com.view.asim#opened", this.f3700d, this.f3701e, i, createScaledBitmap);
}
}
public void performShareInviteCode(int i) {
if (b()) {
f(i);
}
}
public void startShare(boolean z, String str) {
e(z, str);
}
public k5(Activity activity, Context context, int i, Bitmap bitmap) {
this.g = 0;
this.f3698b = activity;
this.f3699c = context;
this.g = i;
this.f = bitmap;
}
}