version upgrade, fixed toolbar blur

This commit is contained in:
nuclearfog 2023-06-18 12:06:45 +02:00
parent 157f9999af
commit 7e92f8cac5
No known key found for this signature in database
GPG Key ID: 03488A185C476379
2 changed files with 16 additions and 6 deletions

View File

@ -4,15 +4,15 @@ plugins {
android {
compileSdkVersion 33
buildToolsVersion '33.0.2'
buildToolsVersion '34.0.0'
namespace 'org.nuclearfog.twidda'
defaultConfig {
applicationId 'org.nuclearfog.twidda'
minSdkVersion 21
targetSdkVersion 33
versionCode 88
versionName '3.2.1'
versionCode 89
versionName '3.2.2'
resConfigs 'en', 'de-rDE', 'zh-rCN'
}

View File

@ -255,12 +255,22 @@ public class AppStyles {
try {
Bitmap image = ((BitmapDrawable) backgroundDrawable).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
// check if image is valid
if (image.getWidth() > 1 && image.getHeight() > 1) {
if (image.getWidth() > 0 && image.getHeight() > 0) {
// crop image to background size
if (background.getMeasuredHeight() > 0 && background.getMeasuredWidth() > 0) {
CropTransformation crop;
int height = image.getWidth() * background.getMeasuredHeight() / background.getMeasuredWidth();
crop = new CropTransformation(image.getWidth(), height, GravityHorizontal.CENTER, GravityVertical.CENTER);
int width, height;
if ((image.getWidth() / (float) image.getHeight() < (background.getWidth() / (float) background.getHeight()))) {
height = image.getWidth() * background.getMeasuredHeight() / background.getMeasuredWidth();
width = image.getWidth();
} else if ((image.getWidth() / (float) image.getHeight() > (background.getWidth() / (float) background.getHeight()))) {
height = image.getHeight();
width = image.getHeight() * background.getMeasuredWidth() / background.getMeasuredHeight();
} else {
width = image.getWidth();
height = image.getHeight();
}
crop = new CropTransformation(width, height, GravityHorizontal.CENTER, GravityVertical.CENTER);
image = crop.transform(image);
}
int widthPixels = Resources.getSystem().getDisplayMetrics().widthPixels;