| | |
| | | import com.tejia.lijin.app.R; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.entity.CouponUser; |
| | | import com.tejia.lijin.app.entity.GoodsDetail; |
| | | import com.tejia.lijin.app.entity.PushEventData; |
| | | import com.tejia.lijin.app.entity.TaoBaoGoodsBrief; |
| | | import com.tejia.lijin.app.entity.common.ImageShowEntity; |
| | | import com.tejia.lijin.app.entity.goods.GoodsDetailVO; |
| | | import com.tejia.lijin.app.ui.BaseActivity; |
| | | import com.tejia.lijin.app.ui.dialog.GoodsDetailHongBaoAndCouponSelectDialog; |
| | | import com.tejia.lijin.app.ui.dialog.JumpTaoBaoDialog; |
| | | import com.tejia.lijin.app.ui.goods.GoodsDetailHongBaoListAdapter; |
| | | import com.tejia.lijin.app.ui.goods.GoodsDetailPreEventManager; |
| | |
| | | import com.tejia.lijin.app.ui.mine.LoginSelectActivity; |
| | | import com.tejia.lijin.app.ui.mine.MyFootmarkActivity; |
| | | import com.tejia.lijin.app.ui.trends.BigImageActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.FlowLayout; |
| | | import com.tejia.lijin.app.util.GlideCircleTransform; |
| | | import com.tejia.lijin.app.util.GlideRoundTransform; |
| | |
| | | import com.tejia.lijin.app.util.Toast_Dialog; |
| | | import com.tejia.lijin.app.util.TopStatusSettings; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.ui.GoodsDetailUtil; |
| | | import com.tejia.lijin.app.util.umengCustomEvent.GoodsCustomEvent; |
| | | import com.tejia.lijin.app.util.user.LoginAndInviteStatusUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | |
| | | |
| | | public class GoodsDetailActivity extends BaseActivity implements View.OnClickListener { |
| | | |
| | | private static final String TAG = "GoodsDetailActivity"; |
| | | /**************************控件定义开始**************************/ |
| | | private MyScrollView lv_goods_pic; |
| | | private MyScrollView sv_goods; |
| | | |
| | | private LinearLayout ll_content; |
| | | |
| | |
| | | |
| | | //商品店铺信息 |
| | | private LinearLayout ll_shop; |
| | | private ImageView iv_shop_img, iv_shop_type; |
| | | private ImageView iv_shop_img; |
| | | private TextView tv_shop_type; |
| | | private TextView tv_shop_name; |
| | | private TextView tv_shop_des, tv_shop_service, tv_shop_logistics, tv_shop_des_grade, tv_shop_logistics_grade, |
| | | tv_shop_service_grade; |
| | |
| | | private RecyclerView rv_price_info; |
| | | |
| | | //图文详情 |
| | | private FrameLayout fl_goods_detail; |
| | | private ImageView iv_imgtext_status; |
| | | private WebView webView; |
| | | private LinearLayout ll_loading; |
| | |
| | | |
| | | private void initView() { |
| | | ll_content = findViewById(R.id.ll_content); |
| | | lv_goods_pic = findViewById(R.id.lv_goods_pic); |
| | | sv_goods = findViewById(R.id.lv_goods_pic); |
| | | tv_top_title1 = findViewById(R.id.tv_top_title1); |
| | | tv_top_title2 = findViewById(R.id.tv_top_title2); |
| | | tv_top_title3 = findViewById(R.id.tv_top_title3); |
| | |
| | | tv_buy = findViewById(R.id.tv_buy); |
| | | ll_top_title = findViewById(R.id.ll_top_title); |
| | | iv_shop_img = findViewById(R.id.iv_shop_img); |
| | | iv_shop_type = findViewById(R.id.iv_shop_type); |
| | | tv_shop_type = findViewById(R.id.tv_shop_type); |
| | | tv_shop_name = findViewById(R.id.tv_shop_name); |
| | | tv_shop_des = findViewById(R.id.tv_shop_des); |
| | | tv_shop_service = findViewById(R.id.tv_shop_service); |
| | |
| | | v_3 = findViewById(R.id.v_3); |
| | | v_4 = findViewById(R.id.v_4); |
| | | |
| | | fl_face = findViewById(R.id.fl_face); |
| | | |
| | | |
| | | avLoadingIndicatorView = findViewById(R.id.avi); |
| | | ll_guess_like = findViewById(R.id.ll_guess_like); |
| | | iv_imgtext_status = findViewById(R.id.iv_imgtext_status); |
| | | fl_goods_detail = findViewById(R.id.fl_goods_detail); |
| | | ll_loading = findViewById(R.id.ll_loading); |
| | | tv_loading = findViewById(R.id.tv_loading); |
| | | iv_loading = findViewById(R.id.iv_loading); |
| | |
| | | //umeng统计 |
| | | GoodsCustomEvent.goodsDetail(this, from); |
| | | inputTime = System.currentTimeMillis(); |
| | | final String goodsId = getIntent().getExtras().getString("goodsId"); |
| | | final int goodsType = Integer.parseInt(getIntent().getExtras().getString("goodsType")); |
| | | |
| | | String tempGoodsType = ""; |
| | | String tempGoodsId = ""; |
| | | |
| | | |
| | | //获取商品ID |
| | | tempGoodsId = getIntent().getExtras().getString("goodsId"); |
| | | if (StringUtils.isNullOrEmpty(tempGoodsId)) |
| | | tempGoodsId = getIntent().getExtras().getString("id"); |
| | | final String goodsId = tempGoodsId; |
| | | |
| | | |
| | | //获取商品类型 |
| | | tempGoodsType = getIntent().getExtras().getString("goodsType"); |
| | | if (StringUtils.isNullOrEmpty(tempGoodsType)) |
| | | tempGoodsType = getIntent().getExtras().getInt("goodsType", 0) + ""; |
| | | if (tempGoodsType.equalsIgnoreCase("0")) |
| | | tempGoodsType = Constant.GOODS_TYPE_TB + ""; |
| | | |
| | | |
| | | final int goodsType = Integer.parseInt(tempGoodsType); |
| | | |
| | | |
| | | from = getIntent().getExtras().getString("from"); |
| | | |
| | | tv_loading.setText("宝贝详情页加载中..."); |
| | |
| | | avLoadingIndicatorView.setVisibility(View.VISIBLE); |
| | | Animation ani = AnimationUtils.loadAnimation(this, R.anim.touming); //申明一个动画 |
| | | avLoadingIndicatorView.setAnimation(ani);//为图片绑定动画 |
| | | findViewById(R.id.fl_face).setVisibility(View.VISIBLE); |
| | | ll_content.setVisibility(View.GONE); |
| | | fl_face.setVisibility(View.VISIBLE); |
| | | bannerAdapter = new ImageAdapter(mBanners, this); |
| | | vp_goods_detail.setAdapter(bannerAdapter); |
| | | vp_goods_detail.setCurrentItem(0, true); |
| | |
| | | } |
| | | }); |
| | | |
| | | lv_goods_pic.setOnScrollListener(new MyScrollView.OnScrollListener() { |
| | | sv_goods.setOnScrollListener(new MyScrollView.OnScrollListener() { |
| | | @Override |
| | | public void onScroll(int scrollY) { |
| | | int titleHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 48); |
| | | int marginTopHeight = DimenUtils.dip2px(GoodsDetailActivity.this, 8); |
| | | if (scrollY < (vp_goods_detail.getHeight() - titleHeight * 2)) {//头部 |
| | | if (scrollY < fl_goods_detail.getTop()) {//头部 |
| | | setPosition(1); |
| | | } else if (scrollY >= vp_goods_detail.getHeight() - titleHeight * 2 |
| | | && scrollY < (vp_goods_detail.getHeight() + webView.getHeight() - titleHeight) |
| | | && webView.getVisibility() != View.GONE) {//详情图片 |
| | | } else if (scrollY >= (fl_goods_detail.getTop() - titleHeight) |
| | | && scrollY < ll_guess_like.getTop()) {//详情图片 |
| | | setPosition(2); |
| | | } else if (scrollY >= (vp_goods_detail.getHeight() |
| | | + webView.getHeight() - titleHeight + marginTopHeight) && scrollY < (vp_goods_detail.getHeight() |
| | | + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight) |
| | | && webView.getVisibility() != View.GONE) {//猜你喜欢 |
| | | setPosition(3); |
| | | } else if (scrollY >= (vp_goods_detail.getHeight() + webView.getHeight() |
| | | + ll_guess_like.getHeight() - titleHeight + marginTopHeight)) {//推荐 |
| | | } else if (scrollY >= ll_guess_like.getTop() - titleHeight) {//猜你喜欢 |
| | | setPosition(4); |
| | | } else { |
| | | setPosition(4); |
| | |
| | | from = ""; |
| | | initView(); |
| | | initData(); |
| | | // getAppPageNotification(); |
| | | getAppPageNotification(); |
| | | } |
| | | |
| | | |
| | |
| | | inAnima.setInterpolator(new DecelerateInterpolator()); |
| | | ll_notification.setAnimation(inAnima); |
| | | ll_notification.startAnimation(inAnima); |
| | | // inAnima.start(); |
| | | inAnima.start(); |
| | | } else if (msg.what == 3) {//关闭弹窗 |
| | | if (dialog != null && dialog.isShowing()) |
| | | dialog.dismiss(); |
| | |
| | | |
| | | tv_name.setText(mInfo.getGoods().getTitle()); |
| | | webView.loadUrl(mInfo.getExtra().getDetailUrl()); |
| | | |
| | | tv_sales_num.setText("月销 " + mInfo.getGoods().getSalesCount()); |
| | | tv_sales_num.setText(GoodsDetailUtil.getSalesTypeDesc(mInfo.getGoods().getSalesType()) + " " + mInfo.getGoods().getSalesCount()); |
| | | |
| | | if (mInfo.getGoods().getShopInfo() != null) { |
| | | ll_shop.setVisibility(View.VISIBLE); |
| | |
| | | tv_shop_name.setText(mInfo.getGoods().getShopInfo().getShopName()); |
| | | |
| | | try { |
| | | GoodsDetailUtil.fillShopType(tv_shop_type, mInfo.getGoods().getShopInfo().getUserType()); |
| | | |
| | | iv_shop_type.setImageDrawable(mInfo.getGoods().getShopInfo().getUserType() == 0 ? |
| | | getResources().getDrawable(R.drawable.ic_shop_type_taobao) : |
| | | getResources().getDrawable(R.drawable.ic_shop_type_tmall)); |
| | | tv_shop_des.setText("宝贝描述: " + mInfo.getGoods().getShopInfo().getScoreGoods()); |
| | | tv_shop_service.setText("卖家服务: " + mInfo.getGoods().getShopInfo().getScoreSeller()); |
| | | tv_shop_logistics.setText("物流服务: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); |
| | | tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "高" : "低"); |
| | | tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "高" : "低"); |
| | | tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "高" : "低"); |
| | | if (!StringUtils.isNullOrEmpty(mInfo.getGoods().getShopInfo().getScoreGoods())) { |
| | | tv_shop_des.setText("宝贝描述: " + mInfo.getGoods().getShopInfo().getScoreGoods()); |
| | | tv_shop_service.setText("卖家服务: " + mInfo.getGoods().getShopInfo().getScoreSeller()); |
| | | tv_shop_logistics.setText("物流服务: " + mInfo.getGoods().getShopInfo().getScoreLogistics()); |
| | | tv_shop_des_grade.setText(mInfo.getGoods().getShopInfo().getScoreGoodsD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreGoodsD() == 1 ? "高" : "低"); |
| | | tv_shop_service_grade.setText(mInfo.getGoods().getShopInfo().getScoreSellerD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreSellerD() == 1 ? "高" : "低"); |
| | | tv_shop_logistics_grade.setText(mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 0 ? "平" : |
| | | mInfo.getGoods().getShopInfo().getScoreLogisticsD() == 1 ? "高" : "低"); |
| | | } else { |
| | | tv_shop_des.setVisibility(View.INVISIBLE); |
| | | tv_shop_service.setVisibility(View.INVISIBLE); |
| | | tv_shop_logistics.setVisibility(View.INVISIBLE); |
| | | tv_shop_des_grade.setVisibility(View.INVISIBLE); |
| | | tv_shop_service_grade.setVisibility(View.INVISIBLE); |
| | | tv_shop_logistics_grade.setVisibility(View.INVISIBLE); |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | |
| | | vp_goods_detail.setCurrentItem(0); |
| | | initFanliAndBuyBtn(mInfo.getExtra().isBuyValid(), mInfo.getExtra().isFanliValid()); |
| | | requestState(0); |
| | | sv_goods.scrollTo(0, 0); |
| | | // ll_content.setVisibility(View.VISIBLE); |
| | | // fl_face.setVisibility(View.GONE); |
| | | } else if (jsonObject.optString("code").equalsIgnoreCase("2")) { |
| | | ll_content.setVisibility(View.GONE); |
| | | findViewById(R.id.ll_goods_nothing).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.fl_face).setVisibility(View.VISIBLE); |
| | | fl_face.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | Log.e("mResult", "goodsdetail---onFinish()"); |
| | | lv_goods_pic.scrollTo(0, 0); |
| | | sv_goods.scrollTo(0, 0); |
| | | avLoadingIndicatorView.hide(); |
| | | findViewById(R.id.fl_face).setVisibility(View.GONE); |
| | | ll_content.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | } |
| | |
| | | finish(); |
| | | break; |
| | | case R.id.tv_top_title1: |
| | | lv_goods_pic.scrollTo(0, 0); |
| | | sv_goods.scrollTo(0, 0); |
| | | setPosition(1); |
| | | break; |
| | | case R.id.tv_top_title2: |
| | | lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() - titleHeight * 2); |
| | | case R.id.tv_top_title2://详情 |
| | | sv_goods.scrollTo(0, fl_goods_detail.getTop()); |
| | | setPosition(2); |
| | | break; |
| | | case R.id.tv_top_title3: |
| | | lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() - titleHeight + marginTopHeight); |
| | | case R.id.tv_top_title3://猜你喜欢 |
| | | sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); |
| | | setPosition(3); |
| | | break; |
| | | case R.id.tv_top_title4: |
| | | lv_goods_pic.scrollTo(0, vp_goods_detail.getHeight() + webView.getHeight() + ll_guess_like.getHeight() - titleHeight + marginTopHeight); |
| | | case R.id.tv_top_title4://推荐 |
| | | Log.i(TAG, (int) ll_guess_like.getTop() + ""); |
| | | sv_goods.scrollTo(0, (int) ll_guess_like.getTop()); |
| | | setPosition(4); |
| | | break; |
| | | |
| | |
| | | |
| | | |
| | | private void goFanli() { |
| | | goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setCouponList(mInfo.getGoods().getCouponInfoList()).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | public void onClick(int p) { |
| | | goodsDetailPreEventManager.startClick(0, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | |
| | | //TODO 返利 |
| | | //TODO 返利 |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }).create().show(); |
| | | //判断是否有多张券情况 |
| | | } |
| | | |
| | | private void goBuy() { |
| | | goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | |
| | | @Override |
| | | public void onPreSuccess() { |
| | | //TODO 购买 |
| | | List<GoodsDetailVO.GoodsHongBaoListVO> hongBaoList = new ArrayList<>(); |
| | | hongBaoList.addAll(mInfo.getGoods().getPriceList()); |
| | | for (int i = 0; i < hongBaoList.size(); i++) { |
| | | if (hongBaoList.get(i).getType() != 2) { |
| | | hongBaoList.remove(i--); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | new GoodsDetailHongBaoAndCouponSelectDialog.Builder(this).setHongBaoList(hongBaoList).setItemClickListener(new GoodsDetailHongBaoAndCouponSelectDialog.OnItemClickListener() { |
| | | @Override |
| | | public void onClick(int p) { |
| | | goodsDetailPreEventManager.startClick(1, new GoodsDetailPreEventManager.IPreEventListener() { |
| | | @Override |
| | | public void onPreSuccess() { |
| | | //TODO 购买 |
| | | } |
| | | }); |
| | | } |
| | | }).create().show(); |
| | | |
| | | } |
| | | |
| | | |
| | | private void setRightsData(List<GoodsDetailVO.GoodsRightsVO> rightsList) { |
| | | if (rightsList == null || rightsList.size() == 0) { |
| | | ll_rights_type.setVisibility(View.GONE); |
| | | return; |
| | | } else { |
| | | ll_rights_type.setVisibility(View.VISIBLE); |
| | | } |
| | |
| | | } |
| | | |
| | | rv_price_info.setLayoutManager(new LinearLayoutManager(rv_price_info.getContext())); |
| | | rv_price_info.setNestedScrollingEnabled(false); |
| | | DividerItemDecoration decoration = new DividerItemDecoration(); |
| | | decoration.setSize(DimenUtils.dip2px(getApplicationContext(), 5)); |
| | | rv_price_info.addItemDecoration(decoration); |
| | | rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), false)); |
| | | rv_price_info.setAdapter(new GoodsDetailHongBaoListAdapter(getApplicationContext(), goodsInfoVO.getPriceList(), new GoodsDetailHongBaoListAdapter.ListClickListener() { |
| | | |
| | | @Override |
| | | public void onHongBaoClick(int p, GoodsDetailVO.GoodsHongBaoListVO info) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onCouponClick(int p) { |
| | | |
| | | } |
| | | }, |
| | | false, true)); |
| | | |
| | | tv_fanli_money_num.setText(goodsInfoVO.getMoneyInfo().getFanliMoney()); |
| | | tv_buy.setText(goodsInfoVO.getMoneyInfo().getHongBaoMoney()); |