copy from app/src/main/java/com/tejia/lijin/app/util/BaseRebateJavaInterface.java
copy to app/src/main/java/com/tejia/lijin/app/util/web/BaseRebateJavaInterfaceBS.java
File was copied from app/src/main/java/com/tejia/lijin/app/util/BaseRebateJavaInterface.java |
| | |
| | | package com.tejia.lijin.app.util; |
| | | package com.tejia.lijin.app.util.web; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | |
| | | import com.alibaba.baichuan.android.trade.model.OpenType; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.tejia.lijin.app.BuXinConstant; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailBrowerActivity; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | | import com.tejia.lijin.app.util.WXUtil; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.wpc.library.DeviceUuidFactory; |
| | | import com.wpc.library.util.GetManifestDataUtil; |
| | |
| | | import com.wpc.library.util.common.PackageUtils2; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.wpc.library.util.security.MD5Utils; |
| | | import com.tejia.lijin.app.BuXinConstant; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailBrowerActivity; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | import static android.content.Context.MODE_PRIVATE; |
| | | |
| | | public class BaseRebateJavaInterface { |
| | | public class BaseRebateJavaInterfaceBS { |
| | | |
| | | Activity mContext; |
| | | |
| | | public BaseRebateJavaInterface(Activity activity) { |
| | | public BaseRebateJavaInterfaceBS(Activity activity) { |
| | | mContext = activity; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getUid() { |
| | | public Object getUid() { |
| | | return mContext.getSharedPreferences("user", MODE_PRIVATE).getString("uid", ""); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public String getVersion() { |
| | | public Object getVersion() { |
| | | return PackageUtils2.getVersionCode(mContext) + ""; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void toast(String str) { |
| | | Toast.makeText(mContext, str, Toast.LENGTH_LONG).show(); |
| | | public void toast(Object str) { |
| | | Toast.makeText(mContext, str.toString(), Toast.LENGTH_LONG).show(); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getSign(String str) { |
| | | public String getSign(Object str) { |
| | | return MD5Utils.getMD532(str + "@?,223Hbb88lll"); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpBaiChuan(String tbClientInfo, String url, String auctionId) { |
| | | public void jumpBaiChuan(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | final String tbClientInfo = json.optString("tbClientInfo"); |
| | | final String url = json.optString("url"); |
| | | final String auctionId = json.optString("auctionId"); |
| | | |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Auto); |
| | | JumpActivityUtil.jumpBaiChuan(mContext, tbClientInfo, url, auctionId, alibcShowParams); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void jumpSearch(String key) { |
| | | public void jumpSearch(Object key) { |
| | | Intent intent = new Intent(mContext, SearchActivity.class); |
| | | intent.putExtra("key", key); |
| | | intent.putExtra("key", key.toString()); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void jumpGoodsDetail(long id) { |
| | | Intent intent = new Intent(mContext, GoodsDetailBrowerActivity.class); |
| | | intent.putExtra("id", id + ""); |
| | | intent.putExtra("isTrolley", true); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void copyText(String atr) { |
| | | ClipboardUtil.copy(mContext, atr); |
| | | public void copyText(Object atr) { |
| | | ClipboardUtil.copy(mContext, atr.toString()); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpPage(String pageClassName, String paramJson) { |
| | | public void jumpPage(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | String pageClassName = json.optString("pageClassName"); |
| | | String paramJson = json.optString("paramJson"); |
| | | |
| | | Intent intent = null; |
| | | JSONObject param = null; |
| | | try { |
| | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getRequestBaseParams(String json) { |
| | | public String getRequestBaseParams(Object json) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | int version = PackageUtils2.getVersionCode(mContext); |
| | | long time = System.currentTimeMillis(); |
| | | String deviceType = MobileUtil.getSystemModel(); |
| | | if (!StringUtils.isEmpty(json)) { |
| | | if (!StringUtils.isEmpty(json.toString())) { |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(json); |
| | | jsonObject = new JSONObject(json.toString()); |
| | | Iterator<String> iterator = jsonObject.keys(); |
| | | while (iterator.hasNext()) { |
| | | String key = iterator.next(); |
| | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void umEventCount(String eventId, String paramsJSON) { |
| | | public void umEventCount(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | String eventId = json.optString("eventId"); |
| | | String paramsJSON = json.optString("paramsJSON"); |
| | | |
| | | Map map = JSON.parseObject(paramsJSON); |
| | | MobclickAgent.onEventObject(mContext, eventId, map); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void umEventCompute(String eventId, String paramsJSON, int du) { |
| | | public void umEventCompute(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | String eventId = json.optString("eventId"); |
| | | String paramsJSON = json.optString("paramsJSON"); |
| | | int du = json.optInt("du"); |
| | | |
| | | Map map = JSON.parseObject(paramsJSON); |
| | | MobclickAgent.onEventValue(mContext, eventId, map, du); |
| | | } |
| | | |
| | | /*********移进来的方法****/ |
| | | @JavascriptInterface |
| | | public void jumpGoodsSplashWithFrom(long id, String from) { |
| | | Intent intent = new Intent(mContext, GoodsDetailActivity.class); |
| | | intent.putExtra("id", id + ""); |
| | | intent.putExtra("from", from); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpGoodsDetail(String id, int goodsType) { |
| | | public void jumpGoodsDetail(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | String id = json.optString("id"); |
| | | String goodsType = json.optString("goodsType"); |
| | | String from = json.optString("from"); |
| | | |
| | | Intent intent = new Intent(mContext, GoodsDetailActivity.class); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", goodsType); |
| | | if(!StringUtils.isNullOrEmpty(from)) |
| | | intent.putExtra("from", from); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void jumpGoodsSplash(long id) { |
| | | Intent intent = new Intent(mContext, GoodsDetailActivity.class); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", Constant.GOODS_TYPE_TB); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void jumpPDDGoodsDetailWithFrom(long id, String from) { |
| | | Intent intent = new Intent(mContext, GoodsDetailActivity.class); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", Constant.GOODS_TYPE_PDD); |
| | | intent.putExtra("from", from); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void jumpJDGoodsDetailWithFrom(long id, String from) { |
| | | Intent intent = new Intent(mContext, GoodsDetailActivity.class); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", Constant.GOODS_TYPE_JD); |
| | | intent.putExtra("from", from); |
| | | mContext.startActivity(intent); |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public void jumpWXXCX(String userName, String path) { |
| | | public void jumpWXXCX(Object args) throws JSONException { |
| | | JSONObject json = new JSONObject(args.toString()); |
| | | String userName = json.optString("userName"); |
| | | String path = json.optString("path"); |
| | | WXUtil.jumpWXXCX(mContext, userName, path); |
| | | } |
| | | |