| | |
| | | package com.tejia.lijin.app.util; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | |
| | | |
| | | try { |
| | | |
| | | if (link.is_native() && !StringUtils.isNullOrEmpty(link.getNativeJumpLink())&&ApkUtil.checkAPP(context, "com.jingdong.app.mall")) { |
| | | if (link.is_native() && !StringUtils.isNullOrEmpty(link.getNativeJumpLink()) && ApkUtil.checkAPP(context, "com.jingdong.app.mall")) { |
| | | KeplerApiManager.getWebViewService().openAppWebViewPage(context, link.getNativeJumpLink(), new KeplerAttachParameter(), mOpenAppAction); |
| | | return; |
| | | } |
| | |
| | | } finally { |
| | | if (dialog != null && dialog.isShowing()) |
| | | dialog.dismiss(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static void jumpJD(final Activity activity, GoodsConvertLinkJumpLink link, final IJumpResult jumpResult) { |
| | | if (link == null) |
| | | return; |
| | | |
| | | if (activity == null) { |
| | | return; |
| | | } |
| | | |
| | | OpenAppAction mOpenAppAction = new OpenAppAction() { |
| | | @Override |
| | | public void onStatus(final int status, final String url) { |
| | | if (activity != null) |
| | | activity.runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (status == OpenAppAction.OpenAppAction_result_APP) { |
| | | //呼京东成功 |
| | | Log.e("mResult", "呼京东成功"); |
| | | jumpResult.onSuccess(); |
| | | } else if (status == OpenAppAction.OpenAppAction_start) { |
| | | //开始状态未必一定执行, |
| | | Log.e("mResult", "开始呼起京东"); |
| | | } else { |
| | | //唤起京东失败 |
| | | Log.e("mResult", "唤起京东失败" + status); |
| | | Intent intent = new Intent(activity, ShareBrowserActivity.class); |
| | | intent.putExtra("url", url); |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | activity.startActivity(intent); |
| | | jumpResult.onFail("唤起京东失败"); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | |
| | | try { |
| | | |
| | | if (link.is_native() && !StringUtils.isNullOrEmpty(link.getNativeJumpLink()) && ApkUtil.checkAPP(activity, "com.jingdong.app.mall")) { |
| | | KeplerApiManager.getWebViewService().openAppWebViewPage(activity, link.getNativeJumpLink(), new KeplerAttachParameter(), mOpenAppAction); |
| | | return; |
| | | } |
| | | |
| | | if (link.getWxxcxJumpInfo() != null) { |
| | | try { |
| | | WXUtil.jumpWXXCX(activity, link.getWxxcxJumpInfo().getUserName(), link.getWxxcxJumpInfo().getPath()); |
| | | return; |
| | | } catch (Exception e) { |
| | | //最后跳转网页 |
| | | Intent intent = new Intent(activity, ShareBrowserActivity.class); |
| | | intent.putExtra("url", link.getJumpLink()); |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | activity.startActivity(intent); |
| | | } |
| | | } |
| | | |
| | | |
| | | Intent intent = new Intent(activity, ShareBrowserActivity.class); |
| | | intent.putExtra("url", link.getJumpLink()); |
| | | intent.putExtra("interceptGoodsDetail", false); |
| | | activity.startActivity(intent); |
| | | } finally { |
| | | jumpResult.onSuccess(); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void jumpSuning(Context context, GoodsConvertLinkJumpLink link) { |
| | | if (context == null) |
| | | return; |
| | |
| | | } |
| | | |
| | | |
| | | public static interface IJumpResult { |
| | | public void onSuccess(); |
| | | |
| | | public void onFail(String msg); |
| | | |
| | | } |
| | | |
| | | } |