com.facebook.drawee.view.SimpleDraweeView Java Examples

The following examples show how to use com.facebook.drawee.view.SimpleDraweeView. 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: MainActivity.java    From DevHeadLine with Apache License 2.0 6 votes vote down vote up
@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 #2
Source File: FrescoImageLoader.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static void display(SimpleDraweeView view, String uri, int width, int height, ControllerListener listener) {
    if (uri != null) {
        PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
        controller.setOldController(view.getController());
        controller.setAutoPlayAnimations(true);
        ImageRequestBuilder imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).setCacheChoice(CacheChoice.SMALL).setLocalThumbnailPreviewsEnabled(true);
        imageRequest.setProgressiveRenderingEnabled(true);
        Log.d("Good", uri);
        if (width > 0 && height > 0) {
            imageRequest.setResizeOptions(new ResizeOptions(width, height));
        }
        controller.setImageRequest(imageRequest.build());
        controller.setControllerListener(listener);
        view.setController(controller.build());
    }
}
 
Example #3
Source File: PictureAdapter.java    From FlyWoo with Apache License 2.0 6 votes vote down vote up
@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 #4
Source File: ImagePipelineRegionDecodingFragment.java    From fresco with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
  mUri =
      sampleUris()
          .createSampleUri(ImageUriProvider.ImageSize.L, ImageUriProvider.Orientation.LANDSCAPE);

  mFullDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_full);
  mFullDraweeView.setController(
      Fresco.newDraweeControllerBuilder()
          .setUri(mUri)
          .setControllerListener(mControllerListener)
          .build());

  mSelectedRegion = (ResizableFrameLayout) view.findViewById(R.id.frame_main);
  mSelectedRegion.init(view.findViewById(R.id.btn_resize));
  mSelectedRegion.setSizeChangedListener(mSizeChangedListener);

  mRegionDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_region);
  mRegionDraweeView.setOnClickListener(
      new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          updateRegion();
        }
      });
}
 
Example #5
Source File: ItemDataAdapter.java    From ListItemFold with MIT License 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.item_data, null);
        ViewHolder viewHolder = new ViewHolder();
        viewHolder.myImageView = (SimpleDraweeView) convertView.findViewById(R.id.my_image_view);
        viewHolder.myTitle = (TextView) convertView.findViewById(R.id.my_title);
        viewHolder.myContent = (TextView) convertView.findViewById(R.id.my_content);
        GenericDraweeHierarchyBuilder builder =
                new GenericDraweeHierarchyBuilder(context.getResources());
        GenericDraweeHierarchy hierarchy = builder
                .setFadeDuration(200)
                .setPlaceholderImage(new ColorDrawable(0xf2f2f2))
                .setProgressBarImage(new CircularProgressDrawable())
                .build();
        viewHolder.myImageView.setHierarchy(hierarchy);
        convertView.setTag(viewHolder);
    }
    initializeViews(getItem(position), (ViewHolder) convertView.getTag());
    return convertView;
}
 
Example #6
Source File: BindingSetters.java    From materialup with Apache License 2.0 6 votes vote down vote up
@BindingAdapter({"bind:normalUrl", "bind:teaserUrl"})
public static void loadImage(SimpleDraweeView view, String normal, String teaser) {
    ImageRequest imageRequest = ImageRequest.fromUri(normal);
    ImageRequest lowRequest = null;
    if (!TextUtils.isEmpty(teaser)) {
        lowRequest = ImageRequest.fromUri(teaser);
    }
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setLowResImageRequest(lowRequest)
            .setOldController(view.getController())
            .setAutoPlayAnimations(true)
            .build();

    view.setController(draweeController);
}
 
Example #7
Source File: AcRecommendRvAdapter.java    From BlueBoard with Apache License 2.0 6 votes vote down vote up
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 #8
Source File: FacebookImageUtil.java    From imsdk-android with MIT License 6 votes vote down vote up
public static void loadWithCache(String url, final SimpleDraweeView target,ImageRequest.CacheChoice type,boolean playAnim)
{
    if (target == null) return;

    Uri uri = Uri.parse(url);
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder
            .setCacheChoice(type)
            .build();
    final PipelineDraweeControllerBuilder pipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setAutoPlayAnimations(playAnim)
            .setOldController(target.getController());
    handler.post(new Runnable() {
        @Override
        public void run() {
            DraweeController controller = pipelineDraweeControllerBuilder.build();
            target.setController(controller);
        }
    });

}
 
