From ddff7888bf7e754d12fb5fc85a58f3012f456490 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 05 六月 2021 17:26:03 +0800 Subject: [PATCH] 特价完善 --- app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 92 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java b/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java index d33a6c6..c8b2e05 100644 --- a/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java +++ b/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java @@ -43,6 +43,7 @@ import com.tejia.lijin.app.entity.share.ShareImageEntity; import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; +import com.tejia.lijin.app.updateApp.UpdateApp; import com.tejia.lijin.app.util.JumpActivityUtil; import com.tejia.lijin.app.util.PermissionHelper; import com.tejia.lijin.app.util.ToastUtil; @@ -129,7 +130,7 @@ } else {//瀛樺偍鏉冮檺宸插紑 String md5 = MD5Utils.getMD532(url.toString()); String path = com.wpc.library.util.Environment.getExternalStorageDirectory() - + "/blksapp"; + + "/tejiaapp"; File file = new File(path + "/" + md5 + ".jpg"); if (!file.exists()) { try { @@ -145,6 +146,53 @@ } else { Toast.makeText(mContext, "鍥剧墖宸茬粡淇濆瓨!", Toast.LENGTH_LONG).show(); + } + } + } + + + /** + * 寮傛淇濆瓨鍥剧墖 + * + * @param args + * @param handler + * @throws JSONException + */ + public void savePictureAsync(Object args, final CompletionHandler handler) throws JSONException { + JSONObject jsonObject = new JSONObject(args.toString()); + String url = jsonObject.optString("url"); + if (mPermissionsChecker == null) + mPermissionsChecker = new PermissionHelper(mContext, this); + if (mPermissionsChecker.lacksPermissions(getPermissions())) { //瀛樺偍鏉冮檺鏈紑鍚� + mPermissionsChecker.showNormalDialog(); + } else {//瀛樺偍鏉冮檺宸插紑 + String md5 = MD5Utils.getMD532(url); + String path = com.wpc.library.util.Environment.getExternalStorageDirectory() + + "/tejiaapp"; + File file = new File(path + "/" + md5 + ".jpg"); + if (!file.exists()) { + try { + File resultFile = Tools.saveImageFromPathToSdCard(mContext, url, path, md5 + ".jpg"); + if (resultFile != null) { + JSONObject result = new JSONObject(); + result.put("code", 0); + result.put("msg", "淇濆瓨鎴愬姛"); + handler.complete(result); + } + } catch (Exception e) { + JSONObject result = new JSONObject(); + result.put("code", 1); + result.put("msg", "鍥剧墖淇濆瓨澶辫触"); + handler.complete(result); + if (file.exists()) + file.delete(); + } + + } else { + JSONObject result = new JSONObject(); + result.put("code", 2); + result.put("msg", "鍥剧墖宸茬粡淇濆瓨"); + handler.complete(result); } } } @@ -243,14 +291,14 @@ @JavascriptInterface - public void hiddenTopMenuCloseBtn() { + public void hiddenTopMenuCloseBtn(Object obj) { if (!boo) tv_top_bar_left2.setVisibility(View.GONE); } @JavascriptInterface - public void hideLoading() { + public void hideLoading(Object obj) { if (!boo) iv_right.post(new Runnable() { @Override @@ -263,7 +311,7 @@ } @JavascriptInterface - public void showLoading() { + public void showLoading(Object obj) { if (!boo) iv_right.post(new Runnable() { @Override @@ -278,7 +326,7 @@ } @JavascriptInterface - public void finishPage() { + public void finishPage(Object obj) { if (!boo) iv_right.post(new Runnable() { @Override @@ -325,7 +373,7 @@ @JavascriptInterface - public void showSharePanel() { + public void showSharePanel(Object obj) { webShareDesc.setShare(); } @@ -490,6 +538,7 @@ //璇锋眰骞垮憡澶辫触 @Override public void onError(int code, String message) { + com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); result.put("code", 1); result.put("msg", message); handler.complete(result); @@ -498,11 +547,16 @@ //瑙嗛骞垮憡鍔犺浇鍚庯紝瑙嗛璧勬簮缂撳瓨鍒版湰鍦扮殑鍥炶皟锛屽湪姝ゅ洖璋冨悗锛屾挱鏀炬湰鍦拌棰戯紝娴佺晠涓嶉樆濉炪�� @Override public void onRewardVideoCached() { + //寮�鍙戣�呭仛涓�涓爣璇� if (mttRewardVideoAd != null) { mttRewardVideoAd.showRewardVideoAd(mContext, TTAdConstant.RitScenes.CUSTOMIZE_SCENES, "scenes_test"); mttRewardVideoAd = null; } + com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); + result.put("code", 100); + result.put("msg", "缂撳瓨鎴愬姛"); + handler.setProgressData(result); } //瑙嗛骞垮憡鐨勭礌鏉愬姞杞藉畬姣曪紝姣斿瑙嗛url绛夛紝鍦ㄦ鍥炶皟鍚庯紝鍙互鎾斁鍦ㄧ嚎瑙嗛锛岀綉缁滀笉濂藉彲鑳藉嚭鐜板姞杞界紦鍐诧紝褰卞搷浣撻獙銆� @@ -533,6 +587,7 @@ @Override public void onVideoError() { + com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); result.put("code", 2); result.put("msg", "瑙嗛鍑洪敊"); handler.complete(result); @@ -540,6 +595,7 @@ @Override public void onRewardVerify(boolean b, int i, String s, int i1, String s1) { + com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); result.put("code", 0); result.put("msg", "骞垮憡灞曠ず瀹屾垚"); handler.complete(result); @@ -579,7 +635,7 @@ @Override public void run() { View view = LayoutInflater.from(mContext).inflate(R.layout.item_reward_ad_fail, null); - LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(DimenUtils.getScreenWidth(mContext)*4/5,LinearLayout.LayoutParams.WRAP_CONTENT); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DimenUtils.getScreenWidth(mContext) * 4 / 5, LinearLayout.LayoutParams.WRAP_CONTENT); view.setLayoutParams(params); TextView tv_content = view.findViewById(R.id.tv_content); tv_content.setText(msg + ""); @@ -587,6 +643,31 @@ } }); } + + + @JavascriptInterface + public void checkUpdate(Object obj) { + UpdateApp app = new UpdateApp(mContext,mContext.getResources().getString(R.string.update_key)); + app.getUpdateInfo(new UpdateApp.UpdateJudgeCallback() { + + @Override + public void onSuccess(boolean show) { + + } + + @Override + public void closeUpdate(boolean close) { + + } + + @Override + public void onFinish() { + + } + }, true);//寮哄埗妫�娴嬫洿鏂� + } + + int type; @@ -657,7 +738,7 @@ + "/rebateshare"; } else if (type == 2) { path = com.wpc.library.util.Environment.getExternalStorageDirectory() - + "/blksapp"; + + "/tejiaapp"; } final File storageDir = new File(path); List<String> filePathList = new ArrayList<>(); @@ -667,13 +748,13 @@ } if (urlList.size() > 0) { - showLoading(); + showLoading(null); shareTempImgEntity = new ArrayList<>(); //鍘讳笅杞� new DownLoadFile().downloadMultiImages(urlList, filePathList, mContext, new DownLoadFile.FileDownLoadListener() { @Override public void finish(List<File> fileList) { - hideLoading(); + hideLoading(null); //瀹屾垚涓嬭浇 if (fileList != null) @@ -702,7 +783,7 @@ } }); } else { - hideLoading(); + hideLoading(null); if (type == 1) shareHandler.sendEmptyMessage(platform); else { -- Gitblit v1.8.0