app version server
This commit is contained in:
parent
706c477ace
commit
1188636818
|
@ -14,8 +14,8 @@ android {
|
||||||
applicationId "es.verdnatura"
|
applicationId "es.verdnatura"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 54
|
versionCode 55
|
||||||
versionName "5.4.4"
|
versionName "5.4.5"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,111 +23,112 @@ import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingViewModel
|
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||||
|
import org.koin.android.ext.koin.androidContext
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val viewModelModule = module{
|
val viewModelModule = module{
|
||||||
// Login
|
// Login
|
||||||
viewModel {
|
viewModel {
|
||||||
LoginViewModel()
|
LoginViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pasilleros
|
// Pasilleros
|
||||||
viewModel {
|
viewModel {
|
||||||
PasilleroViewModel()
|
PasilleroViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pasilleros / Item Card
|
// Pasilleros / Item Card
|
||||||
viewModel {
|
viewModel {
|
||||||
ItemCardViewModel()
|
ItemCardViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pasilleros / Item Card / Historico
|
// Pasilleros / Item Card / Historico
|
||||||
viewModel {
|
viewModel {
|
||||||
HistoricoViewModel()
|
HistoricoViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pasilleros / Buscar Item
|
// Pasilleros / Buscar Item
|
||||||
viewModel {
|
viewModel {
|
||||||
BuscarItemViewModel()
|
BuscarItemViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pasilleros / Inventario
|
// Pasilleros / Inventario
|
||||||
viewModel {
|
viewModel {
|
||||||
InventaryViewModel()
|
InventaryViewModel(androidContext())
|
||||||
}
|
}
|
||||||
// Pasilleros / Faltas
|
// Pasilleros / Faltas
|
||||||
viewModel {
|
viewModel {
|
||||||
FaltasViewModel()
|
FaltasViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShelvingParking
|
// ShelvingParking
|
||||||
viewModel {
|
viewModel {
|
||||||
ShelvingParkingViewModel()
|
ShelvingParkingViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ubicador
|
// Ubicador
|
||||||
viewModel {
|
viewModel {
|
||||||
UbicadorViewModel()
|
UbicadorViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ubicador // Automatic
|
// Ubicador // Automatic
|
||||||
viewModel {
|
viewModel {
|
||||||
AutomaticAddItemViewModel()
|
AutomaticAddItemViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajustes
|
// Ajustes
|
||||||
viewModel {
|
viewModel {
|
||||||
AjustesViewModel()
|
AjustesViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// PALETIZADOR
|
// PALETIZADOR
|
||||||
viewModel {
|
viewModel {
|
||||||
ExpeditionTruckListViewModel()
|
ExpeditionTruckListViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ExpeditionPalletViewModel()
|
ExpeditionPalletViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ExpeditionPalletDetailViewModel()
|
ExpeditionPalletDetailViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ExpeditionScanViewModel()
|
ExpeditionScanViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
// SACADOR
|
// SACADOR
|
||||||
viewModel {
|
viewModel {
|
||||||
SacadorViewModel()
|
SacadorViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
CollectionViewModel()
|
CollectionViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ControladorViewModel()
|
ControladorViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ParkingViewModel()
|
ParkingViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
PreSacadorViewModel()
|
PreSacadorViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ReposicionViewModel()
|
ReposicionViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
BuyersViewModel()
|
BuyersViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
QaualityViewModel()
|
QaualityViewModel(androidContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.preference.PreferenceManager
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
@ -10,15 +13,26 @@ class ApiUtils {
|
||||||
companion object {
|
companion object {
|
||||||
//const val BASE_URL:String = "http://192.168.1.54:8009/"
|
//const val BASE_URL:String = "http://192.168.1.54:8009/"
|
||||||
const val BASE_URL:String = "https://app.verdnatura.es/"
|
const val BASE_URL:String = "https://app.verdnatura.es/"
|
||||||
fun getApiService():VerdnaturaService{
|
|
||||||
|
|
||||||
|
|
||||||
|
fun getApiService(context: Context):VerdnaturaService{
|
||||||
val retrofit = Retrofit.Builder()
|
val retrofit = Retrofit.Builder()
|
||||||
.baseUrl(BASE_URL)
|
.baseUrl(getBaseUrlLocal(context))
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.client(getRequestHeader())
|
.client(getRequestHeader())
|
||||||
.build()
|
.build()
|
||||||
return retrofit.create(VerdnaturaService::class.java)
|
return retrofit.create(VerdnaturaService::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getBaseUrlLocal(context: Context): String {
|
||||||
|
var url = this.getDefaults("base_url",context)
|
||||||
|
if (url.isNullOrEmpty()){
|
||||||
|
setDefaults("base_url", BASE_URL,context)
|
||||||
|
}
|
||||||
|
return if (url.isNullOrEmpty()) BASE_URL else url
|
||||||
|
}
|
||||||
|
|
||||||
fun getRequestHeader(): OkHttpClient? {
|
fun getRequestHeader(): OkHttpClient? {
|
||||||
val client = OkHttpClient.Builder()
|
val client = OkHttpClient.Builder()
|
||||||
.connectTimeout(10, TimeUnit.SECONDS)
|
.connectTimeout(10, TimeUnit.SECONDS)
|
||||||
|
@ -27,6 +41,19 @@ class ApiUtils {
|
||||||
.build()
|
.build()
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||||
|
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
val editor = preferences.edit()
|
||||||
|
editor.putString(key, value)
|
||||||
|
editor.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDefaults(key: String?, context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
return preferences.getString(key, null)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetAjustesUserCase : RestClient() {
|
class GetAjustesUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun getSectors(usuario:String,password:String) : Call<List<SectorItemVO>> {
|
fun getSectors(usuario:String,password:String) : Call<List<SectorItemVO>> {
|
||||||
return restClient!!.getSectors("json","1",usuario,password,"application/json")
|
return restClient!!.getSectors("json","1",usuario,password,"application/json")
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetBuscarItemUserCase : RestClient() {
|
class GetBuscarItemUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun searchItemsUbicador(usuario:String,password:String,itemFk:String) : Call<List<ItemLocationVO>> {
|
fun searchItemsUbicador(usuario:String,password:String,itemFk:String) : Call<List<ItemLocationVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetInventaryUserCase : RestClient() {
|
class GetInventaryUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun itemShelvingRadar(usuario:String,password:String,sectorFk:String) : Call<List<ItemInventaryVO>> {
|
fun itemShelvingRadar(usuario:String,password:String,sectorFk:String) : Call<List<ItemInventaryVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetItemCardUserCase : RestClient() {
|
class GetItemCardUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun getItemCard(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<ItemCardVO> {
|
fun getItemCard(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<ItemCardVO> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||||
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetLoginUserCase() : RestClient() {
|
class GetLoginUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun login(usuario:String,password:String) : Call<String>{
|
fun login(usuario:String,password:String) : Call<String>{
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetPaletizadoresUserCase: RestClient() {
|
class GetPaletizadoresUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun expeditionTruckList(usuario:String,password:String) : Call<List<ItemExpeditionTruckVO>> {
|
fun expeditionTruckList(usuario:String,password:String) : Call<List<ItemExpeditionTruckVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetPreSacadorUseCase() : RestClient() {
|
class GetPreSacadorUseCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun ticketToPrePrepare(usuario:String,password:String,ticketFk:String,sectorFk:String) : Call<List<PreSacadorItemVO>> {
|
fun ticketToPrePrepare(usuario:String,password:String,ticketFk:String,sectorFk:String) : Call<List<PreSacadorItemVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
|
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetQualityUserCase() : RestClient() {
|
class GetQualityUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun itemShelvingBuyerGet(usuario:String,password:String) : Call<List<BuyerVO>> {
|
fun itemShelvingBuyerGet(usuario:String,password:String) : Call<List<BuyerVO>> {
|
||||||
return restClient!!.itemShelvingBuyerGet("json","1",usuario,password,"application/json")
|
return restClient!!.itemShelvingBuyerGet("json","1",usuario,password,"application/json")
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetSacadorControladorUserCase : RestClient() {
|
class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String) : Call<CollectionVO> {
|
fun collectionTicketGet(usuario:String,password:String,collectionFk:String,sectorFk:String,print:String) : Call<CollectionVO> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetShelvingParkingUserCase : RestClient() {
|
class GetShelvingParkingUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String) : Call<List<ItemShelvingParkingVO>> {
|
fun shelvingParking_get(usuario:String,password:String,vShelvingFk:String,vWarehouseFk:String,vDayRange:String) : Call<List<ItemShelvingParkingVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetUbicadorUserCase : RestClient() {
|
class GetUbicadorUserCase(context: Context) : RestClient(context) {
|
||||||
|
|
||||||
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String) : Call<List<ItemUbicadorVO>> {
|
fun itemShelvingList(usuario:String,password:String,vShelvingFk:String) : Call<List<ItemUbicadorVO>> {
|
||||||
val params:ArrayList<String> = ArrayList();
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
open class RestClient {
|
import android.content.Context
|
||||||
|
|
||||||
|
open class RestClient(context:Context) {
|
||||||
var restClient:VerdnaturaService? = null
|
var restClient:VerdnaturaService? = null
|
||||||
var salixClient:SalixService? = null
|
var salixClient:SalixService? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
restClient = ApiUtils.getApiService()
|
restClient = ApiUtils.getApiService(context)
|
||||||
salixClient = ApiSalixUtils.getApiService()
|
salixClient = ApiSalixUtils.getApiService()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.preference.PreferenceManager
|
||||||
|
import android.view.KeyEvent
|
||||||
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
|
||||||
|
@ -12,12 +15,15 @@ import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_ajustes.splash_progress
|
||||||
|
import kotlinx.android.synthetic.main.fragment_login.*
|
||||||
|
|
||||||
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
||||||
|
|
||||||
|
@ -49,6 +55,19 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
item_version.setText(versionName)
|
item_version.setText(versionName)
|
||||||
user = prefs!!.getString(USER,"")
|
user = prefs!!.getString(USER,"")
|
||||||
password = prefs!!.getString(PASSWORD,"")
|
password = prefs!!.getString(PASSWORD,"")
|
||||||
|
|
||||||
|
|
||||||
|
txtserver.setText(this.getDefaults("base_url",this.requireContext()))
|
||||||
|
txtserver.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||||
|
this.setDefaults("base_url",txtserver.text.toString(),this.requireContext())
|
||||||
|
this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
|
||||||
|
this.hideKeyboard()
|
||||||
|
return@OnKeyListener false
|
||||||
|
}
|
||||||
|
false
|
||||||
|
})
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +186,17 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||||
|
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
val editor = preferences.edit()
|
||||||
|
editor.putString(key, value)
|
||||||
|
editor.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDefaults(key: String?, context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
return preferences.getString(key, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -15,9 +16,9 @@ import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
|
||||||
class AjustesViewModel : BaseViewModel() {
|
class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getAjustesUserCase:GetAjustesUserCase = GetAjustesUserCase()
|
private val getAjustesUserCase:GetAjustesUserCase = GetAjustesUserCase(context)
|
||||||
val version : String = "5.0.0";
|
val version : String = "5.0.0";
|
||||||
|
|
||||||
private val _ajustesitem by lazy { ArrayList<AjustesItemVO>() }
|
private val _ajustesitem by lazy { ArrayList<AjustesItemVO>() }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.articulo.fragment
|
package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetItemCardUserCase
|
import es.verdnatura.domain.GetItemCardUserCase
|
||||||
|
@ -11,8 +12,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ItemCardViewModel : BaseViewModel() {
|
class ItemCardViewModel(context: Context) : BaseViewModel() {
|
||||||
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase()
|
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context)
|
||||||
val version : String = "5.0.0";
|
val version : String = "5.0.0";
|
||||||
|
|
||||||
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -12,8 +13,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class BuscarItemViewModel : BaseViewModel() {
|
class BuscarItemViewModel(context: Context) : BaseViewModel() {
|
||||||
private val getBuscarItemUserCase: GetBuscarItemUserCase = GetBuscarItemUserCase()
|
private val getBuscarItemUserCase: GetBuscarItemUserCase = GetBuscarItemUserCase(context)
|
||||||
|
|
||||||
|
|
||||||
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
|
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.calidad.fragment
|
package es.verdnatura.presentation.view.feature.calidad.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetQualityUserCase
|
import es.verdnatura.domain.GetQualityUserCase
|
||||||
|
@ -12,9 +13,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class BuyersViewModel : BaseViewModel() {
|
class BuyersViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getQualityUserCase: GetQualityUserCase = GetQualityUserCase()
|
private val getQualityUserCase: GetQualityUserCase = GetQualityUserCase(context)
|
||||||
|
|
||||||
private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
|
private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
|
||||||
val buyersList: LiveData<BuyerListVO>
|
val buyersList: LiveData<BuyerListVO>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.calidad.fragment
|
package es.verdnatura.presentation.view.feature.calidad.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetQualityUserCase
|
import es.verdnatura.domain.GetQualityUserCase
|
||||||
|
@ -13,9 +14,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class QaualityViewModel : BaseViewModel() {
|
class QaualityViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getQualityUserCase: GetQualityUserCase = GetQualityUserCase()
|
private val getQualityUserCase: GetQualityUserCase = GetQualityUserCase(context)
|
||||||
|
|
||||||
private val _buyersList by lazy { MutableLiveData<ItemBuyerListVO>() }
|
private val _buyersList by lazy { MutableLiveData<ItemBuyerListVO>() }
|
||||||
val buyersList: LiveData<ItemBuyerListVO>
|
val buyersList: LiveData<ItemBuyerListVO>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.fragment
|
package es.verdnatura.presentation.view.feature.collection.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
@ -15,13 +16,13 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionViewModel : BaseViewModel() {
|
class CollectionViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
val emptyMessage = "La colección no tiene tickets";
|
val emptyMessage = "La colección no tiene tickets";
|
||||||
|
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase()
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase()
|
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||||
|
|
||||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||||
val collectionTicketList: LiveData<CollectionVO>
|
val collectionTicketList: LiveData<CollectionVO>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.controlador.fragment
|
package es.verdnatura.presentation.view.feature.controlador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||||
|
@ -10,10 +11,10 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ControladorViewModel : BaseViewModel() {
|
class ControladorViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
private val _collectionTicketList by lazy { MutableLiveData<CollectionVO>() }
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase()
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||||
|
|
||||||
val collectionTicketList: LiveData<CollectionVO>
|
val collectionTicketList: LiveData<CollectionVO>
|
||||||
get() = _collectionTicketList
|
get() = _collectionTicketList
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.faltas.fragment
|
package es.verdnatura.presentation.view.feature.faltas.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -14,11 +15,11 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class FaltasViewModel : BaseViewModel() {
|
class FaltasViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase()
|
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context)
|
||||||
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase()
|
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||||
|
|
||||||
|
|
||||||
private val _faltasList by lazy { MutableLiveData<ItemFaltasListVO>() }
|
private val _faltasList by lazy { MutableLiveData<ItemFaltasListVO>() }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.historico.fragment
|
package es.verdnatura.presentation.view.feature.historico.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -12,8 +13,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class HistoricoViewModel : BaseViewModel() {
|
class HistoricoViewModel(context: Context) : BaseViewModel() {
|
||||||
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase()
|
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.inventario.fragment
|
package es.verdnatura.presentation.view.feature.inventario.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -14,11 +15,11 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class InventaryViewModel : BaseViewModel() {
|
class InventaryViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase()
|
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context)
|
||||||
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase()
|
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
|
||||||
|
|
||||||
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
|
||||||
val inventaryList: LiveData<InventaryListVO>
|
val inventaryList: LiveData<InventaryListVO>
|
||||||
|
|
|
@ -1,20 +1,30 @@
|
||||||
package es.verdnatura.presentation.view.feature.login.fragment
|
package es.verdnatura.presentation.view.feature.login.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.AlarmManager
|
||||||
|
import android.app.PendingIntent
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.preference.PreferenceManager
|
||||||
|
import android.view.KeyEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentLoginBinding
|
import es.verdnatura.databinding.FragmentLoginBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||||
import kotlinx.android.synthetic.main.fragment_login.*
|
import kotlinx.android.synthetic.main.fragment_login.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_login.splash_progress
|
||||||
|
|
||||||
class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginViewModel::class) {
|
|
||||||
|
class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||||
|
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -28,7 +38,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
checkUser()
|
checkUser()
|
||||||
button_login.setOnClickListener(View.OnClickListener {
|
button_login.setOnClickListener(View.OnClickListener {
|
||||||
splash_progress.visibility = View.VISIBLE
|
splash_progress.visibility = View.VISIBLE
|
||||||
viewModel.login(edittext_username.text.toString(),edittext_password.text.toString())
|
viewModel.login(edittext_username.text.toString(), edittext_password.text.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
textview_remember_password.setOnClickListener {
|
textview_remember_password.setOnClickListener {
|
||||||
|
@ -38,13 +48,26 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
saveRemember(false)
|
saveRemember(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
edittext_server.setText(this.getDefaults("base_url", this.requireContext()))
|
||||||
|
edittext_server.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||||
|
this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
|
||||||
|
this.hideKeyboard()
|
||||||
|
restartapp()
|
||||||
|
return@OnKeyListener false
|
||||||
|
}
|
||||||
|
false
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkUser(){
|
private fun checkUser(){
|
||||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||||
if (prefs.getBoolean(RECORDAR,false)){
|
if (prefs.getBoolean(RECORDAR, false)){
|
||||||
edittext_username.setText(prefs.getString(USER,""))
|
edittext_username.setText(prefs.getString(USER, ""))
|
||||||
edittext_password.setText(prefs.getString(PASSWORD,""))
|
edittext_password.setText(prefs.getString(PASSWORD, ""))
|
||||||
if (edittext_password.text.toString().isNotEmpty()){
|
if (edittext_password.text.toString().isNotEmpty()){
|
||||||
switch_remember.isChecked = true
|
switch_remember.isChecked = true
|
||||||
}
|
}
|
||||||
|
@ -56,33 +79,44 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
loginitem.observe(viewLifecycleOwner, Observer {
|
loginitem.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.INVISIBLE
|
splash_progress.visibility = View.INVISIBLE
|
||||||
if (it.isError){
|
if (it.isError) {
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||||
|
.setOkButton("Cerrar") {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
}else{
|
} else {
|
||||||
splash_progress.visibility = View.VISIBLE
|
splash_progress.visibility = View.VISIBLE
|
||||||
saveUserFkPref(it)
|
saveUserFkPref(it)
|
||||||
if (switch_remember.isChecked) {
|
if (switch_remember.isChecked) {
|
||||||
saveRemember(true)
|
saveRemember(true)
|
||||||
}else{
|
} else {
|
||||||
saveRemember(false)
|
saveRemember(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
saveUserAccesPref(edittext_username.text.toString(),edittext_password.text.toString())
|
saveUserAccesPref(
|
||||||
loginSalix(user = edittext_username.text.toString(),password = edittext_password.text.toString())
|
edittext_username.text.toString(),
|
||||||
|
edittext_password.text.toString()
|
||||||
|
)
|
||||||
|
loginSalix(
|
||||||
|
user = edittext_username.text.toString(),
|
||||||
|
password = edittext_password.text.toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
loginsalixitem.observe(viewLifecycleOwner, Observer {
|
loginsalixitem.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.INVISIBLE
|
splash_progress.visibility = View.INVISIBLE
|
||||||
if (it.isError){
|
if (it.isError) {
|
||||||
saveTokenPref("")
|
saveTokenPref("")
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage+". Puedes continuar pero algunas funcionalidades no estarán disponibles.").setOkButton("Entendido"){
|
customDialog.setTitle("Error")
|
||||||
|
.setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
|
||||||
|
.setOkButton(
|
||||||
|
"Entendido"
|
||||||
|
) {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
getVersion()
|
getVersion()
|
||||||
}.show()
|
}.show()
|
||||||
}else{
|
} else {
|
||||||
saveTokenPref(it.token)
|
saveTokenPref(it.token)
|
||||||
getVersion()
|
getVersion()
|
||||||
}
|
}
|
||||||
|
@ -90,7 +124,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
|
|
||||||
version.observe(viewLifecycleOwner, Observer {
|
version.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.INVISIBLE
|
splash_progress.visibility = View.INVISIBLE
|
||||||
if (it){
|
if (it) {
|
||||||
/* customDialog.setTitle("Atención").setDescription("La aplicación se encuentra en fase de desarrollo. Algunas funcionalidades están desactivadas y se van a ir añadiendo de forma progresiva.").setOkButton("Entrar"){
|
/* customDialog.setTitle("Atención").setDescription("La aplicación se encuentra en fase de desarrollo. Algunas funcionalidades están desactivadas y se van a ir añadiendo de forma progresiva.").setOkButton("Entrar"){
|
||||||
goToMain()
|
goToMain()
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
|
@ -99,12 +133,17 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
}.show()*/
|
}.show()*/
|
||||||
goToMain()
|
goToMain()
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
customDialog.setTitle(getString(R.string.Actualizar)).setDescription(getString(R.string.updatemng)).setOkButton(getString(R.string.Actualizar)){
|
customDialog.setTitle(getString(R.string.Actualizar))
|
||||||
|
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||||
|
getString(
|
||||||
|
R.string.Actualizar
|
||||||
|
)
|
||||||
|
) {
|
||||||
val openURL = Intent(Intent.ACTION_VIEW)
|
val openURL = Intent(Intent.ACTION_VIEW)
|
||||||
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
|
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
|
||||||
startActivity(openURL)
|
startActivity(openURL)
|
||||||
}.setKoButton("Cancelar"){
|
}.setKoButton("Cancelar") {
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
goToMain()
|
goToMain()
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -114,44 +153,74 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
|
||||||
super.observeViewModel()
|
super.observeViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveTokenPref(token:String){
|
private fun saveTokenPref(token: String){
|
||||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||||
val editor = prefs.edit()
|
val editor = prefs.edit()
|
||||||
editor.putString(TOKEN,token)
|
editor.putString(TOKEN, token)
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveUserFkPref(loginitem : LoginItemVO){
|
private fun saveUserFkPref(loginitem: LoginItemVO){
|
||||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||||
val editor = prefs.edit()
|
val editor = prefs.edit()
|
||||||
editor.putString(USERFK,loginitem.id)
|
editor.putString(USERFK, loginitem.id)
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveUserAccesPref(user:String,password:String){
|
private fun saveUserAccesPref(user: String, password: String){
|
||||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||||
val editor = prefs.edit()
|
val editor = prefs.edit()
|
||||||
editor.putString(USER,user)
|
editor.putString(USER, user)
|
||||||
editor.putString(PASSWORD,password)
|
editor.putString(PASSWORD, password)
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveRemember(remember:Boolean){
|
private fun saveRemember(remember: Boolean){
|
||||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER, 0)
|
||||||
val editor = prefs.edit()
|
val editor = prefs.edit()
|
||||||
editor.putBoolean(RECORDAR,remember)
|
editor.putBoolean(RECORDAR, remember)
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun goToMain(){
|
private fun goToMain(){
|
||||||
val intent = Intent(activity,MainActivity::class.java)
|
val intent = Intent(activity, MainActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getVersion(){
|
private fun getVersion(){
|
||||||
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName,0).versionName
|
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName, 0).versionName
|
||||||
splash_progress.visibility = View.VISIBLE
|
splash_progress.visibility = View.VISIBLE
|
||||||
viewModel.checkVersion(user = edittext_username.text.toString(),password = edittext_password.text.toString(),version = versionName)
|
viewModel.checkVersion(
|
||||||
|
user = edittext_username.text.toString(),
|
||||||
|
password = edittext_password.text.toString(),
|
||||||
|
version = versionName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||||
|
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
val editor = preferences.edit()
|
||||||
|
editor.putString(key, value)
|
||||||
|
editor.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDefaults(key: String?, context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
return preferences.getString(key, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun restartapp(){
|
||||||
|
val mStartActivity = Intent(context, LoginActivity::class.java)
|
||||||
|
val mPendingIntentId = 123456
|
||||||
|
val mPendingIntent = PendingIntent.getActivity(
|
||||||
|
context,
|
||||||
|
mPendingIntentId,
|
||||||
|
mStartActivity,
|
||||||
|
PendingIntent.FLAG_CANCEL_CURRENT
|
||||||
|
)
|
||||||
|
val mgr = context!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
|
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
|
||||||
|
System.exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.login.fragment
|
package es.verdnatura.presentation.view.feature.login.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetLoginUserCase
|
import es.verdnatura.domain.GetLoginUserCase
|
||||||
|
@ -10,9 +11,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class LoginViewModel() : BaseViewModel() {
|
class LoginViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase()
|
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||||
|
|
||||||
|
|
||||||
private val _loginitem by lazy { MutableLiveData<LoginItemVO> ()}
|
private val _loginitem by lazy { MutableLiveData<LoginItemVO> ()}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -13,9 +14,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionPalletDetailViewModel: BaseViewModel() {
|
class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
|
||||||
|
|
||||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
|
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||||
|
|
||||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
||||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -15,9 +16,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionPalletViewModel : BaseViewModel() {
|
class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
|
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||||
|
|
||||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
||||||
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -15,9 +16,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionScanViewModel : BaseViewModel() {
|
class ExpeditionScanViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
|
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||||
|
|
||||||
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
||||||
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
|
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.GetPaletizadoresUserCase
|
import es.verdnatura.domain.GetPaletizadoresUserCase
|
||||||
|
@ -13,9 +14,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionTruckListViewModel : BaseViewModel() {
|
class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase()
|
private val getPaletizadoresUserCase: GetPaletizadoresUserCase = GetPaletizadoresUserCase(context)
|
||||||
|
|
||||||
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
|
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
|
||||||
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
|
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.parking.fragment
|
package es.verdnatura.presentation.view.feature.parking.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
import es.verdnatura.domain.GetUbicadorUserCase
|
||||||
|
@ -9,8 +10,8 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ParkingViewModel : BaseViewModel() {
|
class ParkingViewModel(context: Context) : BaseViewModel() {
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
class PasilleroViewModel : BaseViewModel() {
|
class PasilleroViewModel(context: Context) : BaseViewModel() {
|
||||||
private val _pasillerositem by lazy { ArrayList<PasillerosItemVO>() }
|
private val _pasillerositem by lazy { ArrayList<PasillerosItemVO>() }
|
||||||
val pasillerositem: List<PasillerosItemVO>
|
val pasillerositem: List<PasillerosItemVO>
|
||||||
get() = _pasillerositem
|
get() = _pasillerositem
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.presacador.fragment
|
package es.verdnatura.presentation.view.feature.presacador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
@ -16,11 +17,11 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class PreSacadorViewModel : BaseViewModel() {
|
class PreSacadorViewModel (context: Context): BaseViewModel() {
|
||||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase()
|
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase()
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase()
|
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||||
|
|
||||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.reposicion.fragment
|
package es.verdnatura.presentation.view.feature.reposicion.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetPreSacadorUseCase
|
import es.verdnatura.domain.GetPreSacadorUseCase
|
||||||
|
@ -14,10 +15,10 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ReposicionViewModel : BaseViewModel() {
|
class ReposicionViewModel(context: Context) : BaseViewModel() {
|
||||||
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase()
|
private val getPreSacadorUseCase: GetPreSacadorUseCase = GetPreSacadorUseCase(context)
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase()
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||||
|
|
||||||
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
private val _salesList by lazy { MutableLiveData<List<PreSacadorItemVO>>() }
|
||||||
val salesList: LiveData<List<PreSacadorItemVO>>
|
val salesList: LiveData<List<PreSacadorItemVO>>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.sacador.fragment
|
package es.verdnatura.presentation.view.feature.sacador.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetSacadorControladorUserCase
|
import es.verdnatura.domain.GetSacadorControladorUserCase
|
||||||
|
@ -14,11 +15,11 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class SacadorViewModel : BaseViewModel() {
|
class SacadorViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
val emptyMessage = "No tienes colecciones pendientes. Presiona sobre el + para crear colección";
|
val emptyMessage = "No tienes colecciones pendientes. Presiona sobre el + para crear colección";
|
||||||
|
|
||||||
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase()
|
private val getSacadorControladorUserCase: GetSacadorControladorUserCase = GetSacadorControladorUserCase(context)
|
||||||
|
|
||||||
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
|
||||||
val collectionList: LiveData<CollectionListVO>
|
val collectionList: LiveData<CollectionListVO>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.shelvingparking.fragment
|
package es.verdnatura.presentation.view.feature.shelvingparking.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -12,10 +13,10 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ShelvingParkingViewModel : BaseViewModel() {
|
class ShelvingParkingViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val getShelvingParkingUserCase: GetShelvingParkingUserCase = GetShelvingParkingUserCase()
|
private val getShelvingParkingUserCase: GetShelvingParkingUserCase = GetShelvingParkingUserCase(context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.transferencia.fragment
|
package es.verdnatura.presentation.view.feature.transferencia.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
import es.verdnatura.domain.GetUbicadorUserCase
|
||||||
|
@ -9,9 +10,9 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class TransferenciaViewModel : BaseViewModel() {
|
class TransferenciaViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.ubicador.fragment
|
package es.verdnatura.presentation.view.feature.ubicador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import es.verdnatura.domain.GetUbicadorUserCase
|
import es.verdnatura.domain.GetUbicadorUserCase
|
||||||
|
@ -9,10 +10,10 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class AutomaticAddItemViewModel : BaseViewModel() {
|
class AutomaticAddItemViewModel (context: Context): BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<ResponseItemVO>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.ubicador.fragment
|
package es.verdnatura.presentation.view.feature.ubicador.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
@ -13,10 +14,10 @@ import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class UbicadorViewModel : BaseViewModel() {
|
class UbicadorViewModel(context: Context) : BaseViewModel() {
|
||||||
|
|
||||||
|
|
||||||
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase()
|
private val getUbicadorUserCase: GetUbicadorUserCase = GetUbicadorUserCase(context)
|
||||||
|
|
||||||
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
private val _shelvingList by lazy { MutableLiveData<ItemUbicadorListVO>() }
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,38 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Server:"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body1"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginRight="@dimen/default_layout_margin"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtserver"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/verdnatura_white"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="text"
|
||||||
|
android:layout_marginTop="4dp"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,25 +35,48 @@
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/Bienvenido"
|
android:text="@string/Bienvenido"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="@dimen/h3"
|
android:textSize="14dp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
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.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/textinputlayout_username"
|
android:id="@+id/textinputlayout_server"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="0dp"
|
||||||
android:textColorHint="@android:color/darker_gray"
|
android:textColorHint="@android:color/darker_gray"
|
||||||
app:layout_constraintStart_toStartOf="@id/textview_welcome"
|
app:layout_constraintStart_toStartOf="@id/textview_welcome"
|
||||||
app:layout_constraintTop_toBottomOf="@id/textview_welcome">
|
app:layout_constraintTop_toBottomOf="@id/textview_welcome">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edittext_server"
|
||||||
|
style="@style/InputLineText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:backgroundTint="@android:color/white"
|
||||||
|
android:hint="Server:"
|
||||||
|
android:inputType="text"
|
||||||
|
android:lines="1"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textColorHint="@android:color/darker_gray" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/textinputlayout_username"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:textColorHint="@android:color/darker_gray"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/textinputlayout_server"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/textinputlayout_server">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edittext_username"
|
android:id="@+id/edittext_username"
|
||||||
style="@style/InputLineText"
|
style="@style/InputLineText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_margin="@dimen/default_layout_margin"
|
android:layout_margin="8dp"
|
||||||
android:backgroundTint="@android:color/white"
|
android:backgroundTint="@android:color/white"
|
||||||
android:hint="@string/Usuario"
|
android:hint="@string/Usuario"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
|
@ -79,7 +102,7 @@
|
||||||
android:id="@+id/edittext_password"
|
android:id="@+id/edittext_password"
|
||||||
style="@style/InputLineText"
|
style="@style/InputLineText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_margin="@dimen/default_layout_margin"
|
android:layout_margin="8dp"
|
||||||
android:backgroundTint="@android:color/white"
|
android:backgroundTint="@android:color/white"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:hint="Password"
|
android:hint="Password"
|
||||||
|
@ -91,6 +114,7 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textview_remember_user"
|
android:id="@+id/textview_remember_user"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
Loading…
Reference in New Issue