diff --git a/.idea/misc.xml b/.idea/misc.xml index 37a75096..7bfef59d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 622fe65f..3ec2e112 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,6 +29,11 @@ android { enabled = true } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } dependencies { diff --git a/app/release/newapp.apk b/app/release/newapp.apk new file mode 100644 index 00000000..5f9cc5ef Binary files /dev/null and b/app/release/newapp.apk differ diff --git a/app/release/output.json b/app/release/output.json new file mode 100644 index 00000000..439b2143 --- /dev/null +++ b/app/release/output.json @@ -0,0 +1 @@ +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"5.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 91a4d371..23e21370 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,11 +13,17 @@ android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true"> - + - + android:windowSoftInputMode="stateHidden" + android:configChanges="orientation" + android:screenOrientation="portrait"/> + diff --git a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt index 21c87e55..da71638f 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt @@ -8,8 +8,8 @@ import java.util.concurrent.TimeUnit class ApiUtils { companion object { - const val BASE_URL:String = "http://192.168.1.108:8000/" - //const val BASE_URL:String = "https://app.verdnatura.es/" + //const val BASE_URL:String = "http://192.168.1.108:8000/" + const val BASE_URL:String = "https://app.verdnatura.es/" fun getApiService():VerdnaturaService{ val retrofit = Retrofit.Builder() .baseUrl(BASE_URL) diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 784273f7..eb4921d9 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -1,10 +1,7 @@ package es.verdnatura.domain -import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import retrofit2.Call -import java.util.* -import kotlin.collections.ArrayList class GetUbicadorUserCase : RestClient() { diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 0c1d5d15..fdb97325 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -28,7 +28,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/version") + @POST("almacennew/version") fun version(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -39,7 +39,7 @@ interface VerdnaturaService { //AJUSTES ========================================================================> - @POST("almacenv2/sector_get") + @POST("almacennew/sector_get") fun getSectors(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -51,7 +51,7 @@ interface VerdnaturaService { //PASILLEROS ========================================================================> //CONSULTAR ARTICULO ========================================================================> - @POST("almacenv2/item_card") + @POST("almacennew/item_card") fun getItemCard(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -60,7 +60,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/item_Stock_Update") + @POST("almacennew/item_Stock_Update") fun itemStockUpdate(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -69,7 +69,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/item_placement_save") + @POST("almacennew/item_placement_save") fun itemPlacementSave(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -78,7 +78,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/buy_updateGrouping") + @POST("almacennew/buy_updateGrouping") fun updateGrouping(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -87,7 +87,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/buy_updatePacking") + @POST("almacennew/buy_updatePacking") fun updatePacking(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -96,7 +96,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/itemSaveMin") + @POST("almacennew/itemSaveMin") fun itemSaveMin(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -106,7 +106,7 @@ interface VerdnaturaService { Call - @POST("almacenv2/barcodes_edit") + @POST("almacennew/barcodes_edit") fun barcodes_edit(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -116,7 +116,7 @@ interface VerdnaturaService { Call //BUSCAR ITEM ========================================================================> - @POST("almacenv2/getItemUbication") + @POST("almacennew/getItemUbication") fun searchItemsUbicador(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -126,7 +126,7 @@ interface VerdnaturaService { Call> //INVENTARIO ========================================================================> - @POST("almacenv2/itemShelvingRadar") + @POST("almacennew/itemShelvingRadar") fun itemShelvingRadar(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -135,7 +135,7 @@ interface VerdnaturaService { @Body params: List): Call> - @POST("almacenv2/faultsReview") + @POST("almacennew/faultsReview") fun faultsReview(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -144,7 +144,7 @@ interface VerdnaturaService { @Body params: List): Call> - @POST("almacenv2/faultsReview_isChecked") + @POST("almacennew/faultsReview_isChecked") fun faultsReview_isChecked(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -154,7 +154,7 @@ interface VerdnaturaService { Call //SHELVING PARKING ========================================================================> - @POST("almacenv2/shelvingParking_get") + @POST("almacennew/shelvingParking_get") fun shelvingParking_get(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -164,7 +164,7 @@ interface VerdnaturaService { Call> //UBICADOR ========================================================================> - @POST("almacenv2/itemShelvingList") + @POST("almacennew/itemShelvingList") fun itemShelvingList(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -173,7 +173,7 @@ interface VerdnaturaService { @Body params: List): Call> - @POST("almacenv2/itemShelvingMake") + @POST("almacennew/itemShelvingMake") fun itemShelvingMake(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -182,7 +182,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/itemShelvingMake_multi") + @POST("almacennew/itemShelvingMake_multi") fun itemShelvingMake_multi(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -191,7 +191,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/shelvingPark") + @POST("almacennew/shelvingPark") fun shelvingPark(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -200,7 +200,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/shelvingChange") + @POST("almacennew/shelvingChange") fun shelvingChange(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -209,7 +209,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/clearShelvingList") + @POST("almacennew/clearShelvingList") fun clearShelvingList(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -218,7 +218,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/itemShelvingTransfer") + @POST("almacennew/itemShelvingTransfer") fun itemShelvingTransfer(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, @@ -227,7 +227,7 @@ interface VerdnaturaService { @Body params: List): Call - @POST("almacenv2/itemShelvingDelete") + @POST("almacennew/itemShelvingDelete") fun itemShelvingDelete(@Header("aplicacion") aplicacion: String, @Header("version") version: String, @Header("user") user: String, diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt index 4771a70b..cdfa81ae 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt @@ -23,6 +23,7 @@ abstract class BaseFragment(viewModelCla protected val SECTORDESCRIP = "sectordescrip" protected val SECTORFK = "sectorFk" protected val WAREHOUSEFK = "warehouseFk" + protected val RECORDAR = "recordar" protected val viewModel: V by viewModel(viewModelClass) protected lateinit var binding: T diff --git a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt index 41b0944c..7f2d3a09 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt @@ -8,7 +8,6 @@ import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO -import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO interface OnOptionsSelectedListener { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index 17733686..1856087d 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -4,6 +4,7 @@ package es.verdnatura.presentation.view.feature.articulo.fragment import android.content.Intent import android.content.SharedPreferences +import android.graphics.drawable.Drawable import android.view.View import android.view.inputmethod.EditorInfo import androidx.lifecycle.Observer @@ -13,6 +14,7 @@ import es.verdnatura.databinding.FragmentItemCardBinding import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnItemCardRowClickListener +import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialogInput @@ -24,6 +26,7 @@ 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.ItemCardVO import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity +import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter import es.verdnatura.presentation.view.feature.main.activity.MainActivity import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_item_card.* @@ -65,9 +68,25 @@ class ItemCardFragment( if (!itemFk.isNullOrEmpty()){ getItemCard(itemFk) } + setToolBar() super.init() } + private fun setToolBar(){ + val listIcons:ArrayList = ArrayList() + val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme()) + listIcons.add(iconReload) + toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener { + override fun onOptionsItemSelected(item: Drawable) { + if (item == iconReload){ + splash_progress.visibility = View.VISIBLE + getItemCard(itemFk) + } + } + + }) + toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + } private fun setEvents(){ edit_itemFk.requestFocus() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt index 893d0829..c9c26853 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/adapter/LocationAdapter.kt @@ -4,7 +4,6 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import es.verdnatura.databinding.ItemLocationRowBinding -import es.verdnatura.presentation.common.OnLocationRowClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt index 7a3ac82c..7a7d011e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt @@ -10,11 +10,9 @@ import es.verdnatura.R import es.verdnatura.databinding.FragmentBuscarItemBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment -import es.verdnatura.presentation.common.OnLocationRowClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter -import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO import es.verdnatura.presentation.view.feature.main.activity.MainActivity import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_buscar_item.* diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt index 59653b9d..928df055 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt @@ -3,17 +3,16 @@ package es.verdnatura.presentation.view.feature.faltas.fragment import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable +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.FragmentFaltasBinding -import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnFaltasNichoClickListener import es.verdnatura.presentation.common.OnFaltasReviewClickListener - import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.component.CustomDialog @@ -21,7 +20,6 @@ import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter - import es.verdnatura.presentation.view.feature.main.activity.MainActivity import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_faltas.* @@ -39,6 +37,8 @@ class FaltasFragment : BaseFragment(Falt private var listInvetoryAux:ArrayList = ArrayList() private lateinit var customDialog: CustomDialog private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null + private var reload = false + private var hideLoad = true companion object { fun newInstance() = FaltasFragment() @@ -51,20 +51,31 @@ class FaltasFragment : BaseFragment(Falt override fun getLayoutId(): Int = R.layout.fragment_faltas - override fun init() { - splash_progress.visibility = View.VISIBLE - activity!!.main_bottom_navigation.visibility = View.GONE - toolbar_title.text = "faultsReview" - setToolBar() + override fun onCreate(savedInstanceState: Bundle?) { val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0) user = prefs.getString(USER,"").toString() password = prefs.getString(PASSWORD,"").toString() sectorFk = prefs.getInt(SECTORFK,1).toString() warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString() viewModel.getFaltas(user,password,warehouseFk) + super.onCreate(savedInstanceState) + } + + override fun init() { + splash_progress.visibility = View.VISIBLE + activity!!.main_bottom_navigation.visibility = View.GONE + toolbar_title.text = "faultsReview" + setToolBar() + customDialogInput = CustomDialogInput(requireContext()) customDialog = CustomDialog(requireContext()) setEvents() + if (reload){ + reload = false + hideLoad = false + splash_progress.visibility = View.VISIBLE + viewModel.getFaltas(user,password,warehouseFk) + } super.init() } @@ -117,10 +128,12 @@ class FaltasFragment : BaseFragment(Falt override fun observeViewModel() { with(viewModel){ - loadFaltasList.observe(viewLifecycleOwner, Observer { event -> - - event.getContentIfNotHandled().notNull { - splash_progress.visibility = View.GONE + faltasList.observe(viewLifecycleOwner, Observer { + if (hideLoad){ + splash_progress.visibility = View.GONE + }else{ + hideLoad = true + } listInvetory = ArrayList() listInvetoryAux = ArrayList() it.list.forEach { @@ -163,7 +176,7 @@ class FaltasFragment : BaseFragment(Falt },pasillerosItemClickListener!!) location_recyclerview.adapter = adapter location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) - } + }) @@ -198,6 +211,9 @@ class FaltasFragment : BaseFragment(Falt } listInvetoryAux.removeAt(position) adapter?.notifyDataSetChanged() + + reload = true + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt index bdcebc63..8eebc6a6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt @@ -3,13 +3,13 @@ package es.verdnatura.presentation.view.feature.inventario.fragment import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable +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.FragmentInventaryBinding -import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnInvetoryNichoClickListener import es.verdnatura.presentation.common.OnOptionsSelectedListener @@ -38,6 +38,8 @@ class InventaryFragment : BaseFragment = ArrayList() private lateinit var customDialog: CustomDialog private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null + private var reload = false + private var hideLoad = true companion object { fun newInstance() = InventaryFragment() @@ -50,23 +52,31 @@ class InventaryFragment : BaseFragment - event.getContentIfNotHandled().notNull { - splash_progress.visibility = View.GONE + + inventaryList.observe(viewLifecycleOwner, Observer { + if (hideLoad){ + splash_progress.visibility = View.GONE + }else{ + hideLoad = true + } + listInvetory = ArrayList() listInvetoryAux = ArrayList() it.list.forEach { @@ -163,7 +180,8 @@ class InventaryFragment : BaseFragment() } val inventaryList: LiveData get() = _inventaryList @@ -52,6 +51,7 @@ class InventaryViewModel : BaseViewModel() { val listError:ArrayList = ArrayList() listError.add(ItemInventaryVO(isError = true,errorMessage = "Error en la llamada de itemShelvingRadar")) _inventaryList.value = InventaryListVO(listError) + } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index a2badb4e..3998db85 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -30,15 +30,25 @@ class LoginFragment : BaseFragment (LoginVi splash_progress.visibility = View.VISIBLE viewModel.login(edittext_username.text.toString(),edittext_password.text.toString()) }) + + textview_remember_password.setOnClickListener { + edittext_username.setText("") + edittext_password.setText("") + switch_remember.isChecked = false + saveRemember(false) + } } private fun checkUser(){ val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0) - edittext_username.setText(prefs.getString(USER,"")) - edittext_password.setText(prefs.getString(PASSWORD,"")) - if (edittext_password.text.toString().isNotEmpty()){ - switch_remember.isChecked = true + if (prefs.getBoolean(RECORDAR,false)){ + edittext_username.setText(prefs.getString(USER,"")) + edittext_password.setText(prefs.getString(PASSWORD,"")) + if (edittext_password.text.toString().isNotEmpty()){ + switch_remember.isChecked = true + } } + } override fun observeViewModel() { @@ -53,10 +63,12 @@ class LoginFragment : BaseFragment (LoginVi splash_progress.visibility = View.VISIBLE saveUserFkPref(it) if (switch_remember.isChecked) { - saveUserAccesPref(edittext_username.text.toString(),edittext_password.text.toString()) + saveRemember(true) }else{ - saveUserAccesPref("","") + saveRemember(false) } + + saveUserAccesPref(edittext_username.text.toString(),edittext_password.text.toString()) loginSalix(user = edittext_username.text.toString(),password = edittext_password.text.toString()) } @@ -78,7 +90,13 @@ class LoginFragment : BaseFragment (LoginVi version.observe(viewLifecycleOwner, Observer { splash_progress.visibility = View.INVISIBLE if (it){ - goToMain() + 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() + customDialog.hide() + }.setKoButton("Cancelar"){ + customDialog.hide() + }.show() + }else{ customDialog.setTitle("Error").setDescription("Existe una versión nueva, es recomendable actualizar.").setOkButton("Actualizar"){ val openURL = Intent(Intent.ACTION_VIEW) @@ -116,6 +134,13 @@ class LoginFragment : BaseFragment (LoginVi editor.apply() } + private fun saveRemember(remember:Boolean){ + val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0) + val editor = prefs.edit() + editor.putBoolean(RECORDAR,remember) + editor.apply() + } + private fun goToMain(){ val intent = Intent(activity,MainActivity::class.java) startActivity(intent) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index 827ed94a..ca7552b0 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -116,11 +116,11 @@ class MainActivity : BaseActivity() , OnPasillerosItemClick true } "Sacadores" -> { - selectedItemMenu.title.toast(this@MainActivity) + "Función Sacadores desactivada".toast(this@MainActivity) true } "Controladores" -> { - selectedItemMenu.title.toast(this@MainActivity) + "Función Controladores desactivada".toast(this@MainActivity) true } "Ajustes" -> { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/AutomaticAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/AutomaticAdapter.kt index 73cad3db..cd4d63ec 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/AutomaticAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/AutomaticAdapter.kt @@ -4,11 +4,8 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import es.verdnatura.databinding.ItemEscanerRowBinding -import es.verdnatura.databinding.ItemUbicationRowBinding import es.verdnatura.presentation.common.OnAutomaticItemClickListener -import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO -import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO class AutomaticAdapter ( private val items: List, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt index bda1fd41..cb75ae2e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.kt @@ -4,15 +4,12 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R -import es.verdnatura.databinding.ItemShelvingparkingRowBinding import es.verdnatura.databinding.ItemUbicationRowBinding import es.verdnatura.presentation.common.OnMoreClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnVisibleClickListener import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO -import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter -import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO class UbicadorAdapter ( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt index 888774b3..dd17537f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt @@ -7,7 +7,6 @@ import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentAutomaticAddItemBinding -import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnAutomaticItemClickListener import es.verdnatura.presentation.view.component.CustomDialog @@ -15,13 +14,9 @@ import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogUbicador import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter -import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_automatic_add_item.* -import kotlinx.android.synthetic.main.fragment_automatic_add_item.edit_matricula -import kotlinx.android.synthetic.main.fragment_automatic_add_item.splash_progress -import kotlinx.android.synthetic.main.fragment_ubicador.* import kotlinx.android.synthetic.main.toolbar.* class AutomaticAddItemFragment( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index 81812792..b735ab2c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -1,6 +1,5 @@ package es.verdnatura.presentation.view.feature.ubicador.fragment -import android.app.Activity import android.content.Context import android.content.SharedPreferences import android.graphics.drawable.Drawable diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index 89efa0fe..b71b55ae 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -3,14 +3,10 @@ package es.verdnatura.presentation.view.feature.ubicador.fragment import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations -import androidx.lifecycle.ViewModel -import es.verdnatura.domain.GetShelvingParkingUserCase import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.ResponseItemVO -import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingListVO -import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorListVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import retrofit2.Call diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml index 4668aaa2..0627f66d 100644 --- a/app/src/main/res/layout/fragment_login.xml +++ b/app/src/main/res/layout/fragment_login.xml @@ -141,7 +141,7 @@ android:layout_marginEnd="16dp" android:paddingStart="@dimen/layout_margin_3" android:paddingEnd="@dimen/layout_margin_3" - android:text="¿No recuerdas tu contraseña? Contacta con informática" + android:text="Borrar datos de acceso" android:textAllCaps="false" android:textColor="@color/verdnatura_white" android:textStyle="normal"