@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub index = position; ViewHolder holder = null; Info info = (Info) mList.get(position).get(INFO); if (convertView == null) { convertView = mInflater.inflate(R.layout.join_info_listview_item, null); holder = new ViewHolder(); holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_name); holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star); holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress); holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt); holder.atm = (TextView) convertView.findViewById(R.id.join_info_item_text_amt); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.name.setText("发起人:" + info.getName()); holder.progress.setText(info.getProgress()); holder.allAtm.setText("¥" + info.getAllAtm()); holder.atm.setText("¥" + info.getAtm()); PublicMethod.createStar( holder.starNum, info.getCrown(), info.getCup(), info.getDiamond(), info.getStarNum(), JoinInfoActivity.this); return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { // Setup view(s). ViewHolder viewHolder = null; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(rowId, null); viewHolder.filename = (TextView) convertView.findViewById(R.id.queue_row_filename); viewHolder.timeleft = (TextView) convertView.findViewById(R.id.queue_row_timeleft); viewHolder.progress = (ProgressBar) convertView.findViewById(R.id.queue_row_progress); viewHolder.checkbox = (CheckBox) convertView.findViewById(R.id.queue_row_checkbox); convertView.setTag(viewHolder); } viewHolder = (ViewHolder) convertView.getTag(); // Apply padding to the row. // See http://code.google.com/p/android/issues/detail?id=27235 convertView.findViewById(R.id.queue_row_root).setPadding(6, 6, 6, 6); QueueItem item = (QueueItem) getItem(position); if (item != null) { viewHolder.filename.setText(item.getName()); viewHolder.timeleft.setText("Time Left: " + item.getEta()); viewHolder.progress.setProgress(item.getPercentDone()); } if (!checkedPositions.isEmpty()) { viewHolder.checkbox.setChecked(checkedPositions.get(position)); } // Setup listeners viewHolder.checkbox.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { CheckBox checkBox = (CheckBox) v; checkedPositions.set(position, checkBox.isChecked()); checkCount = checkBox.isChecked() ? checkCount + 1 : checkCount - 1; ((CheckChangedListener) context).onCheckChanged(checkBox.isChecked(), checkCount); } }); return convertView; }
/* * (non-Javadoc) * * @see * android.support.v4.widget.CursorAdapter#newView(android.content.Context * , android.database.Cursor, android.view.ViewGroup) */ @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater vi = getActivity().getLayoutInflater(); ViewHolder holder = new ViewHolder(); View view = vi.inflate(R.layout.list_row_channel, null); holder.v = (CheckableLinearLayout) view; holder.icon = (ImageView) view.findViewById(R.id.icon); holder.position = (TextView) view.findViewById(R.id.position); holder.channelName = (TextView) view.findViewById(R.id.title); holder.epgTime = (TextView) view.findViewById(R.id.epgTime); holder.progress = (ProgressBar) view.findViewById(R.id.progress); holder.epgTitle = (TextView) view.findViewById(R.id.epgTitle); holder.contextMenu = (ImageView) view.findViewById(R.id.contextMenu); holder.contextMenu.setOnClickListener(ChannelList.this); view.setTag(holder); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder holder = null; if (view == null) { view = context.getLayoutInflater().inflate(R.layout.program_list_widget, null); holder = new ViewHolder(); holder.title = (TextView) view.findViewById(R.id.title); holder.state = (ImageView) view.findViewById(R.id.state); holder.time = (TextView) view.findViewById(R.id.time); holder.date = (TextView) view.findViewById(R.id.date); holder.duration = (TextView) view.findViewById(R.id.duration); holder.progress = (TextView) view.findViewById(R.id.progress); holder.seriesInfo = (TextView) view.findViewById(R.id.series_info); holder.contentType = (TextView) view.findViewById(R.id.content_type); holder.summary = (TextView) view.findViewById(R.id.summary); holder.description = (TextView) view.findViewById(R.id.description); holder.genre = (TextView) view.findViewById(R.id.genre); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } // Get the program and assign all the values Program p = getItem(position); if (p != null) { holder.title.setText(p.title); Utils.setState(holder.state, p.recording); Utils.setDate(holder.date, p.start); Utils.setTime(holder.time, p.start, p.stop); Utils.setDuration(holder.duration, p.start, p.stop); Utils.setProgressText(holder.progress, p.start, p.stop); Utils.setDescription(null, holder.summary, p.summary); Utils.setDescription(null, holder.description, p.description); Utils.setContentType(null, holder.contentType, p.contentType); Utils.setSeriesInfo(null, holder.seriesInfo, p.seriesInfo); Utils.setGenreColor(context, holder.genre, p, TAG); } return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = layoutInflater.inflate(R.layout.listitem_player_achievement, parent, false); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.iv_listitem_player_achievement_icon); holder.title = (TextView) convertView.findViewById(R.id.tv_listitem_player_achievement_title); holder.progress = (ProgressBar) convertView.findViewById(R.id.pb_listitem_player_achievement_progress); holder.description = (TextView) convertView.findViewById(R.id.tv_listitem_player_achievement_description); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } boolean unlocked = getItem(position); Achievement ach = Achievements.getAchievement(position); holder.title.setText(ach.getTitle()); holder.icon.setImageResource(ach.getDrawableID()); if (unlocked) { holder.title.setTextColor(Color.parseColor("#000000")); holder.progress.setVisibility(View.GONE); holder.description.setText(ach.getUnlockedDescription()); holder.description.setTextColor(Color.parseColor("#000000")); holder.icon.clearColorFilter(); } else { // grayscale holder.title.setTextColor(Color.parseColor("#999999")); long maxAmount = ach.getUnlockAmount(); long amount = profile.getPlayerStatistics().getAmount(ach.getStatType()); holder.description.setText( String.format( fa.getResources().getString(R.string.listitem_player_achievements_progress), amount, maxAmount, fa.getResources().getString(ach.getUnlockDescription()))); holder.description.setTextColor(Color.parseColor("#999999")); // if(amount > 0){ holder.progress.setVisibility(View.VISIBLE); holder.progress.setMax((int) maxAmount); holder.progress.setProgress((int) amount); /*}else{ holder.progress.setVisibility(View.GONE); }*/ // TODO: maybe use special not-unlocked icons? ColorMatrix matrix = new ColorMatrix(); matrix.setSaturation(0); // 0 means grayscale ColorMatrixColorFilter cf = new ColorMatrixColorFilter(matrix); holder.icon.setColorFilter(cf); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub index = position; ViewHolder holder = null; Info info = (Info) mList.get(position); if (convertView == null) { convertView = mInflater.inflate(R.layout.join_info_listview_item, null); holder = new ViewHolder(); holder.type = (TextView) convertView.findViewById(R.id.join_info_item_text_name); holder.ding = (TextView) convertView.findViewById(R.id.join_info_item_text_ding); holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_faqiren); holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star); holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress); holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt); holder.layoutLeft = (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_left); holder.layoutCenter = (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_center); holder.layoutRight = (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_right); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (info.getIsTop().equals("true")) { holder.ding.setBackgroundResource(R.drawable.join_top); holder.ding.setVisibility(view.VISIBLE); } else { holder.ding.setVisibility(view.GONE); } int with = PublicMethod.getDisplayWidth(JoinInfoActivity.this); if (with == 800) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( PublicMethod.getPxInt(110, JoinInfoActivity.this), PublicMethod.getPxInt(28, JoinInfoActivity.this)); holder.type.setLayoutParams(params); LinearLayout.LayoutParams paramsLayout = new LinearLayout.LayoutParams(250, LayoutParams.WRAP_CONTENT); holder.layoutLeft.setLayoutParams(paramsLayout); holder.layoutCenter.setLayoutParams(paramsLayout); holder.layoutRight.setLayoutParams(paramsLayout); } holder.type.setText(info.getLottype()); holder.name.setText("发起人:" + getusername(info.getName())); holder.progress.setText(info.getProgress() + "(" + info.getSafe() + ")"); holder.allAtm.setText(info.getAllAtm() + "元"); // holder.atm.setText("¥"+info.getAtm()); // holder.safe.setText(info.getSafe()); PublicMethod.createStar( holder.starNum, info.getCrown(), info.getGrayCrown(), info.getCup(), info.getGrayCup(), info.getDiamond(), info.getGrayDiamond(), info.getStarNum(), info.getGrayStarNum(), JoinInfoActivity.this, 4); return convertView; }