jp.wasabeef.picasso.transformations.CropCircleTransformation Java Examples

The following examples show how to use jp.wasabeef.picasso.transformations.CropCircleTransformation. 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: FeedAdapter.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull FeedItemViewHolder holder, int position) {
    holder.nameView.setText(mTweets.get(position).getName());
    holder.screenNameView.setText(mContext.getString(R.string.scree_name, mTweets.get(position).getScreenName()));
    holder.tweetTimeView.setText(mTweets.get(position).getTweetTime());
    holder.textView.setText(mTweets.get(position).getTweetText());
    holder.retweetView.setText(mTweets.get(position).getRetweets());
    holder.favView.setText(mTweets.get(position).getFavorites());

    Picasso.get()
            .load(mTweets.get(position).getProfileImageUrl())
            .transform(new CropCircleTransformation())
            .into(holder.mProfileImage);
    Picasso.get()
            .load(mTweets.get(position).getProfileBackgroundImageUrl())
            .resize(800,460)
            .centerCrop()
            .transform(new RoundedCornersTransformation(10, 0))
            .into(holder.mProfileBackgroundImage);
}
 
Example #2
Source File: MainActivity.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mTabTitle = findViewById(R.id.tab_title);

    //Setup viewpager and FeedFragmentAdapter
    ViewPager viewPager = findViewById(R.id.vp);
    FeedFragmentAdapter fragmentAdapter = new FeedFragmentAdapter(getSupportFragmentManager());
    viewPager.setAdapter(fragmentAdapter);

    TabLayout tabLayout = findViewById(R.id.main_tab_layout);
    tabLayout.setupWithViewPager(viewPager);


    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));

    tabLayout.getTabAt(0).setIcon(tabSelectedIcon[0]);
    for (int i = 1; i < 4; i++) {
        tabLayout.getTabAt(i).setIcon(tabUnselectedIcon[i]);
    }

    tabLayout.addOnTabSelectedListener(this);

    mDrawerLayout = findViewById(R.id.drawer_layout);

    ImageView profileImage = findViewById(R.id.user_profile_image);
    Picasso.get()
            .load(R.drawable.twitter_profile_image)
            .transform(new CropCircleTransformation())
            .into(profileImage);
}
 
Example #3
Source File: PicassoLoader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
private void setShapeModeAndBlur(SingleConfig config, RequestCreator request) {
    int shapeMode = config.getShapeMode();
    List<Transformation> transformations = new ArrayList<>();

    if(config.isCropFace()){
         //transformations.add(new FaceCenterCrop(config.getWidth(), config.getHeight()));//脸部识别
    }

    if(config.isNeedBlur()){
        transformations.add(new BlurTransformation(GlobalConfig.context,config.getBlurRadius()));
    }


    switch (shapeMode){
        case ShapeMode.RECT:

            if(config.getBorderWidth()>0){

            }
            break;
        case ShapeMode.RECT_ROUND:
            transformations.add(new RoundedCornersTransformation( config.getRectRoundRadius(), 0, RoundedCornersTransformation.CornerType.ALL));

            if(config.getBorderWidth()>0){

            }
            if(config.isGif() && config.getRoundOverlayColor()>0){

            }
            break;
        case ShapeMode.OVAL:
            transformations.add(new CropCircleTransformation());
            if(config.getBorderWidth()>0){

            }
            if(config.isGif() && config.getRoundOverlayColor()>0){

            }
            break;
    }
    if(transformations.size()>0){
        request.transform(transformations);
    }


}
 
Example #4
Source File: UserImage.java    From intra42 with Apache License 2.0 4 votes vote down vote up
public static RequestCreator getPicassoRounded(RequestCreator request) {
    final Transformation transformation = new CropCircleTransformation();
    request.transform(transformation);
    return request;
}