jp.wasabeef.glide.transformations.BlurTransformation Java Examples

The following examples show how to use jp.wasabeef.glide.transformations.BlurTransformation. 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 ToDoList with Apache License 2.0 6 votes vote down vote up
/**
 * Glide图片加载
 */
private void glideLoad(){

    RequestOptions options1 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(MainActivity.this,"head_signature","")))
            .placeholder(R.drawable.default_photo);

    RequestOptions options2 =new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(MainActivity.this,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(MainActivity.this, "path" ,""))
            .apply(options1)
            .into(user_image);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(MainActivity.this, "path" ,""))
            .apply(bitmapTransform(new BlurTransformation(25, 3)))
            .apply(options2)
            .into(nav_bg);
}
 
Example #2
Source File: GlideUtils.java    From Collection-Android with MIT License 6 votes vote down vote up
/**
 * Glide实现高斯模糊
 *
 * @param context
 * @param url
 * @param imageView
 */
public static void loadImgBlur(Context context, String url, int defaultLoadingImg,ImageView imageView) {
	try {
		RequestOptions options = new RequestOptions()
				.priority(Priority.HIGH)
				.placeholder(defaultLoadingImg)
				.error(defaultLoadingImg)
				.bitmapTransform(new BlurTransformation(40, 16));
		Glide.with(context)
				.load(url)
				.apply(options)
				.into(imageView);
	} catch (Exception exception) {
		return;
	}
}
 
Example #3
Source File: BookDetailActivity.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
private void showCoverImage(String image) {
    Glide.with(this).load(image)
            .apply(new RequestOptions().dontAnimate().centerCrop()
                    .placeholder(R.drawable.img_cover_default)
                    .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
                    .error(R.drawable.img_cover_default)).into(ivCover);

    Glide.with(this).load(image)
            .apply(new RequestOptions()
                    .dontAnimate()
                    .centerCrop()
                    .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
                    .placeholder(R.drawable.img_cover_gs)
                    .error(R.drawable.img_cover_gs))
            .apply(RequestOptions.bitmapTransform(new BlurTransformation(25, 3)))
            .into(ivBlurCover);
}
 
Example #4
Source File: AudioBookPlayActivity.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
private void setCoverImage(String image) {
    Glide.with(AudioBookPlayActivity.this).load(image)
            .apply(new RequestOptions().dontAnimate().centerCrop()
                    .centerCrop()
                    .error(R.drawable.img_cover_default)
                    .placeholder(R.drawable.img_cover_default))
            .into(ivCover);

    Glide.with(this).load(image)
            .apply(new RequestOptions()
                    .dontAnimate()
                    .centerCrop()
                    .placeholder(R.drawable.img_cover_gs)
                    .error(R.drawable.img_cover_gs))
            .apply(RequestOptions.bitmapTransform(new BlurTransformation(25, 3)))
            .into(ivBlurCover);
}
 
Example #5
Source File: MainActivity.java    From BeMusic with Apache License 2.0 6 votes vote down vote up
private void showSong(Song song) {
    if (song != null) {
        mMiniTitleTv.setText(song.getTitle());
        mMiniArtistAlbumTv.setText(song.getArtistAlbum());
        Album album = song.getAlbumObj();
        if (album == null) {
            album = PlayManager.getInstance(this).getAlbum(song.getAlbumId());
        }
        if (album != null) {
            Glide.with(this).load(album.getAlbumArt()).asBitmap().placeholder(R.mipmap.ic_launcher).animate(android.R.anim.fade_in).into(mMiniThumbIv);
            Glide.with(this).load(album.getAlbumArt()).asBitmap().animate(android.R.anim.fade_in).transform(new BlurTransformation(this))
                    .into(mHeaderCover);
        }
    } else {
        mMiniTitleTv.setText(R.string.app_name);
        mMiniArtistAlbumTv.setText(R.string.text_github_name);
        Glide.with(this).load(R.drawable.avatar).asBitmap().animate(android.R.anim.fade_in).into(mMiniThumbIv);
        Glide.with(this).load(R.drawable.avatar).asBitmap().animate(android.R.anim.fade_in).transform(new BlurTransformation(this))
                .into(mHeaderCover);
    }

}
 
