示例#1
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.");
   }
 }
示例#2
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);
  }