From 307a53849b9a1f8c4c2a3091b8b6e159cac0de86 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Fri, 2 Jun 2023 14:50:25 +0200 Subject: [PATCH] refs #5322 NaturePhotos --- app/src/main/java/es/verdnatura/domain/SalixService.kt | 4 ++-- .../view/feature/photos/fragment/PhotosFragment.kt | 5 ++++- .../view/feature/photos/fragment/PhotosViewModel.kt | 2 +- app/src/main/res/layout/fragment_photos.xml | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index 8bab2048..9d965955 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -156,8 +156,8 @@ interface SalixService { @POST("Images/upload") @Multipart fun uploadImage( - @Part ("collection") collection: String, - @Query("filter") filter: String, + @Query ("collection") collection: String, + //@Query("fileName") file: String, @Query("id") id: Int, @Part filePart: MultipartBody.Part, ): diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt index fbcc10eb..754395ee 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt @@ -50,7 +50,7 @@ binding.splashProgress.visibility = GONE setEvents() setToolBar() - loadImage() + upLoadPhoto() super.init() } @@ -137,10 +137,13 @@ } private fun upLoadPhoto() { + + println("llamada") val drawable = binding.userImage.drawable if (drawable is BitmapDrawable) { val bitmap = drawable.bitmap + viewModel.uploadPhoto(saveBitmapAsTempFile(requireContext(),bitmap)) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosViewModel.kt index 99c9740b..64288af3 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosViewModel.kt @@ -43,7 +43,7 @@ class PhotosViewModel(val context: Context) : BaseViewModel(context) { ) { - salix.uploadImage("catalog",fileName,itemFK,filePart) + salix.uploadImage("catalog",itemFK,filePart) .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { _responseinsert.value = ResponseItemVO( diff --git a/app/src/main/res/layout/fragment_photos.xml b/app/src/main/res/layout/fragment_photos.xml index 76b3dbab..fc41cfe7 100644 --- a/app/src/main/res/layout/fragment_photos.xml +++ b/app/src/main/res/layout/fragment_photos.xml @@ -33,7 +33,8 @@ android:layout_height="@dimen/itemcard_image_height" android:layout_margin="10dp" android:scaleType="centerCrop" - android:src="@drawable/loadphoto" /> + android:src="@drawable/camion" + app:srcCompat="@drawable/alpha_b_circle_outline" />