widgets: reduce cover size limit
Some double whammy of non-1:1 album cover support and new widget forms apparently blew the bitmap memory capacity of widgets on some devices. Reduce the threshold further in the hope that it'll work. Really hope this isn't that Android 12 bug where the bitmap size calculation is duplicated across all RemoteView persisting in these devices too.
This commit is contained in:
parent
fcae1ebee9
commit
2ecb94c97e
1 changed files with 2 additions and 2 deletions
|
@ -51,11 +51,11 @@ fun newRemoteViews(context: Context, @LayoutRes layoutRes: Int): RemoteViews {
|
||||||
* there is only one image.
|
* there is only one image.
|
||||||
*
|
*
|
||||||
* @param context [Context] required to perform calculation.
|
* @param context [Context] required to perform calculation.
|
||||||
* @param reduce Optional multiplier to reduce the image size. Recommended value is 2 to avoid
|
* @param reduce Optional multiplier to reduce the image size. Recommended value is 3 to avoid
|
||||||
* device-specific variations in memory limit.
|
* device-specific variations in memory limit.
|
||||||
* @return The dimension of a bitmap that can be safely used in [RemoteViews].
|
* @return The dimension of a bitmap that can be safely used in [RemoteViews].
|
||||||
*/
|
*/
|
||||||
fun getSafeRemoteViewsImageSize(context: Context, reduce: Float = 2f): Int {
|
fun getSafeRemoteViewsImageSize(context: Context, reduce: Float = 3f): Int {
|
||||||
val metrics = context.resources.displayMetrics
|
val metrics = context.resources.displayMetrics
|
||||||
val sw = metrics.widthPixels
|
val sw = metrics.widthPixels
|
||||||
val sh = metrics.heightPixels
|
val sh = metrics.heightPixels
|
||||||
|
|
Loading…
Reference in a new issue