Example #9
Source File: MainActivity.java    From Fresco with Apache License 2.0 6 votes vote down vote up
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 #10
Source File: MainActivity.java    From Android-Animation-Set with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setupWindowAnimations();

    ((SimpleDraweeView) findViewById(R.id.view_header))
            .setImageURI(Uri.parse("res://" + getPackageName() + "/" + R.drawable.header_bg));

    mRecyclerView = ((RecyclerView) findViewById(R.id.recycler));
    mRecyclerView.setFocusable(false);
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    mRecyclerView.setNestedScrollingEnabled(false);

    mAdapter = new MyRecyclerViewAdapter(this,
            new int[]{R.drawable.view_gif, R.drawable.drawable_gif, R.drawable.property_gif, R.drawable.ripple_gif,
                    R.drawable.reveal_effect_gif, R.drawable.transition_gif, R.drawable.view_state_gif, R.drawable.vector_gif},
            getResources().getStringArray(R.array.itemName));
    mRecyclerView.setAdapter(mAdapter);
}
 
Example #11
Source File: MainActivity.java    From ImageSelector with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fresco.initialize(this);
    setContentView(R.layout.activity_main);


    tvResult = (TextView) findViewById(R.id.tvResult);
    draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);

    ISNav.getInstance().init(new ImageLoader() {
        @Override
        public void displayImage(Context context, String path, ImageView imageView) {
            Glide.with(context).load(path).into(imageView);
        }
    });
}
 
Example #12
Source File: ListImageDirPopupWindow.java    From imsdk-android with MIT License 6 votes vote down vote up
@Override
public void initViews()
{
	mListDir = (ListView) findViewById(R.id.id_list_dir);
	mListDir.setAdapter(new CommonAdapter<ImageFloder>(context, mDatas,
			R.layout.atom_ui_item_popmenu_list_dir)
	{
		@Override
		public void convert(CommonViewHolder helper, ImageFloder item)
		{
			TextView nameTxt = helper.getView(R.id.id_dir_item_name);
			SimpleDraweeView dirImage = helper.getView(R.id.id_dir_item_image);
               TextView countTxt = helper.getView(R.id.id_dir_item_count);
               nameTxt.setText(item.getName());
			FacebookImageUtil.loadLocalImage(new File(item.getFirstImagePath()),dirImage,
					Utils.dipToPixels(context,R.dimen.atom_ui_image_size),
					Utils.dipToPixels(context,R.dimen.atom_ui_image_size));
               countTxt.setText(item.getCount()+"张");
		}
	});
}
 
Example #13
Source File: UserInfoActivity.java    From BaoKanAndroid with MIT License 6 votes vote down vote up
/**
 * 准备UI
 */
private void prepareUI() {
    mNavigationViewRed = (NavigationViewRed) findViewById(R.id.nav_user_info);
    mPortraitImageView = (SimpleDraweeView) findViewById(R.id.sdv_user_info_portrait);
    mUsernameTextView = (TextView) findViewById(R.id.tv_user_info_username);
    mGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_groupname);
    mPointsTextView = (TextView) findViewById(R.id.tv_user_info_points);
    mModifyInfoLayout = findViewById(R.id.rl_user_info_modify_info_layout);
    mModifySafeInfoLayout = findViewById(R.id.rl_user_info_modify_safe_info_layout);
    mRegisterTimeTextView = (TextView) findViewById(R.id.tv_user_info_registertime);
    mMyPointsTextView = (TextView) findViewById(R.id.tv_user_info_mypoints);
    mMyGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_mygroupname);
    mLogoutButton = (Button) findViewById(R.id.btn_user_info_logout);

    mNavigationViewRed.setupNavigationView(true, false, "我的资料", new NavigationViewRed.OnClickListener() {
        @Override
        public void onBackClick(View v) {
            finish();
        }
    });

    mModifyInfoLayout.setOnClickListener(this);
    mModifySafeInfoLayout.setOnClickListener(this);
    mLogoutButton.setOnClickListener(this);
}
 
