@Override public View getView(final int position, View convertView, ViewGroup parent) { Log.i("getView" + position); ViewHold hold; // find view if (convertView == null) { convertView = View.inflate(Statuses_Draft_Activity.this, R.layout.dynamic_resend_list_item, null); hold = new ViewHold(); hold.content = (TextView) convertView.findViewById(R.id.dynamic_resend_item_content); hold.name = (TextView) convertView.findViewById(R.id.dynamic_resend_item_name); hold.time = (TextView) convertView.findViewById(R.id.dynamic_resend_item_time); convertView.setTag(hold); } else { hold = (ViewHold) convertView.getTag(); } do { // normal final DraftInfo itemInfo = (DraftInfo) getItem(position); // GroupInfo gInfo = // DynamicMgr.getInstance().getGroupItem(itemInfo.groupid); // hold.gname.setText(gInfo!=null?gInfo.gname:""); // hold.gname.setVisibility(gInfo!=null?View.VISIBLE:View.GONE); Log.i("itemInfo.content" + itemInfo.content); // hold.content.setVisibility(View.GONE); // hold.name.setTextSize(14f); // hold.name.setTextColor(Color.BLACK); // hold.name.setText(GlobalUserInfo.getName()); hold.content.setText(Html.fromHtml(itemInfo.content)); hold.name.setText( itemInfo.sending ? getString(R.string.dynamic_sending) : getString(R.string.dynamic_sendfail)); int imageFlagId = 0; if (itemInfo.images.length() > 0) { imageFlagId = R.drawable.dynamic_list_item_image; } // if (itemInfo.images.size()>1) { // imageFlagId = R.drawable.dynamic_list_item_images; // } // hold.name.setCompoundDrawablesWithIntrinsicBounds(0, 0, // imageFlagId, 0); hold.time.setText(DynamicInfo.getTime(itemInfo.crateData * 1000)); hold.time.setCompoundDrawablesWithIntrinsicBounds(imageFlagId, 0, 0, 0); convertView.setBackgroundColor( itemInfo.sending ? getResources().getColor(R.color.blue_block) : getResources().getColor(R.color.transparent)); // ((View)hold.avatar.getParent()).setVisibility(View.GONE); } while (false); return convertView; }
@Override public void onReceive(Context context, Intent intent) { do { long draftID = intent.getLongExtra(DraftMgr.DRAFT_ID, 0); if (intent.getAction().equals(NotifyProgress.ACTION_SUCCEED)) { // 点击刷新 DraftMgr.instance().deleteDraft(draftID); mlistViewAdapter.delItem(draftID); Log.i("draft process delete" + draftID); mlistViewAdapter.notifyDataSetChanged(); break; } if (intent.getAction().equals(NotifyProgress.ACTION_FAIL)) { DraftInfo draftinfo = (DraftInfo) mlistViewAdapter.getItemByid(draftID); if (draftinfo != null) { draftinfo.sending = false; } mlistViewAdapter.notifyDataSetChanged(); break; } if (intent.getAction().equals(NotifyProgress.ACTION_PROCESS)) { break; } } while (false); }
public DynamicBroadcastReceiver(Context c) { Log.v("DynamicBroadcastReceiver"); context = c; // to instance it mReceiver = this; }
@Override public Object getItem(int position) { Log.i("getItem" + position); return mItems.get(position); }
@Override protected void onPause() { Log.i("onPause"); super.onPause(); }