コード例 #1
0
  private void processLayoutUI(final View row, DealHolder holder, final TravelerItem item) {
    picasso
        .load(item.getAvatar())
        .placeholder(R.drawable.ic_avatar_traveler)
        .fit()
        .into(holder.ivAvatar);

    setDirection(holder.ivDirection, item.getDirection());
    setTitle(holder.tvTitle, item);
    holder.tvDistance.setText(
        TextUtil.isEmpty(item.getDistance()) ? "N/A km" : (item.getDistance() + " km"));

    picasso.load(item.getFlagUrl()).fit().into(holder.ivFlag);

    //		row.setOnClickListener(new OnClickListener() {
    //			@Override
    //			public void onClick(View v) {
    //				if (item.getUserStatus() != null && item.getUserStatus().equals("1")
    //						&& item.getFriendStatus() != null && item.getFriendStatus().equals("1") ) {
    //					Intent i = new Intent(mActivity, ChatScreen.class);
    //					i.putExtra(Extras.ITEM, item);
    //					mActivity.startActivity(i);
    //				} else {
    //					Intent i = new Intent(mActivity, TravelerView.class);
    //					i.putExtra(Extras.ITEM, item);
    //					mActivity.startActivity(i);
    //				}
    //			}
    //		});
  }
コード例 #2
0
 private void setTitle(TextView tvTitle, TravelerItem item) {
   String title = "<b>" + item.getNickname();
   if (TextUtil.isEmpty(item.getBirthday())) {
     title += "</b>";
   } else {
     try {
       Long bithday = Long.valueOf(item.getBirthday()) * 1000;
       title += "</b> (" + DateUtils.getTimeYearsUntilNowFrom(bithday) + ")";
     } catch (NumberFormatException e) {
       title += "</b>";
     }
   }
   tvTitle.setText(Html.fromHtml(title));
 }