Example #14
Source File: PersonalInfoActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void bindViews() {

        ll_3 = (LinearLayout) findViewById(R.id.ll_3);
        user_gravatar = (com.facebook.drawee.view.SimpleDraweeView) findViewById(R.id.user_gravatar);
        user_id = (TextView) findViewById(R.id.user_id);
        tv_organizational_structure = (TextView) findViewById(R.id.tv_organizational_structure);
        nickname = (TextView) findViewById(R.id.nickname);
        signature = (TextView) findViewById(R.id.signature);
//        phonenumberCheck = (TextView) findViewById(R.id.phone_number_check);
        add_buddy = (TextView) findViewById(R.id.add_buddy);
        send_message = (TextView) findViewById(R.id.send_message);
        comment_txt = (RelativeLayout) findViewById(R.id.rl_3);
//        phone_layout = (RelativeLayout) findViewById(R.id.phone_layout);
//        mrn = (ReactRootView) findViewById(R.id.mrn);
//        tv_markup.setOnClickListener(this);
        add_buddy.setOnClickListener(this);
        send_message.setOnClickListener(this);
//        phonenumberCheck.setOnClickListener(this);

        remark_layout = (LinearLayout) findViewById(R.id.remark_layout);
        remark_layout.setOnClickListener(this);

        remark_text = (TextView) findViewById(R.id.remark_text);

    }
 
Example #15
Source File: FrescoUtil.java    From PicKing with Apache License 2.0 6 votes vote down vote up
public static void setBlurFrescoController(SimpleDraweeView simpleDraweeView, String url, int iterations, int blurRadius) {
    try {
        Uri uri = Uri.parse(url);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
                .setPostprocessor(new IterativeBoxBlurPostProcessor(iterations, blurRadius))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setOldController(simpleDraweeView.getController())
                .setImageRequest(request)
                .build();
        simpleDraweeView.setController(controller);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
Example #16
Source File: ProfileUtils.java    From imsdk-android with MIT License 5 votes vote down vote up
public static void displayGravatarByUserId(String jid, final SimpleDraweeView headView) {
    ConnectionUtil.getInstance().getUserCard(jid, new IMLogicManager.NickCallBack() {
        @Override
        public void onNickCallBack(Nick nick) {
            if (nick != null && !TextUtils.isEmpty(nick.getHeaderSrc())) {
                displayGravatarByImageSrc((Activity) headView.getContext(), nick.getHeaderSrc(), headView, 0, 0);
            }
        }
    },false,false);

}
 
Example #17
Source File: FacebookImageUtil.java    From imsdk-android with MIT License 5 votes vote down vote up
public static void loadFromResource(int resourceId, final SimpleDraweeView target)
{
    ImageRequest request =  ImageRequestBuilder.newBuilderWithResourceId(resourceId).build();
    final PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setOldController(target.getController());
    handler.post(new Runnable() {
        @Override
        public void run() {
            DraweeController controller = builder.build();
            target.setController(controller);
        }
    });
}
 
Example #18
Source File: JCVideoPlayerStandard.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
protected void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    backButton.setVisibility(View.INVISIBLE);
    thumbImageView = (SimpleDraweeView) findViewById(R.id.thumb);
    coverImageView = (ImageView) findViewById(R.id.cover);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);

    thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);

}
 
Example #19
Source File: CloudChatRecordActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
void initViews()
    {
        QtNewActionBar actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
        setNewActionBar(actionBar);
        ILoadingLayout startLabels = recors_of_chat
                .getLoadingLayoutProxy();
        startLabels.setPullLabel(getText(R.string.atom_ui_tip_prelode_history));// 刚下拉时,显示的提示
        startLabels.setRefreshingLabel(getText(R.string.atom_ui_tip_loding_history));// 刷新时
        startLabels.setReleaseLabel(getText(R.string.atom_ui_tip_release_load));// 下来达到一定距离时,显示的提示
        if(adapter == null)
        {
            adapter = new ExtendChatViewAdapter(this,toId,getHandler(),isFromGroup);
            adapter.setGravatarHandler(new ChatViewAdapter.GravatarHandler() {
                @Override
                public void requestGravatarEvent(String jid, String imageSrc, SimpleDraweeView view) {

                }

//                @Override
//                public void requestGravatarEvent(final String nickOrUid, final SimpleDraweeView view) {
//                    ProfileUtils.displayGravatarByFullname(nickOrUid,view);
//                }
            });
            adapter.setContextMenuRegister(new ChatViewAdapter.ContextMenuRegister() {
                @Override
                public void registerContextMenu(View v) {
                    registerForContextMenu(v);
                }
            });
            recors_of_chat.getRefreshableView().setAdapter(adapter);
            recors_of_chat.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
                @Override
                public void onRefresh(PullToRefreshBase<ListView> listViewPullToRefreshBase) {
                    loadCloudRecords();
                }
            });
        }
    }
 