Example #6
Source File: MovieDetailsPresenter.java    From qvod with MIT License 6 votes vote down vote up
private void initView() {
    ImageLoader.load(positionData.getImages().getLarge(), getView().ivMoviePic, 200);
    getView().getToolbar().setTitle(positionData.getTitle());
    //高斯模糊
    Glide.with(getView())
            .load(positionData.getImages().getLarge())
            .error(R.drawable.stackblur_default)
            .bitmapTransform(new BlurTransformation(getView(), 23, 4))
            .into(getView().ivToolbarBg);
    //高斯模糊
    Glide.with(getView())
            .load(positionData.getImages().getLarge())
            .error(R.drawable.stackblur_default)
            .bitmapTransform(new BlurTransformation(getView(), 23, 4))
            .into(getView().ivDimBg);
    //
    getView().tvDetailsTitle.setText("评分:" + positionData.getRating().getAverage() + "分(" + positionData.getCollect_count() + "人评分)");
    getView().tvDetailsDirect.setText("导演:" + StringFormatUtil.formatName(positionData.getDirectors()));
    getView().tvDetailsActor.setText("演员:" + StringFormatUtil.formatName(positionData.getCasts(), true));
    getView().tvDetailsType.setText("类型:" + StringFormatUtil.formatGenres(positionData.getGenres()));
    getView().tvDetailsDate.setText("上映日期:" + positionData.getYear());
}
 
Example #7
Source File: DisplayUtils.java    From YiZhi with Apache License 2.0 5 votes vote down vote up
/**
 * 显示网络虚化图片
 *
 * @param context   context
 * @param imgUrl    图片url
 * @param imageView 要显示的imageview
 */
public static void displayBlurImg(Context context, final String imgUrl, ImageView imageView) {
    // "23":模糊度;"4":图片缩放4倍后再进行模糊
    Glide.with(context)
            .load(imgUrl)
            .error(R.drawable.stackblur_default)
            .placeholder(R.drawable.stackblur_default)
            .crossFade(300)
            .bitmapTransform(new BlurTransformation(context, 23, 4))
            .into(imageView);
}
 
Example #8
Source File: ImageLoader.java    From Retrofit2SampleApp with MIT License 5 votes vote down vote up
@Override
public void loadImage(String url, final ImageView imageView) {
    Glide.with(imageView.getContext()).load(url).transform(new BitmapTransformation(imageView.getContext()) {
        @Override
        protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
            BlurTransformation blurTransformation = new BlurTransformation(imageView.getContext());
            Resource<Bitmap> blurredBitmapResource = blurTransformation.transform(BitmapResource.obtain(toTransform, pool), 10, 1);

            Bitmap combinedBitmap;
            Bitmap bottom = blurredBitmapResource.get();

            if ((combinedBitmap = pool.get(toTransform.getWidth(), bottom.getHeight() / 3 + toTransform.getHeight(), Bitmap.Config.ARGB_8888)) == null) {
                combinedBitmap = Bitmap.createBitmap(toTransform.getWidth(), bottom.getHeight() / 3 + toTransform.getHeight(), toTransform.getConfig());
            }

            Canvas comboImage = new Canvas(combinedBitmap);
            comboImage.drawBitmap(toTransform, 0f, 0f, null);

            Matrix matrix = new Matrix();
            matrix.postRotate(180);
            matrix.preScale(-1 , 1);
            matrix.postTranslate(0, toTransform.getHeight() * 2);

            comboImage.setMatrix(matrix);
            comboImage.drawBitmap(bottom, 0f, 0f, null);

            return BitmapResource.obtain(combinedBitmap, pool).get();
        }

        @Override
        public String getId() {
            return ImageLoader.class.getName() + ".Transformation";
        }
    }).into(imageView);
}
 
Example #9
Source File: GlideUtil.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
/**
 * 显示高斯模糊效果(电影详情页)
 */
