Skip to content

Commit

Permalink
use IntentCompat to work around Android 13 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Jan 30, 2024
1 parent 2a26752 commit d6bba45
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.core:core:1.12.0")

val cameraVersion = "1.4.0-alpha04"
implementation("androidx.camera:camera-core:$cameraVersion")
Expand Down
15 changes: 3 additions & 12 deletions app/src/main/java/app/grapheneos/camera/util/IntentUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@ package app.grapheneos.camera.util
import android.content.Intent
import android.os.Build
import android.os.Parcelable
import androidx.core.content.IntentCompat

inline fun <reified T : Parcelable> getParcelableExtra(intent: Intent, name: String): T? {
return if (Build.VERSION.SDK_INT >= 33) {
intent.getParcelableExtra(name, T::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra(name) as T?
}
return IntentCompat.getParcelableExtra(intent, name, T::class.java)
}

inline fun <reified T : Parcelable> getParcelableArrayListExtra(intent: Intent, name: String): ArrayList<T>? {
return if (Build.VERSION.SDK_INT >= 33) {
intent.getParcelableArrayListExtra(name, T::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableArrayListExtra(name)
}
return IntentCompat.getParcelableArrayListExtra(intent, name, T::class.java)
}
50 changes: 34 additions & 16 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,28 @@
</artifact>
</component>
<component group="androidx.annotation" name="annotation" version="1.3.0">
<artifact name="annotation-1.3.0.jar">
<sha512 value="63def0a638a01e3b04abf515b27b5250c24b9f95db0b08dde7c27094e1ebdfca79642fd06938843794827400ac1fd437e0f80881350f44adf1fef0e8f177a12f" origin="Generated by Gradle"/>
</artifact>
<artifact name="annotation-1.3.0.module">
<sha512 value="d83ea1966e6f8aa2dbf644da7d89cd406791d730ebaf0ceaa4271555604c3bc0fbcf07ae1f141aad81b498d594152c2c05b5f4f6081d3f9c863a10187090dfa9" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.annotation" name="annotation" version="1.6.0">
<artifact name="annotation-1.6.0.module">
<sha512 value="eecd02c3f41f11fcfd092c4be66feee29c10ff96dd761a0e92ca6a2a399bdb34b6b5d1ad98fc42c730f953cc32ec174b54feceba0023b47aed1f5c1fc767a1d3" origin="Generated by Gradle"/>
</artifact>
<artifact name="annotation-metadata-1.6.0.jar">
<sha512 value="c3be9ce05a835030c5582975b5ab61f9b5af86bf9f2cf3c940d4746c9f58ac13d6086b2d3553aa41dd869008f846f40b6bb310e115cefbeb50aaf94ceb4f5fa7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.annotation" name="annotation-experimental" version="1.0.0">
<artifact name="annotation-experimental-1.0.0.pom">
<sha512 value="e87c9de28ab005a59f2b3142f70a8d9089b20070cfba19966292e6e6961fcc2c279078eecfffb68be195003195a79ac00ee3ee94ceb94d5e391b5403bc296fda" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.annotation" name="annotation-experimental" version="1.3.0">
<artifact name="annotation-experimental-1.3.0.module">
<sha512 value="2cb371cc267c10827f1e92110765a57938e09fd74bd995b9185ffc95675c358421725eacf7fdf0d32c43db90a3432d8dd9c22e24c9bcc106bc58263f25501c74" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.annotation" name="annotation-experimental" version="1.4.0">
<artifact name="annotation-experimental-1.4.0.aar">
<sha512 value="200ad90b30efefbf02f8e8d6c9f3b39d374683b12cda1590a8114426afad149ea7b075f2d58ea973b963bf559bb5fdb2982bad069b9e05299f53471ba8878e86" origin="Generated by Gradle"/>
Expand All @@ -47,6 +57,14 @@
<sha512 value="846b0ee4376748fba414768e2a57801af78e813059d97b9705320c719a6bec282fb2f1dbea100b3ca7873afcdf8efd8035a4c0ba50f1735d57b36af5682f7cd9" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.annotation" name="annotation-jvm" version="1.6.0">
<artifact name="annotation-jvm-1.6.0.jar">
<sha512 value="68c4454bcfb46213caafb6b91ecce163cec0ff68e59015ab8565ebd6712f7f932bdb1aa90558b73fb6e76a75074faa030a3743a7bbd7b70b549926247d075ecf" origin="Generated by Gradle"/>
</artifact>
<artifact name="annotation-jvm-1.6.0.module">
<sha512 value="847fbb4f0bcc6db883f0840b7c311d516b2360279d439d7fe49b1ba03a5c8f00011be69a3a079975c433dfb6bfc538462b0d08b12c702025557b01bbf7702095" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.appcompat" name="appcompat" version="1.6.1">
<artifact name="appcompat-1.6.1.aar">
<sha512 value="7f48ed714deeda7a8956edfda70e7b4c72198316f6e3f6ae049acd1f033762d2ac34fe20cffcf4067410d05736d95eea4fad6a3493b9032f8fb4034b1fda7498" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -198,12 +216,20 @@
<sha512 value="21529ea9c88a5c343469498c3ebf49f1a74ec3e87dfc15aadb1ea8fcc08f5be4acf5ae4477352f4b39da68315620307c72a2d889d3b110c2d8469bbb5443bb35" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core" version="1.9.0">
<artifact name="core-1.9.0.aar">
<sha512 value="4e20f84108645931c6cab2702f6bc920caa3f63d6495a883511c513bf132f3d2f79c528a29c982314b7f27b630c44a4ad8bb0b6997e1d93a269aa39ad94fa7e6" origin="Generated by Gradle"/>
<component group="androidx.core" name="core" version="1.12.0">
<artifact name="core-1.12.0.aar">
<sha512 value="189b9f984e192c29d892a82b78b6715c78b7a2ffa69f81a7d2027362277ce63c8317823db720a8668644cae02a34e8c51f92702282f53faad600667bd5f56b2d" origin="Generated by Gradle"/>
</artifact>
<artifact name="core-1.12.0.module">
<sha512 value="4bee939f8dcae448a334b4dfcbe865fb0b0d850778f1290c07381b2d7954fe112aeb76fea2bb1a414fae3d4ed3eec483b7429f57c45a3be5cd0d4d2d159a5c99" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core-ktx" version="1.12.0">
<artifact name="core-ktx-1.12.0.aar">
<sha512 value="999a6f12b60a3c140e8183f83e001b9d7c6a511fbeaeb6faf1cd31cbb6953758ed758d10e054472f64cdb7ab3d396bb8489a3ced56458e5be1401d705438075c" origin="Generated by Gradle"/>
</artifact>
<artifact name="core-1.9.0.module">
<sha512 value="6d30c1985abb279dab3c4cd760525d25c4ceb8635b933e7da945854a3673baff6bafea3f021fed338461f5f2b99bad8382f8273132560b983fdad44bdbacf405" origin="Generated by Gradle"/>
<artifact name="core-ktx-1.12.0.module">
<sha512 value="f0563b3ccd9471e9d51a682c51a02b62132e4b6433899d6c27f041bd0499f7a7e6e051fed197cc4505d862769dc0886c993a7211812de8ee514af007f749f045" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core-ktx" version="1.2.0">
Expand All @@ -219,14 +245,6 @@
<sha512 value="69f4f44dddc9c927ddd84ff1f22e2a9546788a0d8a04ad33d0678f9b49bf51f3680f63a13e26eee98d9d693eca9ccb65270fd38fbc5f02a7adcbb0accb2ce1b4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core-ktx" version="1.9.0">
<artifact name="core-ktx-1.9.0.aar">
<sha512 value="ac296b336aa1c16ebf1466186fd3fab816a122b5dec17817ea78eb79807a30d8999b6a7828399912c1e96301abdd634d3266c0ae678dbf8e53cbac7c5539ceee" origin="Generated by Gradle"/>
</artifact>
<artifact name="core-ktx-1.9.0.module">
<sha512 value="42545d893d2a405043d94df6f0ad393bd7cc8ca47470d1c21168443545e40024a88a1ac0b13cf4d89f8d5383ac99b3eabec88a6f9c84e9369a162a5bb6c43c61" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.cursoradapter" name="cursoradapter" version="1.0.0">
<artifact name="cursoradapter-1.0.0.aar">
<sha512 value="176ac8e4604749ef5bb7f444c24add479f1d2cc5caab1046bbb35f937bf1cfc4329786cd1fdac3d6ee92fec78cb55ab89e5169ae5c6ee24dd4d20243aa867891" origin="Generated by Gradle"/>
Expand Down

0 comments on commit d6bba45

Please sign in to comment.