| | |
| | | |
| | | import android.Manifest; |
| | | import android.annotation.SuppressLint; |
| | | import android.content.ClipboardManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | |
| | | import com.tejia.lijin.app.entity.HomeBanner; |
| | | import com.tejia.lijin.app.entity.TrendsCategory; |
| | | import com.tejia.lijin.app.entity.common.ImageShowEntity; |
| | | import com.tejia.lijin.app.entity.trends.ConvertLinkJumpVO; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleCommment; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleContent; |
| | | import com.tejia.lijin.app.entity.trends.SendCircleImage; |
| | |
| | | import com.tejia.lijin.app.ui.dialog.SendCircleShareDialog; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.ui.mine.MyInfoActivity; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.ui.recommend.ShareExplosionsGoodsDetailActivity; |
| | | import com.tejia.lijin.app.ui.trends.BigImageActivity; |
| | | import com.tejia.lijin.app.ui.trends.SendCircleAdapter; |
| | | import com.tejia.lijin.app.util.ApkUtil; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.ExceptionConstant; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.PermissionHelper; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.ui.HomeUIUtil; |
| | | import com.tejia.lijin.app.util.ui.TextViewUtil; |
| | | import com.tejia.lijin.app.util.ui.dialog.DialogUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | |
| | | } |
| | | } |
| | | if (adapter == null) { |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, BetterGoodsFragment.this); |
| | | adapter = new SendCircleAdapter(getActivity(), mBannerList, mContentList, BetterGoodsFragment.this, new TextViewUtil.URLClickListener() { |
| | | @Override |
| | | public void onClick(final String url) { |
| | | prepareAction(new IPrePareSuccessListener() { |
| | | @Override |
| | | public void onSuccess() { |
| | | ShoppingApi.evaluateConvertLink( |
| | | getContext(), UserUtil. |
| | | getUid(getContext()), url, new |
| | | BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] |
| | | headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | //成功 |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | ConvertLinkJumpVO jumpVO = new Gson().fromJson(data.toString(), ConvertLinkJumpVO.class); |
| | | switch (jumpVO.getSourceType()) { |
| | | case Constant.GOODS_TYPE_TB: |
| | | GoodsBuyJumpUtil.jumpTB(getActivity(), null, jumpVO.getJumpLink().getJumpLink(), jumpVO.getJumpLink().getNativeJumpLink(), null, null); |
| | | break; |
| | | case Constant.GOODS_TYPE_JD: |
| | | GoodsBuyJumpUtil.jumpJD(getActivity(), jumpVO.getJumpLink(), null, null); |
| | | break; |
| | | case Constant.GOODS_TYPE_PDD: |
| | | GoodsBuyJumpUtil.jumpPDD(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | case Constant.GOODS_TYPE_VIP: |
| | | GoodsBuyJumpUtil.jumpVIPShop(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | case Constant.GOODS_TYPE_SUNING: |
| | | GoodsBuyJumpUtil.jumpSuning(getActivity(), jumpVO.getJumpLink(), null); |
| | | break; |
| | | } |
| | | } else { |
| | | int code = jsonObject.optInt("code"); |
| | | switch (code) { |
| | | case ExceptionConstant.CODE_NOT_LOGIN: |
| | | startActivity(new Intent(getContext(), LoginSelectActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_AUTH_PDD_NO_AUTH: |
| | | Toast.makeText(getContext(), "请备案拼多多账号", Toast.LENGTH_SHORT).show(); |
| | | startActivity(new Intent(getContext(), MyInfoActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_AUTH_TAOBAO_NO_AUTH: |
| | | Toast.makeText(getContext(), "请授权淘宝账号", Toast.LENGTH_SHORT).show(); |
| | | startActivity(new Intent(getContext(), MyInfoActivity.class)); |
| | | break; |
| | | case ExceptionConstant.CODE_JUMP_NO_SUPPORT: |
| | | //不支持跳转 |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | ConvertLinkJumpVO jumpVO = new Gson().fromJson(data.toString(), ConvertLinkJumpVO.class); |
| | | if (jumpVO.getSourceType() != null && jumpVO.getSourceType() == Constant.GOODS_TYPE_TB) { |
| | | //复制口令跳转到淘宝 |
| | | //是否安装淘宝 |
| | | if (ApkUtil.checkAPP(getContext(), "com.taobao.taobao")) { |
| | | ClipboardUtil.copy(getContext(), url); |
| | | startActivity(getContext().getPackageManager().getLaunchIntentForPackage("com.taobao.taobao")); |
| | | } |
| | | } |
| | | break; |
| | | default: |
| | | Toast.makeText(getContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] |
| | | headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | Toast.makeText(getContext(), "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | rv_better_goods.setRecycledViewPool(new RecyclerView.RecycledViewPool()); |
| | | rv_better_goods.setAdapter(adapter); |
| | | |
| | | initLoadingView(); |
| | | } else { |
| | | adapter.notifyDataSetChanged(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | public void onFailure(int statusCode, Header[] headers, String |
| | | responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | bottom.setVisibility(View.GONE); |
| | | if (NetUtils.getNetworkState(srl_better_goods.getContext()).equalsIgnoreCase(NetUtils.NETWORK_NONE)) { |
| | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | if (!pd.isShowing()) |
| | | pd.show(); |
| | | DialogUtil.show(pd); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void createERCode(SendCircleContent content, List<SendCircleImage> imgList, SendCircleImage img, final int position) { |
| | | public void createERCode(SendCircleContent |
| | | content, List<SendCircleImage> imgList, SendCircleImage img, final int position) { |
| | | actionParams = new ActionParams(content, imgList, img, position); |
| | | actionParams.type = ActionParams.TYPE_CREATE_ERCODE; |
| | | prepareAction(new IPrePareSuccessListener() { |
| | |
| | | |
| | | @Override |
| | | public void copyRecommendText(SendCircleContent content) { |
| | | ClipboardUtil.copy(getContext(), content.getTitle()); |
| | | ShoppingApi.evaluateCopyRecommend(getContext(), UserUtil.getUid(getContext()), content.getId(), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | DialogUtil.show(pd); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | if (jsonObject.optInt("code") == 0) { |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | String content = data.optString("content"); |
| | | ClipboardUtil.copy(getContext(), content); |
| | | Toast.makeText(getContext(), "复制成功", Toast.LENGTH_SHORT).show(); |
| | | } else { |
| | | Toast.makeText(getContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) { |
| | | super.onFailure(statusCode, headers, jsonObject, e); |
| | | Toast.makeText(getContext(), "网络请求出错", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(pd); |
| | | } |
| | | }); |
| | | |
| | | copyTypeMap.put(content.getId(), 1); |
| | | } |
| | | |