private static void displayGaussian(Context context, String url, ImageView imageView) {
    // "23":模糊度;"4":图片缩放4倍后再进行模糊
    Glide.with(context)
            .load(url)
            .transition(DrawableTransitionOptions.withCrossFade())
            .error(R.drawable.stackblur_default)
            .placeholder(R.drawable.stackblur_default)
            .transition(DrawableTransitionOptions.withCrossFade(500))
            .transform(new BlurTransformation(50, 8))
            .into(imageView);
}
 
Example #10
Source File: UserInfoActivity.java    From Elephant with Apache License 2.0 5 votes vote down vote up
private void initUserInfo(UserEntity userEntity) {
    Glide.with(this).load(userEntity.getAvatar())
            .bitmapTransform(new BlurTransformation(this, 5))
            .into(mUserImgBg);
    mCollapsingToolbar.setTitle(userEntity.getName());
    mPageTitleTv.setText(userEntity.getName());
    mUserNameTv.setText(userEntity.getName());
    mUserAvatarCiv.setImageURI(Uri.parse(userEntity.getAvatar()));
    mUserShareTv.setText(String.valueOf(userEntity.getTopic_count()));
    mUserReplyTv.setText(String.valueOf(userEntity.getReply_count()));
    mSignatureTv.setText(userEntity.getIntroduction());

    if (!TextUtils.isEmpty(userEntity.getCity())) {
        mUserAddressTv.setText(userEntity.getCity());
        mUserAddressTv.setVisibility(View.VISIBLE);
    }

    if (getUserConstant().isLogin()) {
        if (userEntity.getId() == getUserConstant().getUserData().getData().getId()) {
            mSettingTv.setVisibility(View.VISIBLE);
        }
    }

    if (!TextUtils.isEmpty(mUserEntity.getGithub_url())) {
        mToolBar.getMenu().findItem(R.id.action_github).setVisible(true);
    }

    if (!TextUtils.isEmpty(mUserEntity.getEmail())) {
        mToolBar.getMenu().findItem(R.id.action_email).setVisible(true);
    }

    if (!TextUtils.isEmpty(mUserEntity.getPersonal_website())) {
        mToolBar.getMenu().findItem(R.id.action_blog).setVisible(true);
    }
}
 
Example #11
Source File: TinderCard.java    From Tutorials with Apache License 2.0 5 votes vote down vote up
@Resolve
private void onResolved(){
    MultiTransformation multi = new MultiTransformation(
            new BlurTransformation(mContext, 30),
            new RoundedCornersTransformation(
                    mContext, Utils.dpToPx(7), 0,
                    RoundedCornersTransformation.CornerType.TOP));

    Glide.with(mContext).load(mProfile.getImageUrl())
            .bitmapTransform(multi)
            .into(profileImageView);
    nameAgeTxt.setText(mProfile.getName() + ", " + mProfile.getAge());
    locationNameTxt.setText(mProfile.getLocation());
}
 
Example #12
Source File: MainActivity.java    From CardSlideView with Apache License 2.0 5 votes vote down vote up
@Override
public void onPageSelected(int position) {
    MyBean data = list.get(position);
    Log.e("MainActivity", "onPageSelected" + "position:" + position);
    Glide.with(MainActivity.this)
            .load(data.getImg())
            .apply(new RequestOptions()
                    .transform(new BlurTransformation(5)))
            .into(new SimpleTarget<Drawable>() {
                @Override
                public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
                    mainBG.setImageDrawable(resource);
                }
            });
}
 
Example #13
Source File: DisplayUtils.java    From YiZhi with Apache License 2.0 5 votes vote down vote up
/**
 * 显示资源虚化图片
 *
 * @param context    context
 * @param resourceId 图片资源id
 * @param imageView  要显示的imageview
 */
public static void displayBlurImg(Context context, Integer resourceId, ImageView imageView) {
    // "23":模糊度;"4":图片缩放4倍后再进行模糊
    Glide.with(context)
            .load(resourceId)
            .error(R.drawable.stackblur_default)
            .placeholder(R.drawable.stackblur_default)
            .crossFade(300)
            .bitmapTransform(new BlurTransformation(context, 23, 4))
            .into(imageView);
}
 
