public View getView(int position, View view, ViewGroup parent) { final ThreadRowInfo row = data.getRowList().get(position); int lou = -1; if (row != null) lou = row.getLou(); ViewHolder holder = null; boolean needin = false; SoftReference<View> ref = viewCache.get(position); View cachedView = null; if (ref != null) { cachedView = ref.get(); } if (cachedView != null) { if (((ViewHolder) cachedView.getTag()).position == position) { Log.d(TAG, "get view from cache ,floor " + lou); return cachedView; } else { view = LayoutInflater.from(activity).inflate(R.layout.relative_aritclelist, parent, false); holder = initHolder(view); holder.position = position; view.setTag(holder); viewCache.put(position, new SoftReference<View>(view)); } } else { view = LayoutInflater.from(activity).inflate(R.layout.relative_aritclelist, parent, false); holder = initHolder(view); holder.position = position; view.setTag(holder); viewCache.put(position, new SoftReference<View>(view)); } if (!PhoneConfiguration.getInstance().showReplyButton) { holder.viewBtn.setVisibility(View.GONE); } else { MyListenerForReply myListenerForReply = new MyListenerForReply(position, data, activity); holder.viewBtn.setOnClickListener(myListenerForReply); } ThemeManager theme = ThemeManager.getInstance(); int colorId = theme.getBackgroundColor(position); view.setBackgroundResource(colorId); // colorId = theme.getBackgroundColor(2); if (row == null) { return view; } handleAvatar(holder.avatarIV, row); int fgColorId = ThemeManager.getInstance().getForegroundColor(); final int fgColor = parent.getContext().getResources().getColor(fgColorId); FunctionUtil.handleNickName(row, fgColor, holder.nickNameTV, activity); final int bgColor = parent.getContext().getResources().getColor(colorId); final WebView contentTV = holder.contentTV; final String floor = String.valueOf(lou); TextView floorTV = holder.floorTV; floorTV.setText("[" + floor + " 楼]"); floorTV.setTextColor(fgColor); if (!StringUtil.isEmpty(row.getFromClientModel())) { MyListenerForClient myListenerForClient = new MyListenerForClient(position, data, activity, parent); String from_client_model = row.getFromClientModel(); if (from_client_model.equals("ios")) { holder.clientBtn.setImageResource(R.drawable.ios); // IOS } else if (from_client_model.equals("wp")) { holder.clientBtn.setImageResource(R.drawable.wp); // WP } else if (from_client_model.equals("unknown")) { holder.clientBtn.setImageResource(R.drawable.unkonwn); // 未知orBB } holder.clientBtn.setVisibility(View.VISIBLE); holder.clientBtn.setOnClickListener(myListenerForClient); } if (ActivityUtil.isLessThan_4_3()) { new Thread( new Runnable() { public void run() { FunctionUtil.handleContentTV( contentTV, row, bgColor, fgColor, activity, null, client); } }) .start(); } else if (ActivityUtil.isLessThan_4_4()) { ((Activity) parent.getContext()) .runOnUiThread( new Runnable() { public void run() { FunctionUtil.handleContentTV( contentTV, row, bgColor, fgColor, activity, null, client); } }); } else { FunctionUtil.handleContentTV(contentTV, row, bgColor, fgColor, activity, null, client); } TextView postTimeTV = holder.postTimeTV; postTimeTV.setText(row.getPostdate()); postTimeTV.setTextColor(fgColor); if (needin) { view.invalidate(); } return view; }