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 SingleVolunteerActivity(Context context) { super(context); View.inflate(context, R.layout.item_select_volunteer, this); fb = FinalBitmap.create(context); this.context = context; initView(); }
@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 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; } }
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); }
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 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 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 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."); } }
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 UserManagerAdapter(Context context, ArrayList<AccountManagerBean> managers) { this.context = context; this.mInflater = LayoutInflater.from(context); this.finalBitmap = FinalBitmap.create(context); this.managers = managers; }
private void InitPersonalInfo() { // 更换头像 Trace.d(TAG, "InitPersonalInfo:" + rec.getAvatar().toString()); if (!StringUtil.getInstance().IsEmpty(rec.getAvatar().getBig())) { String url = RequestUrls.SERVER_BASIC_URL + rec.getAvatar().getBig(); try { avatarFB = FinalBitmap.create(HomePageActivity.this); avatarFB.flushCache(); avatarFB.closeCache(); // avatarFB.configLoadfailImage(R.drawable.menu_default_head); avatarFB.display(ivAvatar, url, true); // avatarFB.display(ivAvatar, url, false); } catch (Exception e) { Log.e(TAG, "refreshAvatarView:display user avatar error.", e); } } else { Log.e(TAG, "refreshAvatarView:url is empty."); } ivAvatar.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomePageActivity.this, BigPicImgActivity.class); intent.putExtra(BigPicImgActivity.KET_FOR_BIGPIC, rec.getAvatar().getBig()); startActivityForResult(intent, BIGPIC_FOR_RESULT); HomePageActivity.this.overridePendingTransition( R.anim.my_scale_action, R.anim.my_alpha_action); } }); tvUserName.setText(rec.getUserName()); long sendCount = rec.getOnSaleNum() + rec.getOffSaleNum(); tvSendCount.setText(String.valueOf(sendCount)); long favCount = rec.getFavNum(); tvFavCount.setText(String.valueOf(favCount)); tvAttentionCount.setText(rec.getAttendNum()); tvVisitCount.setText( String.format(getString(R.string.visit_count_format), rec.getVisitCount())); btnOperation.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { showChangeLogoRem(); } }); // 电子邮箱 emailGroup = (ViewGroup) findViewById(R.id.email); TextView tvEmailTitle = (TextView) emailGroup.findViewById(R.id.info_title); tvEmailTitle.setText(R.string.home_page_item_title_email); etEmail = (EditText) emailGroup.findViewById(R.id.info_content); System.out.println("====etEmail==" + rec.getEmail()); String regMacth = "[\\w]+@[\\w]+.[\\w]+"; if (!StringUtil.getInstance().IsEmpty(rec.getEmail()) && rec.getEmail() != null && rec.getEmail().matches(regMacth)) { etEmail.setText(rec.getEmail()); } else { etEmail.setText(""); } ((TextView) emailGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 真实姓名 realNameGroup = (ViewGroup) findViewById(R.id.real_name); TextView tvRealNameTitle = (TextView) realNameGroup.findViewById(R.id.info_title); tvRealNameTitle.setText(R.string.home_page_item_title_real_name); etRealName = (EditText) realNameGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getRealName()) && rec.getRealName() != null) { etRealName.setText(rec.getRealName()); } ((TextView) realNameGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 性别 sexGroup = (ViewGroup) findViewById(R.id.gender); TextView tvSexTitle = (TextView) sexGroup.findViewById(R.id.info_title); tvSexTitle.setText(R.string.home_page_item_title_sex); etSex = (EditText) sexGroup.findViewById(R.id.info_content); sexGroup.setBackgroundResource(R.drawable.light_item_bg_selector); switch (rec.getSex()) { case 0: etSex.setText(R.string.sex_secrecy); break; case 1: etSex.setText(R.string.sex_male); break; case 2: etSex.setText(R.string.sex_female); break; default: break; } ((TextView) sexGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 生日 birthdayGroup = (ViewGroup) findViewById(R.id.birthday); TextView tvBirthdayTitle = (TextView) birthdayGroup.findViewById(R.id.info_title); tvBirthdayTitle.setText(R.string.home_page_item_title_birthday); etBirthday = (EditText) birthdayGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getBirthday()) && rec.getBirthday() != null && !rec.getBirthday().equalsIgnoreCase("0000-00-00")) { etBirthday.setText(rec.getBirthday()); } birthdayGroup.setBackgroundResource(R.drawable.light_item_bg_selector); ((TextView) birthdayGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // MSN msnGroup = (ViewGroup) findViewById(R.id.msn); TextView tvMSNTitle = (TextView) msnGroup.findViewById(R.id.info_title); tvMSNTitle.setText(R.string.home_page_item_title_msn); etMsn = (EditText) msnGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getMsn()) && rec.getMsn() != null) { etMsn.setText(rec.getMsn()); } ((TextView) msnGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // QQ qqGroup = (ViewGroup) findViewById(R.id.qq); TextView tvQQ = (TextView) qqGroup.findViewById(R.id.info_title); tvQQ.setText(R.string.home_page_item_title_qq); etQQ = (EditText) qqGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getQq()) && rec.getQq() != null) { etQQ.setText(rec.getQq()); } ((TextView) qqGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 工作电话 officePhoneGroup = (ViewGroup) findViewById(R.id.office_phone); TextView tvOfficePhone = (TextView) officePhoneGroup.findViewById(R.id.info_title); tvOfficePhone.setText(R.string.home_page_item_title_office_phone); etOfficePhone = (EditText) officePhoneGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getOfficePhone()) && rec.getOfficePhone() != null) { etOfficePhone.setText(rec.getOfficePhone()); } ((TextView) officePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 手机 mobilePhoneGroup = (ViewGroup) findViewById(R.id.mobile_phone); TextView tvMobilePhone = (TextView) mobilePhoneGroup.findViewById(R.id.info_title); tvMobilePhone.setText(R.string.home_page_item_title_mobile_phone); etMobilePhone = (EditText) mobilePhoneGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getMobilePhone()) && rec.getMobilePhone() != null) { etMobilePhone.setText(rec.getMobilePhone()); } ((TextView) mobilePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // 座机 homePhoneGroup = (ViewGroup) findViewById(R.id.home_phone); TextView tvHomePhone = (TextView) homePhoneGroup.findViewById(R.id.info_title); tvHomePhone.setText(R.string.home_page_item_title_home_phone); etHomePhone = (EditText) homePhoneGroup.findViewById(R.id.info_content); if (!StringUtil.getInstance().IsEmpty(rec.getHomePhone()) && rec.getHomePhone() != null) { etHomePhone.setText(rec.getHomePhone()); } ((TextView) homePhoneGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); // attentionGroup = (ViewGroup) findViewById(R.id.attention); // TextView tvAttention = (TextView) attentionGroup // .findViewById(R.id.info_title); // tvAttention.setText(R.string.home_page_item_title_attention); // etAttention = (EditText) // attentionGroup.findViewById(R.id.info_content); // ((TextView) attentionGroup.findViewById(R.id.info_hint)) // .setText(R.string.attention_hint_text); // // ((TextView) // // // attentionGroup.findViewById(R.id.info_hint)).setVisibility(View.VISIBLE); }
public AlbumListAdapter(Context context, List<AlbumBackList> data) { this.minflater = LayoutInflater.from(context); this.context = context; this.data = data; fb = FinalBitmap.create(context); }
public MyFansListAdapter(Context context, List<Followers> followers) { this.minflater = LayoutInflater.from(context); this.context = context; this.followers = followers; fb = FinalBitmap.create(context); }
/** 初始化数据 */ private void initData() { finalBitmap = FinalBitmap.create(MainActivity.this); myCount = new MyCount(3000, 1000); // String channel=ChannelUtil.getChannel(MainActivity.this); }