1
0
Fork 0
mirror of https://gitlab.com/nkming2/nc-photos.git synced 2025-03-10 09:18:52 +01:00
This commit is contained in:
Ming Ming 2022-05-21 03:25:41 +08:00
parent eeb95258c0
commit b75c4dd2f6
2 changed files with 5 additions and 5 deletions
plugin/android/src/main/kotlin/com/nkming/nc_photos/plugin

View file

@ -77,7 +77,7 @@ class ImageProcessorChannelHandler(context: Context) :
maxWidth: Int, maxHeight: Int, radius: Int, result: MethodChannel.Result maxWidth: Int, maxHeight: Int, radius: Int, result: MethodChannel.Result
) = method( ) = method(
fileUrl, headers, filename, maxWidth, maxHeight, fileUrl, headers, filename, maxWidth, maxHeight,
ImageProcessorService.METHOD_DEEL_LAP_PORTRAIT, result, onIntent = { ImageProcessorService.METHOD_DEEP_LAP_PORTRAIT, result, onIntent = {
it.putExtra(ImageProcessorService.EXTRA_RADIUS, radius) it.putExtra(ImageProcessorService.EXTRA_RADIUS, radius)
} }
) )

View file

@ -27,7 +27,7 @@ class ImageProcessorService : Service() {
companion object { companion object {
const val EXTRA_METHOD = "method" const val EXTRA_METHOD = "method"
const val METHOD_ZERO_DCE = "zero-dce" const val METHOD_ZERO_DCE = "zero-dce"
const val METHOD_DEEL_LAP_PORTRAIT = "DeepLab3Portrait" const val METHOD_DEEP_LAP_PORTRAIT = "DeepLab3Portrait"
const val EXTRA_FILE_URL = "fileUrl" const val EXTRA_FILE_URL = "fileUrl"
const val EXTRA_HEADERS = "headers" const val EXTRA_HEADERS = "headers"
const val EXTRA_FILENAME = "filename" const val EXTRA_FILENAME = "filename"
@ -96,7 +96,7 @@ class ImageProcessorService : Service() {
val method = intent.getStringExtra(EXTRA_METHOD) val method = intent.getStringExtra(EXTRA_METHOD)
when (method) { when (method) {
METHOD_ZERO_DCE -> onZeroDce(startId, intent.extras!!) METHOD_ZERO_DCE -> onZeroDce(startId, intent.extras!!)
METHOD_DEEL_LAP_PORTRAIT -> onDeepLapPortrait( METHOD_DEEP_LAP_PORTRAIT -> onDeepLapPortrait(
startId, intent.extras!! startId, intent.extras!!
) )
else -> { else -> {
@ -120,7 +120,7 @@ class ImageProcessorService : Service() {
private fun onDeepLapPortrait(startId: Int, extras: Bundle) { private fun onDeepLapPortrait(startId: Int, extras: Bundle) {
return onMethod( return onMethod(
startId, extras, METHOD_DEEL_LAP_PORTRAIT, args = mapOf( startId, extras, METHOD_DEEP_LAP_PORTRAIT, args = mapOf(
"radius" to extras.getIntOrNull(EXTRA_RADIUS) "radius" to extras.getIntOrNull(EXTRA_RADIUS)
) )
) )
@ -444,7 +444,7 @@ private open class ImageProcessorCommandTask(context: Context) :
fileUri fileUri
) )
ImageProcessorService.METHOD_DEEL_LAP_PORTRAIT -> DeepLab3Portrait( ImageProcessorService.METHOD_DEEP_LAP_PORTRAIT -> DeepLab3Portrait(
context, cmd.maxWidth, cmd.maxHeight, context, cmd.maxWidth, cmd.maxHeight,
cmd.args["radius"] as? Int ?: 16 cmd.args["radius"] as? Int ?: 16
).infer(fileUri) ).infer(fileUri)