예제 #1
0
 public void changer() {
   if (limitbuyList == null) {
     return;
   }
   for (LimitBuyGoods gbproduct : limitbuyList) {
     gbproduct.setDelayTime((Long.valueOf(gbproduct.getDelayTime()) - 1) + "");
     if ("0".equals(gbproduct.getDelayTime())) {
       switch (Integer.valueOf(gbproduct.getRushBuyState())) {
         case 0:
           {
             gbproduct.setDelayTime(gbproduct.getDelayEndTime());
             gbproduct.setRushBuyState("1");
           }
           break;
         case 1:
           {
             gbproduct.setRushBuyState("3");
           }
           break;
         case 2:
           {
             gbproduct.setRushBuyState("3");
           }
           break;
       }
     }
   }
   notifyDataSetChanged();
 }
예제 #2
0
 public void floatTitleButtonClick(int position, Button btn) {
   LimitBuyGoods limitbuy = limitbuyList.get(position);
   if (!CommonUtility.isOrNoZero(limitbuy.getSkuRushBuyPrice(), false)) {
     if (!TextUtils.isEmpty(limitbuy.getRushBuyState())
         && Integer.valueOf(limitbuy.getRushBuyState()) == 1) {
       if (GlobalConfig.isLogin) {
         if (limitbuy != null) {
           isGoShoppingOrder(limitbuy, limitbuy.getRushBuyItemId());
         }
       } else {
         Intent intent = new Intent();
         intent.setClass(context.getApplicationContext(), LoginActivity.class);
         intent.setAction(this.getClass().getName());
         context.startActivity(intent);
       }
     }
   }
 }
예제 #3
0
  private void asyncLoadImage(LimitBuyGoods limitbuy, ImageView imgview, final ViewGroup parent) {
    String thumbUrl = limitbuy.getSkuThumbImgUrl();
    if (TextUtils.isEmpty(thumbUrl)) return;
    limitbuy.setLoadImg(true);
    Bitmap bitmap = imageLoaderManager.getCacheBitmap(limitbuy.getSkuThumbImgUrl());
    imgview.setImageBitmap(bitmap);
    imgview.setTag(thumbUrl);
    if (bitmap == null) {
      imageLoaderManager.asyncLoad(
          new ImageLoadTask(thumbUrl) {

            private static final long serialVersionUID = -4002124060243995848L;

            @Override
            protected Bitmap doInBackground() {
              return NetUtility.downloadNetworkBitmap(filePath);
            }

            @Override
            public void onImageLoaded(ImageLoadTask task, Bitmap bitmap) {
              if (bitmap != null) {
                View tagedView = parent.findViewWithTag(task.filePath);
                if (tagedView != null) {
                  BitmapDrawable destDrawable =
                      new BitmapDrawable(inflater.getContext().getResources(), bitmap);
                  TransitionDrawable transitionDrawable =
                      new TransitionDrawable(new Drawable[] {transparentDrawable, destDrawable});
                  ((ImageView) tagedView).setImageDrawable(transitionDrawable);
                  transitionDrawable.startTransition(300);
                  if (transitionDrawable != null)
                    ((ImageView) tagedView)
                        .setBackgroundResource(R.drawable.product_list_grid_item_icon_bg);
                }
              }
            }
          });
    } else {
      imgview.setBackgroundResource(R.drawable.product_list_grid_item_icon_bg);
    }
  }
