private void setWeatherFromBaiduWeatherListVo(BaiduWeatherListVo result) { if (result != null) { try { Date date = TimeUtil.parseDate(TimeUtil.sdf1, result.getDate()); List<BaiduWeatherData> weatherResults = result.getResults().get(0).getWeather_data(); Calendar nowCalendar = Calendar.getInstance(); Calendar weatherCalendar = Calendar.getInstance(); weatherCalendar.setTime(date); int index = nowCalendar.get(Calendar.DAY_OF_YEAR) - weatherCalendar.get(Calendar.DAY_OF_YEAR); BaiduWeatherData baiduWeatherData = weatherResults.get(index); String imgUrl = baiduWeatherData.getDayPictureUrl(); if (nowCalendar.get(Calendar.HOUR_OF_DAY) > 18 || nowCalendar.get(Calendar.HOUR_OF_DAY) < 6) { imgUrl = baiduWeatherData.getNightPictureUrl(); } if (flightVo.getLeave()) { ivWeatherFrom.setVisibility(View.VISIBLE); FinalBitmap.create(FlightDetailActivity.this).display(ivWeatherFrom, imgUrl); } else { ivWeatherTo.setVisibility(View.VISIBLE); FinalBitmap.create(FlightDetailActivity.this).display(ivWeatherTo, imgUrl); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
public void onClick(View v) { switch (v.getId()) { case R.id.vp_net_photos: View view = findViewById(R.id.layout_net_photos); Animation animation = null; if (flag_bottom) { animation = AnimationUtils.loadAnimation(NetPhotosActivity.this, R.anim.photos_bottom_exit); } else { animation = AnimationUtils.loadAnimation(NetPhotosActivity.this, R.anim.photos_bottom_enter); } view.setAnimation(animation); flag_bottom = !flag_bottom; break; case R.id.btn_net_photos_exit: finish(); break; case R.id.btn_net_photos_save: String photo = photos[viewPager.getCurrentItem()]; FinalBitmap finalBitmap = FinalBitmap.create(NetPhotosActivity.this); Bitmap bitmap = finalBitmap.getBitmapFromCache(photo); if (bitmap != null) { SdCardUtil.savePhoto(NetPhotosActivity.this, bitmap); } else { ToastUtil.prompt(NetPhotosActivity.this, "还在下载大图"); } break; } }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = minflater.inflate(R.layout.fragment_photo_grid_image, null); // 获取布局的长宽,并重新设置 int x = (int) (parent.getWidth() / 3); int y = (int) (parent.getWidth() / 3); convertView.setLayoutParams(new AbsListView.LayoutParams(x, y)); holder = new ViewHolder(); // 初始化finalBitmap fb = FinalBitmap.create(context); holder.photo_img1 = (ImageView) convertView.findViewById(R.id.photo_img); AlbumBackList back = data.get(position); // if(position == 0){ // holder.photo_img.setImageResource(R.drawable.add_album); // }else{ fb.display(holder.photo_img1, "http://61.152.93.162:8380/data/upload/" + back.getSavepath()); // } convertView.setTag(holder); // 绑定ViewHolder对象 } else { holder = (ViewHolder) convertView.getTag(); // 取出ViewHolder对象 } return convertView; }
/** * @param context * @return 作者:fighter <br> * 创建时间:2013-5-24<br> * 修改时间:<br> */ public static FinalBitmap createFinalBitmap(Context context) { FinalBitmap finalBitmap = FinalBitmap.create( context, BitmapCommonUtils.getDiskCacheDir(context, "panlv/cache").getAbsolutePath()); finalBitmap.configCalculateBitmapSizeWhenDecode(true); return finalBitmap; }
public void refreshAvatarView(String url) { Trace.d(TAG, "refreshAvatarView:" + rec.getAvatar().toString()); if (!StringUtil.getInstance().IsEmpty(url)) { try { avatarFB = FinalBitmap.create(HomePageActivity.this); avatarFB.flushCache(); avatarFB.closeCache(); avatarFB.configCalculateBitmapSizeWhenDecode(true); avatarFB.display(ivAvatar, url, true); } catch (Exception e) { Log.e(TAG, "refreshAvatarView:display user avatar error.", e); } } else { Log.e(TAG, "refreshAvatarView:url is empty."); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = new ViewHolder(); if (convertView == null) { convertView = inflater.inflate(R.layout.community_listview_item, null); holder.intro = (TextView) convertView.findViewById(R.id.shequ_item_activities); holder.title = (TextView) convertView.findViewById(R.id.shequ_item_name); holder.time = (TextView) convertView.findViewById(R.id.shequ_hot_item_time); holder.actimg = (ImageView) convertView.findViewById(R.id.shequ_head_pic_item); holder.shequ_item_activities_detail = (TextView) convertView.findViewById(R.id.shequ_item_activities_detail); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); CommunityListbean listbean = list.get(position); holder.title.setText(listbean.getTitle()); holder.time.setVisibility(View.VISIBLE); holder.time.setText(listbean.getTime()); holder.shequ_item_activities_detail.setVisibility(View.GONE); holder.intro.setText(listbean.getDttype()); String actimg = list.get(position).getActimg(); // Picasso.with(context).load(Constant.COMMUNITY_IMAGE_URL+userpic).into(holder.userpic); bitmap.display( holder.actimg, Constant.COMMUNITY_IMAGE_URL + actimg, 40, 80, loadingBitmap, laodfailBitmap); } return convertView; }
public SingleVolunteerActivity(Context context) { super(context); View.inflate(context, R.layout.item_select_volunteer, this); fb = FinalBitmap.create(context); this.context = context; initView(); }
public SyzxYyyAdapter(Context context, List<SyzxYyyList> list) { this.mContext = context; this.inflater = LayoutInflater.from(context); this.infos = list; this.finalBitmap = FinalBitmap.create(context); BitmapFactory.decodeResource(mContext.getResources(), R.drawable.os_img_default_icon); }
@Override public View getView(final int position, View convertView, ViewGroup parent) { Holder holder = null; if (convertView == null) { holder = new Holder(); convertView = inflater.inflate(R.layout.water_band_list_item, null); holder.tv_band_money = (TextView) convertView.findViewById(R.id.m_tv_band_money); holder.tv_band_name = (TextView) convertView.findViewById(R.id.m_tv_band_name); holder.iv_band_icon = (ImageView) convertView.findViewById(R.id.m_iv_band_icon); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } WaterBand waterBand = waterBands.get(position); holder.tv_band_money.setText( "原价" + waterBand.getPrice() + "元/桶" + ",折扣价" + waterBand.getDis_price() + "元/桶"); holder.tv_band_name.setText(waterBand.getName()); finalBitmap.display( holder.iv_band_icon, waterBand.getImg_url(), defDrawable.getBitmap(), defDrawable.getBitmap()); return convertView; }
public GroupListViewAdapter(List<TuanInfo> list, Context context) { // TODO Auto-generated constructor stub this.context = context; this.list = list; format = new DecimalFormat("##.#"); syncImageLoader = new SyncImageLoader(); fb = FinalBitmap.create(context); }
public WaterBandAdapter(Context context) { inflater = LayoutInflater.from(context); waterBands = new ArrayList<WaterBand>(); finalBitmap = FinalBitmap.create(context); this.context = context; // 默认图标赋值 defDrawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.ad_loading); }
public CleanTypeAdapter(Context context) { inflater = LayoutInflater.from(context); cleanTypeDatas = new ArrayList<CleanTypeData>(); finalBitmap = FinalBitmap.create(context); this.context = context; // 默认图标赋值 defDrawable = (BitmapDrawable) context.getResources().getDrawable(R.drawable.ad_loading); }
@SuppressWarnings("static-access") public CommunityHotTopicAdapter(Context context, List<CommunityListbean> list) { super(); this.context = context; this.list = list; bitmap = bitmap.create(context); inflater = LayoutInflater.from(context); laodfailBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.head); loadingBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.head); }
public static FinalBitmap createFinalAlbumBitmap(Context context) { FinalBitmap finalBitmap = FinalBitmap.create( context, BitmapCommonUtils.getDiskCacheDir(context, "panlv/cache").getAbsolutePath()); finalBitmap.configCalculateBitmapSizeWhenDecode(true); finalBitmap.configBitmapMaxHeight(350); finalBitmap.configBitmapMaxWidth(350); finalBitmap.configLoadingImage(R.drawable.shakepic_noimage); finalBitmap.configLoadfailImage(R.drawable.shakepic_noimage); return finalBitmap; }
private void initData() { // TODO Auto-generated method stub uid = SharepreferenceUtil.readString(PreMainActivity.this, SharepreferenceUtil.fileName, "uid"); finalBitmap = FinalBitmap.create(PreMainActivity.this); if (ContextUtil.getHeith(PreMainActivity.this) <= 480) { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 60); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 800) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 140); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 860) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 150); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 960) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 180); // fl_ad.setLayoutParams(linearParams); dpitype = "m"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 1280) { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 200); // fl_ad.setLayoutParams(linearParams); dpitype = "m"; } else { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 210); // fl_ad.setLayoutParams(linearParams); dpitype = "h"; } RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad.getLayoutParams(); linearParams.width = ContextUtil.getWidth(PreMainActivity.this); linearParams.height = linearParams.width / 2; fl_ad.setLayoutParams(linearParams); BitMapUtil.getImgOpt(PreMainActivity.this, finalBitmap, mJazzy, R.drawable.os_login_topicon); }
public void setData(FindBackList data) { this.back = data; name_tv.setText(back.getNickname()); distance_tv.setText(back.getDistance()); // 转换时间戳为距离现在多久的时间 String time = StandardDate.getStandardDate((back.getcTime() * 1000)); time_tv.setText(time); sign_tv.setText(back.getIntro()); if (back.getSex().equals("1")) { sex_img.setImageResource(R.drawable.woman_icon); } else { sex_img.setImageResource(R.drawable.man_icon); } long date = new Date().getTime(); if (back.getAvatar_original() != null) { fb.display(head_img, back.getAvatar_original() + "#" + date); } else if (back.getAvatar_big() != null) { fb.display(head_img, back.getAvatar_big() + "#" + date); } else if (back.getAvatar_middle() != null) { fb.display(head_img, back.getAvatar_middle() + "#" + date); } else if (back.getAvatar_small() != null) { fb.display(head_img, back.getAvatar_small() + "#" + date); } else { fb.display(head_img, back.getAvatar_tiny() + "#" + date); } head_img.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, PersonActivity.class); intent.putExtra("uid", back.getUid()); context.startActivity(intent); } }); }
private void initNearByBitmap() { mNearByBitmap = new FinalBitmap(this); mNearByBitmap.configBitmapLoadThreadSize(5); mNearByBitmap.configDiskCachePath(CACHE); mNearByBitmap.configLoadfailImage(R.drawable.v5_0_1_nearby_activity_photo_bg); mNearByBitmap.configLoadingImage(R.drawable.v5_0_1_nearby_activity_photo_bg); mNearByBitmap.configMemoryCacheSize(1); mNearByBitmap.init(); }
private void initAlbumBitmap() { mAlbumBitmap = new FinalBitmap(this); mAlbumBitmap.configBitmapLoadThreadSize(5); mAlbumBitmap.configDiskCachePath(CACHE); mAlbumBitmap.configLoadfailImage(R.drawable.v5_0_1_select_album_item_default_img); mAlbumBitmap.configLoadingImage(R.drawable.v5_0_1_select_album_item_default_img); mAlbumBitmap.configMemoryCacheSize(1); mAlbumBitmap.init(); }
private void initHeadBitmap() { mHeadBitmap = new FinalBitmap(this); mHeadBitmap.configBitmapLoadThreadSize(5); mHeadBitmap.configDiskCachePath(CACHE); mHeadBitmap.configLoadfailImage(R.drawable.v5_0_1_widget_default_head); mHeadBitmap.configLoadingImage(R.drawable.v5_0_1_widget_default_head); mHeadBitmap.configMemoryCacheSize(1); mHeadBitmap.init(); }
private void initPhotoBitmap() { mPhotoBitmap = new FinalBitmap(this); mPhotoBitmap.configBitmapLoadThreadSize(5); mPhotoBitmap.configDiskCachePath(CACHE); mPhotoBitmap.configLoadfailImage(R.drawable.v5_0_1_photo_default_img); mPhotoBitmap.configLoadingImage(R.drawable.v5_0_1_photo_default_img); mPhotoBitmap.configMemoryCacheSize(1); mPhotoBitmap.init(); }
// 显示宣传图片 private void initAdv(String url) { ad = new Dialog(this, R.style.Transparent); View v = LayoutInflater.from(this).inflate(R.layout.mainplan, null); final ImageView iv = (ImageView) v.findViewById(R.id.iv); finalBitmap.display(iv, url); // iv.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // // TODO Auto-generated method stub // ad.cancel(); // } // }); ad.setContentView(v); ad.show(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { Holder holder = null; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.group_listview_item, null); holder = new Holder(); holder.img = (ImageView) convertView.findViewById(R.id.gropu_listview_img); holder.title = (TextView) convertView.findViewById(R.id.group_listview_title); holder.content = (TextView) convertView.findViewById(R.id.group_listview_content); holder.distance = (TextView) convertView.findViewById(R.id.group_listview_distance); holder.newMoney = (TextView) convertView.findViewById(R.id.group_listview_newMoney); holder.oldMoney = (TextView) convertView.findViewById(R.id.group_listview_oldMoney); holder.now_number = (TextView) convertView.findViewById(R.id.now_number); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } TuanInfo tuanInfo = list.get(position); holder.title.setText(tuanInfo.title); holder.content.setText(tuanInfo.product); holder.distance.setText(format.format(Float.parseFloat(tuanInfo.distance) / 1000.0) + "km"); holder.newMoney.setText(tuanInfo.team_price); holder.oldMoney.setText(tuanInfo.market_price + "元"); holder.oldMoney.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); holder.now_number.setText("已售" + tuanInfo.now_number); fb.display(holder.img, tuanInfo.image); holder.position = position; convertView.setOnClickListener(this); // syncImageLoader.loadImage(position,tuanInfo.image,new SyncImageLoader.OnImageLoadListener() // { // // @Override // public void onImageLoad(Integer t, Drawable drawable) { // holder.img.setImageDrawable(drawable); // } // // @Override // public void onError(Integer t) { // // TODO Auto-generated method stub // // } // }); return convertView; }
@Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (finalBitmap != null) { finalBitmap.onDestroy(); } if (isRegFilter) { isRegFilter = false; this.unregisterReceiver(mReceiver); } Account account = AccountPersist.getInstance().getActiveAccountInfo(PreMainActivity.this); exitConn(account); AccountPersist.getInstance().setActiveAccount(PreMainActivity.this, new Account()); NpcCommon.mThreeNum = ""; Intent i = new Intent(MyApp.MAIN_SERVICE_START); stopService(i); }
@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub switch (msg.what) { case UPDATE_CONTENT: listViewReply.setAdapter(replysAdapter); textViewUsername.setText(topic.getUsername()); textViewReplyTime.setText(topic.getReplyTime()); textViewContent.setText(Html.fromHtml(topic.getContent(), imgGetter, null)); textViewNode.setText(topic.getNode()); textViewClick.setText(topic.getClick()); textViewReplyCount.setText(topic.getReplyCount() + "条回复"); textViewTitle.setText(topic.getTitle()); finalBitmap.display(imageViewAvatar, topic.getAvatar()); layoutProgress.setVisibility(View.GONE); break; default: super.handleMessage(msg); break; } }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null || convertView.getTag() == null) { convertView = (View) mInflater.inflate(R.layout.hy_appointments_manager_item, null); holder = new ViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } AccountManagerBean activityBean = managers.get(position); if (activityBean != null) { finalBitmap.display(holder.ivHead, activityBean.getHeadImage()); holder.ivHead.setTag(activityBean.getAccount()); holder.tvName.setText(activityBean.getName().trim()); holder.tvCompany.setText(activityBean.getCompany().trim()); holder.ivHead.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String launchaccount = v.getTag().toString(); ProjectUtil.goToUserInfoActivity( (HYBaseActivity) context, null, launchaccount, false); } }); } holder.ibDelete.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { delmanager.deleteManager(managers.get(position).getAccount()); } }); return convertView; }
private void init() { setTitle(topic.getTitle()); finalBitmap = FinalBitmap.create(TopicActivity.this); LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutHeader = (LinearLayout) layoutInflater.inflate(R.layout.listview_reply_header, null, false); listViewReply = (ListView) findViewById(R.id.listView_reply); layoutProgress = (LinearLayout) findViewById(R.id.linearLayout_progress); textViewUsername = (TextView) layoutHeader.findViewById(R.id.textView_username); textViewReplyTime = (TextView) layoutHeader.findViewById(R.id.textView_reply_time); imageViewAvatar = (ImageView) layoutHeader.findViewById(R.id.imageView_avatar); textViewContent = (TextView) layoutHeader.findViewById(R.id.textView_content); textViewClick = (TextView) layoutHeader.findViewById(R.id.textView_click); textViewReplyCount = (TextView) layoutHeader.findViewById(R.id.textView_reply_count); textViewTitle = (TextView) layoutHeader.findViewById(R.id.textView_title); textViewNode = (TextView) layoutHeader.findViewById(R.id.textView_node); listViewReply.addHeaderView(layoutHeader); listViewReply.setHeaderDividersEnabled(false); listViewReply.setAdapter(replysAdapter); textViewContent.setMovementMethod(LinkMovementMethod.getInstance()); }
public static void DialogLookBigImg(Activity mActivity, FinalBitmap finalBitmap, String url) { LayoutInflater inflater = LayoutInflater.from(mActivity.getApplicationContext()); View imgEntryView = inflater.inflate(R.layout.dialog_look_big_img, null); final AlertDialog dialog = new AlertDialog.Builder(mActivity).create(); ImageView img = (ImageView) imgEntryView.findViewById(R.id.look_big_img); if (!TextUtils.isEmpty(url)) { finalBitmap.display(img, GlobalUtil.REMOTE_HOST + url); } else { dialog.dismiss(); } dialog.setView(imgEntryView); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.show(); img.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.cancel(); } }); }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder; if (convertView == null) { convertView = minflater.inflate(R.layout.item_fanslist, null); holder = new ViewHolder(); holder.name_tv = (TextView) convertView.findViewById(R.id.name_fans_tv); holder.distance_tv = (TextView) convertView.findViewById(R.id.distance_fans_tv); holder.time_tv = (TextView) convertView.findViewById(R.id.time_fans_tv); holder.age_tv = (TextView) convertView.findViewById(R.id.age_fans_tv); holder.height_tv = (TextView) convertView.findViewById(R.id.height_fans_tv); holder.weight_tv = (TextView) convertView.findViewById(R.id.weight_fans_tv); holder.sign_tv = (TextView) convertView.findViewById(R.id.sign_fans_tv); holder.head_img = (ImageView) convertView.findViewById(R.id.head_fans_img); holder.sex_img = (ImageView) convertView.findViewById(R.id.sex_fans_img); // holder.ll=(LinearLayout)convertView.findViewById(R.id.ll); convertView.setTag(holder); // 绑定ViewHolder对象 } else { holder = (ViewHolder) convertView.getTag(); // 取出ViewHolder对象 } final Followers back = followers.get(position); try { if (back != null) { long data = new Date().getTime(); if (back.getAvatar_middle() != null) { fb.display(holder.head_img, back.getAvatar_middle() + "#" + data); } else if (back.getAvatar_small() != null) { fb.display(holder.head_img, back.getAvatar_small() + "#" + data); } else if (back.getAvatar_big() != null) { fb.display(holder.head_img, back.getAvatar_big() + "#" + data); } holder.name_tv.setText(back.getNickname()); // holder.distance_tv.setText(); String time = StandardDate.getStandardDate((back.getLast_login_time() * 1000)); holder.time_tv.setText(time); if (back.getProfile().getBirthday() != null && !back.getProfile().getBirthday().getValue().equals("")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); String now_year = sdf.format(new java.util.Date()); // 获取当前年份 String old_year = sdf.format( new Date( Integer.parseInt(back.getProfile().getBirthday().getValue()) * 1000L)); // 获取出生年份 String age = String.valueOf(Integer.parseInt(now_year) - Integer.parseInt(old_year)); holder.age_tv.setText(age + "岁"); } if (back.getProfile().getHeight() != null && !back.getProfile().getHeight().getValue().equals("")) { holder.height_tv.setText(back.getProfile().getHeight().getValue() + "cm"); } if (back.getProfile().getWeight() != null && !back.getProfile().getWeight().getValue().equals("")) { holder.weight_tv.setText(back.getProfile().getWeight().getValue() + "kg"); } // holder.age_tv.setText(); // holder.height_tv.setText((CharSequence) // back.getProfile().getHeight().getValue()+"cm"); // holder.weight_tv.setText((CharSequence) // back.getProfile().getWeight().getValue()+"kg"); holder.sign_tv.setText(back.getIntro()); if (back.getSex().equals("1")) { holder.sex_img.setImageResource(R.drawable.man_icon); } else { holder.sex_img.setImageResource(R.drawable.woman_icon); } } } catch (Exception e) { e.printStackTrace(); } convertView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, PersonActivity.class); intent.putExtra("uid", back.getUid()); context.startActivity(intent); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final int selectId = position; ViewHolder viewHolder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.os_dhb_syzx_yyy_list_item, null); viewHolder = new ViewHolder(); viewHolder.iv_thumbnail = (ImageView) convertView.findViewById(R.id.iv_thumbnail); viewHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name); viewHolder.tv_describe = (MarqueeText) convertView.findViewById(R.id.tv_describe); viewHolder.tv_time = (TextView) convertView.findViewById(R.id.tv_time); viewHolder.btn_yyy = (FButton) convertView.findViewById(R.id.btn_yyy); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (infos.get(position).getSmallpic() != null && (infos.get(position).getSmallpic().contains(".jpg") || infos.get(position).getSmallpic().contains(".png"))) { finalBitmap.display( viewHolder.iv_thumbnail, infos.get(position).getSmallpic(), loadingBitmap, loadingBitmap, false); } viewHolder.tv_name.setText(infos.get(position).getTitle()); viewHolder.tv_describe.setText(infos.get(position).getInfo()); viewHolder.tv_time.setText(ContextUtil.formateTime(infos.get(position).getBegintime())); viewHolder.btn_yyy.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // 旧流程,先跳转至摇一摇广告页,浏览完广告图后才可进入摇一摇界面 // ((DhbSyzxShakeListActivity) mContext).getNextAd( // infos.get(selectId).getGgid(), infos.get(selectId) // .getLargepic()); // 新流程,直接跳转至摇一摇界面 Intent intent = new Intent(mContext, DhbSyzxShakeActivity.class); intent.putExtra("currentGgid", infos.get(selectId).getGgid()); intent.putExtra("largepic", infos.get(selectId).getLargepic()); mContext.startActivity(intent); // SimpleDateFormat simpledate = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // try { // Date date1 = simpledate.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new // Date())); // Date date2 = // simpledate.parse(ContextUtil.formateTime(infos.get(selectId).getBegintime())); // Date date3 = // simpledate.parse(ContextUtil.formateTime(infos.get(selectId).getEndtime())); // if(date1.getTime()<date2.getTime()){ // Toast.makeText(mContext, // "活动时间还没到,"+ContextUtil.formateTime(infos.get(selectId).getBegintime())+"开始~", // Toast.LENGTH_SHORT).show(); // }else if(date1.getTime()>date3.getTime()){ // Toast.makeText(mContext, "活动已结束~", Toast.LENGTH_SHORT).show(); // }else{ // ((DhbSyzxShakeListActivity) mContext).getNextAd( // infos.get(selectId).getGgid(), infos.get(selectId) // .getLargepic()); // } // } catch (ParseException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } }); return convertView; }
public AlbumListAdapter(Context context, List<AlbumBackList> data) { this.minflater = LayoutInflater.from(context); this.context = context; this.data = data; fb = FinalBitmap.create(context); }