parent
ec0149decb
commit
62061c8fe6
|
|
@ -209,7 +209,7 @@ fun CutoutScreen(navController: NavController, viewModel: CutoutViewModel = view
|
||||||
if(isLoadingCutoutMethodFromService){
|
if(isLoadingCutoutMethodFromService){
|
||||||
// 服务器完成抠图后,再执行本地加载
|
// 服务器完成抠图后,再执行本地加载
|
||||||
viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap ->
|
viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap ->
|
||||||
if (isSuccess) {
|
if (isSuccess && croppedBitmap != null) {
|
||||||
cutoutResultBitmap.value = croppedBitmap
|
cutoutResultBitmap.value = croppedBitmap
|
||||||
// 重置头像变换
|
// 重置头像变换
|
||||||
headTransform.value = TransformState()
|
headTransform.value = TransformState()
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,9 @@ class CutoutViewModel : BaseViewModel() {
|
||||||
|
|
||||||
if (response.status) {
|
if (response.status) {
|
||||||
Log.i("CutoutViewModel", "抠图成功: ${response.data}")
|
Log.i("CutoutViewModel", "抠图成功: ${response.data}")
|
||||||
|
|
||||||
val resultUrl = Uri.decode(response.data.toString())
|
val resultUrl = Uri.decode(response.data.toString())
|
||||||
// 将 http 替换为 https
|
// 将 http 替换为 https
|
||||||
//val resultUrl = response.data.toString().replace("http://", "https://")
|
//val resultUrl = resultUrl.replace("http://", "https://")
|
||||||
saveUrlToCache(resultUrl, onResult)
|
saveUrlToCache(resultUrl, onResult)
|
||||||
} else {
|
} else {
|
||||||
errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" })
|
errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue