PageRenderTime 48ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/QingTingFanBianYi/src/fm/qingting/qtradio/fm/WebViewPlayer.java

https://gitlab.com/qt-prometheus/qt-prometheus
Java | 1145 lines | 1071 code | 70 blank | 4 comment | 242 complexity | d562bd630f9193baa0c41d466848a076 MD5 | raw file
  1. package fm.qingting.qtradio.fm;
  2. import android.app.Activity;
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.content.IntentFilter;
  7. import android.os.Handler;
  8. import android.webkit.JavascriptInterface;
  9. import android.webkit.WebView;
  10. import cn.com.mma.mobile.tracking.api.Countly;
  11. import com.alibaba.fastjson.JSON;
  12. import com.alibaba.fastjson.JSONObject;
  13. import com.miaozhen.mzmonitor.MZMonitor;
  14. import fm.qingting.framework.manager.EventDispacthManager;
  15. import fm.qingting.framework.utils.ImageLoader;
  16. import fm.qingting.qtradio.ad.platforms.mediav.MediaVAgent;
  17. import fm.qingting.qtradio.ad.platforms.mediav.model.IMediaVListener;
  18. import fm.qingting.qtradio.ad.platforms.mediav.model.MediaVNativeAd;
  19. import fm.qingting.qtradio.ad.platforms.mediav.model.MediaVRequest;
  20. import fm.qingting.qtradio.controller.ControllerManager;
  21. import fm.qingting.qtradio.helper.ChannelHelper;
  22. import fm.qingting.qtradio.helper.PodcasterHelper;
  23. import fm.qingting.qtradio.helper.ProgramHelper;
  24. import fm.qingting.qtradio.jd.data.JDApi;
  25. import fm.qingting.qtradio.jd.data.JDApi.ErrorCode;
  26. import fm.qingting.qtradio.jd.data.JDApi.OnResponseListener;
  27. import fm.qingting.qtradio.jd.data.Response;
  28. import fm.qingting.qtradio.log.LogModule;
  29. import fm.qingting.qtradio.model.CategoryNode;
  30. import fm.qingting.qtradio.model.ChannelNode;
  31. import fm.qingting.qtradio.model.ContentCategoryNode;
  32. import fm.qingting.qtradio.model.InfoManager;
  33. import fm.qingting.qtradio.model.Node;
  34. import fm.qingting.qtradio.model.ProgramScheduleList;
  35. import fm.qingting.qtradio.model.RootNode;
  36. import fm.qingting.qtradio.model.VirtualNode;
  37. import fm.qingting.qtradio.notification.Constants;
  38. import fm.qingting.qtradio.room.UserInfo;
  39. import fm.qingting.qtradio.share.ShareUtil;
  40. import fm.qingting.social.SocialEventListener;
  41. import fm.qingting.utils.QTMSGManage;
  42. import fm.qingting.utils.ThirdTracker;
  43. import java.util.ArrayList;
  44. import java.util.List;
  45. public class WebViewPlayer
  46. implements IMediaVListener
  47. {
  48. private static WebViewPlayer _instance;
  49. private final int ADV_JD = 0;
  50. private final int ADV_MEDIAV = 1;
  51. private final int ADV_OMD = 2;
  52. private final int EVENT_QT = 1;
  53. private final int EVENT_THIRD = 0;
  54. private final int MONITOR_ADMASTER = 1;
  55. private final int MONITOR_MIAOZHEN = 0;
  56. private final int MONITOR_MMA = 2;
  57. private final int REDIRECT_CHANNEL = 0;
  58. private final int REDIRECT_DOWNLOAD = 5;
  59. private final int REDIRECT_IM_CHAT = 9;
  60. private final int REDIRECT_LISTCHANNEL_ATTR = 8;
  61. private final int REDIRECT_LIVECATEGORY = 3;
  62. private final int REDIRECT_NOVEL_CATEGORY = 7;
  63. private final int REDIRECT_PAGE = 1;
  64. private final int REDIRECT_PODCASTER = 4;
  65. private final int REDIRECT_RECOMMENDCATEGORY = 6;
  66. private final int REDIRECT_RESET_FILTER = 11;
  67. private final int REDIRECT_SPEICAL_TOPIC = 10;
  68. private final int REDIRECT_VIRTUALCATEGORY = 2;
  69. private String _attrs = null;
  70. private String _callBack;
  71. private String _callBackJs;
  72. private String _callBackParams;
  73. private String _catid;
  74. private String _channelid;
  75. private int _channeltype;
  76. private String _cname;
  77. private String _desc;
  78. private boolean _enterchat;
  79. private int _groupId = 0;
  80. private String _loadImage;
  81. private String _pageTitle = "";
  82. private String _pageUrl = null;
  83. private int _playSource = -1;
  84. private int _podcasterId = 0;
  85. private String _programid;
  86. private int _sectionId = 0;
  87. private String _shareContent = "";
  88. private String _shareImage = null;
  89. private String _shareTitle = "";
  90. private String _shareUrl = "";
  91. private String _source;
  92. private String _thumb;
  93. private int _topicId = 0;
  94. private WebView _webview;
  95. private final Handler adCallbackHandler = new Handler();
  96. private Runnable adCallbackRunnable = new Runnable()
  97. {
  98. public void run()
  99. {
  100. WebViewPlayer.this.doADCallback();
  101. }
  102. };
  103. private final Handler adHandler = new Handler();
  104. private Runnable adRunnable = new Runnable()
  105. {
  106. public void run()
  107. {
  108. WebViewPlayer.this.doAD();
  109. }
  110. };
  111. private final Handler addPlaySourceHandler = new Handler();
  112. private Runnable addPlaySourceRunnable = new Runnable()
  113. {
  114. public void run()
  115. {
  116. WebViewPlayer.this.addPlaySource();
  117. }
  118. };
  119. private String backUrl = null;
  120. private final Handler callbackHandler = new Handler();
  121. private Runnable callbackRunnable = new Runnable()
  122. {
  123. public void run()
  124. {
  125. WebViewPlayer.this.doCallback();
  126. }
  127. };
  128. private final Handler clickHandler = new Handler();
  129. private Runnable clickRunnable = new Runnable()
  130. {
  131. public void run()
  132. {
  133. WebViewPlayer.this.doClick();
  134. }
  135. };
  136. private boolean disableLongClick = false;
  137. private final Handler loadImageHandler = new Handler();
  138. private Runnable loadImageRunnable = new Runnable()
  139. {
  140. public void run()
  141. {
  142. WebViewPlayer.this.doLoadImage();
  143. }
  144. };
  145. private Context mContext;
  146. private List<WebViewADBean> mLstADBean = new ArrayList();
  147. private List<WebViewActionBean> mLstClickBean = new ArrayList();
  148. private List<WebViewEventBean> mLstEventBean = new ArrayList();
  149. private List<WebViewMonitorBean> mLstMonitorBean = new ArrayList();
  150. private List<WebViewActionBean> mLstShowBean = new ArrayList();
  151. private long mMediaVUpdateTime = 0L;
  152. public boolean mPreventParentTouch = false;
  153. private final Handler monitorHandler = new Handler();
  154. private Runnable monitorRunnable = new Runnable()
  155. {
  156. public void run()
  157. {
  158. WebViewPlayer.this.doMonitor();
  159. }
  160. };
  161. private final Handler playHandler = new Handler();
  162. private Runnable playRunnable = new Runnable()
  163. {
  164. public void run()
  165. {
  166. WebViewPlayer.this.doPlay();
  167. }
  168. };
  169. private final Handler redirectHandler = new Handler();
  170. private Runnable redirectRunnable = new Runnable()
  171. {
  172. public void run()
  173. {
  174. WebViewPlayer.this.doRedirect();
  175. }
  176. };
  177. private int redirectType = 0;
  178. private final Handler reportHandler = new Handler();
  179. private Runnable reportRunnable = new Runnable()
  180. {
  181. public void run()
  182. {
  183. WebViewPlayer.this.doReport();
  184. }
  185. };
  186. private String shareCallback = null;
  187. SocialEventListener shareCallbackListener = new SocialEventListener()
  188. {
  189. public void onCancel(Object paramAnonymousObject)
  190. {
  191. }
  192. public void onComplete(Object paramAnonymousObject1, Object paramAnonymousObject2)
  193. {
  194. WebViewPlayer.this.invokeCallBack(null);
  195. }
  196. public void onException(Object paramAnonymousObject)
  197. {
  198. }
  199. };
  200. private String shareCallbackParam = null;
  201. private final Handler shareHandler = new Handler();
  202. private Runnable shareRunnable = new Runnable()
  203. {
  204. public void run()
  205. {
  206. WebViewPlayer.this.doShare();
  207. }
  208. };
  209. private int shareType = 0;
  210. private final Handler showHandler = new Handler();
  211. private Runnable showRunnable = new Runnable()
  212. {
  213. public void run()
  214. {
  215. WebViewPlayer.this.doShow();
  216. }
  217. };
  218. private final Handler stopHandler = new Handler();
  219. private Runnable stopRunnable = new Runnable()
  220. {
  221. public void run()
  222. {
  223. WebViewPlayer.this.doStop();
  224. }
  225. };
  226. private WechatReceiver wcReceiver;
  227. private void addPlaySource()
  228. {
  229. if (this._playSource != -1)
  230. PlayerAgent.getInstance().addPlaySource(this._playSource);
  231. }
  232. private void doAD()
  233. {
  234. int i = 0;
  235. if (i < this.mLstADBean.size())
  236. {
  237. if (!((WebViewADBean)this.mLstADBean.get(i)).hasRequested)
  238. {
  239. if (((WebViewADBean)this.mLstADBean.get(i)).adType != 0)
  240. break label88;
  241. ((WebViewADBean)this.mLstADBean.get(i)).hasRequested = true;
  242. JDApi.request(new JDApi.OnResponseListener()
  243. {
  244. public void onResponse(Response paramAnonymousResponse)
  245. {
  246. int i;
  247. if (paramAnonymousResponse.getErrorCode() == JDApi.ErrorCode.SUCCESS)
  248. i = 0;
  249. while (true)
  250. {
  251. if (i < WebViewPlayer.this.mLstADBean.size())
  252. {
  253. if (((WebViewPlayer.WebViewADBean)WebViewPlayer.this.mLstADBean.get(i)).adType == 0)
  254. ((WebViewPlayer.WebViewADBean)WebViewPlayer.this.mLstADBean.get(i)).rawData = paramAnonymousResponse.getRawData();
  255. }
  256. else
  257. {
  258. paramAnonymousResponse = (ArrayList)paramAnonymousResponse.getData();
  259. ThirdTracker.getInstance().setJDAdv(paramAnonymousResponse, true);
  260. WebViewPlayer.this.adCallbackHandler.postDelayed(WebViewPlayer.this.adCallbackRunnable, 1L);
  261. return;
  262. }
  263. i += 1;
  264. }
  265. }
  266. });
  267. }
  268. while (true)
  269. {
  270. i += 1;
  271. break;
  272. label88: if (((WebViewADBean)this.mLstADBean.get(i)).adType == 1)
  273. {
  274. ((WebViewADBean)this.mLstADBean.get(i)).hasRequested = true;
  275. loadMediaVAd();
  276. }
  277. else if (((WebViewADBean)this.mLstADBean.get(i)).adType == 2)
  278. {
  279. InfoManager.getInstance().loadAdvFromThirdParty(((WebViewADBean)this.mLstADBean.get(i)).categoryId);
  280. }
  281. }
  282. }
  283. }
  284. private void doADCallback()
  285. {
  286. int i = 0;
  287. if (i < this.mLstADBean.size())
  288. {
  289. if ((((WebViewADBean)this.mLstADBean.get(i)).hasRequested) && (((WebViewADBean)this.mLstADBean.get(i)).rawData != null) && (!((WebViewADBean)this.mLstADBean.get(i)).rawData.equalsIgnoreCase("")) && (((WebViewADBean)this.mLstADBean.get(i)).callback != null))
  290. {
  291. str = "javascript:" + ((WebViewADBean)this.mLstADBean.get(i)).callback;
  292. if (((WebViewADBean)this.mLstADBean.get(i)).callbackParams != null)
  293. break label219;
  294. }
  295. label219: for (String str = str + "("; ; str = str + "('" + ((WebViewADBean)this.mLstADBean.get(i)).callbackParams + "'")
  296. {
  297. str = str + ")";
  298. if ((this._webview != null) && (str != null))
  299. this._webview.loadUrl(str);
  300. i += 1;
  301. break;
  302. }
  303. }
  304. }
  305. private void doCallback()
  306. {
  307. if (this.shareCallback == null)
  308. return;
  309. this._callBackJs = "javascript:";
  310. this._callBackJs += this.shareCallback;
  311. if (this.shareCallbackParam == null);
  312. for (this._callBackJs += "("; ; this._callBackJs = (this._callBackJs + "('" + this.shareCallbackParam + "'"))
  313. {
  314. this._callBackJs += ")";
  315. if ((this._webview == null) || (this._callBackJs == null))
  316. break;
  317. this._webview.loadUrl(this._callBackJs);
  318. return;
  319. }
  320. }
  321. private void doClick()
  322. {
  323. int i = 0;
  324. while (i < this.mLstClickBean.size())
  325. {
  326. if (((WebViewActionBean)this.mLstClickBean.get(i)).adType == 1)
  327. {
  328. int j = 0;
  329. while (j < this.mLstADBean.size())
  330. {
  331. if ((((WebViewADBean)this.mLstADBean.get(j)).adType == 1) && (((WebViewActionBean)this.mLstClickBean.get(i)).categoryId == ((WebViewADBean)this.mLstADBean.get(j)).categoryId) && (((WebViewADBean)this.mLstADBean.get(j)).rawObj != null))
  332. {
  333. ((MediaVNativeAd)((WebViewADBean)this.mLstADBean.get(j)).rawObj).onClick();
  334. return;
  335. }
  336. j += 1;
  337. }
  338. }
  339. i += 1;
  340. }
  341. this.mLstClickBean.clear();
  342. }
  343. private void doLoadImage()
  344. {
  345. if ((this._loadImage != null) && (!this._loadImage.equalsIgnoreCase("")))
  346. ImageLoader.getInstance(InfoManager.getInstance().getContext()).getImage(this._loadImage, 200, 200);
  347. }
  348. private void doMonitor()
  349. {
  350. int i = 0;
  351. if (i < this.mLstMonitorBean.size())
  352. {
  353. if (((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorType == 0)
  354. {
  355. String str = ThirdTracker.getInstance().macroReplace(((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorUrl);
  356. MZMonitor.adTrack(InfoManager.getInstance().getContext(), str);
  357. }
  358. while (true)
  359. {
  360. i += 1;
  361. break;
  362. if (((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorType == 1)
  363. {
  364. if (((WebViewMonitorBean)this.mLstMonitorBean.get(i)).actionType == Constants.ADV_IMPRESSION)
  365. Countly.sharedInstance().onExpose(((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorUrl);
  366. else if (((WebViewMonitorBean)this.mLstMonitorBean.get(i)).actionType == Constants.ADV_CLICK)
  367. Countly.sharedInstance().onClick(((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorUrl);
  368. }
  369. else if (((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorType == 2)
  370. ThirdTracker.getInstance().monitorMMA(((WebViewMonitorBean)this.mLstMonitorBean.get(i)).monitorUrl);
  371. }
  372. }
  373. this.mLstMonitorBean.clear();
  374. }
  375. private void doPlay()
  376. {
  377. if ((this._source != null) && (!this._source.equalsIgnoreCase("")))
  378. {
  379. PlayerAgent.getInstance().stop();
  380. PlayerAgent.getInstance().play(this._source);
  381. }
  382. Object localObject;
  383. do
  384. {
  385. do
  386. {
  387. do
  388. return;
  389. while ((this._channelid == null) || (this._channelid.equalsIgnoreCase("")));
  390. if (this._enterchat)
  391. InfoManager.getInstance().addChatRoom(this._channelid);
  392. if (this._programid == null)
  393. this._programid = "0";
  394. localObject = ProgramHelper.getInstance().getProgramSchedule(Integer.valueOf(this._channelid).intValue(), this._channeltype, false);
  395. }
  396. while (localObject == null);
  397. localObject = ((ProgramScheduleList)localObject).getProgramNode(Integer.valueOf(this._programid).intValue());
  398. }
  399. while (localObject == null);
  400. if (this._playSource != -1)
  401. PlayerAgent.getInstance().addPlaySource(this._playSource);
  402. PlayerAgent.getInstance().play((Node)localObject);
  403. }
  404. private void doRedirect()
  405. {
  406. try
  407. {
  408. if (this._playSource != 0)
  409. PlayerAgent.getInstance().addPlaySource(this._playSource);
  410. switch (this.redirectType)
  411. {
  412. case 0:
  413. if ((this._channelid != null) && (!this._channelid.equalsIgnoreCase("")))
  414. {
  415. ChannelNode localChannelNode2 = ChannelHelper.getInstance().getChannel(Integer.valueOf(this._channelid).intValue(), this._channeltype);
  416. ChannelNode localChannelNode1 = localChannelNode2;
  417. if (localChannelNode2 == null)
  418. {
  419. localChannelNode1 = localChannelNode2;
  420. if (this._catid != null)
  421. {
  422. localChannelNode1 = localChannelNode2;
  423. if (!this._catid.equalsIgnoreCase(""))
  424. localChannelNode1 = ChannelHelper.getInstance().getFakeVirtualChannel(Integer.valueOf(this._channelid).intValue(), Integer.valueOf(this._catid).intValue(), "专辑");
  425. }
  426. }
  427. if (localChannelNode1 != null)
  428. ControllerManager.getInstance().openChannelDetailControllerWithoutDamaku(localChannelNode1);
  429. if ((this._programid != null) && (!this._programid.equalsIgnoreCase("")) && (this._catid != null) && (!this._catid.equalsIgnoreCase("")) && (this._channelid != null) && (!this._channelid.equalsIgnoreCase("")))
  430. {
  431. PlayerAgent.getInstance().playAndLoadData(Integer.valueOf(this._catid).intValue(), Integer.valueOf(this._channelid).intValue(), Integer.valueOf(this._programid).intValue(), this._channeltype, "专辑");
  432. return;
  433. }
  434. }
  435. break;
  436. case 1:
  437. doRedirectPage();
  438. return;
  439. case 2:
  440. doRedirectVirtualCateogry();
  441. return;
  442. case 3:
  443. doRedirectLiveCategory();
  444. return;
  445. case 4:
  446. doRedirectPodcaster();
  447. return;
  448. case 5:
  449. doRedirectDownload();
  450. return;
  451. case 6:
  452. doRedirectRecommendCategory();
  453. return;
  454. case 7:
  455. doRedirectNovelAllContentController();
  456. return;
  457. case 8:
  458. doRedirectChannelListByAttr();
  459. return;
  460. case 9:
  461. doRedirectIMChat();
  462. return;
  463. case 10:
  464. doRedirectSpecialTopic();
  465. return;
  466. case 11:
  467. doRedirectResetFilter();
  468. return;
  469. }
  470. return;
  471. }
  472. catch (Exception localException)
  473. {
  474. }
  475. }
  476. private void doRedirectChannelListByAttr()
  477. {
  478. if ((this._catid != null) && (!this._catid.equalsIgnoreCase("")))
  479. ControllerManager.getInstance().openVirtualCategoryAllContentController(Integer.valueOf(this._catid).intValue(), this._sectionId);
  480. }
  481. private void doRedirectDownload()
  482. {
  483. if ((this._channelid != null) && (!this._channelid.equalsIgnoreCase("")))
  484. {
  485. ChannelNode localChannelNode = ChannelHelper.getInstance().getChannel(Integer.valueOf(this._channelid).intValue(), this._channeltype);
  486. if (localChannelNode != null)
  487. ControllerManager.getInstance().redirectToBatchDownloadView(localChannelNode, false, true);
  488. }
  489. }
  490. private void doRedirectIMChat()
  491. {
  492. if (this._groupId != 0)
  493. ControllerManager.getInstance().openImChatController(String.valueOf(this._groupId));
  494. }
  495. private void doRedirectLiveCategory()
  496. {
  497. if ((this._catid == null) || (this._catid.equalsIgnoreCase("")))
  498. return;
  499. ControllerManager.getInstance().openTraditionalChannelsView(Integer.valueOf(this._catid).intValue());
  500. }
  501. private void doRedirectNovelAllContentController()
  502. {
  503. if ((this._catid != null) && (!this._catid.equalsIgnoreCase("")))
  504. ControllerManager.getInstance().openNovelAllContentController(Integer.valueOf(this._catid).intValue());
  505. }
  506. private void doRedirectPage()
  507. {
  508. if ((this._pageUrl != null) && (!this._pageUrl.equalsIgnoreCase("")))
  509. ControllerManager.getInstance().redirectToActiviyByUrl(this._pageUrl, this._pageTitle, true);
  510. }
  511. private void doRedirectPodcaster()
  512. {
  513. if (this._podcasterId != 0)
  514. {
  515. UserInfo localUserInfo = PodcasterHelper.getInstance().getPodcaster(this._podcasterId);
  516. if (localUserInfo != null)
  517. ControllerManager.getInstance().openPodcasterInfoController(localUserInfo);
  518. }
  519. }
  520. private void doRedirectRecommendCategory()
  521. {
  522. ControllerManager.getInstance().openDiscoverCategoryController(this._sectionId);
  523. }
  524. private void doRedirectResetFilter()
  525. {
  526. ControllerManager.getInstance().openVirtualCategoryAllContentController(this._sectionId, this._attrs);
  527. }
  528. private void doRedirectSpecialTopic()
  529. {
  530. ControllerManager.getInstance().openSpecialTopicController(this._topicId);
  531. }
  532. private void doRedirectVirtualCateogry()
  533. {
  534. ControllerManager.getInstance().openVirtualCategoryAllContentController(this._sectionId);
  535. }
  536. private void doReport()
  537. {
  538. int i = 0;
  539. if (i < this.mLstEventBean.size())
  540. {
  541. if (((WebViewEventBean)this.mLstEventBean.get(i)).eventType == 0)
  542. if ((((WebViewEventBean)this.mLstEventBean.get(i)).eventValue != null) && (!((WebViewEventBean)this.mLstEventBean.get(i)).eventValue.equalsIgnoreCase("")))
  543. QTMSGManage.getInstance().sendStatistcsMessage(((WebViewEventBean)this.mLstEventBean.get(i)).eventName, ((WebViewEventBean)this.mLstEventBean.get(i)).eventValue);
  544. while (true)
  545. {
  546. i += 1;
  547. break;
  548. QTMSGManage.getInstance().sendStatistcsMessage(((WebViewEventBean)this.mLstEventBean.get(i)).eventName);
  549. continue;
  550. if ((((WebViewEventBean)this.mLstEventBean.get(i)).eventType == 1) && (((WebViewEventBean)this.mLstEventBean.get(i)).eventValue != null) && (!((WebViewEventBean)this.mLstEventBean.get(i)).eventValue.equalsIgnoreCase("")))
  551. LogModule.getInstance().send(((WebViewEventBean)this.mLstEventBean.get(i)).eventName, ((WebViewEventBean)this.mLstEventBean.get(i)).eventValue);
  552. }
  553. }
  554. this.mLstEventBean.clear();
  555. }
  556. private void doShare()
  557. {
  558. if (this._shareUrl != null)
  559. {
  560. ShareUtil.shareToPlatform(this._shareUrl, this._shareTitle, this._shareContent, this._shareImage, this.shareType, this.shareCallbackListener);
  561. return;
  562. }
  563. if ((this._channelid != null) && (!this._channelid.equalsIgnoreCase("")))
  564. {
  565. ChannelNode localChannelNode = ChannelHelper.getInstance().getChannel(Integer.valueOf(this._channelid).intValue(), this._channeltype);
  566. if (localChannelNode != null)
  567. {
  568. EventDispacthManager.getInstance().dispatchAction("shareChoose", localChannelNode);
  569. return;
  570. }
  571. EventDispacthManager.getInstance().dispatchAction("shareChoose", InfoManager.getInstance().root().getCurrentPlayingNode());
  572. return;
  573. }
  574. EventDispacthManager.getInstance().dispatchAction("shareChoose", InfoManager.getInstance().root().getCurrentPlayingNode());
  575. }
  576. private void doShow()
  577. {
  578. int i = 0;
  579. while (i < this.mLstShowBean.size())
  580. {
  581. if (((WebViewActionBean)this.mLstShowBean.get(i)).adType == 1)
  582. {
  583. int j = 0;
  584. while (j < this.mLstADBean.size())
  585. {
  586. if ((((WebViewADBean)this.mLstADBean.get(j)).adType == 1) && (((WebViewActionBean)this.mLstShowBean.get(i)).categoryId == ((WebViewADBean)this.mLstADBean.get(j)).categoryId) && (((WebViewADBean)this.mLstADBean.get(j)).rawObj != null))
  587. {
  588. ((MediaVNativeAd)((WebViewADBean)this.mLstADBean.get(j)).rawObj).onShow();
  589. return;
  590. }
  591. j += 1;
  592. }
  593. }
  594. i += 1;
  595. }
  596. this.mLstShowBean.clear();
  597. }
  598. private void doStop()
  599. {
  600. PlayerAgent.getInstance().stop();
  601. }
  602. public static WebViewPlayer getInstance()
  603. {
  604. try
  605. {
  606. if (_instance == null)
  607. _instance = new WebViewPlayer();
  608. WebViewPlayer localWebViewPlayer = _instance;
  609. return localWebViewPlayer;
  610. }
  611. finally
  612. {
  613. }
  614. }
  615. private void invokeCallBack(String paramString)
  616. {
  617. if (this._callBack == null)
  618. return;
  619. this._callBackJs = "javascript:";
  620. this._callBackJs += this._callBack;
  621. if (paramString == null);
  622. for (this._callBackJs += "(null"; ; this._callBackJs = (this._callBackJs + "('" + paramString + "'"))
  623. {
  624. this._callBackJs += ")";
  625. if ((this._webview == null) || (this._callBackJs == null))
  626. break;
  627. this._webview.loadUrl(this._callBackJs);
  628. return;
  629. }
  630. }
  631. private void loadMediaVAd()
  632. {
  633. if (System.currentTimeMillis() / 1000L - this.mMediaVUpdateTime < 50L)
  634. return;
  635. int i = 0;
  636. label23: Object localObject;
  637. Activity localActivity;
  638. int j;
  639. if (i < this.mLstADBean.size())
  640. if (((WebViewADBean)this.mLstADBean.get(i)).adType == 1)
  641. {
  642. if (((WebViewADBean)this.mLstADBean.get(i)).categoryId == 0)
  643. break label191;
  644. localObject = InfoManager.getInstance().root().mContentCategory.mVirtualNode.getCategoryNode(((WebViewADBean)this.mLstADBean.get(i)).categoryId);
  645. if (localObject != null)
  646. {
  647. localActivity = (Activity)InfoManager.getInstance().getContext();
  648. MediaVAgent.getInstance(localActivity).addListener(this);
  649. String str = ((CategoryNode)localObject).name;
  650. j = ((CategoryNode)localObject).categoryId;
  651. int k = ((CategoryNode)localObject).categoryId;
  652. localObject = new MediaVRequest(null, new String[] { str }, j, String.valueOf(k));
  653. MediaVAgent.getInstance(localActivity).loadAds((MediaVRequest)localObject);
  654. }
  655. }
  656. while (true)
  657. {
  658. i += 1;
  659. break label23;
  660. break;
  661. label191: localActivity = (Activity)InfoManager.getInstance().getContext();
  662. MediaVAgent.getInstance(localActivity).addListener(this);
  663. j = ((WebViewADBean)this.mLstADBean.get(i)).categoryId;
  664. localObject = new MediaVRequest(null, new String[] { "首页" }, 0, String.valueOf(j));
  665. MediaVAgent.getInstance(localActivity).loadAds((MediaVRequest)localObject);
  666. }
  667. }
  668. private void parseADInfo(String paramString, WebViewADBean paramWebViewADBean)
  669. {
  670. if ((paramWebViewADBean == null) || (paramString == null))
  671. return;
  672. while (true)
  673. {
  674. int i;
  675. try
  676. {
  677. paramString = JSON.parseObject(paramString);
  678. paramWebViewADBean.adType = paramString.getIntValue("type");
  679. paramWebViewADBean.categoryId = paramString.getIntValue("category_id");
  680. i = 0;
  681. if (i < this.mLstADBean.size())
  682. {
  683. if ((((WebViewADBean)this.mLstADBean.get(i)).adType == paramWebViewADBean.adType) && (((WebViewADBean)this.mLstADBean.get(i)).categoryId == paramWebViewADBean.categoryId))
  684. ((WebViewADBean)this.mLstADBean.get(i)).hasRequested = false;
  685. }
  686. else
  687. {
  688. this.mLstADBean.add(paramWebViewADBean);
  689. return;
  690. }
  691. }
  692. catch (Exception paramString)
  693. {
  694. return;
  695. }
  696. i += 1;
  697. }
  698. }
  699. private void parseActionInfo(String paramString, WebViewActionBean paramWebViewActionBean)
  700. {
  701. if ((paramWebViewActionBean == null) || (paramString == null));
  702. while (true)
  703. {
  704. return;
  705. try
  706. {
  707. paramString = JSON.parseObject(paramString);
  708. paramWebViewActionBean.adType = paramString.getIntValue("type");
  709. paramWebViewActionBean.actionType = paramString.getIntValue("action");
  710. paramWebViewActionBean.categoryId = paramString.getIntValue("category_id");
  711. if (paramWebViewActionBean.actionType == Constants.ADV_CLICK)
  712. {
  713. this.mLstClickBean.add(paramWebViewActionBean);
  714. return;
  715. }
  716. if (paramWebViewActionBean.actionType == Constants.ADV_IMPRESSION)
  717. {
  718. this.mLstShowBean.add(paramWebViewActionBean);
  719. return;
  720. }
  721. }
  722. catch (Exception paramString)
  723. {
  724. }
  725. }
  726. }
  727. private void parseEventInfo(String paramString, WebViewEventBean paramWebViewEventBean)
  728. {
  729. if ((paramWebViewEventBean == null) || (paramString == null));
  730. while (true)
  731. {
  732. return;
  733. try
  734. {
  735. paramString = JSON.parseObject(paramString);
  736. paramWebViewEventBean.eventType = paramString.getIntValue("type");
  737. paramWebViewEventBean.eventName = paramString.getString("event_name");
  738. paramWebViewEventBean.eventValue = paramString.getString("event_value");
  739. if ((paramWebViewEventBean.eventName != null) && (!paramWebViewEventBean.eventName.equalsIgnoreCase("")))
  740. {
  741. this.mLstEventBean.add(paramWebViewEventBean);
  742. return;
  743. }
  744. }
  745. catch (Exception paramString)
  746. {
  747. }
  748. }
  749. }
  750. private void parseMonitorInfo(String paramString, WebViewMonitorBean paramWebViewMonitorBean)
  751. {
  752. if ((paramWebViewMonitorBean == null) || (paramString == null));
  753. while (true)
  754. {
  755. return;
  756. try
  757. {
  758. paramString = JSON.parseObject(paramString);
  759. paramWebViewMonitorBean.monitorType = paramString.getIntValue("type");
  760. paramWebViewMonitorBean.monitorUrl = paramString.getString("monitor_url");
  761. if ((paramWebViewMonitorBean.monitorUrl != null) && (!paramWebViewMonitorBean.monitorUrl.equalsIgnoreCase("")))
  762. {
  763. this.mLstMonitorBean.add(paramWebViewMonitorBean);
  764. return;
  765. }
  766. }
  767. catch (Exception paramString)
  768. {
  769. }
  770. }
  771. }
  772. private void parseResInfo(String paramString)
  773. {
  774. while (true)
  775. {
  776. try
  777. {
  778. this._shareUrl = null;
  779. this._catid = null;
  780. this._channelid = null;
  781. this._programid = null;
  782. this._groupId = 0;
  783. this._sectionId = 0;
  784. this._podcasterId = 0;
  785. if (paramString == null)
  786. return;
  787. paramString = JSON.parseObject(paramString);
  788. this._catid = paramString.getString("category_id");
  789. this._channelid = paramString.getString("channel_id");
  790. this._channeltype = paramString.getIntValue("channel_type");
  791. this._programid = paramString.getString("program_id");
  792. this.redirectType = paramString.getIntValue("redirect");
  793. this._cname = paramString.getString("cname");
  794. this._thumb = paramString.getString("thumb");
  795. this._desc = paramString.getString("desc");
  796. this._source = paramString.getString("source");
  797. this._playSource = paramString.getIntValue("play_source");
  798. this._pageUrl = paramString.getString("page_url");
  799. this._pageTitle = paramString.getString("page_title");
  800. this._sectionId = paramString.getIntValue("section_id");
  801. this._podcasterId = paramString.getIntValue("podcaster_id");
  802. this._attrs = paramString.getString("attribute_id");
  803. if (paramString.getIntValue("enter_chat") == 1)
  804. {
  805. this._enterchat = true;
  806. this.shareType = paramString.getIntValue("share");
  807. this._shareContent = paramString.getString("shareContent");
  808. this._shareImage = paramString.getString("shareImage");
  809. this._shareTitle = paramString.getString("shareTitle");
  810. this._shareUrl = paramString.getString("shareUrl");
  811. this._groupId = paramString.getIntValue("group_id");
  812. this._topicId = paramString.getIntValue("topic_id");
  813. return;
  814. }
  815. }
  816. catch (Exception paramString)
  817. {
  818. paramString.printStackTrace();
  819. return;
  820. }
  821. this._enterchat = false;
  822. }
  823. }
  824. @JavascriptInterface
  825. public void AddPlaySource(String paramString1, String paramString2, String paramString3)
  826. {
  827. if (paramString1 != null);
  828. try
  829. {
  830. this._playSource = JSON.parseObject(paramString1).getIntValue("_playSource");
  831. label18: this.addPlaySourceHandler.postDelayed(this.addPlaySourceRunnable, 1L);
  832. return;
  833. }
  834. catch (Exception paramString1)
  835. {
  836. break label18;
  837. }
  838. }
  839. @JavascriptInterface
  840. public void Click(String paramString1, String paramString2, String paramString3)
  841. {
  842. parseActionInfo(paramString1, new WebViewActionBean(null));
  843. this.clickHandler.postDelayed(this.clickRunnable, 1L);
  844. }
  845. @JavascriptInterface
  846. public void LoadAD(String paramString1, String paramString2, String paramString3)
  847. {
  848. WebViewADBean localWebViewADBean = new WebViewADBean(null);
  849. localWebViewADBean.callback = paramString2;
  850. localWebViewADBean.callbackParams = paramString3;
  851. localWebViewADBean.hasRequested = false;
  852. parseADInfo(paramString1, localWebViewADBean);
  853. this.adHandler.postDelayed(this.adRunnable, 1L);
  854. }
  855. @JavascriptInterface
  856. public void LoadImage(String paramString1, String paramString2, String paramString3)
  857. {
  858. this._loadImage = paramString1;
  859. this.loadImageHandler.postDelayed(this.loadImageRunnable, 1L);
  860. }
  861. @JavascriptInterface
  862. public void Monitor(String paramString1, String paramString2, String paramString3)
  863. {
  864. parseMonitorInfo(paramString1, new WebViewMonitorBean(null));
  865. this.monitorHandler.postDelayed(this.monitorRunnable, 1L);
  866. }
  867. @JavascriptInterface
  868. public void Play(String paramString1, String paramString2, String paramString3)
  869. {
  870. this._callBack = paramString2;
  871. this._callBackParams = paramString3;
  872. parseResInfo(paramString1);
  873. this.playHandler.postDelayed(this.playRunnable, 1L);
  874. }
  875. @JavascriptInterface
  876. public void Redirect(String paramString1, String paramString2, String paramString3)
  877. {
  878. this._callBack = paramString2;
  879. this._callBackParams = paramString3;
  880. parseResInfo(paramString1);
  881. this.redirectHandler.postDelayed(this.redirectRunnable, 1L);
  882. }
  883. @JavascriptInterface
  884. public void RegisterCallback(String paramString1, String paramString2)
  885. {
  886. this.shareCallback = paramString1;
  887. this.shareCallbackParam = paramString2;
  888. }
  889. @JavascriptInterface
  890. public void Report(String paramString1, String paramString2, String paramString3)
  891. {
  892. parseEventInfo(paramString1, new WebViewEventBean(null));
  893. this.reportHandler.postDelayed(this.reportRunnable, 1L);
  894. }
  895. @JavascriptInterface
  896. public void Share(String paramString1, String paramString2, String paramString3)
  897. {
  898. this._callBack = paramString2;
  899. this._callBackParams = paramString3;
  900. parseResInfo(paramString1);
  901. this.shareHandler.postDelayed(this.shareRunnable, 1L);
  902. }
  903. @JavascriptInterface
  904. public void Show(String paramString1, String paramString2, String paramString3)
  905. {
  906. parseActionInfo(paramString1, new WebViewActionBean(null));
  907. this.showHandler.postDelayed(this.showRunnable, 1L);
  908. }
  909. @JavascriptInterface
  910. public void Stop()
  911. {
  912. this.stopHandler.postDelayed(this.stopRunnable, 1L);
  913. }
  914. public void callback()
  915. {
  916. this.callbackHandler.postDelayed(this.callbackRunnable, 1L);
  917. }
  918. public boolean disableLongClick()
  919. {
  920. return this.disableLongClick;
  921. }
  922. public String getBackPolicy()
  923. {
  924. return this.backUrl;
  925. }
  926. public void init(Context paramContext)
  927. {
  928. if (paramContext == null)
  929. return;
  930. this.mContext = paramContext;
  931. this.wcReceiver = new WechatReceiver();
  932. paramContext = new IntentFilter();
  933. paramContext.addAction("android.intent.action.WECHAT_RESP");
  934. this.mContext.registerReceiver(this.wcReceiver, paramContext);
  935. }
  936. public void onMediaVNativeAdResponse(MediaVRequest paramMediaVRequest, ArrayList<MediaVNativeAd> paramArrayList)
  937. {
  938. int i;
  939. if ((paramArrayList != null) && (paramArrayList.size() > 0))
  940. i = 0;
  941. while (true)
  942. {
  943. if (i < this.mLstADBean.size())
  944. {
  945. if ((((WebViewADBean)this.mLstADBean.get(i)).adType == 1) && (((WebViewADBean)this.mLstADBean.get(i)).hasRequested) && (paramMediaVRequest.getRequestId().equalsIgnoreCase(String.valueOf(((WebViewADBean)this.mLstADBean.get(i)).categoryId))))
  946. {
  947. paramMediaVRequest = (MediaVNativeAd)paramArrayList.get(0);
  948. ((WebViewADBean)this.mLstADBean.get(i)).rawData = paramMediaVRequest.toJson();
  949. ((WebViewADBean)this.mLstADBean.get(i)).rawObj = paramMediaVRequest;
  950. }
  951. }
  952. else
  953. {
  954. this.adCallbackHandler.postDelayed(this.adCallbackRunnable, 1L);
  955. return;
  956. }
  957. i += 1;
  958. }
  959. }
  960. @JavascriptInterface
  961. public void preventParentTouchEvent()
  962. {
  963. this.mPreventParentTouch = true;
  964. this._webview.requestDisallowInterceptTouchEvent(true);
  965. }
  966. public void release()
  967. {
  968. try
  969. {
  970. if (this.wcReceiver != null)
  971. {
  972. this.mContext.unregisterReceiver(this.wcReceiver);
  973. this.wcReceiver = null;
  974. }
  975. return;
  976. }
  977. catch (IllegalArgumentException localIllegalArgumentException)
  978. {
  979. localIllegalArgumentException.printStackTrace();
  980. }
  981. }
  982. @JavascriptInterface
  983. public void setDisableLongClick(int paramInt)
  984. {
  985. if (paramInt == 1)
  986. {
  987. this.disableLongClick = true;
  988. return;
  989. }
  990. this.disableLongClick = false;
  991. }
  992. @JavascriptInterface
  993. public void setShareInfo(String paramString)
  994. {
  995. parseResInfo(paramString);
  996. }
  997. public void setWebview(WebView paramWebView)
  998. {
  999. this._webview = paramWebView;
  1000. }
  1001. @JavascriptInterface
  1002. public void setbackPolicy(String paramString)
  1003. {
  1004. this.backUrl = paramString;
  1005. }
  1006. private class WebViewADBean
  1007. {
  1008. public int adType;
  1009. public String callback;
  1010. public String callbackParams;
  1011. public int categoryId;
  1012. public boolean hasRequested;
  1013. public String rawData;
  1014. public Object rawObj;
  1015. private WebViewADBean()
  1016. {
  1017. }
  1018. }
  1019. private class WebViewActionBean
  1020. {
  1021. public int actionType;
  1022. public int adType;
  1023. public int categoryId;
  1024. private WebViewActionBean()
  1025. {
  1026. }
  1027. }
  1028. private class WebViewEventBean
  1029. {
  1030. public String eventName;
  1031. public int eventType;
  1032. public String eventValue;
  1033. private WebViewEventBean()
  1034. {
  1035. }
  1036. }
  1037. private class WebViewMonitorBean
  1038. {
  1039. public int actionType;
  1040. public int monitorType;
  1041. public String monitorUrl;
  1042. private WebViewMonitorBean()
  1043. {
  1044. }
  1045. }
  1046. class WechatReceiver extends BroadcastReceiver
  1047. {
  1048. WechatReceiver()
  1049. {
  1050. }
  1051. public void onReceive(Context paramContext, Intent paramIntent)
  1052. {
  1053. if (paramIntent == null);
  1054. while (true)
  1055. {
  1056. return;
  1057. try
  1058. {
  1059. if ((paramIntent.getAction().equalsIgnoreCase("android.intent.action.WECHAT_RESP")) && ((WebViewPlayer.this.shareType == 0) || (WebViewPlayer.this.shareType == 1)))
  1060. {
  1061. WebViewPlayer.this.invokeCallBack(null);
  1062. return;
  1063. }
  1064. }
  1065. catch (Exception paramContext)
  1066. {
  1067. }
  1068. }
  1069. }
  1070. }
  1071. }
  1072. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  1073. * Qualified Name: fm.qingting.qtradio.fm.WebViewPlayer
  1074. * JD-Core Version: 0.6.2
  1075. */