protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode != RESULT_OK) {
     return;
   }
   switch (requestCode) {
     case REQUEST_CODE_SHOW_PRODUCT:
       Trace.e(TAG, "Show Product:result data->" + (null == data ? "null" : data.toString()));
       if (data != null
           && data.hasExtra(ProductDetailActivity.KEY_PRODUCT_REC)
           && data.hasExtra(ProductDetailActivity.KEY_POST_NUMBER)
           && data.hasExtra(ProductDetailActivity.KEY_EDIT_TYPE)) {
         ProductRec productRec =
             (ProductRec) data.getSerializableExtra(ProductDetailActivity.KEY_PRODUCT_REC);
         int pos = (Integer) data.getSerializableExtra(ProductDetailActivity.KEY_POST_NUMBER);
         int editType =
             data.getIntExtra(
                 ProductDetailActivity.KEY_EDIT_TYPE, ProductDetailActivity.TYPE_EDIT_PRODUCT);
         // 移除记录满足以下条件即可:
         // (1)藏品做了移除操作;
         // (2)藏品做了下架操作;
         // (3)藏品做了重新设置了分类操作;
         boolean isNeedRemoveProduct = false;
         if (editType == ProductDetailActivity.TYPE_REMOVE_PRODUCT) {
           isNeedRemoveProduct = true;
         } else {
           //					if(null != productRec){
           ////						isNeedRemoveProduct = !productRec.isOnSale();
           ////						String catId = productRec.getCatId();
           //						String currPageCatId = null == tagRec ? null : tagRec.getId();
           //						if(!isNeedRemoveProduct && null != catId && null != currPageCatId &&
           // !catId.equalsIgnoreCase(currPageCatId)){
           //							isNeedRemoveProduct = true;
           //						}
           //					}
         }
         if (isNeedRemoveProduct) {
           try {
             productList.remove(pos);
           } catch (Exception e) {
             Log.e(TAG, "Remove ProductRec failure: pos outOfArrIndex Exception.", e);
           }
         } else {
           //					productList.get(pos).setInFav(productRec.getInFav());
           //					productList.get(pos).setFavNum(productRec.getFavNum());
         }
         productAdapter.notifyDataSetInvalidated();
       }
       break;
     case FOR_LOGIN_RESULT:
       readyToGetAllGoodsByTagID(tagRec.getId(), true);
       break;
     default:
       break;
   }
 };
示例#2
0
 public void refreshAvatarView(String url) {
   Trace.d(TAG, "refreshAvatarView:" + rec.getAvatar().toString());
   if (!StringUtil.getInstance().IsEmpty(url)) {
     try {
       avatarFB = FinalBitmap.create(HomePageActivity.this);
       avatarFB.flushCache();
       avatarFB.closeCache();
       avatarFB.configCalculateBitmapSizeWhenDecode(true);
       avatarFB.display(ivAvatar, url, true);
     } catch (Exception e) {
       Log.e(TAG, "refreshAvatarView:display user avatar error.", e);
     }
   } else {
     Log.e(TAG, "refreshAvatarView:url is empty.");
   }
 }
