delight-im / delight-im/Android-AdvancedWebView

[Improve] Use ActivityResultLauncher instead of onActivityResult, because old way has been deprecated.

Open
#283 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
2.4k
Forks
578
PR merge metrics
No merged PRs in 30d

Description

I know that `onActivityResult` deprecated but still used in next API versions. But I suggest to upgrade to consistent with newer API.

**Old way (Kotlin)**

```kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@Suppress("DEPRECATION")
super.onActivityResult(requestCode, resultCode, data)
getViewBinding().advancedWebView.onActivityResult(requestCode, resultCode, data)
}
```

**New way (Kotlin)**

```kotlin
private val mOnWebViewActivityResult = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
getViewBinding().advancedWebView.handleActivityResultCallback(result)
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.