Skip to content

Commit 48fbb69

Browse files
markushiclaude
andauthored
refactor(samples): Convert main screen to Jetpack Compose (#5017)
* refactor(samples): Convert Android sample app MainActivity to Kotlin Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Fix scroll detection * Update Changelog * Address PR comments * Fix tests * Fix lint issues * Bump Lint version * Fix more lint errors * Update proguard rules --------- Co-authored-by: Claude Sonnet 4.5 <[email protected]>
1 parent 5f14e5d commit 48fbb69

File tree

22 files changed

+1073
-783
lines changed

22 files changed

+1073
-783
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Add `installGroupsOverride` parameter and `installGroups` property to Build Distribution SDK ([#5062](https://github.com/getsentry/sentry-java/pull/5062))
88
- Update Android targetSdk to API 36 (Android 16) ([#5016](https://github.com/getsentry/sentry-java/pull/5016))
99

10+
### Fixes
11+
12+
- Fix scroll target detection for Jetpack Compose ([#5017](https://github.com/getsentry/sentry-java/pull/5017))
13+
1014
### Internal
1115

1216
- Establish new native exception mechanisms to differentiate events generated by `sentry-native` from `ApplicationExitInfo`. ([#5052](https://github.com/getsentry/sentry-java/pull/5052))

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
99

1010
# AndroidX required by AGP >= 3.6.x
1111
android.useAndroidX=true
12+
android.experimental.lint.version=8.9.0
1213

1314
# Release information
1415
versionName=8.31.0

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ androidx-annotation = { module = "androidx.annotation:annotation", version = "1.
8282
androidx-activity-compose = { module = "androidx.activity:activity-compose", version = "1.8.2" }
8383
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidxCompose" }
8484
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "androidxCompose" }
85-
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version = "1.2.1" }
85+
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version = "1.4.0" }
86+
androidx-compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version="1.7.8" }
87+
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version="1.7.8" }
8688
androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidxCompose" }
8789
# Note: don't change without testing forwards compatibility
8890
androidx-compose-ui-replay = { module = "androidx.compose.ui:ui", version = "1.5.0" }

sentry-android-replay/src/main/java/io/sentry/android/replay/ScreenshotRecorder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import java.lang.ref.WeakReference
2222
import java.util.concurrent.atomic.AtomicBoolean
2323
import kotlin.math.roundToInt
2424

25-
@SuppressLint("UseKtx")
25+
@SuppressLint("UseKtx", "UseRequiresApi")
2626
@TargetApi(26)
2727
internal class ScreenshotRecorder(
2828
val config: ScreenshotRecorderConfig,

sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry.android.replay
22

3+
import android.annotation.SuppressLint
34
import android.annotation.TargetApi
45
import android.graphics.Point
56
import android.os.Handler
@@ -19,6 +20,7 @@ import java.lang.ref.WeakReference
1920
import java.util.concurrent.ScheduledExecutorService
2021
import java.util.concurrent.atomic.AtomicBoolean
2122

23+
@SuppressLint("UseRequiresApi")
2224
@TargetApi(26)
2325
internal class WindowRecorder(
2426
private val options: SentryOptions,

sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry.android.replay.capture
22

3+
import android.annotation.SuppressLint
34
import android.annotation.TargetApi
45
import android.view.MotionEvent
56
import io.sentry.Breadcrumb
@@ -42,6 +43,7 @@ import java.util.concurrent.atomic.AtomicReference
4243
import kotlin.properties.ReadWriteProperty
4344
import kotlin.reflect.KProperty
4445

46+
@SuppressLint("UseRequiresApi")
4547
@TargetApi(26)
4648
internal abstract class BaseCaptureStrategy(
4749
private val options: SentryOptions,

sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry.android.replay.capture
22

3+
import android.annotation.SuppressLint
34
import android.annotation.TargetApi
45
import android.graphics.Bitmap
56
import android.view.MotionEvent
@@ -24,6 +25,7 @@ import java.io.File
2425
import java.util.Date
2526
import java.util.concurrent.ScheduledExecutorService
2627

28+
@SuppressLint("UseRequiresApi")
2729
@TargetApi(26)
2830
internal class BufferCaptureStrategy(
2931
private val options: SentryOptions,

sentry-android-replay/src/main/java/io/sentry/android/replay/util/Persistable.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry.android.replay.util
22

3+
import android.annotation.SuppressLint
34
import android.annotation.TargetApi
45
import io.sentry.ReplayRecording
56
import io.sentry.SentryOptions
@@ -12,6 +13,7 @@ import java.util.concurrent.ScheduledExecutorService
1213

1314
// TODO: enable this back after we are able to serialize individual touches to disk to not overload
1415
// cpu
16+
@SuppressLint("UseRequiresApi")
1517
@Suppress("unused")
1618
@TargetApi(26)
1719
internal class PersistableLinkedList(

sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import java.lang.NullPointerException
2828
* Recursively traverses the view hierarchy and creates a [ViewHierarchyNode] for each view.
2929
* Supports Compose view hierarchy as well.
3030
*/
31+
@SuppressLint("UseKtx")
3132
internal fun View.traverse(parentNode: ViewHierarchyNode, options: SentryOptions) {
3233
if (this !is ViewGroup) {
3334
return
@@ -87,7 +88,7 @@ internal fun View.isVisibleToUser(): Pair<Boolean, Rect?> {
8788
return false to null
8889
}
8990

90-
@SuppressLint("ObsoleteSdkInt")
91+
@SuppressLint("ObsoleteSdkInt", "UseRequiresApi")
9192
@TargetApi(21)
9293
internal fun Drawable?.isMaskable(): Boolean {
9394
// TODO: maybe find a way how to check if the drawable is coming from the apk or loaded from

sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
package io.sentry.android.replay.video
2929

30+
import android.annotation.SuppressLint
3031
import android.annotation.TargetApi
3132
import android.graphics.Bitmap
3233
import android.media.MediaCodec
@@ -44,6 +45,7 @@ import kotlin.LazyThreadSafetyMode.NONE
4445

4546
private const val TIMEOUT_USEC = 100_000L
4647

48+
@SuppressLint("UseRequiresApi")
4749
@TargetApi(26)
4850
internal class SimpleVideoEncoder(
4951
val options: SentryOptions,
@@ -295,6 +297,7 @@ internal class SimpleVideoEncoder(
295297
}
296298
}
297299

300+
@SuppressLint("UseRequiresApi")
298301
@TargetApi(24)
299302
internal data class MuxerConfig(
300303
val file: File,

0 commit comments

Comments
 (0)