Java Code Examples for com.facebook.drawee.view.SimpleDraweeView#setImageURI()
The following examples show how to use
com.facebook.drawee.view.SimpleDraweeView#setImageURI() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AcRecommendRvAdapter.java From BlueBoard with Apache License 2.0 | 6 votes |
public void setCardViewInfo(AcReOther.DataEntity.PageEntity.ListEntity entity, SimpleDraweeView imgCoverOther, TextView tvTitleOther, TextView tvSubTitleOtherLeft, TextView tvSubTitleOtherRight) { if (entity != null) { imgCoverOther.setImageURI(Uri.parse(entity.getCover())); tvTitleOther.setText(entity.getTitle()); tvSubTitleOtherLeft.setText(MyApplication.getInstance().getApplicationContext().getString(R.string.click) + " " + entity.getViews()); tvSubTitleOtherRight.setText(MyApplication.getInstance().getApplicationContext().getString(R.string.reply) + " " + entity.getComments()); } else { imgCoverOther.setImageURI(null); tvTitleOther.setText(""); tvSubTitleOtherLeft.setText(""); tvSubTitleOtherRight.setText(""); } }
Example 2
Source File: PictureAdapter.java From FlyWoo with Apache License 2.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = View.inflate(context, R.layout.item_picture_folder, null); } SimpleDraweeView image = (SimpleDraweeView) convertView.findViewById(R.id.image); TextView pictureCount = (TextView) convertView.findViewById(R.id.pictureCount); TextView folderName = (TextView) convertView.findViewById(R.id.folderName); TouchCheckBox select = (TouchCheckBox) convertView.findViewById(R.id.select); image.setImageURI(Uri.parse("file://" + list.get(position).getAbsolutePath())); folderName.setText(list.get(position).getName()); pictureCount.setText(Formatter.formatFileSize(context,list.get(position).length())); WFile wfile = new WFile(list.get(position).getAbsolutePath()); Message.CONTENT_TYPE type = Message.CONTENT_TYPE.IMAGE; select.setOnCheckedChangeListener(new OnFileCheckListener(wfile,type)); return convertView; }
Example 3
Source File: SocialPublishActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
@SuppressLint({ "ViewHolder", "InflateParams" }) @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(R.layout.item_gridview_image, null); SimpleDraweeView sdv_image = (SimpleDraweeView) convertView .findViewById(R.id.sdv_image); if (position == list.size() && list.size() < 9) { GenericDraweeHierarchy hierarchy = sdv_image.getHierarchy(); hierarchy.setPlaceholderImage(R.drawable.icon_add); } else { Uri uri_temp = getItem(position); sdv_image.setImageURI(uri_temp); } return convertView; }
Example 4
Source File: MainActivity.java From DevHeadLine with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); // ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( // this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); // drawer.setDrawerListener(toggle); // toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); SimpleDraweeView avatarView = (SimpleDraweeView) navigationView.getHeaderView(0).findViewById(R.id.sdv_avatar); if (avatarView != null) { avatarView.setImageURI(Uri.parse("https://avatars2.githubusercontent.com/u/4241807?v=3&s=460")); } //fragment Manager managerFragment(savedInstanceState); }
Example 5
Source File: MainActivity.java From Fresco with Apache License 2.0 | 6 votes |
private void initView() { //创建SimpleDraweeView对象 simpleDraweeView = (SimpleDraweeView) findViewById(R.id.main_sdv); //创建将要下载的图片的URI Uri imageUri = Uri.parse("http://my.csdn.net/uploads/avatar/4/E/8/1_y1scp.jpg"); //开始下载 simpleDraweeView.setImageURI(imageUri); //创建DraweeController DraweeController controller = Fresco.newDraweeControllerBuilder() //重试之后要加载的图片URI地址 .setUri(imageUri) //设置点击重试是否开启 .setTapToRetryEnabled(true) //设置旧的Controller .setOldController(simpleDraweeView.getController()) //构建 .build(); //设置DraweeController simpleDraweeView.setController(controller); }
Example 6
Source File: BitmapLoadTestActivity.java From AndroidPlayground with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bitmap_load_test); ImageView avatar = (ImageView) findViewById(R.id.mAvatar); avatar.setImageBitmap( decodeSampledBitmapFromResource(getResources(), R.drawable.avatar, 65, 65)); ImageView avatar1 = (ImageView) findViewById(R.id.mAvatar1); avatar1.setImageBitmap( decodeSampledBitmapFromResource(getResources(), R.drawable.avatar, 130, 130)); ImageView avatar2 = (ImageView) findViewById(R.id.mAvatar2); avatar2.setImageResource(R.drawable.avatar); SimpleDraweeView avatar3 = (SimpleDraweeView) findViewById(R.id.mAvatar3); //"http://yolo-debug.oss-cn-beijing.aliyuncs // .com/headimgs/20c8435a-5d12-11e5-8a0b-00163e000555.jpeg" avatar3.setImageURI(Uri.parse( "http://cn.gundam.info/series/buildfighters/wp-content/uploads/sites/2/2014/09" + "/wing_130x130.png")); }
Example 7
Source File: DraweeTransitionFragment.java From fresco with MIT License | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final Uri imageUri = sampleUris().createSampleUri(ImageUriProvider.ImageSize.M); final SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); // You have to enable legacy visibility handling for the start view in order for this to work simpleDraweeView.setLegacyVisibilityHandlingEnabled(true); simpleDraweeView.setImageURI(imageUri); simpleDraweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FOCUS_CROP); simpleDraweeView.getHierarchy().setActualImageFocusPoint(FOCUS_POINT); simpleDraweeView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startTransition(v, imageUri); } }); }
Example 8
Source File: ImageFormatDataUriFragment.java From fresco with MIT License | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final SimpleDraweeView simpleDraweeView = view.findViewById(R.id.drawee_view); simpleDraweeView.setImageURI(dataUri, null); final TextView uriContentTextView = view.findViewById(R.id.datauri_content_textview); uriContentTextView.setText(dataUri); }
Example 9
Source File: ContentsAdapter.java From PicKing with Apache License 2.0 | 5 votes |
private void setFresco(SimpleDraweeView simpleDraweeView, AlbumInfo albumInfo, int width, boolean isGif) { if (albumInfo.getWidth() != null && albumInfo.getHeight() != null) { if (isGif) simpleDraweeView.setImageURI(albumInfo.getPicUrl()); else simpleDraweeView.setImageURI(albumInfo.getGifThumbUrl()); ViewGroup.LayoutParams l = simpleDraweeView.getLayoutParams(); l.width = albumInfo.getWidth(); l.height = albumInfo.getHeight(); simpleDraweeView.setLayoutParams(l); } else FrescoUtil.setControllerListener(simpleDraweeView, albumInfo, width, isGif); }
Example 10
Source File: NetImageAdapter.java From Fishing with GNU General Public License v3.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { SimpleDraweeView draweeView = new SimpleDraweeView(getContext()); draweeView.getHierarchy().setPlaceholderImage(new ColorDrawable(Color.rgb(252,242,230))); draweeView.getHierarchy().setFadeDuration(300); draweeView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); draweeView.setImageURI(ImageModel.getInstance().getSmallImage(getItem(position))); draweeView.setTag(position); draweeView.setOnClickListener(this); return draweeView; }
Example 11
Source File: BindingSetters.java From materialup with Apache License 2.0 | 5 votes |
@BindingAdapter({"bind:normalUrl"}) public static void loadImage(SimpleDraweeView view, String normal) { if (TextUtils.isEmpty(normal)) { view.setImageURI(null); return; } try { view.setImageURI(Uri.parse(normal)); } catch (Exception e) { L.e("avatar :%s", normal); e.printStackTrace(); } }
Example 12
Source File: ImageFrescoContentCell.java From YcShareElement with Apache License 2.0 | 5 votes |
@Override protected void onBindViewHolder(BasePagerViewHolder viewHolder) { Fresco.getImagePipeline().evictFromCache(Uri.parse(mData.url)); SimpleDraweeView imageView = viewHolder.getView(R.id.content_item_img); ViewCompat.setTransitionName(imageView, mData.url); Bitmap thumbnail = mData.url.equals(BitmapThumbnail.sKey)?BitmapThumbnail.sBitmap:null; GenericDraweeHierarchy hierarchy = imageView.getHierarchy(); hierarchy.setPlaceholderImage(new BitmapDrawable(imageView.getResources(),thumbnail), ScalingUtils.ScaleType.FIT_CENTER); hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); imageView.setImageURI(mData.url); }
Example 13
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 5 votes |
public static void simpleLoadImageFromURL(SimpleDraweeView destImageView , String URL) { Uri uri = Uri.parse(URL); if(URL !=null && uri!=null){ destImageView.setImageURI(uri); } }
Example 14
Source File: ImageActivity.java From coderfun with GNU General Public License v3.0 | 5 votes |
private void initSimpleDraweeView() { simpleDraweeView = (SimpleDraweeView) findViewById(R.id.draweeview); GenericDraweeHierarchy hierarchy = simpleDraweeView.getHierarchy(); hierarchy.setProgressBarImage(new ProgressBarDrawable()); Uri uri = Uri.parse(url); simpleDraweeView.setImageURI(uri); }
Example 15
Source File: DateDetailActivity.java From Fishing with GNU General Public License v3.0 | 5 votes |
@Override public void setData(Date data) { getExpansion().dismissProgressPage(); avatar.setImageURI(Uri.parse(data.getAuthorAvatar())); name.setText(data.getAuthorName()); title.setText(data.getTitle()); strTitle = data.getTitle(); time.setText(new JTimeTransform(data.getTime()).toString(new JTimeTransform.RecentDateFormat())); dateTime.setText(new SimpleDateFormat("yyyy年MM月dd日").format(new java.util.Date(data.getAcTime()))); content.setText(data.getContent()); int uid = AccountModel.getInstance().getAccount().getUID(); for (PersonBrief personBrief : data.getEnrollMember()) { if (personBrief.getUID() == uid) { joined = true; join.setText("进入"); } SimpleDraweeView draweeView = new SimpleDraweeView(DateDetailActivity.this); draweeView.setLayoutParams(new ViewGroup.LayoutParams(JUtils.dip2px(40), JUtils.dip2px(40))); draweeView.setImageURI(Uri.parse(personBrief.getAvatar())); draweeView.getHierarchy().setRoundingParams(RoundingParams.asCircle()); draweeView.setOnClickListener(v -> { Intent i = new Intent(DateDetailActivity.this, UserDetailActivity.class); i.putExtra("id", personBrief.getUID()); startActivity(i); }); joinMember.addView(draweeView); } }
Example 16
Source File: SimpleDraweeViewAdapter.java From demo4Fish with MIT License | 4 votes |
@BindingAdapter(value = {"actualImageUri"}) public static void setImageUrl(SimpleDraweeView draweeView, String url) { draweeView.setImageURI(url); }
Example 17
Source File: ImagePipelineQualifiedResourceFragment.java From fresco with MIT License | 4 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); simpleDraweeView.setImageURI(QUALIFIED_RESOURCE_URI); }
Example 18
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 4 votes |
public static void simpleLoadImageFromURI(SimpleDraweeView destImageView , Uri uri) { if(uri!=null){ destImageView.setImageURI(uri); } }
Example 19
Source File: ViewHolder.java From OpenEyes with Apache License 2.0 | 4 votes |
/** * 给ImageView设置ImageResource使用Frsesco * @param uri 资源uri * @return */ public ViewHolder setImageResourcewithFresco(int viewId,Uri uri){ SimpleDraweeView draweeView=getView(viewId); draweeView.setImageURI(uri); return this; }
Example 20
Source File: MainActivity.java From Fresco with Apache License 2.0 | 4 votes |
private void initView() { //获取SimpleDraweeView sdv = (SimpleDraweeView) findViewById(R.id.main_sdv); //初始化多张背景图集合 List<Drawable> bgs = new ArrayList<Drawable>(); bgs.add(ContextCompat.getDrawable(this,R.mipmap.bg_zero)); bgs.add(ContextCompat.getDrawable(this,R.mipmap.bg_one)); bgs.add(ContextCompat.getDrawable(this,R.mipmap.bg_two)); //初始化多张叠加图集合 List<Drawable> overlays = new ArrayList<Drawable>(); overlays.add(ContextCompat.getDrawable(this,R.mipmap.overlay_one)); overlays.add(ContextCompat.getDrawable(this,R.mipmap.overlay_two)); overlays.add(ContextCompat.getDrawable(this, R.mipmap.overlay_three)); GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources()) //设置淡入淡出动画持续时间 .setFadeDuration(5000) //设置单张背景图 .setBackground(ContextCompat.getDrawable(this, R.mipmap.bg_zero)) //设置多张背景图 //.setBackgrounds(bgs) //设置单张叠加图 //.setOverlay(ContextCompat.getDrawable(this,R.mipmap.overlay_one)) //设置多张叠加图 //.setOverlays(overlays) //设置占位图及它的缩放类型 .setPlaceholderImage(ContextCompat.getDrawable(this, R.mipmap.icon_placeholder), ScalingUtils.ScaleType.FOCUS_CROP) //设置正在加载图及其缩放类型 .setProgressBarImage(ContextCompat.getDrawable(this, R.mipmap.icon_progress_bar), ScalingUtils.ScaleType.FOCUS_CROP) //设置失败图及其缩放类型 .setFailureImage(ContextCompat.getDrawable(this, R.mipmap.icon_failure), ScalingUtils.ScaleType.FOCUS_CROP) //设置重试图及其缩放类型 .setRetryImage(ContextCompat.getDrawable(this, R.mipmap.icon_retry), ScalingUtils.ScaleType.FOCUS_CROP) //构建 .build(); //设置GenericDraweeHierarchy sdv.setHierarchy(hierarchy); //构建Controller DraweeController controller = Fresco.newDraweeControllerBuilder() //设置点击重试是否开启 .setTapToRetryEnabled(true) //构建 .build(); //设置Controller sdv.setController(controller); //开始下载 sdv.setImageURI(imageUrl); }