refs #5322 NaturePhotos

This commit is contained in:
Sergio De la torre 2023-06-02 14:50:25 +02:00
parent 6db09cd73a
commit 307a53849b
4 changed files with 9 additions and 5 deletions

View File

@ -156,8 +156,8 @@ interface SalixService {
@POST("Images/upload") @POST("Images/upload")
@Multipart @Multipart
fun uploadImage( fun uploadImage(
@Part ("collection") collection: String, @Query ("collection") collection: String,
@Query("filter") filter: String, //@Query("fileName") file: String,
@Query("id") id: Int, @Query("id") id: Int,
@Part filePart: MultipartBody.Part, @Part filePart: MultipartBody.Part,
): ):

View File

@ -50,7 +50,7 @@
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
setToolBar() setToolBar()
loadImage() upLoadPhoto()
super.init() super.init()
} }
@ -137,10 +137,13 @@
} }
private fun upLoadPhoto() { private fun upLoadPhoto() {
println("llamada")
val drawable = binding.userImage.drawable val drawable = binding.userImage.drawable
if (drawable is BitmapDrawable) { if (drawable is BitmapDrawable) {
val bitmap = drawable.bitmap val bitmap = drawable.bitmap
viewModel.uploadPhoto(saveBitmapAsTempFile(requireContext(),bitmap)) viewModel.uploadPhoto(saveBitmapAsTempFile(requireContext(),bitmap))
} }
} }

View File

@ -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<Any>(context) { .enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_responseinsert.value = ResponseItemVO( _responseinsert.value = ResponseItemVO(

View File

@ -33,7 +33,8 @@
android:layout_height="@dimen/itemcard_image_height" android:layout_height="@dimen/itemcard_image_height"
android:layout_margin="10dp" android:layout_margin="10dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/loadphoto" /> android:src="@drawable/camion"
app:srcCompat="@drawable/alpha_b_circle_outline" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"