PageRenderTime 111ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/QingTingFanBianYi/src/fm/qingting/qtradio/share/ShareUtil.java

https://gitlab.com/qt-prometheus/qt-prometheus
Java | 926 lines | 891 code | 31 blank | 4 comment | 224 complexity | bfa029131cf1d9dbbd69dea2fe2dcf99 MD5 | raw file
  1. package fm.qingting.qtradio.share;
  2. import android.content.Context;
  3. import android.graphics.Bitmap;
  4. import android.graphics.BitmapFactory;
  5. import android.os.Handler;
  6. import android.os.Message;
  7. import android.widget.Toast;
  8. import com.alibaba.fastjson.JSON;
  9. import com.alibaba.fastjson.JSONObject;
  10. import com.tencent.weibo.sdk.android.model.ModelResult;
  11. import com.umeng.analytics.MobclickAgent;
  12. import fm.qingting.framework.controller.ViewController;
  13. import fm.qingting.framework.utils.ImageLoader;
  14. import fm.qingting.qtradio.controller.ControllerManager;
  15. import fm.qingting.qtradio.helper.ChannelHelper;
  16. import fm.qingting.qtradio.log.LogModule;
  17. import fm.qingting.qtradio.logger.QTLogger;
  18. import fm.qingting.qtradio.model.ActivityNode;
  19. import fm.qingting.qtradio.model.BroadcasterNode;
  20. import fm.qingting.qtradio.model.ChannelNode;
  21. import fm.qingting.qtradio.model.InfoManager;
  22. import fm.qingting.qtradio.model.Node;
  23. import fm.qingting.qtradio.model.ProgramNode;
  24. import fm.qingting.qtradio.model.RootNode;
  25. import fm.qingting.qtradio.model.ShareBean;
  26. import fm.qingting.qtradio.model.ShareObjectNode;
  27. import fm.qingting.qtradio.model.SpecialTopicNode;
  28. import fm.qingting.qtradio.notification.Constants;
  29. import fm.qingting.qtradio.room.SnsInfo;
  30. import fm.qingting.qtradio.room.UserInfo;
  31. import fm.qingting.qtradio.social.UserProfile;
  32. import fm.qingting.qtradio.tencentAgent.TencentAgent;
  33. import fm.qingting.qtradio.weiboAgent.WeiboAgent;
  34. import fm.qingting.social.ISocialEventListener;
  35. import fm.qingting.social.SocialEventListener;
  36. import fm.qingting.social.api.QQApi;
  37. import fm.qingting.social.api.QZoneApi;
  38. import fm.qingting.social.api.SinaWeiboApi;
  39. import fm.qingting.social.api.TencentWeiboApi;
  40. import fm.qingting.social.api.WechatApi;
  41. import fm.qingting.utils.DateUtil;
  42. import fm.qingting.utils.DeviceInfo;
  43. import fm.qingting.utils.QTMSGManage;
  44. import fm.qingting.utils.TimeUtil;
  45. import fm.qingting.utils.ViewCaptureUtil;
  46. import java.io.UnsupportedEncodingException;
  47. import java.net.URLEncoder;
  48. import java.util.Iterator;
  49. import java.util.List;
  50. public class ShareUtil
  51. {
  52. private static final String Default_Desc = "有声世界,无限精彩";
  53. public static final int PAGETYPE_AUDIO = 2;
  54. public static final int PAGETYPE_WEBPAGE = 1;
  55. public static final int PLATFORM_MOMENT = 1;
  56. public static final int PLATFORM_QQ = 3;
  57. public static final int PLATFORM_QZONE = 2;
  58. public static final int PLATFORM_SINA = 4;
  59. public static final int PLATFORM_TENCENT = 5;
  60. public static final int PLATFORM_WEIXIN = 0;
  61. private static final String ParaCatid = "catid";
  62. private static final String ParaChannelid = "channelid";
  63. private static final String ParaDeviceid = "deviceid";
  64. private static final String ParaFrom = "from";
  65. private static final String ParaOs = "os";
  66. private static final String ParaPagetype = "pagetype";
  67. private static final String ParaPid = "pid";
  68. private static final String ParaTargetType = "targettype";
  69. private static final String ParaTid = "tid";
  70. private static final String ParaTimestamp = "timestamp";
  71. private static final String ShareChannelTemplate = "我觉得%s不错哟";
  72. private static final String ShareContentCustom = "";
  73. private static final String SharePodcasterTemplate = "我觉得%s的节目不错哟";
  74. private static final String ShareProgramTemplate = "我正在收听%s";
  75. private static final String ShareTopicTemplate = "我觉得%s不错哟";
  76. private static String TAIL_TENCENT = " (分享自@蜻蜓fm)";
  77. private static String TAIL_WEIBO;
  78. public static final int TARGETTYPE_ACTIVITY = 4;
  79. public static final int TARGETTYPE_CHANNEL = 2;
  80. public static final int TARGETTYPE_PODCASTER = 5;
  81. public static final int TARGETTYPE_PROGRAM = 1;
  82. public static final int TARGETTYPE_TOPIC = 3;
  83. private static final Handler mHandler = new Handler()
  84. {
  85. public void handleMessage(Message paramAnonymousMessage)
  86. {
  87. if (paramAnonymousMessage == null);
  88. Context localContext;
  89. do
  90. {
  91. return;
  92. localContext = InfoManager.getInstance().getContext();
  93. }
  94. while (localContext == null);
  95. switch (paramAnonymousMessage.what)
  96. {
  97. default:
  98. return;
  99. case 1:
  100. Toast.makeText(localContext, "分享成功", 0).show();
  101. MobclickAgent.onEvent(localContext, "ShareResult", "succ_" + ShareUtil.mSharePlatformName);
  102. ShareUtil.sendShareText(ShareUtil.mSharePlatformName, ShareUtil.mShareNode);
  103. return;
  104. case 2:
  105. Toast.makeText(localContext, "分享失败", 0).show();
  106. MobclickAgent.onEvent(localContext, "ShareResult", "failed_" + ShareUtil.mSharePlatformName);
  107. ShareUtil.sendShareText(ShareUtil.mSharePlatformName, ShareUtil.mShareNode);
  108. return;
  109. case 3:
  110. Toast.makeText(localContext, "分享取消", 0).show();
  111. MobclickAgent.onEvent(localContext, "ShareResult", "cancel_" + ShareUtil.mSharePlatformName);
  112. return;
  113. case 4:
  114. Toast.makeText(localContext, "邀请成功", 0).show();
  115. MobclickAgent.onEvent(localContext, "ShareResult", "succ_" + ShareUtil.mSharePlatformName);
  116. return;
  117. case 5:
  118. Toast.makeText(localContext, "邀请失败", 0).show();
  119. MobclickAgent.onEvent(localContext, "ShareResult", "failed_" + ShareUtil.mSharePlatformName);
  120. return;
  121. case 6:
  122. Toast.makeText(localContext, "取消邀请", 0).show();
  123. MobclickAgent.onEvent(localContext, "ShareResult", "cancel_" + ShareUtil.mSharePlatformName);
  124. return;
  125. case 7:
  126. }
  127. Toast.makeText(localContext, "请先安装或更新微信", 0).show();
  128. }
  129. };
  130. private static Node mShareNode;
  131. private static String mSharePlatformName;
  132. static
  133. {
  134. TAIL_WEIBO = " (分享自@蜻蜓FM)";
  135. }
  136. private static String composeTrackUrl(String paramString, int paramInt1, int paramInt2, int paramInt3, ProgramLocation paramProgramLocation, Context paramContext)
  137. {
  138. String str = paramString;
  139. if (paramString.startsWith("http"))
  140. str = paramString.substring(paramString.indexOf("/", 8));
  141. StringBuilder localStringBuilder = new StringBuilder().append("http://share.qingting.fm").append(str);
  142. if (str.indexOf("?") == -1);
  143. for (paramString = "?"; ; paramString = "&")
  144. {
  145. str = paramString + "pagetype" + "=" + paramInt1 + "&" + "targettype" + "=" + paramInt2 + "&" + "timestamp" + "=" + DateUtil.getCurrentSeconds() + "&" + "from" + "=" + paramInt3 + "&" + "os" + "=1" + "&" + "deviceid" + "=" + DeviceInfo.getUniqueId(paramContext) + "&av=6";
  146. paramContext = str;
  147. if (paramProgramLocation != null)
  148. {
  149. paramString = str;
  150. if (paramProgramLocation.catId != 0)
  151. paramString = str + "&catid=" + paramProgramLocation.catId;
  152. paramContext = paramString;
  153. if (paramProgramLocation.channelId != 0)
  154. paramContext = paramString + "&channelid=" + paramProgramLocation.channelId;
  155. paramString = paramContext;
  156. if (paramProgramLocation.pId != 0)
  157. paramString = paramContext + "&pid=" + paramProgramLocation.pId;
  158. paramContext = paramString;
  159. if (paramProgramLocation.tId != 0)
  160. paramContext = paramString + "&tid=" + paramProgramLocation.tId;
  161. }
  162. return paramContext;
  163. }
  164. }
  165. private static String getBroadcastors(ChannelNode paramChannelNode, ProgramNode paramProgramNode)
  166. {
  167. StringBuffer localStringBuffer = new StringBuffer();
  168. if ((paramChannelNode != null) && (paramChannelNode.lstPodcasters != null))
  169. {
  170. paramChannelNode = paramChannelNode.lstPodcasters.iterator();
  171. while (paramChannelNode.hasNext())
  172. {
  173. UserInfo localUserInfo = (UserInfo)paramChannelNode.next();
  174. if ((localUserInfo.snsInfo != null) && (localUserInfo.snsInfo.sns_account.trim().length() > 0) && (localUserInfo.snsInfo.sns_name.trim().length() > 0))
  175. localStringBuffer.append(" ,@" + localUserInfo.snsInfo.sns_name.trim());
  176. }
  177. }
  178. if ((paramProgramNode != null) && (paramProgramNode.lstBroadcaster != null))
  179. {
  180. paramChannelNode = paramProgramNode.lstBroadcaster.iterator();
  181. while (paramChannelNode.hasNext())
  182. {
  183. paramProgramNode = (BroadcasterNode)paramChannelNode.next();
  184. if ((paramProgramNode.weiboName != null) && (paramProgramNode.weiboName.trim().length() > 0) && (!paramProgramNode.weiboName.equalsIgnoreCase("未知")))
  185. localStringBuffer.append(" ,@" + paramProgramNode.weiboName.trim());
  186. }
  187. }
  188. if (localStringBuffer.length() > 0)
  189. return " 主播:" + localStringBuffer.substring(2);
  190. return "";
  191. }
  192. public static int getPlatFormNum(int paramInt)
  193. {
  194. switch (paramInt)
  195. {
  196. default:
  197. return 0;
  198. case 0:
  199. return 1;
  200. case 1:
  201. return 2;
  202. case 4:
  203. return 3;
  204. case 5:
  205. return 4;
  206. case 3:
  207. return 5;
  208. case 2:
  209. }
  210. return 6;
  211. }
  212. public static String getPreMessage(Node paramNode)
  213. {
  214. String str = "";
  215. if ((paramNode instanceof ChannelNode))
  216. str = String.format("我正在收听《%s》~", new Object[] { ((ChannelNode)paramNode).title });
  217. do
  218. {
  219. return str;
  220. if ((paramNode instanceof ProgramNode))
  221. return String.format("我正在收听《%s》~", new Object[] { ((ProgramNode)paramNode).title });
  222. if ((paramNode instanceof SpecialTopicNode))
  223. return String.format("我正在浏览《%s》~", new Object[] { ((SpecialTopicNode)paramNode).title });
  224. if ((paramNode instanceof UserInfo))
  225. return String.format("我觉得【%s】的节目不错~", new Object[] { ((UserInfo)paramNode).podcasterName });
  226. }
  227. while (!(paramNode instanceof ActivityNode));
  228. paramNode = (ActivityNode)paramNode;
  229. return getShareTitle(paramNode.name, paramNode.infoTitle);
  230. }
  231. private static Bitmap getShareBitmap(Context paramContext, String paramString)
  232. {
  233. Object localObject2 = null;
  234. Object localObject1 = localObject2;
  235. if (paramString != null)
  236. {
  237. localObject1 = localObject2;
  238. if (!paramString.equalsIgnoreCase(""))
  239. localObject1 = ImageLoader.getInstance(paramContext).getImage(paramString, 200, 200);
  240. }
  241. if (localObject1 != null)
  242. return localObject1;
  243. return BitmapFactory.decodeResource(paramContext.getResources(), 2130837804);
  244. }
  245. private static ShareInfoBean getShareInfoBean(Node paramNode, int paramInt, Context paramContext, String paramString)
  246. {
  247. if (paramNode == null)
  248. return null;
  249. int j = getPlatFormNum(paramInt);
  250. int i = 0;
  251. ShareInfoBean localShareInfoBean = new ShareInfoBean();
  252. localShareInfoBean.content = "";
  253. localShareInfoBean.path = new ProgramLocation();
  254. Object localObject1;
  255. if ((paramNode instanceof ChannelNode))
  256. {
  257. localObject1 = (ChannelNode)paramNode;
  258. localShareInfoBean.path.catId = ((ChannelNode)localObject1).categoryId;
  259. localShareInfoBean.path.channelId = ((ChannelNode)localObject1).channelId;
  260. localShareInfoBean.parentCover = ((ChannelNode)localObject1).getApproximativeThumb();
  261. if ((paramString == null) || (paramString.equalsIgnoreCase("")))
  262. localShareInfoBean.content = String.format("我觉得%s不错哟", new Object[] { getShareTitle(((ChannelNode)localObject1).title, null) });
  263. localShareInfoBean.content += getBroadcastors((ChannelNode)localObject1, null);
  264. if (((ChannelNode)localObject1).channelType != 0)
  265. break label327;
  266. localShareInfoBean.pageUrl = ("/channels/" + ((ChannelNode)localObject1).channelId);
  267. localShareInfoBean.playUrl = ("/live/" + ((ChannelNode)localObject1).resId + ".m3u8");
  268. localShareInfoBean.description = ((ChannelNode)localObject1).title;
  269. localShareInfoBean.title = ((ChannelNode)localObject1).title;
  270. i = 2;
  271. }
  272. ChannelNode localChannelNode;
  273. while ((paramNode instanceof ProgramNode))
  274. {
  275. localObject1 = (ProgramNode)paramNode;
  276. localShareInfoBean.path.catId = ((ProgramNode)localObject1).getCategoryId();
  277. localShareInfoBean.path.channelId = ((ProgramNode)localObject1).channelId;
  278. localShareInfoBean.path.pId = ((ProgramNode)localObject1).id;
  279. localChannelNode = ChannelHelper.getInstance().getChannel((ProgramNode)localObject1);
  280. if (localChannelNode == null)
  281. {
  282. return null;
  283. label327: localShareInfoBean.pageUrl = ("/vchannels/" + ((ChannelNode)localObject1).channelId);
  284. localShareInfoBean.title = ((ChannelNode)localObject1).title;
  285. localShareInfoBean.description = ((ChannelNode)localObject1).desc;
  286. i = 2;
  287. }
  288. else
  289. {
  290. if ((paramString == null) || (paramString.equalsIgnoreCase("")))
  291. localShareInfoBean.content = String.format("我正在收听%s", new Object[] { getShareTitle(localChannelNode.title, ((ProgramNode)localObject1).title) });
  292. localShareInfoBean.content += getBroadcastors(localChannelNode, (ProgramNode)localObject1);
  293. log(localShareInfoBean.content);
  294. localShareInfoBean.parentCover = localChannelNode.getApproximativeThumb();
  295. if ((localShareInfoBean.parentCover == null) && (((ProgramNode)localObject1).isDownloadProgram()))
  296. {
  297. localObject2 = ChannelHelper.getInstance().getChannel(((ProgramNode)localObject1).channelId, 1);
  298. if (localObject2 != null)
  299. localShareInfoBean.parentCover = ((ChannelNode)localObject2).getApproximativeThumb();
  300. }
  301. localShareInfoBean.title = ((ProgramNode)localObject1).title;
  302. localShareInfoBean.description = localChannelNode.title;
  303. if (localChannelNode.channelType != 0)
  304. break label1032;
  305. localShareInfoBean.pageUrl = ("/channels/" + localChannelNode.channelId + "/from/" + TimeUtil.msToDate6(((ProgramNode)localObject1).getAbsoluteStartTime() * 1000L) + "/to/" + TimeUtil.msToDate6(((ProgramNode)localObject1).getAbsoluteEndTime() * 1000L));
  306. if ((localChannelNode.channelType != 0) && (!((ProgramNode)localObject1).mLiveInVirtual))
  307. break label1088;
  308. Object localObject2 = new StringBuilder().append("/cache/");
  309. if (((ProgramNode)localObject1).resId <= 0)
  310. break label1078;
  311. i = ((ProgramNode)localObject1).resId;
  312. label666: localShareInfoBean.playUrl = (i + ".m3u8" + "?start=" + TimeUtil.msToDate10(((ProgramNode)localObject1).getAbsoluteStartTime() * 1000L) + "&end=" + TimeUtil.msToDate10(((ProgramNode)localObject1).getAbsoluteEndTime() * 1000L));
  313. i = 1;
  314. }
  315. }
  316. label732: if ((paramNode instanceof SpecialTopicNode))
  317. {
  318. i = 3;
  319. paramNode = (SpecialTopicNode)paramNode;
  320. localShareInfoBean.pageUrl = ("/topics/" + paramNode.getApiId());
  321. localShareInfoBean.title = paramNode.title;
  322. localShareInfoBean.parentCover = paramNode.thumb;
  323. if ((paramString == null) || (paramString.equalsIgnoreCase("")))
  324. localShareInfoBean.content = String.format("我觉得%s不错哟", new Object[] { getShareTitle(paramNode.title, null) });
  325. localShareInfoBean.description = paramNode.desc;
  326. }
  327. while (true)
  328. {
  329. localShareInfoBean.pageUrl = composeTrackUrl(localShareInfoBean.pageUrl, 1, i, j, localShareInfoBean.path, paramContext);
  330. if (localShareInfoBean.playUrl != null)
  331. localShareInfoBean.playUrl = composeTrackUrl(localShareInfoBean.playUrl, 2, i, j, localShareInfoBean.path, paramContext);
  332. localShareInfoBean.content = (localShareInfoBean.content + " " + localShareInfoBean.pageUrl + getTail(paramInt));
  333. if ((paramInt == 4) && (localShareInfoBean.content != null))
  334. {
  335. localShareInfoBean.content += " ";
  336. localShareInfoBean.content += InfoManager.getInstance().getShareTag();
  337. }
  338. if (localShareInfoBean.description == null)
  339. localShareInfoBean.description = "有声世界,无限精彩";
  340. return localShareInfoBean;
  341. label1032: localShareInfoBean.pageUrl = ("/vchannels/" + ((ProgramNode)localObject1).channelId + "/programs/" + ((ProgramNode)localObject1).id);
  342. break;
  343. label1078: i = localChannelNode.resId;
  344. break label666;
  345. label1088: if ((((ProgramNode)localObject1).lstAudioPath != null) && (((ProgramNode)localObject1).lstAudioPath.size() > 0))
  346. {
  347. localShareInfoBean.playUrl = ("/" + (String)((ProgramNode)localObject1).lstAudioPath.get(((ProgramNode)localObject1).lstAudioPath.size() - 1));
  348. i = 1;
  349. break label732;
  350. }
  351. localObject1 = ((ProgramNode)localObject1).getSharedSourcePath();
  352. if ((localObject1 != null) && (!((String)localObject1).equalsIgnoreCase("")))
  353. {
  354. localShareInfoBean.playUrl = ((String)localObject1);
  355. i = 1;
  356. break label732;
  357. }
  358. return null;
  359. if ((paramNode instanceof UserInfo))
  360. {
  361. i = 5;
  362. paramNode = (UserInfo)paramNode;
  363. localShareInfoBean.pageUrl = ("/podcasters/" + paramNode.podcasterId);
  364. localShareInfoBean.title = ("蜻蜓FM主播: " + paramNode.podcasterName);
  365. localShareInfoBean.parentCover = paramNode.snsInfo.sns_avatar;
  366. if ((paramString == null) || (paramString.equalsIgnoreCase("")))
  367. localShareInfoBean.content = String.format("我觉得%s的节目不错哟", new Object[] { getShareTitle(paramNode.podcasterName, null) });
  368. if ((paramNode.snsInfo.sns_account.trim().length() > 0) && (paramNode.snsInfo.sns_name.trim().length() > 0))
  369. localShareInfoBean.content = (localShareInfoBean.content + "@" + paramNode.snsInfo.sns_name);
  370. localShareInfoBean.description = ("主播" + paramNode.podcasterName + "已经入驻蜻蜓FM了,赶紧来听听TA的节目吧");
  371. }
  372. else if ((paramNode instanceof ActivityNode))
  373. {
  374. localShareInfoBean.pageUrl = ((ActivityNode)paramNode).contentUrl;
  375. localShareInfoBean.title = ((ActivityNode)paramNode).name;
  376. localShareInfoBean.description = ((ActivityNode)paramNode).infoTitle;
  377. if ((localShareInfoBean.description == null) || (localShareInfoBean.description.equalsIgnoreCase("")))
  378. localShareInfoBean.description = localShareInfoBean.title;
  379. localShareInfoBean.content = (" " + localShareInfoBean.pageUrl + getTail(paramInt));
  380. localShareInfoBean.playUrl = null;
  381. localShareInfoBean.parentCover = ((ActivityNode)paramNode).infoUrl;
  382. return localShareInfoBean;
  383. }
  384. }
  385. }
  386. private static String getShareTitle(String paramString1, String paramString2)
  387. {
  388. String str2 = "";
  389. String str1 = str2;
  390. if (paramString1 != null)
  391. {
  392. str1 = str2;
  393. if (!paramString1.equalsIgnoreCase(""))
  394. str1 = "" + "【" + normalizeTitle(paramString1) + "】";
  395. }
  396. paramString1 = str1;
  397. if (paramString2 != null)
  398. paramString1 = str1 + normalizeTitle(paramString2);
  399. return paramString1;
  400. }
  401. private static String getTail(int paramInt)
  402. {
  403. if (paramInt == 4)
  404. return TAIL_WEIBO;
  405. return TAIL_TENCENT;
  406. }
  407. public static String getTypeString(int paramInt)
  408. {
  409. switch (paramInt)
  410. {
  411. default:
  412. return "分享";
  413. case 0:
  414. return "微信好友";
  415. case 1:
  416. return "微信朋友圈";
  417. case 2:
  418. return "QQ空间";
  419. case 3:
  420. return "QQ好友";
  421. case 4:
  422. return "新浪微博";
  423. case 5:
  424. }
  425. return "腾讯微博";
  426. }
  427. public static void inviteByPlatform(Context paramContext, Node paramNode, int paramInt)
  428. {
  429. if (paramNode == null)
  430. return;
  431. shareToPlatform(paramContext, paramNode, paramInt, Boolean.valueOf(true));
  432. }
  433. public static void inviteByPlatformIm(Context paramContext, int paramInt, String paramString)
  434. {
  435. paramString = InfoManager.getInstance().root().getCurrentPlayingNode();
  436. if (paramString == null)
  437. return;
  438. shareToPlatform(paramContext, paramString, paramInt, Boolean.valueOf(true));
  439. }
  440. private static void log(String paramString)
  441. {
  442. }
  443. private static String normalizeTitle(String paramString)
  444. {
  445. return paramString.trim();
  446. }
  447. private static void sendLog(Node paramNode, int paramInt)
  448. {
  449. if (paramNode.nodeName.equalsIgnoreCase("program"))
  450. {
  451. paramNode = QTLogger.getInstance().buildShareLog((ProgramNode)paramNode, paramInt);
  452. if (paramNode != null)
  453. LogModule.getInstance().send(Constants.ShareLogType, paramNode);
  454. }
  455. do
  456. {
  457. do
  458. {
  459. do
  460. return;
  461. while ((!paramNode.nodeName.equalsIgnoreCase("channel")) || (!((ChannelNode)paramNode).isLiveChannel()));
  462. paramNode = ((ChannelNode)paramNode).getProgramNodeByTime(System.currentTimeMillis());
  463. }
  464. while ((paramNode == null) || (!paramNode.available));
  465. paramNode = QTLogger.getInstance().buildShareLog(paramNode, paramInt);
  466. }
  467. while (paramNode == null);
  468. LogModule.getInstance().send(Constants.ShareLogType, paramNode);
  469. }
  470. private static void sendShareText(String paramString, Node paramNode)
  471. {
  472. if ((paramNode == null) || (paramString == null));
  473. label278:
  474. while (true)
  475. {
  476. return;
  477. ShareBean localShareBean = new ShareBean();
  478. localShareBean.platform = paramString;
  479. if (InfoManager.getInstance().getUserProfile().getUserInfo() != null);
  480. for (paramString = InfoManager.getInstance().getUserProfile().getUserInfo().snsInfo.sns_id; ; paramString = null)
  481. {
  482. if (paramNode == null)
  483. break label278;
  484. if (paramNode.nodeName.equalsIgnoreCase("program"))
  485. {
  486. localShareBean.channelType = ((ProgramNode)paramNode).channelType;
  487. localShareBean.programId = ((ProgramNode)paramNode).uniqueId;
  488. if (localShareBean.channelType == 0)
  489. {
  490. paramNode = InfoManager.getInstance().root().getCurrentPlayingChannelNode();
  491. if (paramNode == null)
  492. break;
  493. localShareBean.categoryId = paramNode.categoryId;
  494. }
  495. for (localShareBean.channelId = paramNode.channelId; ; localShareBean.channelId = ((ProgramNode)paramNode).channelId)
  496. {
  497. localShareBean.snsId = paramString;
  498. localShareBean.time = (System.currentTimeMillis() / 1000L);
  499. paramString = QTLogger.getInstance().buildPublishLog(localShareBean);
  500. if (paramString == null)
  501. break;
  502. LogModule.getInstance().send("Share", paramString);
  503. return;
  504. localShareBean.categoryId = ((ProgramNode)paramNode).getCategoryId();
  505. }
  506. }
  507. if (!paramNode.nodeName.equalsIgnoreCase("channel"))
  508. break;
  509. localShareBean.channelType = ((ChannelNode)paramNode).channelType;
  510. localShareBean.categoryId = ((ChannelNode)paramNode).categoryId;
  511. localShareBean.channelId = ((ChannelNode)paramNode).channelId;
  512. localShareBean.snsId = paramString;
  513. localShareBean.time = (System.currentTimeMillis() / 1000L);
  514. paramString = QTLogger.getInstance().buildPublishLog(localShareBean);
  515. if (paramString == null)
  516. break;
  517. LogModule.getInstance().send("Share", paramString);
  518. return;
  519. }
  520. }
  521. }
  522. public static void shareToPlatform(Context paramContext, Node paramNode, int paramInt)
  523. {
  524. shareToPlatform(paramContext, paramNode, paramInt, Boolean.valueOf(false));
  525. }
  526. public static void shareToPlatform(Context paramContext, Node paramNode, int paramInt, Boolean paramBoolean)
  527. {
  528. if (paramNode == null)
  529. return;
  530. Object localObject2;
  531. Object localObject1;
  532. Object localObject4;
  533. String str;
  534. Object localObject5;
  535. SocialEventListener local3;
  536. while (true)
  537. {
  538. try
  539. {
  540. if (!(paramNode instanceof ShareObjectNode))
  541. break;
  542. localObject3 = (ShareObjectNode)paramNode;
  543. localObject2 = ((ShareObjectNode)localObject3).message;
  544. localObject1 = ((ShareObjectNode)localObject3).node;
  545. paramInt = ((ShareObjectNode)localObject3).type;
  546. localObject4 = getShareInfoBean((Node)localObject1, paramInt, paramContext, (String)localObject2);
  547. ((ShareInfoBean)localObject4).content = ((String)localObject2 + ((ShareInfoBean)localObject4).content);
  548. localObject2 = ((ShareInfoBean)localObject4).pageUrl;
  549. str = ((ShareInfoBean)localObject4).playUrl;
  550. localObject5 = ((ShareInfoBean)localObject4).title;
  551. localObject3 = "http://qingting.fm";
  552. if ((((ShareInfoBean)localObject4).parentCover != null) && (!((ShareInfoBean)localObject4).parentCover.equalsIgnoreCase("")))
  553. {
  554. localObject1 = ((ShareInfoBean)localObject4).parentCover;
  555. local3 = new SocialEventListener()
  556. {
  557. public void onCancel(Object paramAnonymousObject)
  558. {
  559. if ((ShareUtil.mSharePlatformName == "weibo") || (ShareUtil.mSharePlatformName == "tencent"))
  560. {
  561. paramAnonymousObject = ShareUtil.mHandler;
  562. if (!this.val$isInvite.booleanValue())
  563. break label49;
  564. }
  565. label49: for (int i = 6; ; i = 3)
  566. {
  567. paramAnonymousObject = Message.obtain(paramAnonymousObject, i, null);
  568. ShareUtil.mHandler.sendMessage(paramAnonymousObject);
  569. return;
  570. }
  571. }
  572. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  573. {
  574. if (ShareUtil.mSharePlatformName == "weibo")
  575. {
  576. WeiboAgent.getInstance().onSocialLogin(paramAnonymousObject1);
  577. paramAnonymousObject1 = ShareUtil.mHandler;
  578. if (!this.val$isInvite.booleanValue())
  579. break label65;
  580. }
  581. label65: for (int i = 4; ; i = 1)
  582. {
  583. paramAnonymousObject1 = Message.obtain(paramAnonymousObject1, i, null);
  584. ShareUtil.mHandler.sendMessage(paramAnonymousObject1);
  585. return;
  586. if (ShareUtil.mSharePlatformName != "tencent")
  587. break;
  588. TencentAgent.getInstance().onSocialLogin(paramAnonymousObject1);
  589. break;
  590. }
  591. }
  592. public void onException(Object paramAnonymousObject)
  593. {
  594. if (this.val$isInvite.booleanValue());
  595. for (int i = 5; ; i = 2)
  596. {
  597. paramAnonymousObject = Message.obtain(ShareUtil.mHandler, i, null);
  598. ShareUtil.mHandler.sendMessage(paramAnonymousObject);
  599. return;
  600. }
  601. }
  602. };
  603. mShareNode = paramNode;
  604. if (!mShareNode.nodeName.equalsIgnoreCase("specialtopic"))
  605. break label792;
  606. QTMSGManage.getInstance().sendStatistcsMessage("sharespecialtopic", String.valueOf(paramInt));
  607. break label792;
  608. mSharePlatformName = "wechat";
  609. if (str != null)
  610. break label237;
  611. WechatApi.shareWebPage(paramContext, (String)localObject2, (String)localObject5, ((ShareInfoBean)localObject4).description, getShareBitmap(paramContext, (String)localObject1), Boolean.valueOf(false), local3);
  612. sendLog(paramNode, Constants.SHARE_WECHAT);
  613. return;
  614. }
  615. }
  616. catch (Exception paramContext)
  617. {
  618. log(paramContext.toString());
  619. return;
  620. }
  621. localObject1 = "http://s1.qingting.fm/images/qt_logo.jpg";
  622. continue;
  623. label237: WechatApi.shareAudio(paramContext, (String)localObject2, str, (String)localObject5, ((ShareInfoBean)localObject4).description, getShareBitmap(paramContext, (String)localObject1), Boolean.valueOf(false), local3);
  624. }
  625. mSharePlatformName = "wechatfriend";
  626. if (str == null)
  627. WechatApi.shareWebPage(paramContext, (String)localObject2, (String)localObject5, ((ShareInfoBean)localObject4).description, getShareBitmap(paramContext, (String)localObject1), Boolean.valueOf(true), local3);
  628. while (true)
  629. {
  630. sendLog(paramNode, Constants.SHARE_MOMENTS);
  631. return;
  632. WechatApi.shareAudio(paramContext, (String)localObject2, str, (String)localObject5, ((ShareInfoBean)localObject4).description, getShareBitmap(paramContext, (String)localObject1), Boolean.valueOf(true), local3);
  633. }
  634. mSharePlatformName = "qzone";
  635. Object localObject3 = ((ShareInfoBean)localObject4).description;
  636. if (localObject2 == null)
  637. {
  638. paramBoolean = "http://qingting.fm";
  639. label363: QZoneApi.share(paramContext, (String)localObject5, (String)localObject3, paramBoolean, (String)localObject1, "蜻蜓FM", local3);
  640. sendLog(paramNode, Constants.SHARE_QZONE);
  641. return;
  642. mSharePlatformName = "qqfriend";
  643. localObject4 = ((ShareInfoBean)localObject4).description;
  644. if (localObject2 != null)
  645. break label839;
  646. paramBoolean = (Boolean)localObject3;
  647. label408: QQApi.share(paramContext, (String)localObject5, (String)localObject4, (String)localObject1, paramBoolean, str, local3);
  648. sendLog(paramNode, Constants.SHARE_QQ);
  649. return;
  650. localObject1 = ((ShareInfoBean)localObject4).parentCover;
  651. paramBoolean = (Boolean)localObject1;
  652. if (localObject1 == null)
  653. {
  654. localObject2 = ControllerManager.getInstance().getLastViewController();
  655. paramBoolean = (Boolean)localObject1;
  656. if (((ViewController)localObject2).controllerName.equalsIgnoreCase("mainplayview"))
  657. {
  658. ViewCaptureUtil.setScreenView(((ViewController)localObject2).getView());
  659. ViewCaptureUtil.captureViewPath();
  660. paramBoolean = ViewCaptureUtil.getViewPath();
  661. }
  662. }
  663. mSharePlatformName = "weibo";
  664. if (paramBoolean == null)
  665. break label845;
  666. localObject1 = paramBoolean;
  667. if (paramBoolean == "")
  668. break label845;
  669. label508: if (((String)localObject1).startsWith("http"))
  670. SinaWeiboApi.shareImage(paramContext, ((ShareInfoBean)localObject4).content, (String)localObject1, "", "", local3);
  671. while (true)
  672. {
  673. sendLog(paramNode, Constants.SHARE_WEIBO);
  674. return;
  675. SinaWeiboApi.shareLocalImage(paramContext, ((ShareInfoBean)localObject4).content, (String)localObject1, local3);
  676. }
  677. mSharePlatformName = "tencent";
  678. localObject2 = ((ShareInfoBean)localObject4).playUrl;
  679. paramBoolean = ((ShareInfoBean)localObject4).content;
  680. if ((localObject2 != null) && (((String)localObject2).length() > 80) && (paramBoolean != null))
  681. if (paramBoolean == null)
  682. {
  683. paramInt = -1;
  684. localObject3 = paramBoolean.substring(0, paramInt);
  685. paramBoolean = paramBoolean.substring(paramInt);
  686. if (paramBoolean.indexOf(" ") <= 0)
  687. break label853;
  688. localObject1 = paramBoolean.substring(0, paramBoolean.indexOf(" "));
  689. paramBoolean = paramBoolean.substring(paramBoolean.indexOf(" "));
  690. }
  691. }
  692. while (true)
  693. {
  694. localObject5 = new SocialEventListener()
  695. {
  696. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  697. {
  698. paramAnonymousObject1 = (ModelResult)paramAnonymousObject1;
  699. if (paramAnonymousObject1 == null);
  700. do
  701. {
  702. do
  703. return;
  704. while (!paramAnonymousObject1.isSuccess());
  705. paramAnonymousObject1 = (JSONObject)JSON.parse(paramAnonymousObject1.getObj().toString());
  706. }
  707. while (paramAnonymousObject1 == null);
  708. paramAnonymousObject1 = paramAnonymousObject1.getJSONObject("data");
  709. paramAnonymousObject1 = "http://url.cn/" + paramAnonymousObject1.getString("short_url");
  710. paramAnonymousObject2 = (String)getValue("message");
  711. String str = (String)getValue("suffix");
  712. SocialEventListener local1 = new SocialEventListener()
  713. {
  714. public void onComplete(Object paramAnonymous2Object1, Object paramAnonymous2Object2)
  715. {
  716. paramAnonymous2Object1 = (ModelResult)paramAnonymous2Object1;
  717. if (paramAnonymous2Object1.isSuccess())
  718. {
  719. paramAnonymous2Object1 = ((JSONObject)JSON.parse(paramAnonymous2Object1.getObj().toString())).getJSONObject("data");
  720. paramAnonymous2Object1 = "http://url.cn/" + paramAnonymous2Object1.getString("short_url");
  721. paramAnonymous2Object2 = (String)getValue("message");
  722. String str = (String)getValue("suffix");
  723. paramAnonymous2Object1 = paramAnonymous2Object2 + paramAnonymous2Object1 + str;
  724. paramAnonymous2Object2 = (String)getValue("playUrl");
  725. TencentWeiboApi.shareMusic(ShareUtil.4.this.val$context, paramAnonymous2Object1, paramAnonymous2Object2, (String)getValue("title"), "蜻蜓FM", (SocialEventListener)getValue("listener"));
  726. }
  727. }
  728. };
  729. local1.setValue("message", paramAnonymousObject2);
  730. local1.setValue("suffix", str);
  731. local1.setValue("title", getValue("title"));
  732. local1.setValue("playUrl", paramAnonymousObject1);
  733. local1.setValue("listener", getValue("listener"));
  734. paramAnonymousObject1 = (String)getValue("contentLink");
  735. try
  736. {
  737. paramAnonymousObject2 = URLEncoder.encode(paramAnonymousObject1, "UTF-8");
  738. paramAnonymousObject1 = paramAnonymousObject2;
  739. TencentWeiboApi.getShortLink(this.val$context, paramAnonymousObject1, local1);
  740. return;
  741. }
  742. catch (UnsupportedEncodingException paramAnonymousObject2)
  743. {
  744. while (true)
  745. paramAnonymousObject2.printStackTrace();
  746. }
  747. }
  748. };
  749. ((SocialEventListener)localObject5).setValue("message", localObject3);
  750. ((SocialEventListener)localObject5).setValue("contentLink", localObject1);
  751. ((SocialEventListener)localObject5).setValue("suffix", paramBoolean);
  752. ((SocialEventListener)localObject5).setValue("title", ((ShareInfoBean)localObject4).title);
  753. ((SocialEventListener)localObject5).setValue("playUrl", localObject2);
  754. ((SocialEventListener)localObject5).setValue("listener", local3);
  755. while (true)
  756. {
  757. try
  758. {
  759. paramBoolean = URLEncoder.encode((String)localObject2, "UTF-8");
  760. TencentWeiboApi.getShortLink(paramContext, paramBoolean, (ISocialEventListener)localObject5);
  761. sendLog(paramNode, Constants.SHARE_TENCENT);
  762. return;
  763. paramInt = paramBoolean.indexOf("http://share.qingting.fm/");
  764. }
  765. catch (UnsupportedEncodingException paramBoolean)
  766. {
  767. paramBoolean.printStackTrace();
  768. paramBoolean = (Boolean)localObject2;
  769. continue;
  770. }
  771. TencentAgent.getInstance().publishTencentWeibo((ShareInfoBean)localObject4);
  772. }
  773. localObject2 = "";
  774. localObject1 = paramNode;
  775. break;
  776. label792: switch (paramInt)
  777. {
  778. case 0:
  779. case 1:
  780. case 2:
  781. case 3:
  782. case 4:
  783. case 5:
  784. }
  785. return;
  786. paramBoolean = (Boolean)localObject2;
  787. break label363;
  788. label839: paramBoolean = (Boolean)localObject2;
  789. break label408;
  790. label845: localObject1 = "http://s1.qingting.fm/images/qt_logo.jpg";
  791. break label508;
  792. label853: localObject1 = paramBoolean;
  793. }
  794. }
  795. public static void shareToPlatform(String paramString, final int paramInt1, int paramInt2)
  796. {
  797. if ((paramString == null) || (paramString.equalsIgnoreCase("")));
  798. do
  799. {
  800. return;
  801. if (WeiboAgent.getInstance().isLoggedIn().booleanValue())
  802. {
  803. SinaWeiboApi.shareText(InfoManager.getInstance().getContext(), paramString, null, null, new SocialEventListener()
  804. {
  805. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  806. {
  807. paramAnonymousObject1 = Message.obtain(ShareUtil.mHandler, paramInt1, null);
  808. ShareUtil.mHandler.sendMessage(paramAnonymousObject1);
  809. }
  810. public void onException(Object paramAnonymousObject)
  811. {
  812. paramAnonymousObject = Message.obtain(ShareUtil.mHandler, this.val$failCode, null);
  813. ShareUtil.mHandler.sendMessage(paramAnonymousObject);
  814. }
  815. });
  816. return;
  817. }
  818. }
  819. while (!TencentAgent.getInstance().isLoggedIn().booleanValue());
  820. TencentWeiboApi.shareText(InfoManager.getInstance().getContext(), paramString, new SocialEventListener()
  821. {
  822. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  823. {
  824. paramAnonymousObject1 = Message.obtain(ShareUtil.mHandler, paramInt1, null);
  825. ShareUtil.mHandler.sendMessage(paramAnonymousObject1);
  826. }
  827. public void onException(Object paramAnonymousObject)
  828. {
  829. paramAnonymousObject = Message.obtain(ShareUtil.mHandler, this.val$failCode, null);
  830. ShareUtil.mHandler.sendMessage(paramAnonymousObject);
  831. }
  832. });
  833. }
  834. public static void shareToPlatform(String paramString1, String paramString2, String paramString3, String paramString4, int paramInt, SocialEventListener paramSocialEventListener)
  835. {
  836. Context localContext = InfoManager.getInstance().getContext();
  837. if (localContext == null)
  838. return;
  839. switch (paramInt)
  840. {
  841. case 2:
  842. default:
  843. return;
  844. case 0:
  845. WechatApi.shareWebPage(localContext, paramString1, paramString2, paramString3, getShareBitmap(localContext, paramString4), Boolean.valueOf(false), paramSocialEventListener);
  846. return;
  847. case 1:
  848. WechatApi.shareWebPage(localContext, paramString1, paramString2, paramString3, getShareBitmap(localContext, paramString4), Boolean.valueOf(true), paramSocialEventListener);
  849. return;
  850. case 3:
  851. QQApi.share(localContext, paramString2, paramString3, paramString4, paramString1, paramString1, paramSocialEventListener);
  852. return;
  853. case 4:
  854. }
  855. if ((paramString4 == null) || (paramString4.equalsIgnoreCase("")));
  856. for (paramString2 = "http://s1.qingting.fm/images/qt_logo.jpg"; ; paramString2 = paramString4)
  857. {
  858. paramString4 = paramString3;
  859. if (paramString3 == null)
  860. paramString4 = "";
  861. paramString3 = paramString4 + " ";
  862. paramString1 = paramString3 + paramString1;
  863. paramString1 = paramString1 + " (分享自@蜻蜓fm)";
  864. if ((paramString2 == null) || (!paramString2.startsWith("http")))
  865. break;
  866. SinaWeiboApi.shareImage(localContext, paramString1, paramString2, "", "", paramSocialEventListener);
  867. return;
  868. }
  869. }
  870. public static String wrapPageUrl(String paramString, int paramInt1, ProgramLocation paramProgramLocation, Context paramContext, int paramInt2)
  871. {
  872. return composeTrackUrl(paramString, 1, 1, paramInt1, paramProgramLocation, paramContext);
  873. }
  874. public void shareUrlToMoments(String paramString)
  875. {
  876. if (paramString == null)
  877. return;
  878. WechatApi.shareUrlToMoments(InfoManager.getInstance().getContext(), paramString, "", "", null, new ISocialEventListener()
  879. {
  880. public void onCancel(Object paramAnonymousObject)
  881. {
  882. }
  883. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  884. {
  885. }
  886. public void onException(Object paramAnonymousObject)
  887. {
  888. }
  889. });
  890. }
  891. }
  892. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  893. * Qualified Name: fm.qingting.qtradio.share.ShareUtil
  894. * JD-Core Version: 0.6.2
  895. */