Example #14
Source File: DisplayUtils.java    From YiZhi with Apache License 2.0 5 votes vote down vote up
/**
 * 显示本地虚化图片
 *
 * @param context   context
 * @param file      本地图片file
 * @param imageView 要显示的imageview
 */
public static void displayBlurImg(Context context, File file, ImageView imageView) {
    // "23":模糊度;"4":图片缩放4倍后再进行模糊
    Glide.with(context)
            .load(file)
            .error(R.drawable.stackblur_default)
            .placeholder(R.drawable.stackblur_default)
            .crossFade(300)
            .bitmapTransform(new BlurTransformation(context, 23, 4))
            .into(imageView);
}
 
Example #15
Source File: PlayBgDrawableController.java    From Musicoco with Apache License 2.0 5 votes vote down vote up
private void updateBackgroundDrawable(PlayBackgroundModeEnum bgMode, SongInfo info) {

        String path = null;
        if (info != null) {
            path = info.getAlbum_path();

        }
        ImageView view = (ImageView) isBg.getCurrentView();
        switch (bgMode) {
            case PICTUREWITHMASK: {
                final VignetteFilterTransformation vtf = new VignetteFilterTransformation(
                        activity,
                        new PointF(0.5f, 0.4f),
                        new float[]{0.0f, 0.0f, 0.0f},
                        0.1f,
                        0.75f
                );

                Glide.with(activity)
                        .load(StringUtils.isReal(path) ? path : R.drawable.default_album)
                        .diskCacheStrategy(DiskCacheStrategy.RESULT)
                        .bitmapTransform(vtf)
                        .crossFade()
                        .into(view);
                break;
            }
            case PICTUREWITHBLUR:
            default: {
                final BlurTransformation btf = new BlurTransformation(activity, 10, 10);
                Glide.with(activity)
                        .load(StringUtils.isReal(path) ? path : R.drawable.default_album)
                        .diskCacheStrategy(DiskCacheStrategy.RESULT)
                        .bitmapTransform(btf)
                        .crossFade()
                        .into(view);
                break;
            }
        }
    }
 
Example #16
Source File: GlideUtils.java    From Collection-Android with MIT License 5 votes vote down vote up
public static void loadImgBlur(Context context, String url, int defaultLoadingImg,ImageView imageView,int blurRadius,int blurSampling) {
	try {
		RequestOptions options = new RequestOptions()
				.priority(Priority.HIGH)
				.placeholder(defaultLoadingImg)
				.error(defaultLoadingImg)
				.bitmapTransform(new BlurTransformation(blurRadius, blurSampling));
		Glide.with(context)
				.load(url)
				.apply(options)
				.into(imageView);
	} catch (Exception exception) {
		return;
	}
}
 
Example #17
Source File: UserDataActivity.java    From ToDoList with Apache License 2.0 5 votes vote down vote up
/**
 * Glide图片加载
 */
private void glideLoad(){

    RequestOptions options_1 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(UserDataActivity.this,"head_signature","")))
            .placeholder(R.drawable.default_photo);

    RequestOptions options_2 = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .signature(new ObjectKey(SPUtils.get(UserDataActivity.this,"head_signature","")))
            .placeholder(R.drawable.ic_img1);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(options_1)
            .into(toolbar_userhead);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(options_1)
            .into(user_head);

    Glide.with(getApplicationContext())
            .load(SPUtils.get(UserDataActivity.this, "path" ,""))
            .apply(bitmapTransform(new BlurTransformation(25, 3)))
            .apply(options_2)
            .into(top_bg);
}
 