Example #20
Source File: AnswerRequestActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void bindViews() {
    rl_header = (RelativeLayout) findViewById(R.id.rl_header);
    user_gravatar = (com.facebook.drawee.view.SimpleDraweeView) findViewById(R.id.user_gravatar);
    sign = (TextView) findViewById(R.id.sign);
    radio_allow = (RadioButton) findViewById(R.id.radio_allow);
    radio_deny = (RadioButton) findViewById(R.id.radio_deny);
    edit_deny_reason = (EditText) findViewById(R.id.edit_deny_reason);
    operation_btn = (TextView) findViewById(R.id.operation_btn);
}
 
Example #21
Source File: FrescoVitoLithoRegionDecodeFragment.java    From fresco with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
  mUri =
      sampleUris()
          .createSampleUri(ImageUriProvider.ImageSize.L, ImageUriProvider.Orientation.LANDSCAPE);

  mFullDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_full);
  mFullDraweeView.setController(
      Fresco.newDraweeControllerBuilder()
          .setUri(mUri)
          .setControllerListener(mControllerListener)
          .build());

  mSelectedParentBounds = (ResizableFrameLayout) view.findViewById(R.id.frame_parent_bounds);
  mSelectedParentBounds.init(view.findViewById(R.id.btn_resize_parent_bounds));
  mSelectedParentBounds.setSizeChangedListener(mSizeChangedListener);

  mSelectedFocusPoint = (ResizableFrameLayout) view.findViewById(R.id.frame_focus_point);
  mSelectedFocusPoint.init(view.findViewById(R.id.btn_resize_focus_point));
  mSelectedFocusPoint.setSizeChangedListener(mSizeChangedListener);

  mRegionDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_region);
  mRegionDraweeView.setOnClickListener(
      new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          updateRegion();
        }
      });
}
 
Example #22
Source File: MainActivity.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
/**
 * 准备侧滑菜单
 */
private void prepareMenu() {
    mSlidingMenu = new SlidingMenu(mContext);
    mSlidingMenu.setMode(SlidingMenu.LEFT);
    mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mSlidingMenu.setShadowWidth(0);
    mSlidingMenu.setBehindOffset((int) (SizeUtils.getScreenWidthPx(mContext) * 0.5));
    mSlidingMenu.setFadeDegree(0.0f);
    mSlidingMenu.setBehindScrollScale(0.0f);
    mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

    // 为侧滑菜单设置布局
    View view = View.inflate(mContext, R.layout.slidingmenu_profile, null);
    mSlidingMenu.setMenu(view);

    mPortraitView = view.findViewById(R.id.ll_slidingmenu_profile_portrait_layout);
    mPortraitImageView = (SimpleDraweeView) view.findViewById(R.id.sdv_slidingmenu_profile_portrait_image);
    mNicknameTextView = (TextView) view.findViewById(R.id.tv_slidingmenu_profile_nickname);
    mCollectionView = view.findViewById(R.id.rl_slidingmenu_profile_collection_layout);
    mCommentView = view.findViewById(R.id.rl_slidingmenu_profile_comment_layout);
    mClearCacheView = view.findViewById(R.id.rl_slidingmenu_profile_clear_cache_layout);
    mChangModeView = view.findViewById(R.id.rl_slidingmenu_profile_change_mode_layout);
    mFeedbackView = view.findViewById(R.id.rl_slidingmenu_profile_feekback_layout);
    mCommendView = view.findViewById(R.id.rl_slidingmenu_profile_commend_layout);
    mAboutView = view.findViewById(R.id.rl_slidingmenu_profile_aboutme_layout);

    mPortraitView.setOnClickListener(this);
    mCollectionView.setOnClickListener(this);
    mCommentView.setOnClickListener(this);
    mClearCacheView.setOnClickListener(this);
    mChangModeView.setOnClickListener(this);
    mFeedbackView.setOnClickListener(this);
    mCommendView.setOnClickListener(this);
    mAboutView.setOnClickListener(this);

}
 
