You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
i am trying to add center crop in my code but i get issue please help me to solve this.
here is my current codes,
//set wallpaper on Home Screen
private void setWallpaperToHomeScreen() {
relativeLayoutLoadMore.setVisibility(View.VISIBLE);
Glide.with(this)
.asBitmap()
.load(Config.ADMIN_PANEL_URL+"/images/"+arrayList.get(currentPosition).getImage_url())
.into(new CustomTarget() {
@RequiresApi(api = Build.VERSION_CODES.N) @OverRide
public void onResourceReady(@nonnull Bitmap resource, @nullable Transition<? super Bitmap> transition) {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(WallpaperDetailsActivity.this);
try {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
int width = metrics.widthPixels;
Bitmap bitmap = Bitmap.createScaledBitmap(resource,width,height, true);
wallpaperManager.getDesiredMinimumWidth();//returned 1280 on s3
wallpaperManager.getDesiredMinimumHeight();//also returned 1280 on s3
wallpaperManager.suggestDesiredDimensions(width, height);
wallpaperManager.setBitmap(bitmap,null, true, WallpaperManager.FLAG_SYSTEM);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Snackbar.make(rootLayout,"Wallpaper was set successfully",Snackbar.LENGTH_LONG).show();
relativeLayoutLoadMore.setVisibility(View.GONE);
showFullScreenAds();
}
}, Constant.DELAY_SET_WALLPAPER);
} catch (IOException e) {
e.printStackTrace();
relativeLayoutLoadMore.setVisibility(View.GONE);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
Code that i want add in my app
public static void setWallpaper(Context context, BitmapDrawable wallpaper) {
Hello,
i am trying to add center crop in my code but i get issue please help me to solve this.
here is my current codes,
//set wallpaper on Home Screen
private void setWallpaperToHomeScreen() {
relativeLayoutLoadMore.setVisibility(View.VISIBLE);
Glide.with(this)
.asBitmap()
.load(Config.ADMIN_PANEL_URL+"/images/"+arrayList.get(currentPosition).getImage_url())
.into(new CustomTarget() {
@RequiresApi(api = Build.VERSION_CODES.N)
@OverRide
public void onResourceReady(@nonnull Bitmap resource, @nullable Transition<? super Bitmap> transition) {
Code that i want add in my app
public static void setWallpaper(Context context, BitmapDrawable wallpaper) {
private static Bitmap centerCropWallpaper(Context context, Bitmap wallpaper, int desiredHeight){
please help me to add this my app
The text was updated successfully, but these errors were encountered: