| | |
| | | package com.weikou.beibeivideo.util; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.BroadcastReceiver; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.IntentFilter; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | |
| | | import com.alibaba.baichuan.android.trade.AlibcTrade; |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | | import com.alibaba.baichuan.android.trade.callback.AlibcTradeCallback; |
| | | import com.alibaba.baichuan.android.trade.model.AlibcShowParams; |
| | | import com.alibaba.baichuan.android.trade.model.OpenType; |
| | | import com.alibaba.baichuan.android.trade.page.AlibcDetailPage; |
| | | import com.alibaba.baichuan.trade.biz.AlibcConstants; |
| | | import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType; |
| | | import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult; |
| | | import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.tencent.mm.opensdk.constants.ConstantsAPI; |
| | | import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | | import com.weikou.beibeivideo.entity.JumpDetail; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | |
| | | import org.json.JSONException; |
| | | |
| | |
| | | AlibcDetailPage basePage = new AlibcDetailPage(auctionId); |
| | | AlibcTrade.openByBizCode(mActivity, basePage, null, |
| | | new WebViewClient(), new WebChromeClient(), "nativeDetail", alibcShowParams, |
| | | alibcTaokeParams, null, new AlibcTradeCallback(){ |
| | | alibcTaokeParams, null, new AlibcTradeCallback() { |
| | | |
| | | @Override |
| | | public void onTradeSuccess(AlibcTradeResult alibcTradeResult) { |
| | |
| | | return; |
| | | if (detail == null) |
| | | return; |
| | | if (detail.isNeedLogin() && !UserUtil.isLogin(context)) { |
| | | context.startActivity(new Intent(context, LoginActivity.class)); |
| | | return; |
| | | } |
| | | |
| | | String type = detail.getType(); |
| | | switch (type) { |
| | |
| | | String url = params.getString("url"); |
| | | if (StringUtils.isEmpty(url)) |
| | | return; |
| | | |
| | | //跳转百川 |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Auto); |
| | | JumpActivityUtil.jumpBaiChuan(context, null, url, "", alibcShowParams); |
| | | alibcShowParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeJumpBROWER); |
| | | // AlibcTrade.openByUrl(GoodsDetailActivityTB.this, "", |
| | | // url, null, new WebViewClient(), new WebChromeClient(), |
| | | // alibcShowParams, alibcTaokeParams, exParams, new MiDuoTradeCallback("")); |
| | | |
| | | AlibcTaokeParams alibcTaokeParams = new AlibcTaokeParams("", "", ""); |
| | | alibcTaokeParams.setPid(BeibeiConstant.BAICHUAN_PID); |
| | | alibcTaokeParams.setAdzoneid(BeibeiConstant.BAICHUAN_ADZONE_ID); |
| | | alibcTaokeParams.pid = BeibeiConstant.BAICHUAN_PID; |
| | | alibcTaokeParams.adzoneid = BeibeiConstant.BAICHUAN_ADZONE_ID; |
| | | alibcTaokeParams.extraParams = new HashMap<>(); |
| | | alibcTaokeParams.extraParams.put("taokeAppkey", BeibeiConstant.BAICHUAN_APPKEY); |
| | | |
| | | AlibcTradeSDK.setTaokeParams(alibcTaokeParams); |
| | | AlibcTradeUtil.openByUrl(context, |
| | | url, null, new WebViewClient(), new WebChromeClient(), |
| | | alibcShowParams, alibcTaokeParams, null); |
| | | break; |
| | | |
| | | case "wxxcx": |
| | | if (params == null) |
| | | return; |
| | | //微信小程序 |
| | | String path = params.getString("path"); |
| | | String userName = params.getString("userName"); |
| | | if (StringUtils.isEmpty(userName)) { |
| | | return; |
| | | } |
| | | IWXAPI api = WXAPIFactory.createWXAPI(context, BeibeiConstant.WECHAT_ID, true); |
| | | WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req(); |
| | | req.userName = userName; // 填小程序原始id |
| | | req.path = path; ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 |
| | | req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版 |
| | | api.sendReq(req); |
| | | |
| | | |
| | | break; |
| | | |
| | | case "web": |
| | | if (params == null) |
| | | return; |
| | | { |
| | | String webUrl = params.getString("url").toString(); |
| | | String title = params.getString("title"); |
| | | context.startActivity(new Intent(context, BrowserActivity.class).putExtra("url", webUrl).putExtra("title", title)); |
| | | } |
| | | |
| | | |
| | | break; |
| | | |
| | | default: { |
| | | try { |
| | | Intent intent = new Intent(context, Class.forName(JumpActivityUtil.filterActivityName(detail.getActivity()))); |