Example #23
Source File: ReadingAdapter.java    From Leisure with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);
    parentView = itemView;
    image = (SimpleDraweeView) itemView.findViewById(R.id.bookImg);
    title = (TextView) itemView.findViewById(R.id.bookTitle);
    info = (TextView) itemView.findViewById(R.id.bookInfo);
    collect_cb = (CheckBox) itemView.findViewById(R.id.collect_cb);
    ebook = (ImageView) itemView.findViewById(R.id.ebook);
    if(isCollection) {
        text = (TextView) parentView.findViewById(R.id.text);
    }
}
 
Example #24
Source File: FrescoImageloadHelper.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL, Context context, BaseBitmapDataSubscriber bbds
, BasePostprocessor postprocessor)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
            .setResizeOptions(new ResizeOptions(w,h))
            .setProgressiveRenderingEnabled(true);
    if(postprocessor!=null){
        builder.setPostprocessor(postprocessor);
    }
    ImageRequest imageRequest =
            builder
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
Example #25
Source File: UpActivity.java    From droidddle with Apache License 2.0 5 votes vote down vote up
@Override
public void setContentView(int layout) {
    super.setContentView(getBastLayout());
    NavigationView nv = (NavigationView) findViewById(R.id.navigation_view);
    View view = nv.inflateHeaderView(R.layout.drawer_header);
    mProfileCoverView = (ImageView) view.findViewById(R.id.profile_cover_image);
    mAvatarView = (SimpleDraweeView) view.findViewById(R.id.profile_image);
    mUserEmailView = (TextView) view.findViewById(R.id.profile_email_text);
    mUserNameView = (TextView) view.findViewById(R.id.profile_name_text);
    ViewGroup root = (ViewGroup) findViewById(R.id.main_content);
    getLayoutInflater().inflate(layout, root, true);
}
 
Example #26
Source File: ImageFrescoContentCell.java    From YcShareElement with Apache License 2.0 5 votes vote down vote up
@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 #27
Source File: ViewUtil.java    From RecyclerRenderers with Apache License 2.0 5 votes vote down vote up
public static void bind(final SimpleDraweeView view, String uri) {
  ImageRequest imageRequest =
      ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri))
          .build();
  DraweeController draweeController = Fresco.newDraweeControllerBuilder()
      .setImageRequest(imageRequest)
      .setOldController(view.getController())
      .setAutoPlayAnimations(true)
      .build();
  view.setController(draweeController);
}
 
Example #28
Source File: SimpleTreeAdapter.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public View getConvertView(final Node node, int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = null;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.atom_ui_tree_item, parent, false);
        viewHolder = new ViewHolder();
        viewHolder.icon = (SimpleDraweeView) convertView
                .findViewById(R.id.treenode_icon);
        viewHolder.label = (TextView) convertView
                .findViewById(R.id.treenode_label);
        convertView.setTag(viewHolder);

    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }

    if(node.isRoot())
    {
        viewHolder.icon.setVisibility(View.GONE);
        viewHolder.label.setText(node.getName());
    }
    else {
        ProfileUtils.loadNickName(node.getKey(),viewHolder.label,  true);
        viewHolder.icon.setVisibility(View.VISIBLE);
        ProfileUtils.displayGravatarByUserId(node.getKey(),viewHolder.icon);
    }

    return convertView;
}
 
Example #29
Source File: SearchChatingAdapter.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void convert(CommonViewHolder viewHolder, IMMessage item) {
    SimpleDraweeView gravatar = viewHolder.getView(R.id.conversation_gravatar);
    TextView nickName = viewHolder.getView(android.R.id.text1);
    EmojiconTextView message = viewHolder.getView(android.R.id.text2);
    ProfileUtils.loadNickName(item.getType() == ConversitionType.MSG_TYPE_CHAT?
            QtalkStringUtils.parseBareJid(item.getFromID()):item.getFromID(),nickName,false);
    message.setText(ChatTextHelper.showContentType(item.getBody(), item.getMsgType()));
    updateGravatar(gravatar,item.getFromID());
}
 
Example #30
Source File: MyImageUtil.java    From MyImageUtil with Apache License 2.0 5 votes vote down vote up
public static void show(View view, String url){
    FrescoUtil.measureView(view);
    int height = view.getMeasuredHeight();
    int width = view.getMeasuredWidth();

    //处理matchparent的情况:宽度设置为屏幕宽度减去两边的边距共30dp
    if (width < 5){//matchparent
        width = FrescoUtil.screenWidth;
    }

    if (view instanceof  SimpleDraweeView){
        FrescoUtil.loadUrl(url,(SimpleDraweeView)view,null,width,height,null);
    }
}