public View getView(int position, View convertView, ViewGroup parent) { final ChatMsgEntity entity = chatLists.get(position); boolean isComMsg = entity.getMsgType(); ViewHolder viewHolder = null; if (convertView == null) { if (isComMsg) { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_left, null); } else { convertView = mInflater.inflate(R.layout.chatting_item_msg_text_right, null); } viewHolder = new ViewHolder(); viewHolder.tvSendTime = (TextView) convertView.findViewById(R.id.tv_sendtime); viewHolder.tvUserName = (TextView) convertView.findViewById(R.id.tv_username); viewHolder.tvContent = (TextView) convertView.findViewById(R.id.tv_chatcontent); viewHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.isComMsg = isComMsg; convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.tvSendTime.setText(entity.getDate()); if (entity.getText().contains(".amr")) { viewHolder.tvContent.setText(""); viewHolder.tvContent.setCompoundDrawablesWithIntrinsicBounds( 0, 0, R.drawable.chatto_voice_playing, 0); viewHolder.tvTime.setText(entity.getTime()); } else { viewHolder.tvContent.setText(entity.getText()); viewHolder.tvContent.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); viewHolder.tvTime.setText(""); } viewHolder.tvContent.setOnClickListener( new OnClickListener() { public void onClick(View v) { if (entity.getText().contains(".amr")) { playMusic( android.os.Environment.getExternalStorageDirectory() + "/" + entity.getText()); } } }); viewHolder.tvUserName.setText(entity.getName()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; layoutInflater = LayoutInflater.from(context); if (convertView == null) { convertView = layoutInflater.inflate(R.layout.fragment_hashtag_list_item, null); viewHolder = new ViewHolder(); viewHolder.ivPor = (ImageView) convertView.findViewById(R.id.fragment_hahstag_list_item_iv1); // viewHolder.ivEvent = (ImageView) convertView // viewHolder.ifFixed = (ImageView) convertView.findViewById(R.id.fragment_hahstag_list_item_iv3); viewHolder.ibLike = (ImageView) convertView.findViewById(R.id.fragment_hashtag_list_item_iv2); viewHolder.tvEvent = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv2); viewHolder.tvName = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv1); viewHolder.tvEvent = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv2); viewHolder.tvLocation = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv3); viewHolder.tvTime = (TextView) convertView.findViewById(R.id.fragment_hashtag_list_item_tv4); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), R.mipmap.btn_follow); viewHolder.ibLike.setImageBitmap( ImageUtilities.getRoundedCroppedBitmap( bmp, (int) (context.getResources().getDimension(R.dimen.img_width)))); byte[] bitmapBytes = (byte[]) list.get(position).get(POSTERIMG); String bmpStr = new String(bitmapBytes, Charset.defaultCharset()); Bitmap bmpPor = ImageUtilities.decodeBase64(bmpStr); viewHolder.ivPor.setImageBitmap( ImageUtilities.getRoundedCroppedBitmap( bmpPor, (int) (context.getResources().getDimension(R.dimen.img_width)))); setStatus(viewHolder.ifFixed, (String) list.get(position).get(IFFIXED)); viewHolder.tvName.setText( (String) list.get(position).get(DEPARTMENT) + " " + (String) list.get(position).get(STUDENT_NAME)); viewHolder.tvEvent.setText("Events: " + (String) list.get(position).get(EVENTS)); viewHolder.tvLocation.setText("Location: " + (String) list.get(position).get(LOCATION)); viewHolder.tvTime.setText( "Time: " + TimeUtilities.StringToTime((String) list.get(position).get(TIME))); return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final ViewHolder viewHolder; if (null == convertView) { convertView = mInflater.inflate(R.layout.interact_share_item, null); viewHolder = new ViewHolder(); viewHolder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon); viewHolder.tvNickName = (TextView) convertView.findViewById(R.id.tv_nick_name); viewHolder.replyBtn = (TextView) convertView.findViewById(R.id.msg_reply_btn); viewHolder.tvContent = (TextView) convertView.findViewById(R.id.tv_content); viewHolder.tvTime = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.msgReplyList = (LinearLayout) convertView.findViewById(R.id.msg_reply_list); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } final ShareBean shareBean = shareBeans.get(position); viewHolder.tvNickName.setText(shareBean.getNickName()); viewHolder.tvContent.setText(shareBean.getTitle()); final Calendar c = Calendar.getInstance(); int mYear = c.get(Calendar.YEAR); // 获取当前年份 int mMonth = c.get(Calendar.MONTH) + 1; // 获取当前月份 int mDay = c.get(Calendar.DAY_OF_MONTH); // 获取当前月份的日期号码 // try // { // String timeY = // DateUtil.Y_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeM = // DateUtil.M_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeD = // DateUtil.D_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeHM = // DateUtil.TIME_H_M_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // String timeString = // DateUtil.M_D_DF.format(DateUtil.STANDARD_DF.parse(shareBean.getCreateTime())); // if (timeM.startsWith("0")) // { // timeM = timeM.substring(1, timeM.length()); // } // if (timeD.startsWith("0")) // { // timeD = timeD.substring(1, timeD.length()); // } // if (timeY.equals(String.valueOf(mYear)) // && timeM.equals(String.valueOf(mMonth)) // && timeD.equals(String.valueOf(mDay))) // { // viewHolder.tvTime.setText(context.getResources() // .getString(R.string.unit_today) + " " + timeHM); // } // else // { // viewHolder.tvTime.setText(timeString); // } // // } // catch (ParseException e) // { // // TODO Auto-generated catch block // e.printStackTrace(); // } String url = Constant.URL_iconUrl + shareBean.getCreatorPicUrl(); Log.d(TAG, "url-->" + url); bitmapUtilsHead.display( viewHolder.ivIcon, url, new BitmapLoadCallBack<View>() { @Override public void onLoadCompleted( View container, String uri, Bitmap bitmap, BitmapDisplayConfig config, BitmapLoadFrom from) { // TODO Auto-generated method stub viewHolder.ivIcon.setImageBitmap( BitMapUtil.toRoundCorner(bitmap, Constant.BITMAP_PIXELS)); } @Override public void onLoadFailed(View container, String uri, Drawable drawable) { // TODO Auto-generated method stub } }); // bitmapUtilsHead.display(viewHolder.ivIcon, url); viewHolder.ivIcon.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); // intent.setClass(context, FriendInfoActivity.class); intent.putExtra("userId", shareBean.getCreatorId()); // context.startActivity(intent); Log.d(TAG, "ivIcon.setOnClick---->"); } }); // viewHolder.msgReplyList.setVisibility(View.VISIBLE); // List<String> ss = new ArrayList<String>(); // ss.add("aa"); // ss.add("bb"); // ss.add("cc"); // dynamicAdd(viewHolder.msgReplyList, ss); viewHolder.replyBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Message msg = new Message(); msg.what = Constant.MSG_REPLY; handler.sendMessage(msg); } }); return convertView; }
@Override public View getItemView(SingleWorkout workout, View convertView, ViewGroup parent) { super.getItemView(workout, convertView, parent); final ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_cards, parent, false); holder = new ViewHolder(); holder.ivImage = (ImageView) convertView.findViewById(R.id.imageViewProfilePic); holder.ivPeek1 = (ImageView) convertView.findViewById(R.id.imageViewPeek1); holder.ivPeek2 = (ImageView) convertView.findViewById(R.id.imageViewPeek2); holder.ivPeek3 = (ImageView) convertView.findViewById(R.id.imageViewPeek3); holder.tvTitle = (TextView) convertView.findViewById(R.id.textViewTitle); holder.tvDifficulty = (TextView) convertView.findViewById(R.id.textViewDifficulty); holder.tvTime = (TextView) convertView.findViewById(R.id.textViewTime); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.tvTitle.setText(workout.get_title()); holder.tvTime.setText(workout.get_time()); holder.tvDifficulty.setText(workout.get_difficulty()); try { JSONArray mJsonArray = new JSONArray(workout.get_pictureArrayJSON()); String pictureVal1 = "w" + mJsonArray.getString(0); String pictureVal2 = "w" + mJsonArray.getString(1); String pictureVal3 = "w" + mJsonArray.getString(2); holder.ivPeek1.setImageResource( getContext() .getResources() .getIdentifier(pictureVal1, "drawable", getContext().getPackageName())); holder.ivPeek2.setImageResource( getContext() .getResources() .getIdentifier(pictureVal2, "drawable", getContext().getPackageName())); holder.ivPeek3.setImageResource( getContext() .getResources() .getIdentifier(pictureVal3, "drawable", getContext().getPackageName())); } catch (JSONException e) { e.printStackTrace(); } // needed to get User profile pic for parse feed try { ParseUser mUser = workout.getParseUser("user"); mUser.fetchInBackground( new GetCallback<ParseObject>() { @Override public void done(ParseObject parseObject, ParseException e) { try { final byte[] mBytes = parseObject.getBytes("photo"); if (mBytes != null) { new Handler() .post( new Runnable() { @Override public void run() { Bitmap bitmap = BitmapFactory.decodeByteArray(mBytes, 0, mBytes.length); holder.ivImage.setImageBitmap(bitmap); } }); } } catch (Exception f) { Log.e(TAG, f.getMessage()); } } }); } catch (Exception e) { Log.e(TAG, e.getMessage()); } // still need to populate the ivPeek with icons return convertView; }
@Override public View getView(int i, View convertView, ViewGroup viewGroup) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.trade_flow_item, null); holder = new ViewHolder(); holder.tvStatus = (TextView) convertView.findViewById(R.id.trade_status); holder.tvTime = (TextView) convertView.findViewById(R.id.trade_time); holder.tvAccount = (TextView) convertView.findViewById(R.id.trade_account); holder.tvReceiveAccount = (TextView) convertView.findViewById(R.id.trade_receive_account); holder.tvClientNumber = (TextView) convertView.findViewById(R.id.trade_client_number); holder.tvAmount = (TextView) convertView.findViewById(R.id.trade_amount); // this 2 text values are according to the trade type holder.tvAccountKey = (TextView) convertView.findViewById(R.id.trade_account_key); holder.tvReceiveAccountKey = (TextView) convertView.findViewById(R.id.trade_receive_account_key); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final TradeRecord record = getItem(i); convertView.setTag(R.id.trade_status, record); DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(); df.applyPattern("0.00"); switch (mTradeType) { case 2: case 3: holder.tvAccountKey.setText(getString(R.string.trade_pay_account)); holder.tvReceiveAccountKey.setText(getString(R.string.trade_receive_account)); holder.tvAccount.setText(StringUtil.replaceNum(record.getPayFromAccount())); holder.tvReceiveAccount.setText(StringUtil.replaceNum(record.getPayIntoAccount())); break; case 1: holder.tvAccountKey.setVisibility(View.INVISIBLE); // .setText(getString(R.string.trade_close_time)); holder.tvReceiveAccountKey.setText(getString(R.string.trade_poundage)); // holder.tvAccount.setText(record.getTradedTimeStr()); holder.tvReceiveAccount.setText( getString(R.string.notation_yuan) + df.format(record.getPoundage() * 1.0f / 100)); break; case 5: holder.tvAccountKey.setText(getString(R.string.trade_account_name)); holder.tvReceiveAccountKey.setText(getString(R.string.trade_account_number)); holder.tvAccount.setText(StringUtil.replaceName(record.getAccountName())); holder.tvReceiveAccount.setText(record.getAccountNumber()); break; case 4: holder.tvAccountKey.setVisibility(View.INVISIBLE); holder.tvReceiveAccountKey.setText(getString(R.string.trade_phone_number)); // holder.tvReceiveAccount.setText(StringUtil.mobileUtil(record.getPhone())); holder.tvReceiveAccount.setText(StringUtil.replaceNum(record.getPhone())); break; } holder.tvStatus.setText( getResources().getStringArray(R.array.trade_status)[record.getTradedStatus()]); holder.tvTime.setText(record.getTradedTimeStr()); holder.tvClientNumber.setText(record.getTerminalNumber()); holder.tvAmount.setText( getString(R.string.notation_yuan) + df.format(record.getAmount() * 1.0f / 100)); return convertView; }