コード例 #1
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.layout_trans_btn_back:
       finish();
       break;
     case R.id.layout_trans_btn_cart:
       Intent intent2 = new Intent(this, CarsActivity.class);
       intent2.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       // intent2.putExtra(MainActivity.SWITCH_INDEX, 2);
       startActivity(intent2);
       break;
     case R.id.product_details_customer_service:
       break;
     case R.id.product_details_favourite:
       break;
     case R.id.product_details_addcart:
       showSkuPopupWindow(0);
       ActivityUtils.startScaleAnimotion(mScrollView, 0.85f, 0.85f);
       break;
     case R.id.product_details_buy_now:
       showSkuPopupWindow(1);
       ActivityUtils.startScaleAnimotion(mScrollView, 0.85f, 0.85f);
       break;
     case R.id.layout_product_comment_more:
       Intent intent4 = new Intent(this, CommentListActivity.class);
       intent4.putExtra("commentList", (Serializable) product.getCommentList());
       intent4.putExtra("point", product.getCommentPoint());
       intent4.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
       startActivity(intent4);
       break;
     default:
       break;
   }
 }
コード例 #2
0
 /** 评论列表 */
 private void initCommentList() {
   TextView txtCommenterNum = (TextView) findViewById(R.id.layout_product_comment_commenter_num);
   TextView txtCommenterPoint = (TextView) findViewById(R.id.layout_product_comment_total_point);
   RatingBar ratingBar = (RatingBar) findViewById(R.id.layout_product_comment_ratingbar);
   LinearLayout llytContainer = (LinearLayout) findViewById(R.id.layout_product_comment_container);
   txtCommenterNum.setText("用户评价(" + product.getCommentCount() + "人)");
   txtCommenterPoint.setText("综合评分:" + product.getCommentPoint());
   ratingBar.setRating(product.getCommentPoint());
   if (null == product.getCommentList() || 2 >= product.getCommentList().size()) {
     findViewById(R.id.layout_product_comment_more).setVisibility(View.GONE);
     return;
   }
   if (null != product.getCommentList()) {
     for (int i = 0; i < 2; i++) {
       Comment2 comment = product.getCommentList().get(i);
       if (null == comment) {
         return;
       }
       llytContainer.addView(creatCommentView(comment));
       llytContainer.addView(getLayoutInflater().inflate(R.layout.line_gray_full, null));
     }
   }
 }