Skip to content

Commit 94b1fb9

Browse files
MHShettythestinger
authored andcommitted
Fix crash when capture button drawable has LayerDrawable type
1 parent 3ecbdae commit 94b1fb9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.content.Context
77
import android.content.pm.PackageManager.PERMISSION_GRANTED
88
import android.graphics.Bitmap
99
import android.graphics.drawable.GradientDrawable
10+
import android.graphics.drawable.LayerDrawable
1011
import android.graphics.drawable.StateListDrawable
1112
import android.location.Location
1213
import android.media.MediaMetadataRetriever
@@ -278,6 +279,8 @@ class VideoCapturer(private val mActivity: MainActivity) {
278279

279280
val gd: GradientDrawable = if (drawable is StateListDrawable) {
280281
drawable.current as GradientDrawable
282+
} else if (drawable is LayerDrawable) {
283+
drawable.current as GradientDrawable
281284
} else {
282285
drawable as GradientDrawable
283286
}
@@ -328,6 +331,8 @@ class VideoCapturer(private val mActivity: MainActivity) {
328331

329332
val gd: GradientDrawable = if (drawable is StateListDrawable) {
330333
drawable.current as GradientDrawable
334+
} else if (drawable is LayerDrawable) {
335+
drawable.current as GradientDrawable
331336
} else {
332337
drawable as GradientDrawable
333338
}

0 commit comments

Comments
 (0)