android / android/codelab-android-workmanager

RenderScript was deprecate

Open
#318 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
557
Forks
242
PR merge metrics
No merged PRs in 30d

Description

In WorkerUtils.kt fun blurBitmap
Change code
```
rsContext = RenderScript.create(applicationContext, RenderScript.ContextType.DEBUG)
val inAlloc = Allocation.createFromBitmap(rsContext, bitmap)
val outAlloc = Allocation.createTyped(rsContext, inAlloc.type)
val theIntrinsic = ScriptIntrinsicBlur.create(rsContext, Element.U8_4(rsContext))
theIntrinsic.apply {
setRadius(10f)
theIntrinsic.setInput(inAlloc)
theIntrinsic.forEach(outAlloc)
}
outAlloc.copyTo(output)
```
to
```
var blurredBitmap: Bitmap? = Toolkit.blur(bitmap,25)
return blurredBitmap!!
```

Instruction to migrate
https://developer.android.com/guide/topics/renderscript/migrate

You just need to download the project, get the renderscript-toolkit module and add it to this Codelab project.
https://github.com/android/renderscript-intrinsics-replacement-toolkit

Contributor guide

Open the contributing guide

Research direction

Start in WorkerUtils.kt at fun blurBitmap and read the linked RenderScript migration instructions. Add the renderscript-toolkit module from the referenced repository to this Codelab project, then update the blur implementation as described in the issue. Done means the project builds and blurBitmap uses the replacement toolkit instead of RenderScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, mobile
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.