本文整理汇总了Java中jp.wasabeef.blurry.Blurry类的典型用法代码示例。如果您正苦于以下问题:Java Blurry类的具体用法?Java Blurry怎么用?Java Blurry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Blurry类属于jp.wasabeef.blurry包,在下文中一共展示了Blurry类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshProfilPicBlurred
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
private void refreshProfilPicBlurred() {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Blurry.with(MainActivity.this).radius(25).sampling(2).capture(profilPic).into(profilPicBlurred);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}, 10);
}
示例2: onUserUpdated
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
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);
});
}
}
示例3: tryBlur
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
private void tryBlur(int sampling, int radius){
int newSampling = sampling;
if(newSampling < 2) {
newSampling = 2;
}
Blurry.with(getActivity())
.radius(10)
.sampling(newSampling)
.async(new Blurry.ImageComposer.ImageComposerListener() {
@Override
public void onImageReady(BitmapDrawable drawable) {
if(lastAlpha == 1f){
ivDetailHeader.setImageBitmap(srcHeaderBg);
} else {
ivDetailHeader.setImageDrawable(drawable);
}
}
})
.from(srcHeaderBg)
.into(ivDetailHeader)
;
}
示例4: showArt
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
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);
});
}
});
}
}
示例5: Render
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
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);
}
示例6: setBackgroundImage
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
private void setBackgroundImage(Context context, Bitmap image) {
Blurry.with(context)
.radius(15)
.from(image)
.into(backgroundImage);
enableParallaxIfPossible(context, image.getWidth());
}
示例7: onClick
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
@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;
}
}
示例8: onFragmentInteraction
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
@Override
public void onFragmentInteraction() {
Blurry.delete(rootView);
}
示例9: init
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
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);
}
示例10: init
import jp.wasabeef.blurry.Blurry; //导入依赖的package包/类
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);
}