示例#3
0
  private void InitPersonalInfo() {
    // 更换头像

    Trace.d(TAG, "InitPersonalInfo:" + rec.getAvatar().toString());
    if (!StringUtil.getInstance().IsEmpty(rec.getAvatar().getBig())) {
      String url = RequestUrls.SERVER_BASIC_URL + rec.getAvatar().getBig();
      try {
        avatarFB = FinalBitmap.create(HomePageActivity.this);
        avatarFB.flushCache();
        avatarFB.closeCache();
        //				avatarFB.configLoadfailImage(R.drawable.menu_default_head);
        avatarFB.display(ivAvatar, url, true);
        //				avatarFB.display(ivAvatar, url, false);
      } catch (Exception e) {
        Log.e(TAG, "refreshAvatarView:display user avatar error.", e);
      }
    } else {
      Log.e(TAG, "refreshAvatarView:url is empty.");
    }
    ivAvatar.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(HomePageActivity.this, BigPicImgActivity.class);
            intent.putExtra(BigPicImgActivity.KET_FOR_BIGPIC, rec.getAvatar().getBig());
            startActivityForResult(intent, BIGPIC_FOR_RESULT);
            HomePageActivity.this.overridePendingTransition(
                R.anim.my_scale_action, R.anim.my_alpha_action);
          }
        });

    tvUserName.setText(rec.getUserName());

    long sendCount = rec.getOnSaleNum() + rec.getOffSaleNum();
    tvSendCount.setText(String.valueOf(sendCount));

    long favCount = rec.getFavNum();
    tvFavCount.setText(String.valueOf(favCount));

    tvAttentionCount.setText(rec.getAttendNum());

    tvVisitCount.setText(
        String.format(getString(R.string.visit_count_format), rec.getVisitCount()));

    btnOperation.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            showChangeLogoRem();
          }
        });

    // 电子邮箱
    emailGroup = (ViewGroup) findViewById(R.id.email);
    TextView tvEmailTitle = (TextView) emailGroup.findViewById(R.id.info_title);
    tvEmailTitle.setText(R.string.home_page_item_title_email);
    etEmail = (EditText) emailGroup.findViewById(R.id.info_content);
    System.out.println("====etEmail==" + rec.getEmail());
    String regMacth = "[\\w]+@[\\w]+.[\\w]+";

    if (!StringUtil.getInstance().IsEmpty(rec.getEmail())
        && rec.getEmail() != null
        && rec.getEmail().matches(regMacth)) {

      etEmail.setText(rec.getEmail());
    } else {
      etEmail.setText("");
    }

    ((TextView) emailGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 真实姓名
    realNameGroup = (ViewGroup) findViewById(R.id.real_name);
    TextView tvRealNameTitle = (TextView) realNameGroup.findViewById(R.id.info_title);
    tvRealNameTitle.setText(R.string.home_page_item_title_real_name);
    etRealName = (EditText) realNameGroup.findViewById(R.id.info_content);
    if (!StringUtil.getInstance().IsEmpty(rec.getRealName()) && rec.getRealName() != null) {
      etRealName.setText(rec.getRealName());
    }

    ((TextView) realNameGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 性别
    sexGroup = (ViewGroup) findViewById(R.id.gender);
    TextView tvSexTitle = (TextView) sexGroup.findViewById(R.id.info_title);
    tvSexTitle.setText(R.string.home_page_item_title_sex);
    etSex = (EditText) sexGroup.findViewById(R.id.info_content);
    sexGroup.setBackgroundResource(R.drawable.light_item_bg_selector);

    switch (rec.getSex()) {
      case 0:
        etSex.setText(R.string.sex_secrecy);
        break;
      case 1:
        etSex.setText(R.string.sex_male);
        break;
      case 2:
        etSex.setText(R.string.sex_female);
        break;
      default:
        break;
    }
    ((TextView) sexGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 生日
    birthdayGroup = (ViewGroup) findViewById(R.id.birthday);
    TextView tvBirthdayTitle = (TextView) birthdayGroup.findViewById(R.id.info_title);
    tvBirthdayTitle.setText(R.string.home_page_item_title_birthday);
    etBirthday = (EditText) birthdayGroup.findViewById(R.id.info_content);

    if (!StringUtil.getInstance().IsEmpty(rec.getBirthday())
        && rec.getBirthday() != null
        && !rec.getBirthday().equalsIgnoreCase("0000-00-00")) {
      etBirthday.setText(rec.getBirthday());
    }
    birthdayGroup.setBackgroundResource(R.drawable.light_item_bg_selector);

    ((TextView) birthdayGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // MSN
    msnGroup = (ViewGroup) findViewById(R.id.msn);
    TextView tvMSNTitle = (TextView) msnGroup.findViewById(R.id.info_title);
    tvMSNTitle.setText(R.string.home_page_item_title_msn);
    etMsn = (EditText) msnGroup.findViewById(R.id.info_content);

    if (!StringUtil.getInstance().IsEmpty(rec.getMsn()) && rec.getMsn() != null) {
      etMsn.setText(rec.getMsn());
    }
    ((TextView) msnGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // QQ
    qqGroup = (ViewGroup) findViewById(R.id.qq);
    TextView tvQQ = (TextView) qqGroup.findViewById(R.id.info_title);
    tvQQ.setText(R.string.home_page_item_title_qq);
    etQQ = (EditText) qqGroup.findViewById(R.id.info_content);
    if (!StringUtil.getInstance().IsEmpty(rec.getQq()) && rec.getQq() != null) {
      etQQ.setText(rec.getQq());
    }
    ((TextView) qqGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 工作电话
    officePhoneGroup = (ViewGroup) findViewById(R.id.office_phone);
    TextView tvOfficePhone = (TextView) officePhoneGroup.findViewById(R.id.info_title);
    tvOfficePhone.setText(R.string.home_page_item_title_office_phone);
    etOfficePhone = (EditText) officePhoneGroup.findViewById(R.id.info_content);
    if (!StringUtil.getInstance().IsEmpty(rec.getOfficePhone()) && rec.getOfficePhone() != null) {
      etOfficePhone.setText(rec.getOfficePhone());
    }
    ((TextView) officePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 手机
    mobilePhoneGroup = (ViewGroup) findViewById(R.id.mobile_phone);
    TextView tvMobilePhone = (TextView) mobilePhoneGroup.findViewById(R.id.info_title);
    tvMobilePhone.setText(R.string.home_page_item_title_mobile_phone);
    etMobilePhone = (EditText) mobilePhoneGroup.findViewById(R.id.info_content);
    if (!StringUtil.getInstance().IsEmpty(rec.getMobilePhone()) && rec.getMobilePhone() != null) {
      etMobilePhone.setText(rec.getMobilePhone());
    }
    ((TextView) mobilePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // 座机
    homePhoneGroup = (ViewGroup) findViewById(R.id.home_phone);
    TextView tvHomePhone = (TextView) homePhoneGroup.findViewById(R.id.info_title);
    tvHomePhone.setText(R.string.home_page_item_title_home_phone);
    etHomePhone = (EditText) homePhoneGroup.findViewById(R.id.info_content);
    if (!StringUtil.getInstance().IsEmpty(rec.getHomePhone()) && rec.getHomePhone() != null) {
      etHomePhone.setText(rec.getHomePhone());
    }
    ((TextView) homePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);

    // attentionGroup = (ViewGroup) findViewById(R.id.attention);
    // TextView tvAttention = (TextView) attentionGroup
    // .findViewById(R.id.info_title);
    // tvAttention.setText(R.string.home_page_item_title_attention);
    // etAttention = (EditText)
    // attentionGroup.findViewById(R.id.info_content);
    // ((TextView) attentionGroup.findViewById(R.id.info_hint))
    // .setText(R.string.attention_hint_text);
    // // ((TextView)
    // //
    // attentionGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE);
  }