Example #18
Source File: FragmentSingleIllust.java    From Pixiv-Shaft with MIT License 4 votes vote down vote up
private void loadImage() {
    int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
    switch (currentNightMode) {
        case Configuration.UI_MODE_NIGHT_NO:
        case Configuration.UI_MODE_NIGHT_UNDEFINED:
            Glide.with(mContext)
                    .load(GlideUtil.getSquare(illust))
                    .apply(bitmapTransform(new BlurTransformation(25, 3)))
                    .transition(withCrossFade())
                    .into(baseBind.bgImage);
            break;
        case Configuration.UI_MODE_NIGHT_YES:
            baseBind.bgImage.setImageResource(R.color.black);
            break;
    }


    mDetailAdapter = new IllustDetailAdapter(illust, mActivity);
    mDetailAdapter.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(View v, int position, int viewType) {
            if (viewType == 0) {
                Intent intent = new Intent(mContext, ImageDetailActivity.class);
                intent.putExtra("illust", illust);
                intent.putExtra("dataType", "二级详情");
                intent.putExtra("index", position);
                if (Shaft.sSettings.isFirstImageSize()) {
                    mActivity.startActivity(intent);
                } else {
                    if (mDetailAdapter.getHasLoad().get(position)) {
                        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(mActivity,
                                v, "big_image_" + position).toBundle();
                        startActivity(intent, bundle);
                    } else {
                        mActivity.startActivity(intent);
                    }
                }
            } else if (viewType == 1) {

            }
        }
    });
    baseBind.recyclerView.setAdapter(mDetailAdapter);
}
 
Example #19
Source File: Glide4Loader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
private Transformation[] getBitmapTransFormations(SingleConfig config) {

        Transformation[] forms = null;
        int shapeMode = config.getShapeMode();
        List<Transformation> transformations = new ArrayList<>();

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

        if(config.getScaleMode() == ScaleMode.CENTER_CROP){
            transformations.add(new CenterCrop());
        }else{
            transformations.add(new FitCenter());
        }


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

        switch (shapeMode){
            case ShapeMode.RECT:

                if(config.getBorderWidth()>0){

                }
                break;
            case ShapeMode.RECT_ROUND:
            case ShapeMode.RECT_ROUND_ONLY_TOP:

                RoundedCornersTransformation.CornerType cornerType = RoundedCornersTransformation.CornerType.ALL;
                if(shapeMode == ShapeMode.RECT_ROUND_ONLY_TOP){
                    cornerType = RoundedCornersTransformation.CornerType.TOP;
                }
                /*transformations.add(new BorderRoundTransformation2(config.getContext(),
                        config.getRectRoundRadius(), 0,config.getBorderWidth(),
                        config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));*/

                /*if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add(new BorderRoundTransformation(config.getContext(),
                            config.getRectRoundRadius(), 0,config.getBorderWidth(),
                            config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));
                }else {*/
                    transformations.add(new RoundedCornersTransformation(
                            config.getRectRoundRadius(),config.getBorderWidth(), cornerType));
               // }

                break;
            case ShapeMode.OVAL:
                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add( new CropCircleWithBorderTransformation(
                            config.getBorderWidth(),config.getContext().getResources().getColor(config.getBorderColor())));
                }else {
                    transformations.add( new CropCircleTransformation());
                }


                break;
            default:break;
        }

        if(!transformations.isEmpty()){
             forms = new Transformation[transformations.size()];
            for (int i = 0; i < transformations.size(); i++) {
                forms[i] = transformations.get(i);
            }
           return forms;
        }
        return forms;

    }
 
Example #20
Source File: BangumiDetailsActivity.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
@SuppressLint("SetTextI18n")
@Override
public void finishTask()
{

    //设置番剧封面
    Glide.with(this)
            .load(result.getCover())
            .centerCrop()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .placeholder(R.drawable.bili_default_image_tv)
            .dontAnimate()
            .into(mBangumiPic);

    //设置背景高斯模糊图片
    Glide.with(this)
            .load(result.getCover())
            .bitmapTransform(new BlurTransformation(this))
            .into(mBangumiBackgroundImage);

    //设置番剧标题
    mBangumiTitle.setText(result.getTitle());
    //设置番剧更新状态
    if (result.getIs_finish().equals("0"))
    {
        mUpdateIndex.setText("更新至第" + result.getNewest_ep_index() + "话");
        mBangumiUpdate.setText("连载中");
    } else
    {
        mUpdateIndex.setText(result.getNewest_ep_index() + "话全");
        mBangumiUpdate.setText("已完结" + result.getNewest_ep_index() + "话全");
    }

    //设置番剧播放和追番数量
    mBangumiPlay.setText("播放:" + NumberUtil.converString(Integer.valueOf(result.getPlay_count()))
            + "  " + "追番:" + NumberUtil.converString(Integer.valueOf(result.getFavorites())));
    //设置番剧简介
    mBangumiIntroduction.setText(result.getEvaluate());
    //设置评论数量
    mBangumiCommentCount.setText("评论 第1话(" + mPageInfo.getAcount() + ")");
    //设置标签布局
    List<BangumiDetailsInfo.ResultBean.TagsBean> tags = result.getTags();
    mTagsLayout.setAdapter(new TagAdapter<BangumiDetailsInfo.ResultBean.TagsBean>(tags)
    {

        @Override
        public View getView(FlowLayout parent, int position, BangumiDetailsInfo.ResultBean.TagsBean tagsBean)
        {


            TextView mTags = (TextView) LayoutInflater.from(BangumiDetailsActivity.this)
                    .inflate(R.layout.layout_tags_item, parent, false);
            mTags.setText(tagsBean.getTag_name());

            return mTags;
        }
    });

    //设置番剧分季版本
    initSeasonsRecycler();
    //设置番剧选集
    initSelectionRecycler();
    //设置番剧推荐
    initRecommendRecycler();
    //设置番剧评论
    initCommentRecycler();
    //加载完毕隐藏进度条
    hideProgressBar();
}
 
Example #21
Source File: GlideLoader.java    From ImageLoader with Apache License 2.0 4 votes vote down vote up
private Transformation[] getBitmapTransFormations(SingleConfig config) {

        Transformation[] forms = null;
        int shapeMode = config.getShapeMode();
        List<Transformation> transformations = new ArrayList<>();

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

        if(config.getScaleMode() == ScaleMode.CENTER_CROP){
            transformations.add(new CenterCrop(config.getContext()));
        }else{
            transformations.add(new FitCenter(config.getContext()));
        }


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

        switch (shapeMode){
            case ShapeMode.RECT:

                if(config.getBorderWidth()>0){

                }
                break;
            case ShapeMode.RECT_ROUND:
            case ShapeMode.RECT_ROUND_ONLY_TOP:

                RoundedCornersTransformation.CornerType cornerType = RoundedCornersTransformation.CornerType.ALL;
                if(shapeMode == ShapeMode.RECT_ROUND_ONLY_TOP){
                    cornerType = RoundedCornersTransformation.CornerType.TOP;
                }
                /*transformations.add(new BorderRoundTransformation2(config.getContext(),
                        config.getRectRoundRadius(), 0,config.getBorderWidth(),
                        config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));*/

                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add(new BorderRoundTransformation(config.getContext(),
                            config.getRectRoundRadius(), 0,config.getBorderWidth(),
                            config.getContext().getResources().getColor(config.getBorderColor()),0x0b1100));
                }else {
                    transformations.add(new RoundedCornersTransformation(config.getContext(),
                            config.getRectRoundRadius(),config.getBorderWidth(), cornerType));
                }

                break;
            case ShapeMode.OVAL:
                if(config.getBorderWidth() > 0 && config.getBorderColor() != 0){
                    transformations.add( new CropCircleWithBorderTransformation(config.getContext(),
                            config.getBorderWidth(),config.getContext().getResources().getColor(config.getBorderColor())));
                }else {
                    transformations.add( new CropCircleTransformation(config.getContext()));
                }


                break;
            default:break;
        }

        if(!transformations.isEmpty()){
             forms = new Transformation[transformations.size()];
            for (int i = 0; i < transformations.size(); i++) {
                forms[i] = transformations.get(i);
            }
           return forms;
        }
        return forms;

    }
 
