refs #5513 Añadida imagen original

This commit is contained in:
Sergio De la torre 2023-06-12 10:22:08 +02:00
parent bdec030f66
commit ea510de356
8 changed files with 52 additions and 38 deletions

View File

@ -84,21 +84,13 @@
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #5322 NaturePhotos">
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_image_upload.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/activity/LoginActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_photos.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_photos.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/dimens.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/dimens.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -110,7 +102,7 @@
<component name="CodeInsightWorkspaceSettings">
<option name="optimizeImportsOnTheFly" value="true" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[21114523025303]" />
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[JN5PH6MNXGOF99ZT]" />
<component name="ExportToHTMLSettings">
<option name="OPEN_IN_BROWSER" value="true" />
<option name="OUTPUT_DIRECTORY" value="C:\Program Files\Android\Android Studio\inspections" />
@ -421,13 +413,6 @@
<option name="presentableId" value="Default" />
<updated>1618825571576</updated>
</task>
<task id="LOCAL-00112" summary="refs #4683 Autoconsumo">
<created>1679050359974</created>
<option name="number" value="00112" />
<option name="presentableId" value="LOCAL-00112" />
<option name="project" value="LOCAL" />
<updated>1679050359974</updated>
</task>
<task id="LOCAL-00113" summary="refs #4755 mostrar tickets">
<created>1679305084809</created>
<option name="number" value="00113" />
@ -764,7 +749,14 @@
<option name="project" value="LOCAL" />
<updated>1686034352693</updated>
</task>
<option name="localTasksCounter" value="161" />
<task id="LOCAL-00161" summary="refs #4021 Cambiado quantity a printedStickers">
<created>1686551912840</created>
<option name="number" value="00161" />
<option name="presentableId" value="LOCAL-00161" />
<option name="project" value="LOCAL" />
<updated>1686551912841</updated>
</task>
<option name="localTasksCounter" value="162" />
<servers />
</component>
<component name="Vcs.Log.History.Properties">

View File

@ -99,19 +99,19 @@ class PhotosFragment(
}
private fun getPhoto() {
pickImage()
pickImage()
}
private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
binding.editItemFk.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editItemFk.text.toString().isEmpty())
{
if (!binding.editItemFk.text.toString().isEmpty()) {
originalItem = itemScanValue(
originalItem = itemScanValue(
binding.editItemFk.text.toString(),
"buy",
"more"
@ -167,7 +167,10 @@ class PhotosFragment(
} else {
if (it.id != 0) {
binding.itemData.text = "${it.id}: ${it.longName}"
if (!it.urlImage200.isNullOrEmpty()) {
binding.itemcardOriginal.visibility = VISIBLE
binding.itemcardOriginal.loadUrl(it.urlImage200)
}
} else {
ma.messageWithSound(
getString(R.string.itemNotFound),
@ -193,8 +196,11 @@ class PhotosFragment(
val drawable = binding.itemcardImage.drawable
if (drawable is BitmapDrawable) {
val bitmap = drawable.bitmap
binding.splashProgress.visibility=VISIBLE
viewModel.uploadPhoto(itemFK = originalItem, urlImage = saveBitmapAsTempFile(requireContext(), bitmap))
binding.splashProgress.visibility = VISIBLE
viewModel.uploadPhoto(
itemFK = originalItem,
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
)
}
}
}
@ -221,10 +227,11 @@ class PhotosFragment(
val pickIntent = Intent(Intent.ACTION_PICK)
pickIntent.type = "image/*"
val captureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
val chooserIntent = Intent.createChooser(pickIntent, "Seleccionar imagen")
val chooserIntent = Intent.createChooser(pickIntent, getString(R.string.selectImage))
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(captureIntent))
startActivityForResult(chooserIntent, PICK_IMAGE_REQUEST)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK) {
if (data != null && data.data != null) {
@ -232,7 +239,10 @@ class PhotosFragment(
binding.itemcardImage.setImageURI(data.data)
} else {
// Imagen cámara
var uri = saveBitmapAsTempFile(requireContext(),data?.extras?.get("data") as Bitmap).toUri()
var uri = saveBitmapAsTempFile(
requireContext(),
data?.extras?.get("data") as Bitmap
).toUri()
binding.itemcardImage.setImageURI(uri)
//binding.itemcardImage.setImageBitmap(data?.extras?.get("data") as? Bitmap?)

View File

@ -30,12 +30,9 @@
android:inputType="text"
android:textColor="@color/verdnatura_white"
android:textColorHint="@color/verdnatura_white"
android:layout_marginBottom="@dimen/layout_margin_1"
/>
<LinearLayout
android:id="@+id/itemcard_layout"
android:layout_width="match_parent"
@ -45,23 +42,34 @@
<ImageView
android:id="@+id/itemcard_image"
android:layout_width="match_parent"
android:layout_height="@dimen/itemcard_image_height"
android:layout_width="@dimen/itemcard_image"
android:layout_height="@dimen/itemcard_image"
android:scaleType="centerCrop"
android:src="@drawable/loadphoto"
android:layout_margin="@dimen/item_image_width_min"/>
android:layout_gravity="center"
android:layout_marginBottom="@dimen/layout_margin_1"/>
<TextView
android:id="@+id/item_data"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center"
android:inputType="text"
android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_pumpkin_orange"
android:textColorHint="@color/verdnatura_white"
android:layout_margin="@dimen/ef_margin_medium"
android:layout_margin="@dimen/ef_margin_small"
/>
<ImageView
android:id="@+id/itemcard_original"
android:layout_width="@dimen/itemcard_image"
android:layout_height="@dimen/itemcard_image"
android:scaleType="centerCrop"
android:src="@drawable/loadphoto"
android:visibility="invisible"
android:layout_gravity="center"/>
</LinearLayout>

View File

@ -593,5 +593,6 @@
<string name="scanItemUpload">Escanea artículo a subir</string>
<string name="messageUploadItem">Tienes que escanear el artículo para poder subirlo</string>
<string name="messageUpload">Sube la imagen al servidor</string>
<string name="selectImage">Seleccionar imagen</string>
</resources>

View File

@ -593,5 +593,6 @@
<string name="scanItemUpload">Escanea artículo a subir</string>
<string name="messageUploadItem">Tienes que escanear el artículo para poder subirlo</string>
<string name="messageUpload">Sube la imagen al servidor</string>
<string name="selectImage">Seleccionar imagen</string>
</resources>

View File

@ -593,5 +593,6 @@
<string name="scanItemUpload">Escanea artículo a subir</string>
<string name="messageUploadItem">Tienes que escanear el artículo para poder subirlo</string>
<string name="messageUpload">Sube la imagen al servidor</string>
<string name="selectImage">Seleccionar imagen</string>
</resources>

View File

@ -85,7 +85,7 @@
<dimen name="packaging_margin_main_menu">5dp</dimen>
<dimen name="itemcard_image_height">300dp</dimen>
<dimen name="itemcard_image">250dp</dimen>
<dimen name="itemcard_image_height_medium">200dp</dimen>
<dimen name="options_image_width">40dp</dimen>

View File

@ -592,4 +592,5 @@
<string name="scanItemUpload">Scan item upload</string>
<string name="messageUploadItem">Tienes que escanear el artículo para poder subirlo</string>
<string name="messageUpload">Sube la imagen al servidor</string>
<string name="selectImage">Seleccionar imagen</string>
</resources>