From 62061c8fe605887d5405c039780d04cca869ebca Mon Sep 17 00:00:00 2001 From: shenzuqiang Date: Fri, 13 Mar 2026 10:52:01 +0800 Subject: [PATCH] =?UTF-8?q?Dev=EF=BC=9A=201=E3=80=81=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=8A=A0=E5=9B=BE=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=89=93=E5=BA=95=E6=96=B9=E6=A1=88=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt | 2 +- app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt b/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt index 7b48624..fb5d9df 100644 --- a/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt +++ b/app/src/main/java/com/img/rabbit/pages/screen/make/CutoutScreen.kt @@ -209,7 +209,7 @@ fun CutoutScreen(navController: NavController, viewModel: CutoutViewModel = view if(isLoadingCutoutMethodFromService){ // 服务器完成抠图后,再执行本地加载 viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap -> - if (isSuccess) { + if (isSuccess && croppedBitmap != null) { cutoutResultBitmap.value = croppedBitmap // 重置头像变换 headTransform.value = TransformState() diff --git a/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt b/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt index cbcf224..78cfacb 100644 --- a/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt +++ b/app/src/main/java/com/img/rabbit/viewmodel/CutoutViewModel.kt @@ -77,10 +77,9 @@ class CutoutViewModel : BaseViewModel() { if (response.status) { Log.i("CutoutViewModel", "抠图成功: ${response.data}") - val resultUrl = Uri.decode(response.data.toString()) // 将 http 替换为 https - //val resultUrl = response.data.toString().replace("http://", "https://") + //val resultUrl = resultUrl.replace("http://", "https://") saveUrlToCache(resultUrl, onResult) } else { errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" })