예제 #4
0
  private void bingBigpictureData(LimitBuyGoods limitbuy, ViewHolder holder, ViewGroup parent) {
    if (limitbuy != null) {
      holder.title.setText(toDBC(limitbuy.getSkuName()));
      if (!CommonUtility.isOrNoZero(limitbuy.getSkuRushBuyPrice(), false)) {
        holder.limitPriceUnittext.setText("¥");
        holder.limitPricetext.setVisibility(View.VISIBLE);
        holder.limitPriceFloattext.setVisibility(View.VISIBLE);
        holder.limitPricetext.setText(limitbuy.getSkuRushBuyPrice().split("\\.")[0].toString());
        holder.limitPriceFloattext.setText(
            "." + limitbuy.getSkuRushBuyPrice().split("\\.")[1].toString());
        holder.discounttext.setText(limitbuy.getDiscountRate());
      } else {
        holder.limitPriceUnittext.setText(context.getString(R.string.now_not_have_price));
        holder.limitPricetext.setVisibility(View.GONE);
        holder.limitPriceFloattext.setVisibility(View.GONE);
      }
      holder.gomePricetext.setText("¥" + limitbuy.getSkuOriginalPrice());
      holder.gomePricetext.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
      try {
        int progress =
            (int)
                (Integer.valueOf(limitbuy.getRemainNum())
                    * 100
                    / Integer.valueOf(limitbuy.getLimitNum()));
        holder.progessBar.setProgress(progress);
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (!TextUtils.isEmpty(limitbuy.getDelayTime())) {
        long timeSecound = 0;
        try {
          timeSecound = Long.valueOf(limitbuy.getDelayTime());
        } catch (Exception e) {
          e.printStackTrace();
        }
        String hourMinSecond = FileUtils.limitSecToTime(timeSecound);
        String[] hmsStrs = hourMinSecond.split(":");
        if (hmsStrs != null && hmsStrs.length == 3) {
          holder.hourtext.setText(hmsStrs[0].substring(0, 1));
          holder.mintext.setText(hmsStrs[1].substring(0, 1));
          holder.secondtext.setText(hmsStrs[2].substring(0, 1));
          holder.hourUnitText.setText(hmsStrs[0].substring(1, 2));
          holder.minUnitText.setText(hmsStrs[1].substring(1, 2));
          holder.secondUnitText.setText(hmsStrs[2].substring(1, 2));
        }
      }

      if (!TextUtils.isEmpty(limitbuy.getRushBuyState())) {
        switch (Integer.valueOf(limitbuy.getRushBuyState())) {
          case 0:
            {
              holder.limitnumtext.setText(R.string.limitbuy_limitnum);
              holder.tagImageView.setBackgroundResource(R.drawable.limit_buy_item_two_icon);
              holder.limitbuy_disend.setText(R.string.limitbuy_disstart);
              holder.remainnumtextdata.setText(limitbuy.getRemainNum());
            }
            break;
          case 1:
            {
              holder.limitnumtext.setText(R.string.limitbuy_remainnum);
              holder.tagImageView.setBackgroundResource(R.drawable.limit_buy_item_one_icon);
              holder.limitbuy_disend.setText(R.string.limitbuy_disend);
              holder.remainnumtextdata.setText(limitbuy.getRemainNum());
            }
            break;
          case 2:
            {
              holder.limitnumtext.setText(R.string.limitbuy_remainnum);
              holder.tagImageView.setBackgroundResource(R.drawable.limit_buy_item_three_icon);
              holder.remainnumtextdata.setText(limitbuy.getRemainNum());
            }
            break;
          case 3:
            {
              holder.limitnumtext.setText(R.string.limitbuy_remainnum);
              holder.tagImageView.setBackgroundResource(R.drawable.limit_buy_item_four_icon);
              holder.remainnumtextdata.setText(limitbuy.getRemainNum());
            }
            break;
        }
      }
    }
    if (!GlobalConfig.getInstance().isNeedLoadImage() && !limitbuy.isLoadImg()) {
      // 不需要加载图片
      holder.imageView1.setImageResource(R.drawable.category_product_tapload_bg);
      holder.imageView1.setOnLongClickListener(
          new MyOnLongClickListener(limitbuy, holder.imageView1, parent));
    } else {
      // 需要加载图片
      asyncLoadImage(limitbuy, holder.imageView1, parent);
    }
  }