refs #5135
This commit is contained in:
parent
5fa4e29c51
commit
fe98c3f9fb
|
@ -11,7 +11,7 @@
|
||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 242,
|
"versionCode": 245,
|
||||||
"versionName": "23.48Beta",
|
"versionName": "23.48Beta",
|
||||||
"outputFile": "app-beta-release.apk"
|
"outputFile": "app-beta-release.apk"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,32 +2,44 @@ package es.verdnatura
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.graphics.Color
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import es.verdnatura.di.viewModelModule
|
import es.verdnatura.di.viewModelModule
|
||||||
import es.verdnatura.domain.RestClient
|
import es.verdnatura.domain.RestClient
|
||||||
import es.verdnatura.domain.SalixService
|
import es.verdnatura.domain.SalixService
|
||||||
import es.verdnatura.domain.VerdnaturaService
|
import es.verdnatura.domain.VerdnaturaService
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
|
import es.verdnatura.presentation.common.InteceptorListener
|
||||||
|
import es.verdnatura.presentation.common.MainActivityListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
||||||
import org.koin.android.ext.koin.androidContext
|
import org.koin.android.ext.koin.androidContext
|
||||||
import org.koin.core.context.loadKoinModules
|
import org.koin.core.context.loadKoinModules
|
||||||
import org.koin.core.context.startKoin
|
import org.koin.core.context.startKoin
|
||||||
|
|
||||||
class MobileApplication : Application() {
|
class MobileApplication : Application(), InteceptorListener {
|
||||||
|
private lateinit var interceptoreListener: InteceptorListener
|
||||||
|
private var mainActivityListener: MainActivityListener? = null
|
||||||
|
fun setMainListener(listener: MainActivityListener) {
|
||||||
|
mainActivityListener = listener
|
||||||
|
}
|
||||||
|
|
||||||
lateinit var silex: VerdnaturaService
|
lateinit var silex: VerdnaturaService
|
||||||
lateinit var salix: SalixService
|
lateinit var salix: SalixService
|
||||||
var userId: Int? = null
|
var userId: Int? = null
|
||||||
var userName: String? = null
|
var userName: String? = null
|
||||||
var renewPeriod:Long = 0
|
var renewPeriod: Long = 0
|
||||||
var renewInterval:Long = 0
|
var renewInterval: Long = 0
|
||||||
var userPassword: String? = null
|
var userPassword: String? = null
|
||||||
var hasNetwork:Boolean = true
|
var hasNetwork: Boolean = true
|
||||||
var serialNumber:String = ""
|
var serialNumber: String = ""
|
||||||
var versionName:String = ""
|
var versionName: String = ""
|
||||||
var androidId:String = ""
|
var androidId: String = ""
|
||||||
var mperror: MediaPlayer? = null
|
var mperror: MediaPlayer? = null
|
||||||
var mpok: MediaPlayer? = null
|
var mpok: MediaPlayer? = null
|
||||||
private lateinit var customDialog: CustomDialogMainActivity
|
private lateinit var customDialog: CustomDialogMainActivity
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
protected val PREFS_USER = "es.verdnatura.user.prefs"
|
protected val PREFS_USER = "es.verdnatura.user.prefs"
|
||||||
|
|
||||||
|
@ -41,7 +53,7 @@ class MobileApplication : Application() {
|
||||||
loadKoinModules(moduleList)
|
loadKoinModules(moduleList)
|
||||||
}
|
}
|
||||||
|
|
||||||
var restClient = RestClient(this)
|
var restClient = RestClient(this, this)
|
||||||
silex = restClient.restClient
|
silex = restClient.restClient
|
||||||
salix = restClient.salixClient
|
salix = restClient.salixClient
|
||||||
}
|
}
|
||||||
|
@ -50,6 +62,7 @@ class MobileApplication : Application() {
|
||||||
val prefs: SharedPreferences = getSharedPreferences(PREFS_USER, 0)
|
val prefs: SharedPreferences = getSharedPreferences(PREFS_USER, 0)
|
||||||
return prefs.edit()
|
return prefs.edit()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPrefsShared(): SharedPreferences {
|
fun getPrefsShared(): SharedPreferences {
|
||||||
return getSharedPreferences(PREFS_USER, 0)
|
return getSharedPreferences(PREFS_USER, 0)
|
||||||
}
|
}
|
||||||
|
@ -58,4 +71,24 @@ class MobileApplication : Application() {
|
||||||
if (bool) mpok!!.start() else mperror!!.start()
|
if (bool) mpok!!.start() else mperror!!.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun messageToast(isError: Boolean, message:String) {
|
||||||
|
val playSound = when (isError) {
|
||||||
|
null -> null
|
||||||
|
false -> mpok
|
||||||
|
true -> mperror
|
||||||
|
}
|
||||||
|
playSound?.start()
|
||||||
|
message.toast(this,color = Color.RED)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInterceptionResult(visibility: Int) {
|
||||||
|
if (mainActivityListener != null) {
|
||||||
|
handler.post {
|
||||||
|
val mainActivityListener = this.mainActivityListener
|
||||||
|
mainActivityListener?.onApplicationEventAnimation(visibility)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ package es.verdnatura.domain
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
|
import es.verdnatura.presentation.common.InteceptorListener
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
@ -10,14 +11,12 @@ import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class ApiSalixUtils {
|
class ApiSalixUtils {
|
||||||
companion object {
|
companion object {
|
||||||
//const val BASE_URL:String = "http://192.168.1.155:9009/"
|
|
||||||
//const val BASE_URL: String = "https://test-salix.verdnatura.es/api/"
|
|
||||||
const val BASE_URL: String = "https://salix.verdnatura.es"
|
const val BASE_URL: String = "https://salix.verdnatura.es"
|
||||||
|
|
||||||
fun getApiService(context: Context): SalixService {
|
fun getApiService(context: Context,myObserver: InteceptorListener?): SalixService {
|
||||||
|
|
||||||
var salixClient = OkHttpClient.Builder()
|
var salixClient = OkHttpClient.Builder()
|
||||||
.addInterceptor(SalixInterceptor(context))
|
.addInterceptor(SalixInterceptor(context, myObserver))
|
||||||
.connectTimeout(10, TimeUnit.SECONDS)
|
.connectTimeout(10, TimeUnit.SECONDS)
|
||||||
.writeTimeout(10, TimeUnit.SECONDS)
|
.writeTimeout(10, TimeUnit.SECONDS)
|
||||||
.readTimeout(40, TimeUnit.SECONDS)
|
.readTimeout(40, TimeUnit.SECONDS)
|
||||||
|
@ -39,7 +38,6 @@ class ApiSalixUtils {
|
||||||
GsonConverterFactory.create(GsonBuilder().serializeNulls().create() )
|
GsonConverterFactory.create(GsonBuilder().serializeNulls().create() )
|
||||||
).build()
|
).build()
|
||||||
|
|
||||||
//d("VERDNATURA::","El server Salix es "+getBaseUrlLocal(context = context))
|
|
||||||
return salixRetrofit.create(SalixService::class.java)
|
return salixRetrofit.create(SalixService::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import es.verdnatura.presentation.common.InteceptorListener
|
||||||
|
|
||||||
open class RestClient(context: Context) {
|
open class RestClient(context: Context, myObserver: InteceptorListener? = null) {
|
||||||
var restClient: VerdnaturaService
|
var restClient: VerdnaturaService
|
||||||
var salixClient: SalixService
|
var salixClient: SalixService
|
||||||
|
|
||||||
init {
|
init {
|
||||||
restClient = ApiUtils.getApiService(context)
|
restClient = ApiUtils.getApiService(context)
|
||||||
salixClient = ApiSalixUtils.getApiService(context)
|
salixClient = ApiSalixUtils.getApiService(context, myObserver)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -53,9 +54,9 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun defaultErrorHandler(t: Throwable) {
|
private fun defaultErrorHandler(t: Throwable) {
|
||||||
println("ErrorSalixx${t.message}")
|
//println("ErrorSalixx${t.message}")
|
||||||
(nameofFunction((this)) + t.message).toast(context)
|
// (nameofFunction((this)) + t.message).toast(context)
|
||||||
//(context as MobileApplication).playSoundIsOK(false)
|
(context as MobileApplication).messageToast(true, (nameofFunction((this)) + t.message))
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onSuccess(response: Response<T>) {
|
open fun onSuccess(response: Response<T>) {
|
||||||
|
|
|
@ -2,24 +2,21 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.util.Log.d
|
import android.view.View
|
||||||
|
import es.verdnatura.presentation.common.InteceptorListener
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class SalixInterceptor : Interceptor {
|
class SalixInterceptor(private val context: Context, private val listener: InteceptorListener?) :
|
||||||
private var context: Context
|
Interceptor {
|
||||||
|
|
||||||
constructor(context: Context) {
|
|
||||||
this.context = context
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
override fun intercept(chain: Interceptor.Chain, ): Response {
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
|
||||||
val prefs: SharedPreferences =
|
val prefs: SharedPreferences =
|
||||||
this.context.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
this.context.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||||
val request = chain.request()
|
var request = chain.request()
|
||||||
//sergio: condición para que añada o no headers según se vaya quitando de las llamadas
|
//sergio: condición para que añada o no headers según se vaya quitando de las llamadas
|
||||||
//no quitar condición hasta que estén quitados
|
//no quitar condición hasta que estén quitados
|
||||||
if (request.headers().toString().isEmpty()) {
|
if (request.headers().toString().isEmpty()) {
|
||||||
|
@ -27,10 +24,14 @@ class SalixInterceptor : Interceptor {
|
||||||
.addHeader("Content-Type", "application/json")
|
.addHeader("Content-Type", "application/json")
|
||||||
.addHeader("Authorization", prefs.getString("token", ""))
|
.addHeader("Authorization", prefs.getString("token", ""))
|
||||||
.build()
|
.build()
|
||||||
|
request = newRequest
|
||||||
return chain.proceed(newRequest)
|
}
|
||||||
} else
|
if (request.url().toString().contains("renew")){
|
||||||
return chain.proceed(request)
|
return chain.proceed(request)
|
||||||
|
}else{
|
||||||
|
listener!!.onInterceptionResult(View.VISIBLE)
|
||||||
|
val response = chain.proceed(request)
|
||||||
|
listener!!.onInterceptionResult(View.INVISIBLE)
|
||||||
|
return response }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,11 @@ interface SalixService {
|
||||||
@Query("params") params: Any? = null
|
@Query("params") params: Any? = null
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("Applications/itemShelvingSale_setQuantity/execute-proc")
|
||||||
|
fun itemShelvingSaleSetquantitySalix(
|
||||||
|
@Query("schema") schema: String = "vn",
|
||||||
|
@Query("params") params: Any? = null
|
||||||
|
): Call<Any>
|
||||||
@POST("Applications/collection_addWithReservation/execute-proc")
|
@POST("Applications/collection_addWithReservation/execute-proc")
|
||||||
fun collectionAddWithReservation(
|
fun collectionAddWithReservation(
|
||||||
@Query("schema") schema: String = "vn",
|
@Query("schema") schema: String = "vn",
|
||||||
|
@ -722,7 +727,7 @@ interface SalixService {
|
||||||
): Call<Unit>
|
): Call<Unit>
|
||||||
|
|
||||||
@POST("ItemShelvingSales/itemShelvingSaleSetQuantity")
|
@POST("ItemShelvingSales/itemShelvingSaleSetQuantity")
|
||||||
fun itemShelvingsConfirmRerserved(
|
fun itemShelvingSaleSetQuantity(
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import es.verdnatura.MobileApplication
|
|
||||||
import okhttp3.FormBody
|
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.RequestBody
|
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
|
@ -23,22 +20,37 @@ class SilexInterceptor : Interceptor {
|
||||||
val prefs: SharedPreferences =
|
val prefs: SharedPreferences =
|
||||||
this.context.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
this.context.getSharedPreferences("es.verdnatura.user.prefs", 0)
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
//sergio: condición para que añada o no headers según se vaya quitando de las llamadas
|
|
||||||
//no quitar condición hasta que estén quitados
|
|
||||||
//Tarea 5486 se añade Authorization, más adelante ver de quitar.
|
|
||||||
if (request.headers().toString().isEmpty()) {
|
if (request.headers().toString().isEmpty()) {
|
||||||
val newRequest = request.newBuilder()
|
val newRequest = request.newBuilder()
|
||||||
.addHeader("aplicacion", "json")
|
.addHeader("aplicacion", "json")
|
||||||
.addHeader("version", "1")
|
.addHeader("version", "1")
|
||||||
// Tarea 5613 comentar user y pass cuando en Silex está subido
|
|
||||||
//.addHeader("user",(context as MobileApplication).userName)
|
|
||||||
//.addHeader("pass", (context as MobileApplication).userPassword)
|
|
||||||
.addHeader("Authorization", prefs.getString("token", ""))
|
.addHeader("Authorization", prefs.getString("token", ""))
|
||||||
.addHeader("Content-Type", "application/json")
|
.addHeader("Content-Type", "application/json")
|
||||||
.build()
|
.build()
|
||||||
// d("VERDNATURA::", newRequest.headers().toString() + newRequest.url())
|
// d("VERDNATURA::", newRequest.headers().toString() + newRequest.url())
|
||||||
|
/* try {
|
||||||
|
(context as MainActivity).progressAnimation(View.VISIBLE)
|
||||||
|
println("print IN")
|
||||||
|
}catch (ex:Exception){}*/
|
||||||
|
/* if (request != null) {
|
||||||
|
println("Es una solicitud: ${request.method()} ${request.url()}")
|
||||||
|
}else{
|
||||||
|
val response = chain.proceed(request)
|
||||||
|
if (response != null) {
|
||||||
|
// Realizar acciones específicas para la respuesta
|
||||||
|
// Puedes acceder a response.code(), response.body(), etc.
|
||||||
|
println("Es una respuesta: ${response.code()} ${response.message()}")
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
return chain.proceed(newRequest)
|
return chain.proceed(newRequest)
|
||||||
} else
|
} else
|
||||||
|
/* try {
|
||||||
|
(context as MainActivity).progressAnimation(View.INVISIBLE)
|
||||||
|
println("print OUT")
|
||||||
|
}catch (ex:Exception){}*/
|
||||||
|
|
||||||
return chain.proceed(request)
|
return chain.proceed(request)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package es.verdnatura.presentation.common
|
package es.verdnatura.presentation.common
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.widget.TextView
|
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
|
@ -217,4 +216,10 @@ interface onVehicleSelected {
|
||||||
interface OnClickDynamic {
|
interface OnClickDynamic {
|
||||||
fun onClickDynamic(addressFK: Int)
|
fun onClickDynamic(addressFK: Int)
|
||||||
}
|
}
|
||||||
|
interface InteceptorListener {
|
||||||
|
fun onInterceptionResult(visibility: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MainActivityListener {
|
||||||
|
fun onApplicationEventAnimation(visibility: Int)
|
||||||
|
}
|
|
@ -2,8 +2,6 @@ package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.View
|
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
@ -73,7 +71,6 @@ class BuscarItemFragment(
|
||||||
|
|
||||||
private fun getLocations(itemFk: Any) {
|
private fun getLocations(itemFk: Any) {
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.itemshelvingGetInfo(itemFk)
|
viewModel.itemshelvingGetInfo(itemFk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,34 +79,25 @@ class BuscarItemFragment(
|
||||||
loadLocationList.observe(viewLifecycleOwner, Observer { event ->
|
loadLocationList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
|
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
binding.splashProgress.visibility = GONE
|
|
||||||
|
|
||||||
if (it.list.isNotEmpty()) {
|
try {
|
||||||
if (it.list[0].isError) {
|
adapter = LocationAdapter(it.list, pasillerosItemClickListener!!)
|
||||||
ma.messageWithSound(
|
binding.locationRecyclerview.adapter = adapter
|
||||||
it.list[0].errorMessage,
|
binding.locationRecyclerview.layoutManager =
|
||||||
true,
|
LinearLayoutManager(
|
||||||
true,
|
requireContext(),
|
||||||
it.list[0].errorMessage
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false
|
||||||
)
|
)
|
||||||
}else{
|
} catch (ex: Exception) {
|
||||||
adapter = LocationAdapter(it.list, pasillerosItemClickListener!!)
|
ma.messageWithSound(
|
||||||
binding.locationRecyclerview.adapter = adapter
|
message = ex.message.toString(),
|
||||||
binding.locationRecyclerview.layoutManager =
|
isError = true,
|
||||||
LinearLayoutManager(
|
isPlayed = true
|
||||||
requireContext(),
|
)
|
||||||
LinearLayoutManager.VERTICAL,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
var totalVisible = 0
|
|
||||||
it.list.forEach {
|
|
||||||
totalVisible += it.visible
|
|
||||||
}
|
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
|
||||||
getString(R.string.item) + itemFk + " " + getString(R.string.visibleTotal) + totalVisible
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
|
getString(R.string.item) + itemFk + " " + getString(R.string.visibleTotal) + it.list.sumOf { it.visible }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,18 @@
|
||||||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.SilexCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
|
class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
//private val getBuscarItemUserCase: GetBuscarItemUserCase = GetBuscarItemUserCase(context)
|
|
||||||
|
|
||||||
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
|
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
|
||||||
val locationList: LiveData<LocationListVO>
|
val locationList: LiveData<LocationListVO>
|
||||||
get() = _locationList
|
get() = _locationList
|
||||||
|
@ -26,27 +20,13 @@ class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun itemshelvingGetInfo(itemFk: Any) {
|
fun itemshelvingGetInfo(itemFk: Any) {
|
||||||
//salix falla fecha
|
//salix falla fecha
|
||||||
// silex.searchItemsUbicador(itemFk)
|
// silex.searchItemsUbicador(itemFk)
|
||||||
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
|
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
|
||||||
.enqueue(object : SilexCallback<List<ItemLocationVO>>(context) {
|
.enqueue(object : SalixCallback<List<ItemLocationVO>>(context) {
|
||||||
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
|
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
|
||||||
_locationList.value = response.body()?.let { LocationListVO(it) }
|
_locationList.value = response.body()?.let { LocationListVO(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
val listError: ArrayList<ItemLocationVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemLocationVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_locationList.value = LocationListVO(listError)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import es.verdnatura.databinding.FragmentCollectionNewBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragmentSalix
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
|
@ -39,7 +39,6 @@ import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterNew
|
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterNew
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.modelViewModel.FragmentsViewModel
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.*
|
import es.verdnatura.presentation.view.feature.sacador.model.*
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -49,9 +48,8 @@ import org.json.JSONObject
|
||||||
class CollectionFragmentPickerNew(
|
class CollectionFragmentPickerNew(
|
||||||
var collection: CollectionTicket,
|
var collection: CollectionTicket,
|
||||||
var type: String = SACADOR
|
var type: String = SACADOR
|
||||||
) : BaseFragmentSalix<FragmentCollectionNewBinding, CollectionViewModel, FragmentsViewModel>(
|
) : BaseFragment<FragmentCollectionNewBinding, CollectionViewModel>(
|
||||||
CollectionViewModel::class,
|
CollectionViewModel::class
|
||||||
FragmentsViewModel::class
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var sales: List<Sale> = listOf()
|
private var sales: List<Sale> = listOf()
|
||||||
|
@ -229,22 +227,8 @@ class CollectionFragmentPickerNew(
|
||||||
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
||||||
println("Sacador saleGroup ${sales[indice].itemShelvingSaleFk}")
|
println("Sacador saleGroup ${sales[indice].itemShelvingSaleFk}")
|
||||||
|
|
||||||
/* callBack(
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
viewModelSalix.callBackProcedSalix(
|
viewModel.saleTrackingAddPreparedSaleGroup(saleGroupScanned.toInt())
|
||||||
"itemShelvingSale_setQuantity",
|
|
||||||
params = arrayListOf(
|
|
||||||
sales[indice].itemShelvingSaleFk,
|
|
||||||
)
|
|
||||||
), splashProgress = binding.splashProgress
|
|
||||||
|
|
||||||
)*/
|
|
||||||
|
|
||||||
callBack(
|
|
||||||
viewModelSalix.callBackProcedSalix(
|
|
||||||
"saleTracking_add", params = arrayListOf(saleGroupScanned)
|
|
||||||
), splashProgress = binding.splashProgress
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
|
@ -376,9 +360,7 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
/* with(viewModelSalix) {
|
||||||
|
|
||||||
with(viewModelSalix) {
|
|
||||||
responseCallBack.observe(viewLifecycleOwner, Observer {
|
responseCallBack.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
@ -423,15 +405,15 @@ class CollectionFragmentPickerNew(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if (!goBack) {
|
*//* if (!goBack) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
if (it.isError) it.errorMessage else getString(R.string.savedShelves),
|
if (it.isError) it.errorMessage else getString(R.string.savedShelves),
|
||||||
it.isError, true
|
it.isError, true
|
||||||
)
|
)
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
|
@ -503,6 +485,27 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
responseCollectionAddItem.observe(viewLifecycleOwner, Observer {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
if (!goBack) {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
ma.messageWithSound(
|
||||||
|
"ítem y reserva añadida correctamente",
|
||||||
|
it.isError, !it.isError
|
||||||
|
)
|
||||||
|
viewModel.collectionTicketGet(
|
||||||
|
collection.collectionFk,
|
||||||
|
getDataInt(SECTORFK),
|
||||||
|
print = "0",
|
||||||
|
type
|
||||||
|
)
|
||||||
|
|
||||||
|
goBack = false
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
responsePrint.observe(viewLifecycleOwner, Observer {
|
responsePrint.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
|
||||||
|
@ -522,45 +525,7 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* responseSplit.observe(viewLifecycleOwner) {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
|
|
||||||
if (!goBack) {
|
|
||||||
|
|
||||||
if (it.isError) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
it.errorMessage,
|
|
||||||
it.isError, true
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.splitOk),
|
|
||||||
it.isError, true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* responseItem_updatePackingShelve.observe(viewLifecycleOwner, Observer {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
ma.messageWithSound(
|
|
||||||
if (it.isError) it.errorMessage else getString(R.string.packingSave),
|
|
||||||
it.isError, !it.isError
|
|
||||||
)
|
|
||||||
if (!it.isError) {
|
|
||||||
viewModel.collectionTicketGet(
|
|
||||||
collection.collectionFk,
|
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
|
|
||||||
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
@ -582,65 +547,39 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* responseSaleGroup.observe(viewLifecycleOwner, Observer {
|
responseItemShelvingSale.observe(viewLifecycleOwner, Observer {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
myGroupList[positionConfirm].isPicked = 1
|
||||||
|
myGroupList[positionConfirm].reservedQuantity = quantityConfirm
|
||||||
|
viewModel.collectionTicketGetSalix(
|
||||||
|
collection.collectionFk,
|
||||||
|
print = false
|
||||||
|
)
|
||||||
|
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
||||||
|
//saleAdapter!!.notifyDataSetChanged()
|
||||||
|
ma.messageWithSound(
|
||||||
|
"Confirmada acción",
|
||||||
|
it.isError, !it.isError
|
||||||
|
)
|
||||||
|
})
|
||||||
|
responseItemShelvingSaleUnPicked.observe(viewLifecycleOwner, Observer {
|
||||||
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
myGroupList[positionUnmarked].isPicked = 1
|
||||||
|
myGroupList[positionUnmarked].reservedQuantity = quantityConfirm
|
||||||
|
viewModel.collectionTicketGetSalix(
|
||||||
|
collection.collectionFk,
|
||||||
|
print = false
|
||||||
|
)
|
||||||
|
lm!!.scrollToPositionWithOffset(positionUnmarked, 0)
|
||||||
|
//saleAdapter!!.notifyDataSetChanged()
|
||||||
|
ma.messageWithSound(
|
||||||
|
"Confirmada acción",
|
||||||
|
it.isError, !it.isError
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
if (it.isError) {
|
|
||||||
|
|
||||||
ma.messageWithSound(it.errorMessage, true, true)
|
|
||||||
} else {
|
|
||||||
ma.messageWithSound(getString(R.string.previousCollected), false, true)
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.collectionTicketGet(
|
|
||||||
collection.collectionFk,
|
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})*/
|
|
||||||
|
|
||||||
/* item.observe(viewLifecycleOwner, Observer {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
if (!goBack) toastDisponibility(it)
|
|
||||||
goBack = false
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
/* responseNew.observe(viewLifecycleOwner, Observer {
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
// if (!goBack) {
|
|
||||||
if (it.isError) {
|
|
||||||
customDialog.setTitle(getString(R.string.disponibility))
|
|
||||||
.setDescription(getString(R.string.errorCollectionNew) + it.errorMessage)
|
|
||||||
.setKoButton(getString(R.string.close)) {
|
|
||||||
scanRequest()
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()
|
|
||||||
} else {
|
|
||||||
|
|
||||||
binding.splashProgress.visibility =
|
|
||||||
View.VISIBLE
|
|
||||||
|
|
||||||
|
|
||||||
if (!goBack) {
|
|
||||||
|
|
||||||
viewModel.collectionTicketGet(
|
|
||||||
collection.collectionFk,
|
|
||||||
getDataInt(SECTORFK),
|
|
||||||
print = "0",
|
|
||||||
type
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
goBack = false
|
|
||||||
|
|
||||||
})*/
|
|
||||||
|
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
@ -893,23 +832,17 @@ class CollectionFragmentPickerNew(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean) {
|
private fun markLine(position: Int, quantity: Int, isItemShelvingSaleEmpty: Boolean?) {
|
||||||
|
|
||||||
state = 0
|
state = 0
|
||||||
isScanned = null
|
isScanned = null
|
||||||
positionConfirm = position
|
positionConfirm = position
|
||||||
quantityConfirm = quantity
|
quantityConfirm = quantity
|
||||||
isMarking = true
|
isMarking = true
|
||||||
callBack(
|
|
||||||
viewModelSalix.callBackProcedSalix(
|
viewModel.itemShelvingSaleSetQuantity(myGroupList[position].itemShelvingSaleFk,
|
||||||
"itemShelvingSale_setQuantity",
|
quantity,
|
||||||
params = arrayListOf(
|
isItemShelvingSaleEmpty)
|
||||||
myGroupList[position].itemShelvingSaleFk,
|
|
||||||
quantity,
|
|
||||||
isItemShelvingSaleEmpty
|
|
||||||
)
|
|
||||||
), splashProgress = binding.splashProgress
|
|
||||||
)
|
|
||||||
|
|
||||||
//nuevo tema agrupacion sales
|
//nuevo tema agrupacion sales
|
||||||
//checkStateParent()
|
//checkStateParent()
|
||||||
|
@ -999,19 +932,8 @@ class CollectionFragmentPickerNew(
|
||||||
}
|
}
|
||||||
storedBackPosition = position
|
storedBackPosition = position
|
||||||
setListPosition(position, false)
|
setListPosition(position, false)
|
||||||
|
viewModel.itemShelvingSaleUnpicked(sales[position].itemShelvingSaleFk)
|
||||||
callBack(
|
|
||||||
viewModelSalix.callBackProcedSalix(
|
|
||||||
"itemShelvingSale_unpicked",
|
|
||||||
params = arrayListOf(
|
|
||||||
sales[position].itemShelvingSaleFk,
|
|
||||||
)
|
|
||||||
), splashProgress = binding.splashProgress
|
|
||||||
)
|
|
||||||
|
|
||||||
positionUnmarked = position
|
positionUnmarked = position
|
||||||
|
|
||||||
|
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
|
@ -1186,7 +1108,7 @@ class CollectionFragmentPickerNew(
|
||||||
/* if (myGroupList[storedPosition].reservedQuantity == 0) {
|
/* if (myGroupList[storedPosition].reservedQuantity == 0) {
|
||||||
showQuestionUbicationEmpty(storedPosition)
|
showQuestionUbicationEmpty(storedPosition)
|
||||||
} else {*/
|
} else {*/
|
||||||
markLine(storedPosition, quantity, false)
|
markLine(storedPosition, quantity, null)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@ -1326,16 +1248,11 @@ class CollectionFragmentPickerNew(
|
||||||
binding.splashProgress.visibility =
|
binding.splashProgress.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
|
|
||||||
callBack(
|
|
||||||
viewModelSalix.callBackProcedSalix(
|
viewModel.collectionAddWithReservation(customDialogList.getValue().toInt(),
|
||||||
"collection_addWithReservation",
|
customDialogList.getValueTwo().toInt(),
|
||||||
params = arrayListOf(
|
ticketSelected)
|
||||||
customDialogList.getValue().toInt(),
|
|
||||||
customDialogList.getValueTwo().toInt(),
|
|
||||||
ticketSelected
|
|
||||||
)
|
|
||||||
), splashProgress = binding.splashProgress
|
|
||||||
)
|
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
hideKeyboards()
|
hideKeyboards()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
|
@ -22,7 +22,7 @@ class HistoricoArticuloViewModel(val context: Context) : BaseViewModel(context)
|
||||||
val loadHistoricoList = Transformations.map(_historicoList) { Event(it) }
|
val loadHistoricoList = Transformations.map(_historicoList) { Event(it) }
|
||||||
|
|
||||||
fun itemGetBalance(itemFk: Int, vWarehouseFk: Int) {
|
fun itemGetBalance(itemFk: Int, vWarehouseFk: Int) {
|
||||||
//salix falla fecha
|
//salix falla fecha -- No tiene hora.
|
||||||
silex.itemDiary(itemFk, vWarehouseFk)
|
silex.itemDiary(itemFk, vWarehouseFk)
|
||||||
// salix.itemGetBalance(arrayListOf(itemFk, vWarehouseFk, null))
|
// salix.itemGetBalance(arrayListOf(itemFk, vWarehouseFk, null))
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package es.verdnatura.presentation.view.feature.historicoarticulo.model
|
package es.verdnatura.presentation.view.feature.historicoarticulo.model
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import es.verdnatura.domain.isoToString
|
||||||
|
|
||||||
class ItemHistoricoVO(
|
class ItemHistoricoVO(
|
||||||
var shipped: String? = null,
|
//var shipped: String? = null,
|
||||||
var stateName: String? = null,
|
var stateName: String? = null,
|
||||||
var origin: Int? = null,
|
var origin: Int? = null,
|
||||||
var reference: String? = null,
|
var reference: String? = null,
|
||||||
|
@ -12,7 +16,13 @@ class ItemHistoricoVO(
|
||||||
var balance: Int? = null,
|
var balance: Int? = null,
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage: String = ""
|
var errorMessage: String = ""
|
||||||
)
|
) {
|
||||||
|
var shipped: String = ""
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
get() {
|
||||||
|
return field.isoToString(returnOnlyDate = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ItemHistoricoListVO(
|
class ItemHistoricoListVO(
|
||||||
var list: List<ItemHistoricoVO> = listOf()
|
var list: List<ItemHistoricoVO> = listOf()
|
||||||
|
|
|
@ -98,7 +98,7 @@ import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickListener,
|
class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickListener,
|
||||||
OnTruckClickListener, OnPalletClickListener, OnComprobarPalletViewClickListener,
|
OnTruckClickListener, OnPalletClickListener, OnComprobarPalletViewClickListener,
|
||||||
OnCollectionSelectedListener, OnCollectionTicketSelectedListener {
|
OnCollectionSelectedListener, OnCollectionTicketSelectedListener,MainActivityListener {
|
||||||
|
|
||||||
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
||||||
private lateinit var customDialog: CustomDialogMainActivity
|
private lateinit var customDialog: CustomDialogMainActivity
|
||||||
|
@ -147,6 +147,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
setFragments()
|
setFragments()
|
||||||
setBottomMenuFragment()
|
setBottomMenuFragment()
|
||||||
setRegisterNetwork()
|
setRegisterNetwork()
|
||||||
|
(application as MobileApplication).setMainListener(this)
|
||||||
//Tarea
|
//Tarea
|
||||||
//printBluetooth()
|
//printBluetooth()
|
||||||
|
|
||||||
|
@ -1126,4 +1127,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onApplicationEventAnimation(visibility:Int) {
|
||||||
|
binding.splashAnimation.visibility = visibility
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -19,7 +18,6 @@ class ExpeditionStateFragment(
|
||||||
ExpeditionStateViewModel::class
|
ExpeditionStateViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
private var adapter: ExpeditionStateAdapter? = null
|
private var adapter: ExpeditionStateAdapter? = null
|
||||||
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
|
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
|
||||||
private var itemScan = ""
|
private var itemScan = ""
|
||||||
|
@ -36,7 +34,6 @@ class ExpeditionStateFragment(
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setToolBar(title: String) {
|
private fun setToolBar(title: String) {
|
||||||
binding.mainToolbar.toolbarTitle.text = title
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
}
|
}
|
||||||
|
@ -46,8 +43,19 @@ class ExpeditionStateFragment(
|
||||||
binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
|
binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (binding.editItemFk.text.toString().isNotEmpty()) {
|
if (binding.editItemFk.text.toString().isNotEmpty()) {
|
||||||
getExpedtionState(binding.editItemFk.toInt())
|
try {
|
||||||
itemScan = binding.editItemFk.text.toString()
|
viewModel.expeditionGetStateJSON(binding.editItemFk.toInt())
|
||||||
|
itemScan = binding.editItemFk.text.toString()
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorInput),
|
||||||
|
isError = true,
|
||||||
|
isToasted = true,
|
||||||
|
isPlayed = true,
|
||||||
|
titleWithError = "Error"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
binding.editItemFk.setText("")
|
binding.editItemFk.setText("")
|
||||||
ma.hideKeyboard(binding.editItemFk)
|
ma.hideKeyboard(binding.editItemFk)
|
||||||
|
@ -60,39 +68,18 @@ class ExpeditionStateFragment(
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getExpedtionState(expeditionFk: Int) {
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.expedition_getStateJSON(expeditionFk)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
itemexpedition.observe(viewLifecycleOwner) {
|
itemexpedition.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
setItemExpeditionState(it)
|
||||||
if (it.isError) {
|
|
||||||
binding.itemcardLayout.visibility = View.GONE
|
|
||||||
binding.mainToolbar.toolbarTitle.text = entryPoint
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.noDataLabelScanned),
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
getString(R.string.noResults)
|
|
||||||
)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setItemExpeditionState(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
|
private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
|
||||||
setToolBar(getString(R.string.expedition) + itemScan)
|
setToolBar(getString(R.string.expedition) + " " + itemScan)
|
||||||
binding.itemcardLayout.visibility = View.VISIBLE
|
binding.itemcardLayout.visibility = View.VISIBLE
|
||||||
|
|
||||||
listItemsRow = ArrayList()
|
listItemsRow = ArrayList()
|
||||||
|
@ -110,9 +97,7 @@ class ExpeditionStateFragment(
|
||||||
binding.itemexpeditionstateRecyclerview.layoutManager =
|
binding.itemexpeditionstateRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,51 +2,30 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
//import es.verdnatura.presentation.view.feature.paletizador.model.itemExpeditionDynamicsList
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.isoToString
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
|
class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
|
||||||
val itemcard: LiveData<ItemCardVO>
|
|
||||||
get() = _itemcard
|
|
||||||
|
|
||||||
private val _itemexpeditionlist by lazy { MutableLiveData<itemExpedetionState>() }
|
|
||||||
val itemexpeditionlist: LiveData<itemExpedetionState>
|
|
||||||
get() = _itemexpeditionlist
|
|
||||||
|
|
||||||
private val _itemexpedition by lazy { MutableLiveData<itemExpedetionState>() }
|
private val _itemexpedition by lazy { MutableLiveData<itemExpedetionState>() }
|
||||||
val itemexpedition: LiveData<itemExpedetionState>
|
val itemexpedition: LiveData<itemExpedetionState>
|
||||||
get() = _itemexpedition
|
get() = _itemexpedition
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
fun expeditionGetStateJSON(expeditionFk: Int) {
|
||||||
val response: LiveData<ResponseItemVO>
|
|
||||||
get() = _response
|
|
||||||
|
|
||||||
private val _itemspackinglist by lazy { MutableLiveData<ItemPackingTypeList>() }
|
|
||||||
val itemspackinglist: LiveData<ItemPackingTypeList>
|
|
||||||
get() = _itemspackinglist
|
|
||||||
|
|
||||||
private val _itemsExpeditionlist by lazy { MutableLiveData<ItemPackingTypeList>() }
|
|
||||||
val itemsExpeditionlist: LiveData<ItemPackingTypeList>
|
|
||||||
get() = _itemsExpeditionlist
|
|
||||||
|
|
||||||
fun expedition_getStateJSON(expeditionFk: Int) {
|
|
||||||
salix.expedition_getState(params = arrayListOf(expeditionFk))
|
salix.expedition_getState(params = arrayListOf(expeditionFk))
|
||||||
.enqueue(object : SalixCallback<ArrayList<JsonObject>>(context) {
|
.enqueue(object : SalixCallback<ArrayList<JsonObject>>(context) {
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onSuccess(response: Response<ArrayList<JsonObject>>) {
|
override fun onSuccess(response: Response<ArrayList<JsonObject>>) {
|
||||||
_itemexpedition.value = itemExpedetionState(
|
_itemexpedition.value = itemExpedetionState(
|
||||||
isError = false,
|
isError = false,
|
||||||
|
@ -60,31 +39,26 @@ class ExpeditionStateViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_itemexpedition.value = itemExpedetionState(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!),
|
|
||||||
list = mutableListOf()
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> {
|
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> {
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
var list = mutableListOf<itemsExpeditionDynamics>()
|
var list = mutableListOf<itemsExpeditionDynamics>()
|
||||||
var expeditionState: Map<String, String?> =
|
var expeditionState: Map<String, String?> =
|
||||||
gson.fromJson(json, object : TypeToken<Map<String, String?>>() {}.type)
|
gson.fromJson(json, object : TypeToken<Map<String, String?>>() {}.type)
|
||||||
expeditionState.forEach {
|
expeditionState.forEach {
|
||||||
|
|
||||||
list.add(itemsExpeditionDynamics(key = it.key, it.value ?: ""))
|
list.add(itemsExpeditionDynamics(key = it.key, it.value ?: ""))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
list.forEach { element ->
|
||||||
|
if (element.value!!.takeLast(4).matches(Regex("[0-9]{3}Z"))) {
|
||||||
|
element.value = element.value.isoToString(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
|
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
|
||||||
"${
|
"${
|
||||||
LocalDate.now().atTime(LocalTime.MAX)
|
LocalDate.now().atTime(LocalTime.MAX)
|
||||||
}"]}}}"""
|
}"]}},"order": "eta ASC"}"""
|
||||||
).enqueue(object : SalixCallback<List<ItemExpeditionTruckVO>>(context) {
|
).enqueue(object : SalixCallback<List<ItemExpeditionTruckVO>>(context) {
|
||||||
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
||||||
_expeditionTruckList.value =
|
_expeditionTruckList.value =
|
||||||
|
|
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.parking.fragment
|
||||||
|
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -34,13 +33,14 @@ class ParkingFragment (var menuOrigin:String): BaseFragment<FragmentParkingBindi
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
// ma.progressAnimation(View.INVISIBLE)
|
||||||
setEvents()
|
setEvents()
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.Parking)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.Parking)
|
||||||
|
|
||||||
if (menuOrigin ==getString(R.string.main)){hideBackButton(binding.mainToolbar)}
|
if (menuOrigin ==getString(R.string.main)){hideBackButton(binding.mainToolbar)}
|
||||||
//sergio: después de las últimas actualizaciones se queda activo. Se cambia opción visibilidad.
|
//sergio: después de las últimas actualizaciones se queda activo. Se cambia opción visibilidad.
|
||||||
//viewModel.hideProgressLoading()
|
//viewModel.hideProgressLoading()
|
||||||
binding.splashProgress.visibility=View.GONE
|
// binding.splashProgress.visibility=View.GONE
|
||||||
setList()
|
setList()
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -68,10 +68,10 @@ class ParkingFragment (var menuOrigin:String): BaseFragment<FragmentParkingBindi
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
response.observe(viewLifecycleOwner, Observer {
|
||||||
if (it.isError){
|
/* if (it.isError){
|
||||||
ma.messageWithSound(it.errorMessage, isError = true,isPlayed = true)
|
ma.messageWithSound(it.errorMessage, isError = true,isPlayed = true)
|
||||||
|
|
||||||
}else{
|
}else{*/
|
||||||
ma.messageWithSound(message=getString(R.string.Aparcado), isError = false,isPlayed = false, isToasted = true)
|
ma.messageWithSound(message=getString(R.string.Aparcado), isError = false,isPlayed = false, isToasted = true)
|
||||||
numParking -= 1
|
numParking -= 1
|
||||||
if (numParking <= 0) {
|
if (numParking <= 0) {
|
||||||
|
@ -79,23 +79,23 @@ class ParkingFragment (var menuOrigin:String): BaseFragment<FragmentParkingBindi
|
||||||
setList()
|
setList()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
|
|
||||||
isLoading.observe(viewLifecycleOwner, Observer {
|
/* isLoading.observe(viewLifecycleOwner, Observer {
|
||||||
if (it){
|
if (it){
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
}else{
|
}else{
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
isLoadingProgress.observe(viewLifecycleOwner, {
|
isLoadingProgress.observe(viewLifecycleOwner, {
|
||||||
|
|
||||||
binding.splashProgress.visibility = it
|
binding.splashProgress.visibility = it
|
||||||
|
|
||||||
})
|
})*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package es.verdnatura.presentation.view.feature.parking.fragment
|
package es.verdnatura.presentation.view.feature.parking.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
@ -18,41 +14,13 @@ class ParkingViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
|
||||||
private val _isLoading by lazy { MutableLiveData<Boolean>() }
|
|
||||||
val isLoading: LiveData<Boolean> = _isLoading
|
|
||||||
|
|
||||||
private val _isLoadingProgress by lazy { MutableLiveData<Int>() }
|
|
||||||
val isLoadingProgress: LiveData<Int> = _isLoadingProgress
|
|
||||||
|
|
||||||
private fun showProgressLoading() {
|
|
||||||
_isLoading.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hideProgressLoading() {
|
|
||||||
_isLoading.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ProgressLoading(visibility: Int) {
|
|
||||||
_isLoadingProgress.value = visibility
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setParking(scanItem: String, parking: String) {
|
fun setParking(scanItem: String, parking: String) {
|
||||||
ProgressLoading(VISIBLE)
|
|
||||||
salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
|
salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
SalixCallback<Any>(context) {
|
SalixCallback<Any>(context) {
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
ProgressLoading(GONE)
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
ProgressLoading(GONE)
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
/*package es.verdnatura.presentation.view.feature.parking.adapter
|
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import es.verdnatura.databinding.ItemBarcodeRowBinding
|
|
||||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
|
||||||
/*
|
|
||||||
|
|
||||||
class ParkingAdapter (
|
|
||||||
private val items: List<BarcodeVO>,
|
|
||||||
private val onBarcodeRowClickListener: OnBarcodeRowClickListener
|
|
||||||
): RecyclerView.Adapter<ParkingAdapter.ItemHolder> () {
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
|
||||||
return ItemHolder(
|
|
||||||
ItemBarcodeRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() =items.size
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
|
||||||
holder.bind(items[position])
|
|
||||||
holder.binding.root.setOnClickListener {
|
|
||||||
onBarcodeRowClickListener.onBarcodeRowClickListener(items[position])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inner class ItemHolder(
|
|
||||||
val binding: ItemBarcodeRowBinding
|
|
||||||
) : RecyclerView.ViewHolder(binding.root){
|
|
||||||
fun bind(item: BarcodeVO) {
|
|
||||||
binding.apply {
|
|
||||||
this.item = item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -1,153 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.parking.fragment
|
|
||||||
|
|
||||||
import android.media.MediaPlayer
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
|
||||||
import android.view.inputmethod.EditorInfo
|
|
||||||
import androidx.lifecycle.Observer
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.databinding.FragmentParkingBinding
|
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
|
||||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
|
||||||
import es.verdnatura.presentation.common.hideKeyboard
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter
|
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
|
||||||
class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewModel>(ParkingSaleViewModel::class) {
|
|
||||||
|
|
||||||
|
|
||||||
private lateinit var customDialog: CustomDialog
|
|
||||||
private var scanerList:ArrayList<BarcodeVO> = ArrayList()
|
|
||||||
private var adapter : ParkingAdapter? = null
|
|
||||||
private var numParking : Int = 0
|
|
||||||
var mperror: MediaPlayer? = null
|
|
||||||
var mpok: MediaPlayer? = null
|
|
||||||
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_parking
|
|
||||||
companion object {
|
|
||||||
fun newInstance(SaleVO: Any?) = ParkingFragment("")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
|
||||||
setEvents()
|
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.Parking)
|
|
||||||
binding.splashProgress.visibility=View.GONE
|
|
||||||
setList()
|
|
||||||
customDialog = CustomDialog(requireContext())
|
|
||||||
super.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setEvents(){
|
|
||||||
binding.scanInput.requestFocus()
|
|
||||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
|
||||||
checkScan(binding.scanInput.text.toString())
|
|
||||||
}
|
|
||||||
binding.scanInput.setText("")
|
|
||||||
requireActivity().hideKeyboard()
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
|
||||||
requireActivity().onBackPressed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
|
||||||
with(viewModel){
|
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
|
||||||
if (it.isError){
|
|
||||||
mperror?.start()
|
|
||||||
ma.messageWithSound(it.errorMessage,true,false)
|
|
||||||
/* customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage).setOkButton(getString(R.string.close)){
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()*/
|
|
||||||
}else{
|
|
||||||
ma.messageWithSound(it.errorMessage,false,false, isToasted = true)
|
|
||||||
numParking -= 1
|
|
||||||
if (numParking <= 0) {
|
|
||||||
//viewModel.hideProgressLoading()
|
|
||||||
|
|
||||||
mpok?.start()
|
|
||||||
setList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
isLoading.observe(viewLifecycleOwner, Observer {
|
|
||||||
if (it){
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
}else{
|
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
isLoadingProgress.observe(viewLifecycleOwner, {
|
|
||||||
|
|
||||||
binding.splashProgress.visibility = it
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setList(){
|
|
||||||
scanerList = ArrayList()
|
|
||||||
adapter = ParkingAdapter(scanerList,object: OnBarcodeRowClickListener{
|
|
||||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
|
||||||
scanerList.removeAt(scanerList.indexOf(item))
|
|
||||||
adapter?.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
|
||||||
|
|
||||||
binding.fragmentParkingScanList.adapter = adapter
|
|
||||||
binding.fragmentParkingScanList.layoutManager = lm
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkScan(txtScan:String){
|
|
||||||
var isParking:Boolean = false
|
|
||||||
if (txtScan.trim().length == 4 && isLetter(txtScan.substring(txtScan.length - 1)) || txtScan.contains("-")){
|
|
||||||
isParking = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isParking){
|
|
||||||
numParking = scanerList.size
|
|
||||||
scanerList.forEach {
|
|
||||||
// binding.splashProgress.visibility = View.VSIIBLE
|
|
||||||
viewModel.setParking(
|
|
||||||
parking = txtScan,
|
|
||||||
scanItem = it.code!!
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
scanerList.add(BarcodeVO(code = txtScan))
|
|
||||||
adapter?.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
|
|
||||||
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
|
|
||||||
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(NumberFormatException::class)
|
|
||||||
fun isLetter(text: String): Boolean {
|
|
||||||
return text.matches("[a-zA-Z ]+".toRegex())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.parking.fragment
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.View
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
class ParkingSaleViewModel(val context: Context) : BaseViewModel(context) {
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val response: LiveData<ResponseItemVO>
|
|
||||||
get() = _response
|
|
||||||
|
|
||||||
private val _isLoading by lazy { MutableLiveData<Boolean>() }
|
|
||||||
val isLoading: LiveData<Boolean> = _isLoading
|
|
||||||
|
|
||||||
private val _isLoadingProgress by lazy { MutableLiveData<Int>() }
|
|
||||||
val isLoadingProgress: LiveData<Int> = _isLoadingProgress
|
|
||||||
|
|
||||||
private val _responseParkingAdd by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val responseParkingAdd: LiveData<ResponseItemVO>
|
|
||||||
get() = _responseParkingAdd
|
|
||||||
|
|
||||||
private fun showProgressLoading() {
|
|
||||||
_isLoading.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hideProgressLoading() {
|
|
||||||
_isLoading.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ProgressLoading(visibility: Int) {
|
|
||||||
_isLoadingProgress.value = visibility
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setParking(scanItem: String, parking: String) {
|
|
||||||
ProgressLoading(VISIBLE)
|
|
||||||
salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
|
|
||||||
.enqueue(object :
|
|
||||||
SalixCallback<Any>(context) {
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
ProgressLoading(View.GONE)
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -28,6 +28,28 @@
|
||||||
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" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/splash_animation"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@color/verdnatura_black_8_alpha_6"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||||
|
app:lottie_autoPlay="true"
|
||||||
|
app:lottie_loop="true"
|
||||||
|
app:lottie_rawRes="@raw/orange_loading"
|
||||||
|
app:lottie_speed="2" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
android:id="@+id/main_bottom_navigation_fragment"
|
android:id="@+id/main_bottom_navigation_fragment"
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -15,118 +14,89 @@
|
||||||
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">
|
||||||
>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edit_itemFk"
|
android:id="@+id/edit_itemFk"
|
||||||
style="@style/ScanLineTextSearch"
|
style="@style/ScanLineTextSearch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:hint="@string/Escaneaetiqueta"
|
android:hint="@string/Escaneaetiqueta"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="@color/verdnatura_white" />
|
android:textColor="@color/verdnatura_white" />
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginTop="@dimen/layout_margin_min"
|
android:layout_marginTop="@dimen/layout_margin_min"
|
||||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="@dimen/layout_margin_min"
|
android:paddingLeft="@dimen/layout_margin_min"
|
||||||
android:paddingRight="@dimen/layout_margin_min">
|
android:paddingRight="@dimen/layout_margin_min">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
android:text="Parking"
|
android:text="Parking"
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:textSize="@dimen/body2" />
|
||||||
android:gravity="center"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
android:text="@string/Matrícula"
|
android:text="@string/Matrícula"
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:textSize="@dimen/body2" />
|
||||||
android:gravity="center"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
android:text="@string/Visible"
|
android:text="@string/Visible"
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:textSize="@dimen/body2" />
|
||||||
android:gravity="center"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
android:text="Prioridad"
|
android:text="Prioridad"
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:layout_weight="1"
|
android:textSize="@dimen/body2" />
|
||||||
android:gravity="center"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/Fecha"
|
|
||||||
android:textSize="@dimen/body2"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"/>
|
android:gravity="center"
|
||||||
|
android:text="@string/Fecha"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/location_recyclerview"
|
android:id="@+id/location_recyclerview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
tools:listitem="@layout/item_location_row"/>
|
tools:listitem="@layout/item_location_row" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<include
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
' <include
|
|
||||||
android:id="@+id/main_toolbar"
|
android:id="@+id/main_toolbar"
|
||||||
layout="@layout/toolbar_fragment"
|
layout="@layout/toolbar_fragment"
|
||||||
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" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/splash_progress"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/verdnatura_black_8_alpha_6"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
|
||||||
|
|
||||||
app:lottie_autoPlay="true"
|
|
||||||
app:lottie_loop="true"
|
|
||||||
app:lottie_rawRes="@raw/orange_loading"
|
|
||||||
app:lottie_speed="2" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -1,16 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/scroll_view"
|
android:id="@+id/scroll_view"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -23,37 +19,33 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/edit_itemFk"
|
|
||||||
style="@style/ScanLineTextSearch"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:hint="@string/Escaneaetiqueta"
|
|
||||||
android:inputType="text"
|
|
||||||
android:lines="1"
|
|
||||||
android:maxLines="1"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_itemFk"
|
||||||
|
style="@style/ScanLineTextSearch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:hint="@string/Escaneaetiqueta"
|
||||||
|
android:inputType="text"
|
||||||
|
android:lines="1"
|
||||||
|
android:maxLines="1" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/itemcard_layout"
|
android:id="@+id/itemcard_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:orientation="vertical"
|
||||||
android:orientation="vertical">
|
android:padding="10dp">
|
||||||
|
|
||||||
<!-- TAGS ======================================================================================================= -->
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/layout_margin_min"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="@dimen/layout_margin_min"
|
android:padding="@dimen/layout_margin_min">
|
||||||
android:layout_marginBottom="@dimen/layout_margin_min">
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- VALORES ================================================================================================== -->
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -66,48 +58,18 @@
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
tools:listitem="@layout/item_expeditionstate_row" />
|
tools:listitem="@layout/item_expeditionstate_row" />
|
||||||
</RelativeLayout>>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
' <include
|
<include
|
||||||
android:id="@+id/main_toolbar"
|
android:id="@+id/main_toolbar"
|
||||||
layout="@layout/toolbar_fragment"
|
layout="@layout/toolbar_fragment"
|
||||||
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" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/splash_progress"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/verdnatura_black_8_alpha_6"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
|
||||||
|
|
||||||
app:lottie_autoPlay="true"
|
|
||||||
app:lottie_loop="true"
|
|
||||||
app:lottie_rawRes="@raw/orange_loading"
|
|
||||||
app:lottie_speed="2" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -1,9 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="es.verdnatura.presentation.view.feature.parking.fragment.ParkingViewModel" />
|
type="es.verdnatura.presentation.view.feature.parking.fragment.ParkingViewModel" />
|
||||||
|
@ -14,24 +15,19 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/verdnatura_black">
|
android:background="@color/verdnatura_black">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/scan_input"
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
style="@style/ScanLineTextSearch"
|
||||||
android:id="@+id/scan_input"
|
android:layout_width="match_parent"
|
||||||
style="@style/ScanLineTextSearch"
|
android:hint="@string/Escaner"
|
||||||
android:layout_width="match_parent"
|
android:imeOptions="actionDone"
|
||||||
android:hint="@string/Escaner"
|
android:inputType="textCapCharacters"
|
||||||
android:inputType="textCapCharacters"
|
android:lines="1"
|
||||||
android:lines="1"
|
android:maxLines="1"
|
||||||
android:maxLines="1"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textColor="@color/verdnatura_white"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:imeOptions="actionDone"
|
app:layout_constraintTop_toTopOf="@+id/main_toolbar" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/main_toolbar"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
|
@ -59,7 +55,6 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||||
tools:listitem="@layout/item_barcode_row" />
|
tools:listitem="@layout/item_barcode_row" />
|
||||||
|
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/main_toolbar"
|
android:id="@+id/main_toolbar"
|
||||||
layout="@layout/toolbar_fragment"
|
layout="@layout/toolbar_fragment"
|
||||||
|
@ -67,27 +62,5 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/splash_progress"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/verdnatura_black_8_alpha_6"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:gravity="center"
|
|
||||||
app:isVisible="@{viewModel.isLoading}">
|
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
|
||||||
app:lottie_autoPlay="true"
|
|
||||||
app:lottie_loop="true"
|
|
||||||
app:lottie_rawRes="@raw/orange_loading"
|
|
||||||
app:lottie_speed="2" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
Loading…
Reference in New Issue