refs #5322 NaturePhotos
This commit is contained in:
parent
fd04b7b52f
commit
bdec030f66
|
@ -83,10 +83,23 @@
|
||||||
</select>
|
</select>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="version 23.22">
|
<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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/beta/release/output-metadata.json" beforeDir="false" afterPath="$PROJECT_DIR$/app/beta/release/output-metadata.json" 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/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" 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/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -184,7 +197,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="master" />
|
<entry key="$PROJECT_DIR$" value="4021-gestion_embalajes" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
@ -232,40 +245,40 @@
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
<option name="showMembers" value="true" />
|
<option name="showMembers" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ApkExportedModule": "Gestor_Almacén.app",
|
"ApkExportedModule": "Gestor_Almacén.app",
|
||||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||||
"PROJECT_TRUSTED_KEY": "true",
|
"PROJECT_TRUSTED_KEY": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4",
|
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4",
|
||||||
"android-custom-viewC:/Users/sergiodt/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_SELECTED": "RecyclerView",
|
"android-custom-viewC:/Users/sergiodt/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_SELECTED": "RecyclerView",
|
||||||
"cidr.known.project.marker": "true",
|
"cidr.known.project.marker": "true",
|
||||||
"com.developerphil.adbidea.selecteddevices": "21114523025303",
|
"com.developerphil.adbidea.selecteddevices": "21114523025303",
|
||||||
"com.google.services.firebase.aqiPopupShown": "true",
|
"com.google.services.firebase.aqiPopupShown": "true",
|
||||||
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
||||||
"project.structure.last.edited": "Modules",
|
"project.structure.last.edited": "Modules",
|
||||||
"project.structure.proportion": "0.17",
|
"project.structure.proportion": "0.17",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||||
"settings.editor.selected.configurable": "preferences.sourceCode.Shell Script"
|
"settings.editor.selected.configurable": "preferences.sourceCode.Shell Script"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"ExportApk.BuildVariants": [
|
"ExportApk.BuildVariants": [
|
||||||
"generalRelease"
|
"generalRelease"
|
||||||
],
|
],
|
||||||
"com.android.tools.idea.sqlite.queryhistory": [
|
"com.android.tools.idea.sqlite.queryhistory": [
|
||||||
"select * from expedition e where e.addressFk= 34915",
|
"select * from expedition e where e.addressFk= 34915",
|
||||||
"select * from expedition e where e.id= 6872921",
|
"select * from expedition e where e.id= 6872921",
|
||||||
"select count(*) from expeditionPending\n",
|
"select count(*) from expeditionPending\n",
|
||||||
"select count(*) from expedition\n",
|
"select count(*) from expedition\n",
|
||||||
"select count(*) from expedition"
|
"select count(*) from expedition"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="PsdUISettings">
|
<component name="PsdUISettings">
|
||||||
<option name="MODULE_TAB" value="Default Config" />
|
<option name="MODULE_TAB" value="Default Config" />
|
||||||
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
||||||
|
@ -872,12 +885,12 @@
|
||||||
<MESSAGE value="refs #5764 Añadir onclick pantalla Día de venta" />
|
<MESSAGE value="refs #5764 Añadir onclick pantalla Día de venta" />
|
||||||
<MESSAGE value="refs #5322 Nature" />
|
<MESSAGE value="refs #5322 Nature" />
|
||||||
<MESSAGE value="strings" />
|
<MESSAGE value="strings" />
|
||||||
<MESSAGE value="refs #5322 NaturePhotos" />
|
|
||||||
<MESSAGE value="Translation" />
|
<MESSAGE value="Translation" />
|
||||||
<MESSAGE value="refs #5513" />
|
<MESSAGE value="refs #5513" />
|
||||||
<MESSAGE value="refs #4678" />
|
<MESSAGE value="refs #4678" />
|
||||||
<MESSAGE value="refs #5713" />
|
<MESSAGE value="refs #5713" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="refs #5713" />
|
<MESSAGE value="refs #5322 NaturePhotos" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="refs #5322 NaturePhotos" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -895,16 +908,6 @@
|
||||||
<line>457</line>
|
<line>457</line>
|
||||||
<option name="timeStamp" value="3" />
|
<option name="timeStamp" value="3" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="kotlin-line">
|
|
||||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosFragment.kt</url>
|
|
||||||
<line>150</line>
|
|
||||||
<option name="timeStamp" value="8" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="kotlin-line">
|
|
||||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/photos/fragment/PhotosViewModel.kt</url>
|
|
||||||
<line>55</line>
|
|
||||||
<option name="timeStamp" value="9" />
|
|
||||||
</line-breakpoint>
|
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
<pin-to-top-manager>
|
<pin-to-top-manager>
|
||||||
|
|
|
@ -179,7 +179,6 @@ interface SalixService {
|
||||||
@Multipart
|
@Multipart
|
||||||
fun uploadImage(
|
fun uploadImage(
|
||||||
@Query ("collection") collection: String,
|
@Query ("collection") collection: String,
|
||||||
//@Query("fileName") file: String,
|
|
||||||
@Query("id") id: Int,
|
@Query("id") id: Int,
|
||||||
@Part filePart: MultipartBody.Part,
|
@Part filePart: MultipartBody.Part,
|
||||||
):
|
):
|
||||||
|
|
|
@ -238,6 +238,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
||||||
|
|
||||||
R.drawable.camion ->getString(R.string.openLoadingConsignee)
|
R.drawable.camion ->getString(R.string.openLoadingConsignee)
|
||||||
R.drawable.exit ->getString(R.string.exitScreen)
|
R.drawable.exit ->getString(R.string.exitScreen)
|
||||||
|
R.drawable.ic_image_upload->getString(R.string.messageUpload)
|
||||||
|
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|
|
@ -190,7 +190,7 @@ class ItemCardFragment(
|
||||||
private fun getItemCard(itemFk: String) {
|
private fun getItemCard(itemFk: String) {
|
||||||
warehouseFk = getDataInt(WAREHOUSEFK)
|
warehouseFk = getDataInt(WAREHOUSEFK)
|
||||||
binding.splashProgressTwo.visibility = View.VISIBLE
|
binding.splashProgressTwo.visibility = View.VISIBLE
|
||||||
viewModel.getItemCard(itemFk, warehouseFk!!)
|
viewModel.getItemCard(itemFk.toInt(), warehouseFk!!)
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,13 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposalList
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposalList
|
||||||
|
import okhttp3.MediaType
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.RequestBody
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
@ -39,7 +45,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
|
||||||
fun getItemCard(
|
fun getItemCard(
|
||||||
itemFk: String,
|
itemFk: Int,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
|
@ -304,4 +310,39 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private val _responseinsert by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
val responseinsert: LiveData<ResponseItemVO>
|
||||||
|
get() = _responseinsert
|
||||||
|
|
||||||
|
|
||||||
|
fun uploadPhoto(
|
||||||
|
urlImage:String,
|
||||||
|
itemFK:Int,
|
||||||
|
file: File = File("$urlImage"),
|
||||||
|
fileRequestBody: RequestBody = RequestBody.create(MediaType.parse("image/jpeg"), file),
|
||||||
|
filePart: MultipartBody.Part = MultipartBody.Part.createFormData("file", file.name, fileRequestBody),
|
||||||
|
) {
|
||||||
|
salix.uploadImage("catalog",itemFK,filePart)
|
||||||
|
.enqueue(object : SilexCallback<Any>(context) {
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
_responseinsert.value = ResponseItemVO(
|
||||||
|
isError = true,
|
||||||
|
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
_responseinsert.value = ResponseItemVO(
|
||||||
|
isError = false
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.login.activity
|
package es.verdnatura.presentation.view.feature.login.activity
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ActivityLoginBinding
|
import es.verdnatura.databinding.ActivityLoginBinding
|
||||||
import es.verdnatura.presentation.base.BaseActivity
|
import es.verdnatura.presentation.base.BaseActivity
|
||||||
|
@ -9,39 +10,26 @@ import es.verdnatura.presentation.common.addFragment
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginFragment
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
|
||||||
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
|
||||||
|
|
||||||
|
class LoginActivity : BaseActivity<ActivityLoginBinding>() {
|
||||||
|
private var imageUri: Uri? = null
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.activity_login
|
override fun getLayoutId(): Int = R.layout.activity_login
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
/* val intent = intent
|
val intent = intent
|
||||||
val action = intent.action
|
val action = intent.action
|
||||||
val type = intent.type*/
|
val type = intent.type
|
||||||
/* val crashButton = Button(this)
|
|
||||||
crashButton.text = "Crash!"
|
|
||||||
crashButton.setOnClickListener {
|
|
||||||
throw RuntimeException("Test Crash") // Force a crash
|
|
||||||
}
|
|
||||||
|
|
||||||
addContentView(crashButton, ViewGroup.LayoutParams(
|
//Tarea 5322
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT))*/
|
|
||||||
|
|
||||||
//goToMain()
|
|
||||||
/*Tarea 5322
|
|
||||||
if (Intent.ACTION_SEND == action && type?.startsWith("image/") == true) {
|
if (Intent.ACTION_SEND == action && type?.startsWith("image/") == true) {
|
||||||
val imageUri: Uri? = intent.getParcelableExtra(Intent.EXTRA_STREAM)
|
val clipData = intent.clipData
|
||||||
imageUri?.let {
|
if (clipData != null) {
|
||||||
// Aquí puedes procesar la imagen recibida
|
imageUri = clipData.getItemAt(0).uri
|
||||||
// por ejemplo, mostrarla en una ImageView
|
}
|
||||||
val imageView: ImageView = findViewById(R.id.imageView)
|
|
||||||
imageView.setImageURI(imageUri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
addFragment(LoginFragment.newInstance(imageUri), R.id.main_frame_layout, LoginFragment.TAG)
|
||||||
|
|
||||||
addFragment(LoginFragment.newInstance(), R.id.main_frame_layout, LoginFragment.TAG)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goToMain() {
|
fun goToMain() {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.Log.d
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -34,7 +33,8 @@ import java.util.*
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
class LoginFragment(var imageUri: Uri?) :
|
||||||
|
BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||||
|
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
private lateinit var customNewForm: CustomDialogInputThreeValues
|
private lateinit var customNewForm: CustomDialogInputThreeValues
|
||||||
|
@ -42,13 +42,15 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private lateinit var listForms: List<WorkForms>
|
private lateinit var listForms: List<WorkForms>
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance() = LoginFragment()
|
fun newInstance(imageUri: Uri?) = LoginFragment(imageUri)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_login
|
override fun getLayoutId(): Int = R.layout.fragment_login
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
@ -63,8 +65,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
password = binding.edittextPassword.text.toString()
|
password = binding.edittextPassword.text.toString()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (imageUri != null && getData(TOKEN).isNotBlank()) {
|
||||||
|
goToMain()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.textviewRememberPassword.setOnClickListener {
|
binding.textviewRememberPassword.setOnClickListener {
|
||||||
|
@ -271,7 +276,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
openURL.data =
|
openURL.data =
|
||||||
Uri.parse(it.url)
|
Uri.parse(it.url)
|
||||||
startActivity(openURL)
|
startActivity(openURL)
|
||||||
} catch (ex:Exception) {
|
} catch (ex: Exception) {
|
||||||
getString(R.string.problemUpdate).toast(requireActivity())
|
getString(R.string.problemUpdate).toast(requireActivity())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,6 +522,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
||||||
|
|
||||||
private fun goToMain() {
|
private fun goToMain() {
|
||||||
val intent = Intent(activity, MainActivity::class.java)
|
val intent = Intent(activity, MainActivity::class.java)
|
||||||
|
intent.data = imageUri
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
|
|
|
@ -5,6 +5,7 @@ package es.verdnatura.presentation.view.feature.main.activity
|
||||||
import PhotosFragment
|
import PhotosFragment
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
|
import android.net.Uri
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
@ -18,7 +19,6 @@ import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseActivity
|
import es.verdnatura.presentation.base.BaseActivity
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
import es.verdnatura.presentation.testing.testPrint
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||||
|
@ -65,9 +65,9 @@ import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationC
|
||||||
import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationFragment
|
import es.verdnatura.presentation.view.feature.reubication.fragment.ReubicationFragment
|
||||||
import es.verdnatura.presentation.view.feature.reubication.model.Reubication
|
import es.verdnatura.presentation.view.feature.reubication.model.Reubication
|
||||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketFragment
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment
|
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment
|
||||||
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketFragment
|
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeFragment
|
import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeFragment
|
||||||
|
@ -108,6 +108,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
private fun setFragments() {
|
private fun setFragments() {
|
||||||
try {
|
try {
|
||||||
val extras = intent.extras
|
val extras = intent.extras
|
||||||
|
val uriImage = intent.data
|
||||||
|
|
||||||
|
|
||||||
if (extras != null && extras.containsKey("menu")) {
|
if (extras != null && extras.containsKey("menu")) {
|
||||||
comeFromDelivery = true
|
comeFromDelivery = true
|
||||||
val option = extras.getString("menu")
|
val option = extras.getString("menu")
|
||||||
|
@ -143,7 +146,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
), getString(R.string.titleInfo)
|
), getString(R.string.titleInfo)
|
||||||
)
|
)
|
||||||
"summary"->{
|
"summary" -> {
|
||||||
|
|
||||||
onPasillerosItemClickListener(
|
onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
|
@ -155,10 +158,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
R.string.titleDeliverySummary
|
R.string.titleDeliverySummary
|
||||||
)
|
)
|
||||||
|
|
||||||
),extras.getString("route").toString()
|
), extras.getString("route").toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"unload"->{
|
"unload" -> {
|
||||||
onPasillerosItemClickListener(
|
onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
30,
|
30,
|
||||||
|
@ -189,10 +192,28 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
AjustesFragment.TAG,
|
AjustesFragment.TAG,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if (uriImage != null && uriImage is Uri) {
|
||||||
|
onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
30,
|
||||||
|
R.drawable.photo_camera,
|
||||||
|
getString(R.string.titlePhotos),
|
||||||
|
R.string.titlePhotos,
|
||||||
|
getString(
|
||||||
|
R.string.titlePhotosDescrip
|
||||||
|
)
|
||||||
|
|
||||||
|
), uriImage.toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
getString(R.string.error).toast(this)
|
getString(R.string.error).toast(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun haveSector(): Boolean {
|
fun haveSector(): Boolean {
|
||||||
|
@ -674,7 +695,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.titleLoadTruck) -> {
|
getString(R.string.titleLoadTruck) -> {
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
LoadUnloadFragment.newInstance(item.title, "ON DELIVERY",entryPoint),
|
LoadUnloadFragment.newInstance(item.title, "ON DELIVERY", entryPoint),
|
||||||
if (comeFromDelivery == true) {
|
if (comeFromDelivery == true) {
|
||||||
getString(R.string.titleLoadTruck)
|
getString(R.string.titleLoadTruck)
|
||||||
} else {
|
} else {
|
||||||
|
@ -687,7 +708,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
getString(R.string.titleUnLoadTruck) -> {
|
getString(R.string.titleUnLoadTruck) -> {
|
||||||
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
LoadUnloadFragment.newInstance(item.title, "DELIVERED",entryPoint),
|
LoadUnloadFragment.newInstance(item.title, "DELIVERED", entryPoint),
|
||||||
if (comeFromDelivery == true) {
|
if (comeFromDelivery == true) {
|
||||||
getString(R.string.titleUnLoadTruck)
|
getString(R.string.titleUnLoadTruck)
|
||||||
} else {
|
} else {
|
||||||
|
@ -700,7 +721,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
getString(R.string.titleDeliverySummary) -> {
|
getString(R.string.titleDeliverySummary) -> {
|
||||||
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
SummaryFragment.newInstance(item.title, "ON DELIVERY",entryPoint.toInt()),
|
SummaryFragment.newInstance(item.title, "ON DELIVERY", entryPoint.toInt()),
|
||||||
if (comeFromDelivery == true) {
|
if (comeFromDelivery == true) {
|
||||||
getString(R.string.titleDeliverySummary)
|
getString(R.string.titleDeliverySummary)
|
||||||
} else {
|
} else {
|
||||||
|
@ -712,12 +733,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.titlePhotos) -> {
|
getString(R.string.titlePhotos) -> {
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
PhotosFragment.newInstance(item.title))
|
PhotosFragment.newInstance(item.title, entryPoint)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.testing) -> {
|
getString(R.string.testing) -> {
|
||||||
addFragmentOnTop(
|
// addFragmentOnTop(
|
||||||
PhotosFragment.newInstance(item.title))
|
// PhotosFragment.newInstance(item.title))
|
||||||
//addFragmentOnTop(testPrint.newInstance(item.title))
|
//addFragmentOnTop(testPrint.newInstance(item.title))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -923,7 +945,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
mpErrorRepeat?.start()
|
mpErrorRepeat?.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
||||||
R.string.titlePackaging,
|
R.string.titlePackaging,
|
||||||
contextApp.getString(R.string.titlePackagingDescrip)
|
contextApp.getString(R.string.titlePackagingDescrip)
|
||||||
)
|
)
|
||||||
)
|
)*/
|
||||||
|
//Tarea 5322
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
6,
|
6,
|
||||||
|
@ -519,7 +520,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
||||||
R.string.titlePhotos,
|
R.string.titlePhotos,
|
||||||
contextApp.getString(R.string.titlePhotos)
|
contextApp.getString(R.string.titlePhotos)
|
||||||
)
|
)
|
||||||
)*/
|
)
|
||||||
|
|
||||||
val working_in_test=false
|
val working_in_test=false
|
||||||
if (working_in_test){
|
if (working_in_test){
|
||||||
|
|
|
@ -1,47 +1,50 @@
|
||||||
|
import android.app.Activity.RESULT_OK
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.view.View
|
import android.provider.MediaStore
|
||||||
import android.view.View.*
|
import android.view.View.*
|
||||||
import android.widget.ImageView
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.annotation.RequiresApi
|
import android.widget.ImageView
|
||||||
import androidx.lifecycle.Observer
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.core.net.toUri
|
||||||
import es.verdnatura.R
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.databinding.FragmentPhotosBinding
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding
|
import es.verdnatura.databinding.FragmentPhotosBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.loadUrl
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
import es.verdnatura.presentation.view.feature.photos.fragment.PhotosViewModel
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
|
|
||||||
class PhotosFragment(
|
class PhotosFragment(
|
||||||
var title: String
|
var title: String,
|
||||||
) : BaseFragment<FragmentPhotosBinding, PhotosViewModel>(
|
var uriImage: Uri?
|
||||||
PhotosViewModel::class
|
) : BaseFragment<FragmentPhotosBinding, ItemCardViewModel>(
|
||||||
) {
|
ItemCardViewModel::class
|
||||||
|
) {
|
||||||
|
private val PICK_IMAGE_REQUEST = 1
|
||||||
|
private val REQUEST_IMAGE_CAPTURE = 2
|
||||||
|
private val imageUri: Uri? = null
|
||||||
|
private var originalItem = 0
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_photos
|
override fun getLayoutId(): Int = R.layout.fragment_photos
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String) = PhotosFragment(title)
|
fun newInstance(title: String, uriImage: String) = PhotosFragment(title, uriImage.toUri())
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
@ -50,10 +53,16 @@
|
||||||
binding.splashProgress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
setEvents()
|
setEvents()
|
||||||
setToolBar()
|
setToolBar()
|
||||||
upLoadPhoto()
|
setImage()
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setImage() {
|
||||||
|
if (uriImage != null) {
|
||||||
|
binding.itemcardImage.setImageURI(uriImage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
|
@ -62,63 +71,79 @@
|
||||||
binding.mainToolbar.backButton.visibility = VISIBLE
|
binding.mainToolbar.backButton.visibility = VISIBLE
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
val iconPhone = ImageView(context)
|
val iconPhoto = ImageView(context)
|
||||||
iconPhone.setImageResource(R.drawable.phone_call)
|
val iconSend = ImageView(context)
|
||||||
|
iconSend.setImageResource(R.drawable.ic_image_upload)
|
||||||
|
iconPhoto.setImageResource(R.drawable.ef_ic_camera_white)
|
||||||
|
|
||||||
|
iconPhoto.tooltipText = getTooltip(R.drawable.ef_ic_camera_white)
|
||||||
|
iconSend.tooltipText = getTooltip(R.drawable.ic_image_upload)
|
||||||
|
|
||||||
|
listIcons.add(iconPhoto)
|
||||||
|
listIcons.add(iconSend)
|
||||||
|
|
||||||
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
|
|
||||||
listIcons.add(iconPhone)
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
iconPhone.drawable -> upLoadPhoto()
|
iconPhoto.drawable -> getPhoto()
|
||||||
|
iconSend.drawable -> upLoadPhoto()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getPhoto() {
|
||||||
|
pickImage()
|
||||||
private fun loadImage() {
|
|
||||||
|
|
||||||
// binding.splashProgress.visibility = VISIBLE
|
|
||||||
|
|
||||||
binding.userImage.loadUrl(
|
|
||||||
getData("base_urlSalix") + "/api/Images/user/160x160/19591/download?access_token=${
|
|
||||||
getData(
|
|
||||||
TOKEN
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
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())
|
||||||
|
{
|
||||||
|
|
||||||
|
originalItem = itemScanValue(
|
||||||
|
binding.editItemFk.text.toString(),
|
||||||
|
"buy",
|
||||||
|
"more"
|
||||||
|
).toString().toInt()
|
||||||
|
|
||||||
|
try {
|
||||||
|
binding.splashProgress.visibility = VISIBLE
|
||||||
|
viewModel.getItemCard(
|
||||||
|
originalItem, getDataInt(WAREHOUSEFK)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Ex: Exception) {
|
||||||
|
ma.messageWithSound(Ex.message.toString(), true, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.editItemFk.setText("")
|
||||||
|
ma.hideKeyboard(binding.editItemFk)
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.editItemFk.requestFocus()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
responseinsert.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
responseinsert.observe(viewLifecycleOwner, Observer {
|
|
||||||
|
|
||||||
binding.splashProgress.visibility = GONE
|
binding.splashProgress.visibility = GONE
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
it.errorMessage + getString(R.string.user) + title,
|
it.errorMessage + getString(R.string.user) + title,
|
||||||
|
@ -130,11 +155,31 @@
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
getString(R.string.itemUpdated),
|
getString(R.string.itemUpdated),
|
||||||
isError = it.isError,
|
isError = it.isError,
|
||||||
true, isToasted = null,
|
true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
}
|
||||||
|
itemcard.observe(viewLifecycleOwner) {
|
||||||
|
binding.splashProgress.visibility = GONE
|
||||||
|
if (it.isError) {
|
||||||
|
ma.messageWithSound(it.errorMessage, true, false)
|
||||||
|
} else {
|
||||||
|
if (it.id != 0) {
|
||||||
|
binding.itemData.text = "${it.id}: ${it.longName}"
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.itemNotFound),
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
getString(R.string.noResults)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,15 +187,18 @@
|
||||||
|
|
||||||
private fun upLoadPhoto() {
|
private fun upLoadPhoto() {
|
||||||
|
|
||||||
val drawable = binding.userImage.drawable
|
if (binding.itemData.text.isNullOrEmpty()) {
|
||||||
|
getString(R.string.messageUploadItem).toast(requireContext()).show()
|
||||||
|
} else {
|
||||||
|
val drawable = binding.itemcardImage.drawable
|
||||||
if (drawable is BitmapDrawable) {
|
if (drawable is BitmapDrawable) {
|
||||||
val bitmap = drawable.bitmap
|
val bitmap = drawable.bitmap
|
||||||
|
binding.splashProgress.visibility=VISIBLE
|
||||||
println("Ruta"+saveBitmapAsTempFile(requireContext(),bitmap))
|
viewModel.uploadPhoto(itemFK = originalItem, urlImage = saveBitmapAsTempFile(requireContext(), bitmap))
|
||||||
|
|
||||||
viewModel.uploadPhoto(saveBitmapAsTempFile(requireContext(),bitmap))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun saveBitmapAsTempFile(context: Context, bitmap: Bitmap): String {
|
fun saveBitmapAsTempFile(context: Context, bitmap: Bitmap): String {
|
||||||
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
|
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
|
||||||
val fileName = "IMG_$timeStamp.jpg"
|
val fileName = "IMG_$timeStamp.jpg"
|
||||||
|
@ -168,4 +216,27 @@
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun pickImage() {
|
||||||
|
val pickIntent = Intent(Intent.ACTION_PICK)
|
||||||
|
pickIntent.type = "image/*"
|
||||||
|
val captureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
||||||
|
val chooserIntent = Intent.createChooser(pickIntent, "Seleccionar imagen")
|
||||||
|
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) {
|
||||||
|
// Imagen seleccionada desde la galería
|
||||||
|
binding.itemcardImage.setImageURI(data.data)
|
||||||
|
} else {
|
||||||
|
// Imagen cámara
|
||||||
|
var uri = saveBitmapAsTempFile(requireContext(),data?.extras?.get("data") as Bitmap).toUri()
|
||||||
|
binding.itemcardImage.setImageURI(uri)
|
||||||
|
//binding.itemcardImage.setImageBitmap(data?.extras?.get("data") as? Bitmap?)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960"
|
||||||
|
android:tint="#FFF">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M250,800Q164,800 102,738Q40,676 40,590Q40,512 89.5,452.5Q139,393 217,381Q237,284 311,222.5Q385,161 482,161Q595,161 671.5,242.5Q748,324 748,438L748,462L748,462Q820,460 870,508.5Q920,557 920,631Q920,700 870,750Q820,800 751,800L510,800Q486,800 468,782Q450,764 450,740L450,482L367,565L324,522L480,366L636,522L593,565L510,482L510,740Q510,740 510,740Q510,740 510,740L751,740Q796,740 828,708Q860,676 860,631Q860,586 828,554Q796,522 751,522L688,522L688,438Q688,349 627.5,285Q567,221 478,221Q389,221 328,285Q267,349 267,438L248,438Q186,438 143,481.5Q100,525 100,589Q100,651 143.93,695.5Q187.86,740 250,740L390,740L390,800L250,800ZM480,510L480,510L480,510Q480,510 480,510Q480,510 480,510L480,510L480,510Q480,510 480,510Q480,510 480,510L480,510Q480,510 480,510Q480,510 480,510L480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510L480,510L480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510L480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510Q480,510 480,510L480,510L480,510Z"/>
|
||||||
|
</vector>
|
|
@ -1,59 +1,74 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:id="@+id/itemcard_layout"
|
android:id="@+id/scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/name_item"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:orientation="vertical" >
|
||||||
android:layout_marginTop="@dimen/toolbar_height"
|
|
||||||
android:hint="Item"
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_itemFk"
|
||||||
|
style="@style/ScanLineTextSearch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:hint="@string/scanItemUpload"
|
||||||
|
android:inputType="text"
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/h5"
|
android:textColorHint="@color/verdnatura_white"
|
||||||
android:textStyle="bold" />
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/itemcard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/user_image"
|
android:id="@+id/itemcard_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/itemcard_image_height"
|
android:layout_height="@dimen/itemcard_image_height"
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/camion"
|
android:src="@drawable/loadphoto"
|
||||||
app:srcCompat="@drawable/alpha_b_circle_outline" />
|
android:layout_margin="@dimen/item_image_width_min"/>
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
|
android:id="@+id/item_data"
|
||||||
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:gravity="center"
|
||||||
android:layout_margin="10dp"
|
android:inputType="text"
|
||||||
android:layout_marginBottom="@dimen/layout_margin_min"
|
android:textSize="@dimen/body1"
|
||||||
android:orientation="vertical"
|
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||||
android:padding="@dimen/layout_margin_min">
|
android:textColorHint="@color/verdnatura_white"
|
||||||
|
android:layout_margin="@dimen/ef_margin_medium"
|
||||||
|
/>
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/main_toolbar"
|
android:id="@+id/main_toolbar"
|
||||||
|
@ -63,18 +78,19 @@
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/splash_progress"
|
android:id="@+id/splash_progress"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/verdnatura_black_8_alpha_6"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone"
|
android:background="@color/verdnatura_black_8_alpha_6"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
|
||||||
|
@ -87,5 +103,7 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -229,7 +229,7 @@
|
||||||
<string name="operation">Operación </string>
|
<string name="operation">Operación </string>
|
||||||
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
||||||
<string name="confirm">Confirmar acción</string>
|
<string name="confirm">Confirmar acción</string>
|
||||||
<string name="scanItem">Escanea un item</string>
|
<string name="scanItem">Escanea un artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición.</string>
|
||||||
|
@ -590,5 +590,8 @@
|
||||||
<string name="checkItemShelving">¿Desea resetear la revisión del carro?</string>
|
<string name="checkItemShelving">¿Desea resetear la revisión del carro?</string>
|
||||||
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
||||||
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
||||||
|
<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>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -229,7 +229,7 @@
|
||||||
<string name="operation">Operación </string>
|
<string name="operation">Operación </string>
|
||||||
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
||||||
<string name="confirm">Confirmar acción</string>
|
<string name="confirm">Confirmar acción</string>
|
||||||
<string name="scanItem">Escanea un item</string>
|
<string name="scanItem">Escanear artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición.</string>
|
||||||
|
@ -590,5 +590,8 @@
|
||||||
<string name="checkItemShelving">Souhaitez-vous supprimer la révision de la voiture?</string>
|
<string name="checkItemShelving">Souhaitez-vous supprimer la révision de la voiture?</string>
|
||||||
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
||||||
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
||||||
|
<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>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -229,7 +229,7 @@
|
||||||
<string name="operation">Operación </string>
|
<string name="operation">Operación </string>
|
||||||
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
<string name="closeOdrder">¿Estás seguro de cerrar el pedido?</string>
|
||||||
<string name="confirm">Confirmar acción</string>
|
<string name="confirm">Confirmar acción</string>
|
||||||
<string name="scanItem">Escanea un item</string>
|
<string name="scanItem">Escanear artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición.</string>
|
||||||
|
@ -590,5 +590,8 @@
|
||||||
<string name="checkItemShelving">Você deseja excluir a revisão do carro?</string>
|
<string name="checkItemShelving">Você deseja excluir a revisão do carro?</string>
|
||||||
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
<string name="item_checking">Al pulsar permite resetear la revisión</string>
|
||||||
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
<string name="checkItemShelvingDescrip">Revisión del carro</string>
|
||||||
|
<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>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -589,5 +589,7 @@
|
||||||
<string name="checkItemShelving">Do you want to delete the shelving review?</string>
|
<string name="checkItemShelving">Do you want to delete the shelving review?</string>
|
||||||
<string name="item_checking">By pressing it allows resetting the review</string>
|
<string name="item_checking">By pressing it allows resetting the review</string>
|
||||||
<string name="checkItemShelvingDescrip">Shelving checking</string>
|
<string name="checkItemShelvingDescrip">Shelving checking</string>
|
||||||
|
<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>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue