mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
@@ -32,6 +32,7 @@ import org.isoron.uhabits.core.commands.CommandRunner
|
|||||||
import org.isoron.uhabits.core.preferences.Preferences
|
import org.isoron.uhabits.core.preferences.Preferences
|
||||||
import org.isoron.uhabits.core.preferences.WidgetPreferences
|
import org.isoron.uhabits.core.preferences.WidgetPreferences
|
||||||
import org.isoron.uhabits.intents.PendingIntentFactory
|
import org.isoron.uhabits.intents.PendingIntentFactory
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
abstract class BaseWidget(val context: Context, val id: Int, val stacked: Boolean) {
|
abstract class BaseWidget(val context: Context, val id: Int, val stacked: Boolean) {
|
||||||
private val widgetPrefs: WidgetPreferences
|
private val widgetPrefs: WidgetPreferences
|
||||||
@@ -103,8 +104,8 @@ abstract class BaseWidget(val context: Context, val id: Int, val stacked: Boolea
|
|||||||
|
|
||||||
private fun getBitmapFromView(view: View): Bitmap {
|
private fun getBitmapFromView(view: View): Bitmap {
|
||||||
view.invalidate()
|
view.invalidate()
|
||||||
val width = view.measuredWidth
|
val width = max(1, view.measuredWidth)
|
||||||
val height = view.measuredHeight
|
val height = max(1, view.measuredHeight)
|
||||||
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||||
val canvas = Canvas(bitmap)
|
val canvas = Canvas(bitmap)
|
||||||
view.draw(canvas)
|
view.draw(canvas)
|
||||||
|
|||||||
Reference in New Issue
Block a user