Skip to content

Cleanup WalpaperLoaderTask - #260

Open
Donnnno wants to merge 12 commits into
zixpo:mainfrom
Donnnno:bitmap
Open

Cleanup WalpaperLoaderTask#260
Donnnno wants to merge 12 commits into
zixpo:mainfrom
Donnnno:bitmap

Conversation

@Donnnno

@Donnnno Donnnno commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Got this message from the Play Console:

Improve your app's performance with bitmap image optimization

Your app manually downloads and decodes images from the network in the following places: Decoded in candybar.lib.tasks.WallpaperPropertiesLoaderTask.run Downloaded in candybar.lib.helpers.WallpaperHelper.getStream This can lead to excessive memory usage, poor performance, and app crashes. To reduce memory usage, we recommend using an image loading library to automatically handle downsampling, caching, and memory management for you.

Merge #251 first :)


Changes Made:

  1. Replaced Manual Network Download:
  • Removed the use of HttpURLConnection via WallpaperHelper.getStream() for fetching images.
  • Implemented Glide.with(context).asFile().load(url).submit().get() to download the wallpaper. This leverages Glide's built-in networking (OkHttp) and automatic caching, preventing redundant downloads and reducing data usage.
  1. Optimized Image Decoding:
  • Replaced the full image decoding (BitmapFactory.decodeStream) which loaded the entire bitmap into memory just to read dimensions.
  • Implemented BitmapFactory.Options with inJustDecodeBounds = true to extract dimensions and MIME type from the downloaded file without allocating memory for the full bitmap.
  1. Improved Metadata Accuracy:
  • Changed how the wallpaper size is determined. It now uses the actual file length (file.length()) instead of the memory footprint of the decoded bitmap, providing a more accurate "file size" value for the dashboard.
  1. Handled Assets Protocol:
  • Added support to convert assets:// URIs to Glide-compatible android_asset URIs, ensuring local wallpapers are also handled through the optimized pipeline.
  1. Cleaned Up Code:
  • Removed unused imports (InputStream, WallpaperHelper, Bitmap) and added safety null checks for Context.

Generated with Google's built in Android studio AI

@Donnnno Donnnno changed the title Bitmap Cleanup WalpaperLoaderTask Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant