Ejemplo n.º 1
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.orderdetail_relative_bottom_tab:
        isShowDetail = !isShowDetail;
        if (isShowDetail) {
          mActivity.findViewById(R.id.orderdetail_relative_bottom).setVisibility(View.VISIBLE);
          mActivity.findViewById(R.id.orderdetail_relative_center).setVisibility(View.VISIBLE);
          ((ImageView) mActivity.findViewById(R.id.orderdetail_relative_bottom_tab_img))
              .setImageResource(R.drawable.ic_up);
        } else {
          mActivity.findViewById(R.id.orderdetail_relative_bottom).setVisibility(View.GONE);
          mActivity.findViewById(R.id.orderdetail_relative_center).setVisibility(View.GONE);
          ((ImageView) mActivity.findViewById(R.id.orderdetail_relative_bottom_tab_img))
              .setImageResource(R.drawable.ic_down);
        }
        break;
      case R.id.orderdetail_products_bottom_tab:
        mAdapter.setShowAll(!mAdapter.isShowAll());
        mAdapter.notifyDataSetChanged();
        if (mAdapter.isShowAll()) {
          ((TextView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_tv))
              .setText("收起商品");

          ((ImageView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_img))
              .setImageResource(R.drawable.ic_up);
        } else {
          ((TextView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_tv))
              .setText("其他" + (mOrderModel.getLeftNum()) + "件商品");

          ((ImageView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_img))
              .setImageResource(R.drawable.ic_down);
        }
        break;
      case R.id.orderdetail_wuliu_button:
        Bundle b = new Bundle();
        ArrayList<OrderProductModel> pModels = mOrderModel.getOrderProductModelList();
        ArrayList<String> pUrls = new ArrayList<String>();
        for (OrderProductModel model : pModels) {
          String url = IcsonProImgHelper.getAdapterPicUrl(model.getProductCharId(), 95);
          pUrls.add(url);
        }
        b.putString("orderId", mOrderModel.getOrderCharId());
        b.putStringArrayList("prodCharIds", pUrls);

        ToolUtil.startActivity(mActivity, AdviseActivity.class, b);
        ToolUtil.sendTrack(
            mActivity.getClass().getName(),
            mActivity.getString(R.string.tag_OrderDetailActivity),
            AdviseActivity.class.getName(),
            mActivity.getString(R.string.tag_AdviseActivity),
            "01013");
        ToolUtil.reportStatisticsClick(mActivity.getActivityPageId(), "21001");
        break;
      case R.id.orderdetail_callphone_button:
        Intent pIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:4008281878"));
        AppUtils.checkAndCall(mActivity, pIntent);
        ToolUtil.reportStatisticsClick(mActivity.getActivityPageId(), "21002");
        break;
    }
  }
Ejemplo n.º 2
0
  private void renderProductList() {
    final LinearListView listView =
        (LinearListView) mActivity.findViewById(R.id.orderdetail_linear_order_list);
    listView.removeAllViews();

    if (mOrderModel == null) {
      listView.setVisibility(View.GONE);
      return;
    }
    listView.setVisibility(
        mOrderModel.getOrderProductModelList().size() > 0 ? View.VISIBLE : View.GONE);

    final ArrayList<OrderProductModel> products = mOrderModel.getOrderProductModelList();

    listView.setVisibility(products.size() > 0 ? View.VISIBLE : View.GONE);

    if (products.size() > 0) {
      mAdapter = new OrderDetailProductAdapter(mActivity, products);
      mAdapter.setShowAll(mOrderModel.isShowAll());
      if (products.size() > 1) {
        if (mOrderModel.isShowAll()) {
          mFooterView =
              mActivity
                  .getLayoutInflater()
                  .inflate(R.layout.my_orderdetail_product_item_footer, null);
          ((TextView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_tv))
              .setText("收起商品");

          ((ImageView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_img))
              .setImageResource(R.drawable.ic_up);
        } else {
          mFooterView =
              mActivity
                  .getLayoutInflater()
                  .inflate(R.layout.my_orderdetail_product_item_footer, null);
          ((TextView) mFooterView.findViewById(R.id.orderdetail_products_bottom_tab_tv))
              .setText("其他" + (mOrderModel.getLeftNum()) + "件商品");
        }
        listView.addFooterView(mFooterView);
        mFooterView.setOnClickListener(this);
      }
      listView.setAdapter(mAdapter);
      listView.setOnItemClickListener(
          new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              OrderProductModel model = (OrderProductModel) mAdapter.getItem(position);
              // 可以评论,并且未评论
              if (model.isCanEvaluate() && !model.isEvaluated()) {
                Bundle param = new Bundle();
                param.putSerializable(OrderEvaluateActivity.ORDER_PRODUCT_MODEL, model);
                ToolUtil.startActivity(
                    mActivity,
                    OrderEvaluateActivity.class,
                    param,
                    OrderDetailActivity.REQUEST_CODE);
                ToolUtil.sendTrack(
                    mActivity.getClass().getName(),
                    mActivity.getString(R.string.tag_OrderDetailActivity),
                    OrderEvaluateActivity.class.getName(),
                    mActivity.getString(R.string.tag_OrderEvaluateActivity),
                    "01011");
              } else if (model.getGiftCount() == 0) {
                Bundle param = new Bundle();
                param.putLong(ItemActivity.REQUEST_PRODUCT_ID, id);
                ToolUtil.startActivity(mActivity, ItemActivity.class, param);

                ToolUtil.sendTrack(
                    mActivity.getClass().getName(),
                    mActivity.getString(R.string.tag_OrderDetailActivity),
                    ItemActivity.class.getName(),
                    mActivity.getString(R.string.tag_ItemActivity),
                    "01012",
                    String.valueOf(id));
              } else {
                Bundle param = new Bundle();
                param.putLong(OrderDetailProductActivity.REQUEST_PRODUCT_ID, model.getProductId());
                param.putString(OrderDetailProductActivity.REQUEST_ORDER_INFO, mOrderInfo);
                ToolUtil.startActivity(mActivity, OrderDetailProductActivity.class, param);
                ToolUtil.sendTrack(
                    mActivity.getClass().getName(),
                    mActivity.getString(R.string.tag_OrderDetailActivity),
                    OrderDetailProductActivity.class.getName(),
                    mActivity.getString(R.string.tag_OrderDetailProductActivity),
                    "01013");
              }
            }
          });
    }
  }