wallpapers hooks: fix (maybe)
- close outputstream > release dedicated memory - delete temp file on exit - improved check"compress" for null
This commit is contained in:
@@ -73,8 +73,10 @@ public class WallpapersHooks {
|
|||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
||||||
File outPutFile = File.createTempFile("wallpaper_temp","image");
|
File outPutFile = File.createTempFile("wallpaper_temp","image");
|
||||||
|
outPutFile.deleteOnExit();
|
||||||
FileOutputStream outputStream = new FileOutputStream(outPutFile);
|
FileOutputStream outputStream = new FileOutputStream(outPutFile);
|
||||||
selectedBitmap.compress(Bitmap.CompressFormat.PNG, 85 , outputStream);
|
selectedBitmap.compress(Bitmap.CompressFormat.PNG, 85 , outputStream);
|
||||||
|
outputStream.close();
|
||||||
|
|
||||||
return outPutFile;
|
return outPutFile;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -93,16 +95,20 @@ public class WallpapersHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getWallpaperUrl() {
|
public static String getWallpaperUrl() {
|
||||||
if (getWallpaperFile().exists() && eligibleWallpaperFile(getWallpaperFile()))
|
var file = getWallpaperFile();
|
||||||
if (compress(getWallpaperFile()) == null) {
|
|
||||||
|
if (file.exists() && eligibleWallpaperFile(file)) {
|
||||||
|
var compressed = compress(file);
|
||||||
|
if (compressed == null) {
|
||||||
return "default";
|
return "default";
|
||||||
} else if (getBoolValue("compresswp", true)){
|
} else if (getBoolValue("compresswp", true) && compressed != null) {
|
||||||
return compress(getWallpaperFile()).getAbsolutePath();
|
return compressed.getAbsolutePath();
|
||||||
} else {
|
} else {
|
||||||
return getWallpaperFile().getAbsolutePath();
|
return file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
return "default";
|
|
||||||
|
return "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getWallpaper() {
|
public static Drawable getWallpaper() {
|
||||||
|
|||||||
Reference in New Issue
Block a user