jp.wasabeef.blurry.Blurry Java Examples

The following examples show how to use jp.wasabeef.blurry.Blurry. 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: ProfileActivity.java    From mvvm-template with GNU General Public License v3.0 6 votes vote down vote up
public void onUserUpdated(@Nullable UserDetail user) {
    if (user != null) {

        if (binding.viewPager.getAdapter() == null) {
            new Handler(Looper.myLooper()).postDelayed(this::initPager, 300);
        }

        binding.tvName.setText(user.getDisplayName());
        binding.tvLink.setText(user.getHtmlUrl());

        if (InputHelper.isEmpty(user.getBio())) {
            binding.tvBio.setVisibility(View.GONE);
        } else {
            binding.tvBio.setVisibility(View.VISIBLE);
            binding.tvBio.setText(user.getBio());
        }
        GlideUtils.loadImageBitmap(this, user.getAvatarUrl(), bitmap -> {
            binding.imvAvatar.setImageBitmap(bitmap);
            Blurry.with(this).radius(25).from(bitmap).into(binding.imvBackground);
        });
    }
}
 
Example #2
Source File: TrackFragment.java    From Melophile with Apache License 2.0 6 votes vote down vote up
public void showArt(String artUrl) {
  if (!TextUtils.equals(lastArtUrl, artUrl)) {
    lastArtUrl = artUrl;
    Glide.with(getContext())
            .load(artUrl)
            .asBitmap()
            .priority(Priority.IMMEDIATE)
            .into(new ImageViewTarget<Bitmap>(smallImage) {
              @Override
              protected void setResource(Bitmap resource) {
                smallImage.setImageBitmap(resource);
                smallImage.post(() -> {
                  Blurry.with(getContext())
                          .async(bitmap -> {
                            background.setImageDrawable(bitmap);
                            getActivity().supportStartPostponedEnterTransition();
                          })
                          .from(resource)
                          .into(background);
                });
              }
            });
  }
}
 
Example #3
Source File: BlurryOverlayView.java    From react-native-android-blurryoverlay with MIT License 6 votes vote down vote up
private void Render(Activity activity) {

        // Defaults
        if(this.radius == 0)
            setRadius(defaultRadius);
        if(this.sampling == 0)
            setSampling(defaultSampling);

        Log.i(LOGTAG, String.format("activity %s", activity));

        final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);

        Log.i(LOGTAG, String.format("viewGroup %s", viewGroup));
        Log.i(LOGTAG, String.format("this %s", this));

        Blurry.Composer c = Blurry.with(activity)
                .radius(this.radius)
                .sampling(this.sampling);

        if(this.color != null)
                c = c.color(Color.parseColor(this.color));

        //c.async()
        c.capture(viewGroup)
        .into(this);
    }
 
Example #4
Source File: ImageBindingAdapter.java    From WanAndroid with GNU General Public License v3.0 5 votes vote down vote up
@BindingAdapter("blurImage")
public static void setBlurImage(ImageView imageView, String url) {
    Glide.with(imageView.getContext())
            .applyDefaultRequestOptions(PicConfig.itemOptions)
            .asBitmap()
            .load(url)
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                    Blurry.with(imageView.getContext()).from(resource).into(imageView);
                }
            });

}
 
Example #5
Source File: MainActivity.java    From MyBlogDemo with Apache License 2.0 5 votes vote down vote up
@Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_slide:
//                Blurry.with(this)
//                        .color(Color.argb(66, 255, 255, 0))
//                        .radius(25)
//                        .sampling(2)
//                        .async()
//                        .onto((ViewGroup) getWindow().getDecorView());
//                BaseUtil.startActivityOnspecifiedAnimation(this, SlidToFinishActivity.class);
                photoUtils.takePhoto(2222);

                break;
            case R.id.tv_browser:
                Blurry.delete((ViewGroup) getWindow().getDecorView());
                BaseUtil.startActivityOnspecifiedAnimation(this, ScrollingActivity.class);
//                BaseUtil.startActivityOnspecifiedAnimation(this, BrowserActivity.class);
                break;
            case R.id.tv_browser2:
                BaseUtil.startActivityOnspecifiedAnimation(this, ScrollingActivity.class);
                break;
            case R.id.scrollView:

                BaseUtil.startActivityOnspecifiedAnimation(this, FangshiActivity.class);
                break;
            case R.id.bottom_sheet:

//                BaseUtil.startActivityOnspecifiedAnimation(this, BottomSheetActivity.class);
                JumpUtil.jumpToBottome(this);
                break;
            case R.id.button:
                buttonOutAnimation(interpolator);
                break;
        }
    }
 
Example #6
Source File: PeekView.java    From Android-3DTouch-PeekView with MIT License 4 votes vote down vote up
private void init(Activity context, PeekViewOptions options, @NonNull View content, @Nullable OnPeek callbacks) {
    this.options = options;
    this.callbacks = callbacks;

    FINGER_SIZE = DensityUtils.toPx(context, FINGER_SIZE_DP);

    // get the main content view of the display
    androidContentView = (FrameLayout) context.findViewById(android.R.id.content).getRootView();

    // initialize the display size
    Display display = context.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    screenHeight = size.y;
    screenWidth = size.x;

    // set up the content we want to show
    this.content = content;
    contentParams = content.getLayoutParams();

    if (options.getAbsoluteHeight() != 0) {
        setHeight(DensityUtils.toPx(context, options.getAbsoluteHeight()));
    } else {
        setHeightByPercent(options.getHeightPercent());
    }

    if (options.getAbsoluteWidth() != 0) {
        setWidth(DensityUtils.toPx(context, options.getAbsoluteWidth()));
    } else {
        setWidthByPercent(options.getWidthPercent());
    }

    // tell the code that the view has been onInflated and let them use it to
    // set up the layout.
    if (callbacks != null) {
        callbacks.onInflated(content);
    }

    // add the background dim to the frame
    dim = new View(context);
    dim.setBackgroundColor(Color.BLACK);
    dim.setAlpha(options.getBackgroundDim());

    FrameLayout.LayoutParams dimParams =
            new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    dim.setLayoutParams(dimParams);

    if (options.shouldBlurBackground()) {
        Blurry.with(context)
                .radius(2)
                .sampling(5)
                .animate()
                .color(options.getBlurOverlayColor())
                .onto((ViewGroup) androidContentView.getRootView());

        dim.setAlpha(0f);
    }

    // add the dim and the content view to the upper level frame layout
    addView(dim);
    addView(content);
}
 
Example #7
Source File: PeekView.java    From Slide with GNU General Public License v3.0 4 votes vote down vote up
private void init(Activity context, PeekViewOptions options, @NonNull View content,
        @Nullable OnPeek callbacks) {
    this.options = options;
    this.callbacks = callbacks;

    FINGER_SIZE = DensityUtils.toPx(context, FINGER_SIZE_DP);

    // get the main content view of the display
    androidContentView = (FrameLayout) context.findViewById(android.R.id.content).getRootView();

    // initialize the display size
    Display display = context.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    screenHeight = size.y;
    screenWidth = size.x;

    // set up the content we want to show
    this.content = content;
    contentParams = content.getLayoutParams();

    if (options.getAbsoluteHeight() != 0) {
        setHeight(DensityUtils.toPx(context, options.getAbsoluteHeight()));
    } else {
        setHeightByPercent(options.getHeightPercent());
    }

    if (options.getAbsoluteWidth() != 0) {
        setWidth(DensityUtils.toPx(context, options.getAbsoluteWidth()));
    } else {
        setWidthByPercent(options.getWidthPercent());
    }

    // tell the code that the view has been onInflated and let them use it to
    // set up the layout.
    if (callbacks != null) {
        callbacks.onInflated(this, content);
    }

    // add the background dim to the frame
    dim = new View(context);
    dim.setBackgroundColor(Color.BLACK);
    dim.setAlpha(options.getBackgroundDim());

    LayoutParams dimParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    dim.setLayoutParams(dimParams);

    if (options.shouldBlurBackground()) {
        try {
            Blurry.with(context)
                    .radius(2)
                    .sampling(5)
                    .animate()
                    .color(options.getBlurOverlayColor())
                    .onto((ViewGroup) androidContentView.getRootView());

            dim.setAlpha(0f);
        } catch(Exception ignored){

        }
    }

    // add the dim and the content view to the upper level frame layout
    addView(dim);
    addView(content);
}