Example #22
Source File: BangumiDetailsActivity.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
@SuppressLint("SetTextI18n")
@Override
public void finishTask()
{

    //设置番剧封面
    Glide.with(this)
            .load(result.getCover())
            .centerCrop()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .placeholder(R.drawable.bili_default_image_tv)
            .dontAnimate()
            .into(mBangumiPic);

    //设置背景高斯模糊图片
    Glide.with(this)
            .load(result.getCover())
            .bitmapTransform(new BlurTransformation(this))
            .into(mBangumiBackgroundImage);

    //设置番剧标题
    mBangumiTitle.setText(result.getTitle());
    //设置番剧更新状态
    if (result.getIs_finish().equals("0"))
    {
        mUpdateIndex.setText("更新至第" + result.getNewest_ep_index() + "话");
        mBangumiUpdate.setText("连载中");
    } else
    {
        mUpdateIndex.setText(result.getNewest_ep_index() + "话全");
        mBangumiUpdate.setText("已完结" + result.getNewest_ep_index() + "话全");
    }

    //设置番剧播放和追番数量
    mBangumiPlay.setText("播放:" + NumberUtil.converString(Integer.valueOf(result.getPlay_count()))
            + "  " + "追番:" + NumberUtil.converString(Integer.valueOf(result.getFavorites())));
    //设置番剧简介
    mBangumiIntroduction.setText(result.getEvaluate());
    //设置评论数量
    mBangumiCommentCount.setText("评论 第1话(" + mPageInfo.getAcount() + ")");
    //设置标签布局
    List<BangumiDetailsInfo.ResultBean.TagsBean> tags = result.getTags();
    mTagsLayout.setAdapter(new TagAdapter<BangumiDetailsInfo.ResultBean.TagsBean>(tags)
    {

        @Override
        public View getView(FlowLayout parent, int position, BangumiDetailsInfo.ResultBean.TagsBean tagsBean)
        {


            TextView mTags = (TextView) LayoutInflater.from(BangumiDetailsActivity.this)
                    .inflate(R.layout.layout_tags_item, parent, false);
            mTags.setText(tagsBean.getTag_name());

            return mTags;
        }
    });

    //设置番剧分季版本
    initSeasonsRecycler();
    //设置番剧选集
    initSelectionRecycler();
    //设置番剧推荐
    initRecommendRecycler();
    //设置番剧评论
    initCommentRecycler();
    //加载完毕隐藏进度条
    hideProgressBar();
}
 
Example #23
Source File: RepositoryAdapter.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
Transformation<Bitmap> getTransform(int position, Context mContext) {
    if (position % 19 == 0) {
        return new CropCircleTransformation(mContext);
    } else if (position % 19 == 1) {
        return new RoundedCornersTransformation(mContext, 30, 0,
                RoundedCornersTransformation.CornerType.BOTTOM);

    } else if (position % 19 == 2) {
        return new CropTransformation(mContext, 300, 100, CropTransformation.CropType.BOTTOM);

    } else if (position % 19 == 3) {
        return new CropSquareTransformation(mContext);

    } else if (position % 19 == 4) {
        return new CropTransformation(mContext, 300, 100, CropTransformation.CropType.CENTER);

    } else if (position % 19 == 5) {
        return new ColorFilterTransformation(mContext, Color.argb(80, 255, 0, 0));

    } else if (position % 19 == 6) {
        return new GrayscaleTransformation(mContext);

    } else if (position % 19 == 7) {
        return new CropTransformation(mContext, 300, 100);

    } else if (position % 19 == 8) {
        return new BlurTransformation(mContext, 25);
    } else if (position % 19 == 9) {
        return new ToonFilterTransformation(mContext);

    } else if (position % 19 == 10) {
        return new SepiaFilterTransformation(mContext);

    } else if (position % 19 == 11) {
        return new ContrastFilterTransformation(mContext, 2.0f);
    } else if (position % 19 == 12) {
        return new InvertFilterTransformation(mContext);
    } else if (position % 19 == 13) {
        return new PixelationFilterTransformation(mContext, 20);
    } else if (position % 19 == 14) {
        return new SketchFilterTransformation(mContext);
    } else if (position % 19 == 15) {
        return new SwirlFilterTransformation(mContext, 0.5f, 1.0f, new PointF(0.5f, 0.5f));
    } else if (position % 19 == 16) {
        return new BrightnessFilterTransformation(mContext, 0.5f);
    } else if (position % 19 == 17) {
        return new KuwaharaFilterTransformation(mContext, 25);
    } else if (position % 19 == 18) {
        return new VignetteFilterTransformation(mContext, new PointF(0.5f, 0.5f),
                new float[]{0.0f, 0.0f, 0.0f}, 0f, 0.75f);
    }
    return null;
}