TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 ShareActionSheet.java 源代码,内容仅作参考
package com.tencent.biz.troopbar;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.tencent.biz.pubaccount.AccountDetailActivity;
import com.tencent.biz.pubaccount.PublicAccountBrowser;
import com.tencent.biz.pubaccount.PublicAccountJavascriptInterface;
import com.tencent.biz.qrcode.util.QRUtils;
import com.tencent.biz.widgets.ElasticHorScrView;
import com.tencent.common.app.AppInterface;
import com.tencent.mobileqq.activity.ForwardRecentActivity;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.PublicAccountHandler;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.forward.ForwardConstants;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.AbsStructMsg;
import com.tencent.mobileqq.structmsg.StructMsgFactory;
import com.tencent.mobileqq.utils.ShareMsgHelper;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.tim.wxapi.WXShareHelper;
import com.tencent.widget.ActionSheet;
import com.tencent.widget.ActionSheetHelper;
import cooperation.qzone.QZoneShareManager;
import java.util.ArrayList;
import java.util.List;
public class ShareActionSheet implements AdapterView.OnItemClickListener {
static String f83315a = "http://imgplat.store.qq.com/bqq_qfpic/520520/%s_%s_face/0";
protected float f6522a;
protected int f6523a;
protected Detail f6524a;
public ElasticHorScrView f6525a;
protected BaseActivity f6526a;
protected QQAppInterface f6527a;
public ActionSheet f6528a;
int f83316b;
protected String f6529b;
public class Detail {
String f83317a;
String f83318b;
String f83319c;
public Detail(String str, String str2, String str3) {
this.f83317a = str;
this.f83318b = str2;
this.f83319c = str3;
}
}
public ShareActionSheet(QQAppInterface qQAppInterface, BaseActivity baseActivity, Detail detail, int i, String str) {
this.f6527a = qQAppInterface;
this.f6526a = baseActivity;
this.f6522a = baseActivity.getResources().getDisplayMetrics().density;
this.f6524a = detail;
this.f6523a = i;
this.f6529b = str;
}
public void m1766a() {
if (this.f6528a == null) {
this.f6528a = (ActionSheet) ActionSheetHelper.a(this.f6526a, (View) null);
this.f6528a.b(a(), (LinearLayout.LayoutParams) null);
}
if (!this.f6528a.isShowing()) {
this.f6528a.show();
}
}
protected View a() {
List arrayList;
List arrayList2;
View inflate = this.f6526a.getLayoutInflater().inflate(R.layout.f56706name_res_0x7f030169, (ViewGroup) null);
this.f6525a = (ElasticHorScrView) inflate.findViewById(R.id.f48773name_res_0x7f0906a1);
((ElasticHorScrView) inflate.findViewById(R.id.f48775name_res_0x7f0906a3)).setVisibility(8);
GridView gridView = (GridView) inflate.findViewById(R.id.f48774name_res_0x7f0906a2);
TextView textView = (TextView) inflate.findViewById(R.id.f47786action_sheet_title);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
layoutParams.topMargin = (int) (13.0f * this.f6522a);
textView.setLayoutParams(layoutParams);
textView.setText(R.string.f63203cancel);
textView.setOnClickListener(new hvf(this));
if (Build.VERSION.SDK_INT >= 9) {
this.f6525a.setOverScrollMode(2);
}
List[] m1767a = m1767a();
if (m1767a.length > 0) {
arrayList = m1767a[0];
} else {
arrayList = new ArrayList(0);
}
if (m1767a.length > 1) {
arrayList2 = m1767a[1];
} else {
arrayList2 = new ArrayList(0);
}
int size = arrayList.size();
gridView.setNumColumns(size);
ViewGroup.LayoutParams layoutParams2 = gridView.getLayoutParams();
layoutParams2.width = (int) ((((size - 1) * 10) + (size * 75) + 3) * this.f6522a);
gridView.setLayoutParams(layoutParams2);
gridView.setAdapter((ListAdapter) new PublicAccountBrowser.ActionSheetItemAdapter(this.f6526a, 0, arrayList));
gridView.setSelector(new ColorDrawable(0));
gridView.setOnItemClickListener(this);
int i = layoutParams2.width;
this.f83316b = i;
arrayList2.size();
inflate.post(new hvg(this, i));
return inflate;
}
protected List[] m1767a() {
ArrayList arrayList = new ArrayList();
PublicAccountBrowser.ActionSheetItem actionSheetItem = new PublicAccountBrowser.ActionSheetItem();
actionSheetItem.f4003a = this.f6526a.getString(R.string.f60742name_res_0x7f0a0923);
actionSheetItem.B = R.drawable.f41658name_res_0x7f020245;
actionSheetItem.f4004a = true;
actionSheetItem.C = 2;
actionSheetItem.f4005b = "";
arrayList.add(actionSheetItem);
PublicAccountBrowser.ActionSheetItem actionSheetItem2 = new PublicAccountBrowser.ActionSheetItem();
actionSheetItem2.f4003a = this.f6526a.getString(R.string.f60749name_res_0x7f0a092a);
actionSheetItem2.B = R.drawable.f41659name_res_0x7f020246;
actionSheetItem2.f4004a = true;
actionSheetItem2.C = 3;
actionSheetItem2.f4005b = "";
arrayList.add(actionSheetItem2);
PublicAccountBrowser.ActionSheetItem actionSheetItem3 = new PublicAccountBrowser.ActionSheetItem();
actionSheetItem3.f4003a = this.f6526a.getString(R.string.f60759name_res_0x7f0a0934);
actionSheetItem3.B = R.drawable.f41661name_res_0x7f020248;
actionSheetItem3.C = 9;
actionSheetItem3.f4005b = "";
arrayList.add(actionSheetItem3);
PublicAccountBrowser.ActionSheetItem actionSheetItem4 = new PublicAccountBrowser.ActionSheetItem();
actionSheetItem4.f4003a = this.f6526a.getString(R.string.f60760name_res_0x7f0a0935);
actionSheetItem4.B = R.drawable.f41655name_res_0x7f020242;
actionSheetItem4.C = 10;
actionSheetItem4.f4005b = "";
arrayList.add(actionSheetItem4);
return new ArrayList[]{arrayList};
}
@Override
public void onItemClick(AdapterView adapterView, View view, int i, long j) {
Object tag = view.getTag();
if (tag != null) {
if (this.f6528a.isShowing()) {
this.f6528a.dismiss();
}
int i2 = ((PublicAccountBrowser.ActionSheetItemViewHolder) tag).f4008a.C;
switch (i2) {
case 2:
a((Activity) this.f6526a, this.f6524a, this.f6523a, this.f6529b);
PublicAccountHandler.a(this.f6527a, this.f6524a.f83317a, ReportController.q, "interest_data", "share_qq");
return;
case 3:
a(this.f6526a, this.f6524a, this.f6523a, this.f6529b);
PublicAccountHandler.a(this.f6527a, this.f6524a.f83317a, ReportController.q, "interest_data", "share_qzone");
return;
case 4:
case 5:
case 6:
case 7:
case 8:
default:
return;
case 9:
case 10:
a(this.f6526a, this.f6524a, this.f6523a, this.f6529b, i2);
PublicAccountHandler.a(this.f6527a, this.f6524a.f83317a, ReportController.q, "interest_data", i2 == 9 ? "share_wechat" : "share_circle");
ReportController.b(null, "dc01332", "Pb_account_lifeservice", this.f6524a.f83317a, "0X8005A2C", "0X8005A2C", 0, 0, "", "", "", "");
return;
}
}
}
public static void a(Activity activity, Detail detail, int i, String str) {
Intent intent = new Intent();
if (QLog.isColorLevel()) {
QLog.d("forward", 2, "ShareActionSheet shareToFriend");
}
intent.setClass(activity, ForwardRecentActivity.class);
intent.putExtra(ForwardConstants.p, true);
intent.putExtra("category", activity.getString(R.string.f60658name_res_0x7f0a08ce));
intent.putExtra(AppConstants.Key.G, 1001);
intent.putExtra(AppConstants.Key.bf, str);
intent.putExtra("title", detail.f83318b);
intent.putExtra(ForwardConstants.C, true);
intent.putExtra("desc", a(detail.f83319c));
intent.putExtra("req_type", 1);
intent.putExtra(AppConstants.Key.bR, "plugin");
intent.putExtra(PublicAccountJavascriptInterface.f4018c, detail.f83317a);
intent.putExtra(ForwardConstants.W_, "public_account");
String str2 = "";
String str3 = "";
if (i == 1) {
intent.putExtra(AppConstants.Key.bh, ShareMsgHelper.f33959a + detail.f83317a);
str2 = AppConstants.VALUE.f17435a + detail.f83317a;
str3 = "mqqapi://card/show_pslcard?src_type=internal&card_type=public_account&uin=" + detail.f83317a + "&version=1";
} else if (i == 2) {
long parseLong = Long.parseLong(detail.f83317a);
intent.putExtra(AppConstants.Key.bh, String.format(f83315a, Integer.valueOf((int) (parseLong % 256)), Long.valueOf(parseLong)));
str2 = "mqqapi://app/action?pkg=com.tencent.mobileqq&account_type=2&uintype=1024&cmp=com.tencent.biz.pubaccount.AccountDetailActivity&uin=" + detail.f83317a;
str3 = "mqqapi://card/show_pslcard?src_type=internal&card_type=qq_bussiness_account&uin=" + detail.f83317a + "&version=1";
}
intent.putExtra(AppConstants.Key.bS, str2);
intent.putExtra(AppConstants.Key.bT, str3);
AbsStructMsg a2 = StructMsgFactory.a(intent.getExtras());
if (a2 != null) {
intent.putExtra(AppConstants.Key.ci, a2.getBytes());
intent.putExtra(AccountDetailActivity.f3785h, true);
activity.startActivity(intent);
}
}
public static String a(String str) {
if (str.length() > 30 || str.getBytes().length > 100) {
if (str.length() > 30) {
str = str.substring(0, 30);
}
if (Math.min(str.getBytes().length, 100) == 100) {
int length = str.length() / 2;
StringBuilder sb = new StringBuilder(str.substring(0, length));
while (sb.toString().getBytes().length < 100) {
sb.append(str.charAt(length));
length++;
}
str = sb.toString();
}
return str + vfr.f78684a;
}
return str;
}
public static void a(BaseActivity baseActivity, Detail detail, int i, String str) {
Bundle bundle = new Bundle();
bundle.putString("title", detail.f83318b);
bundle.putString("desc", detail.f83319c);
bundle.putString(AppConstants.Key.bf, str);
ArrayList<String> arrayList = new ArrayList<>(1);
if (i == 1) {
arrayList.add(ShareMsgHelper.f33959a + detail.f83317a);
} else if (i == 2) {
try {
long parseLong = Long.parseLong(detail.f83317a);
arrayList.add(String.format(f83315a, Integer.valueOf((int) (parseLong % 256)), Long.valueOf(parseLong)));
} catch (Exception e) {
return;
}
}
bundle.putStringArrayList("image_url", arrayList);
bundle.putLong(AppConstants.Key.aU, 0L);
bundle.putString(PublicAccountJavascriptInterface.f4018c, detail.f83317a);
bundle.putBoolean(AccountDetailActivity.f3785h, true);
QZoneShareManager.m10877a((AppInterface) baseActivity.app, (Context) baseActivity, bundle, (DialogInterface.OnDismissListener) null);
}
public static void a(BaseActivity baseActivity, Detail detail, int i, String str, int i2) {
int i3;
if (!WXShareHelper.a().m10253a()) {
i3 = R.string.f64448name_res_0x7f0a179f;
} else {
i3 = !WXShareHelper.a().m10254b() ? R.string.f64449name_res_0x7f0a17a0 : -1;
}
if (i3 != -1) {
QRUtils.a(0, i3);
return;
}
String valueOf = String.valueOf(System.currentTimeMillis());
WXShareHelper.a().a(new hvh(valueOf));
WXShareHelper.a().a(valueOf, detail.f83318b, baseActivity.app.a(detail.f83317a, (byte) 1, true), detail.f83319c, str, i2 != 9 ? 1 : 0);
}
}