navigation
This commit is contained in:
parent
cb005b3837
commit
a56613525b
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.di
|
package es.verdnatura.di
|
||||||
|
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||||
|
@ -17,6 +18,11 @@ val viewModelModule = module{
|
||||||
PasilleroViewModel()
|
PasilleroViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pasilleros / Item Card
|
||||||
|
viewModel {
|
||||||
|
ItemCardViewModel()
|
||||||
|
}
|
||||||
|
|
||||||
// Ajustes
|
// Ajustes
|
||||||
viewModel {
|
viewModel {
|
||||||
AjustesViewModel()
|
AjustesViewModel()
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
|
import retrofit2.Call
|
||||||
|
|
||||||
|
class GetItemCardUserCase : RestClient() {
|
||||||
|
|
||||||
|
fun getItemCard(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<ItemCardVO> {
|
||||||
|
val params:ArrayList<String> = ArrayList();
|
||||||
|
params.add(itemFk)
|
||||||
|
params.add(warehouseFk)
|
||||||
|
return restClient!!.getItemCard("json","1",usuario,password,"application/json",params = params)!!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package es.verdnatura.domain
|
||||||
|
|
||||||
|
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.Header
|
import retrofit2.http.Header
|
||||||
|
@ -9,6 +10,7 @@ import retrofit2.http.POST
|
||||||
|
|
||||||
interface VerdnaturaService {
|
interface VerdnaturaService {
|
||||||
|
|
||||||
|
//LOGIN ========================================================================>
|
||||||
@POST("security/login")
|
@POST("security/login")
|
||||||
fun login(@Header("aplicacion") aplicacion: String,
|
fun login(@Header("aplicacion") aplicacion: String,
|
||||||
@Header("version") version: String,
|
@Header("version") version: String,
|
||||||
|
@ -27,6 +29,8 @@ interface VerdnaturaService {
|
||||||
@Body params: List<String>):
|
@Body params: List<String>):
|
||||||
Call<Boolean>
|
Call<Boolean>
|
||||||
|
|
||||||
|
|
||||||
|
//AJUSTES ========================================================================>
|
||||||
@POST("almacenv2/sector_get")
|
@POST("almacenv2/sector_get")
|
||||||
fun getSectors(@Header("aplicacion") aplicacion: String,
|
fun getSectors(@Header("aplicacion") aplicacion: String,
|
||||||
@Header("version") version: String,
|
@Header("version") version: String,
|
||||||
|
@ -35,4 +39,15 @@ interface VerdnaturaService {
|
||||||
@Header("Content-Type") content_type: String):
|
@Header("Content-Type") content_type: String):
|
||||||
Call<List<SectorItemVO>>
|
Call<List<SectorItemVO>>
|
||||||
|
|
||||||
|
|
||||||
|
//PASILLEROS ========================================================================>
|
||||||
|
@POST("almacenv2/item_card")
|
||||||
|
fun getItemCard(@Header("aplicacion") aplicacion: String,
|
||||||
|
@Header("version") version: String,
|
||||||
|
@Header("user") user: String,
|
||||||
|
@Header("pass") pass: String,
|
||||||
|
@Header("Content-Type") content_type: String,
|
||||||
|
@Body params: List<String>):
|
||||||
|
Call<ItemCardVO>
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Bundle
|
||||||
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
|
||||||
|
@ -16,6 +17,7 @@ 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 es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
|
||||||
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
import kotlinx.android.synthetic.main.fragment_ajustes.*
|
||||||
|
|
||||||
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(AjustesViewModel::class) {
|
||||||
|
@ -32,10 +34,16 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
}
|
}
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_ajustes
|
override fun getLayoutId(): Int = R.layout.fragment_ajustes
|
||||||
|
|
||||||
override fun init() {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
|
prefs = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,"Sin sector").toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0))
|
viewModel.inititializeDefaultAjusts(prefs!!.getString(SECTORDESCRIP,"Sin sector").toString(),prefs!!.getInt(SECTORFK,0),prefs!!.getInt(WAREHOUSEFK,0))
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
activity!!.main_bottom_navigation.visibility = View.VISIBLE
|
||||||
user_text.setText(prefs!!.getString(USERFK,""))
|
user_text.setText(prefs!!.getString(USERFK,""))
|
||||||
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName,0).versionName
|
val versionName = activity!!.packageManager.getPackageInfo(activity!!.packageName,0).versionName
|
||||||
item_version.setText(versionName)
|
item_version.setText(versionName)
|
||||||
|
@ -44,6 +52,7 @@ class AjustesFragment : BaseFragment<FragmentAjustesBinding,AjustesViewModel>(Aj
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel){
|
with(viewModel){
|
||||||
ajustesAdapter = AjustesAdapter(ajustesitem,object: OnAjustesItemClickListener{
|
ajustesAdapter = AjustesAdapter(ajustesitem,object: OnAjustesItemClickListener{
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import androidx.lifecycle.Observer
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||||
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||||
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_item_card.*
|
||||||
|
|
||||||
|
class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>(ItemCardViewModel::class) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance() = ItemCardFragment()
|
||||||
|
}
|
||||||
|
private lateinit var customDialog: CustomDialog
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||||
|
setEvents()
|
||||||
|
customDialog = CustomDialog(requireContext())
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setEvents(){
|
||||||
|
edit_itemFk.requestFocus()
|
||||||
|
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
getItemCard(edit_itemFk.text.toString())
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getItemCard(itemFk:String){
|
||||||
|
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||||
|
val user = prefs.getString(USER,"")
|
||||||
|
val password = prefs.getString(PASSWORD,"")
|
||||||
|
val warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||||
|
splash_progress.visibility = View.VISIBLE
|
||||||
|
viewModel.getItemCard(itemFk,warehouseFk,user!!,password!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun observeViewModel() {
|
||||||
|
with(viewModel){
|
||||||
|
itemcard.observe(viewLifecycleOwner, Observer {
|
||||||
|
splash_progress.visibility = View.GONE
|
||||||
|
if (it.isError){
|
||||||
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||||
|
customDialog.hide()
|
||||||
|
}.show()
|
||||||
|
}else{
|
||||||
|
customDialog.setTitle("Perfecto!!!").setDescription("Tenemos datos para itemFk: "+it.id).setOkButton("Cerrar"){
|
||||||
|
customDialog.hide()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.GetItemCardUserCase
|
||||||
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Callback
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
class ItemCardViewModel : BaseViewModel() {
|
||||||
|
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase()
|
||||||
|
val version : String = "5.0.0";
|
||||||
|
|
||||||
|
private val _itemcard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
|
val itemcard: LiveData<ItemCardVO>
|
||||||
|
get() = _itemcard
|
||||||
|
|
||||||
|
|
||||||
|
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String) {
|
||||||
|
getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback<ItemCardVO>{
|
||||||
|
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
|
||||||
|
_itemcard.value = ItemCardVO(isError = true,errorMessage = t.message!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call<ItemCardVO>, response: Response<ItemCardVO>) {
|
||||||
|
if (response.body() != null){
|
||||||
|
_itemcard.value = response.body()!!
|
||||||
|
}else{
|
||||||
|
_itemcard.value = ItemCardVO(isError = true,errorMessage = "Error al llamar a vn.itemCard")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.articulo.model
|
||||||
|
|
||||||
|
class ItemCardVO (
|
||||||
|
var id:String = "0",
|
||||||
|
var longNameString:String = "0",
|
||||||
|
var value5:String = "",
|
||||||
|
var value6:String = "0",
|
||||||
|
var value7:String = "0",
|
||||||
|
var image:String = "0",
|
||||||
|
var size:String = "0",
|
||||||
|
var stems:String = "0",
|
||||||
|
var category:String = "0",
|
||||||
|
var producer:String = "0",
|
||||||
|
var origin:String = "0",
|
||||||
|
var nicho:String = "0",
|
||||||
|
var reserva:String = "0",
|
||||||
|
var enNicho:String = "0",
|
||||||
|
var available:String = "0",
|
||||||
|
var enAltillo:String = "0",
|
||||||
|
var repo:String = "0",
|
||||||
|
var total:String = "0",
|
||||||
|
var min:String = "0",
|
||||||
|
var grouping:String = "0",
|
||||||
|
var packing:String = "0",
|
||||||
|
var barcodes:List<String> = listOf(),
|
||||||
|
var tag5:String = "",
|
||||||
|
var tag6:String = "",
|
||||||
|
var tag7:String = "",
|
||||||
|
var isError: Boolean = false,
|
||||||
|
var errorMessage:String = ""
|
||||||
|
)
|
|
@ -1,9 +1,12 @@
|
||||||
package es.verdnatura.presentation.view.feature.main.activity
|
package es.verdnatura.presentation.view.feature.main.activity
|
||||||
|
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
import android.view.View
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ActivityMainBinding
|
import es.verdnatura.databinding.ActivityMainBinding
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
@ -13,6 +16,7 @@ import es.verdnatura.presentation.common.TAG
|
||||||
import es.verdnatura.presentation.common.addFragment
|
import es.verdnatura.presentation.common.addFragment
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||||
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
|
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
|
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
@ -26,19 +30,31 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
|
|
||||||
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
private var lastBottomMenuItemSelected: ItemMenuVO? = null
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
|
val fm: FragmentManager = supportFragmentManager
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.activity_main
|
override fun getLayoutId(): Int = R.layout.activity_main
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
customDialog = CustomDialog(this)
|
customDialog = CustomDialog(this)
|
||||||
setBottomMenu()
|
setBottomMenu()
|
||||||
addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG)
|
if(haveSector()) addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG)
|
||||||
|
else addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openFragment(fragment: Fragment) {
|
private fun haveSector() : Boolean{
|
||||||
|
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs",0)
|
||||||
|
val sectorFk = prefs.getInt("sectorFk",-1)
|
||||||
|
return sectorFk != -1
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openFragment(fragment: Fragment,tagname:String) {
|
||||||
val transaction = supportFragmentManager.beginTransaction()
|
val transaction = supportFragmentManager.beginTransaction()
|
||||||
transaction.replace(R.id.main_frame_layout, fragment)
|
transaction.replace(R.id.main_frame_layout, fragment)
|
||||||
transaction.addToBackStack(null)
|
transaction.addToBackStack(tagname)
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,11 +85,21 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
bottomMenu.menu.add(Menu.NONE, it.id, Menu.NONE, it.title).icon = it.defaultImage
|
bottomMenu.menu.add(Menu.NONE, it.id, Menu.NONE, it.title).icon = it.defaultImage
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select first item by default
|
|
||||||
val firstItem = bottomMenuItems.first()
|
if(haveSector()){
|
||||||
bottomMenu.selectedItemId = firstItem.id
|
// Select first item by default
|
||||||
bottomMenu.menu.findItem(firstItem.id).icon = firstItem.selectedImage
|
val firstItem = bottomMenuItems.first()
|
||||||
lastBottomMenuItemSelected = firstItem
|
bottomMenu.selectedItemId = firstItem.id
|
||||||
|
bottomMenu.menu.findItem(firstItem.id).icon = firstItem.selectedImage
|
||||||
|
lastBottomMenuItemSelected = firstItem
|
||||||
|
}else{
|
||||||
|
// Select last item by default
|
||||||
|
val lastItem = bottomMenuItems.last()
|
||||||
|
bottomMenu.selectedItemId = lastItem.id
|
||||||
|
bottomMenu.menu.findItem(lastItem.id).icon = lastItem.selectedImage
|
||||||
|
lastBottomMenuItemSelected = lastItem
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bottomMenu.setOnNavigationItemSelectedListener { menuItem ->
|
bottomMenu.setOnNavigationItemSelectedListener { menuItem ->
|
||||||
// Get selected item from itemList and apply ui changes to menu view
|
// Get selected item from itemList and apply ui changes to menu view
|
||||||
|
@ -87,7 +113,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
|
|
||||||
when (selectedItemMenu?.title) {
|
when (selectedItemMenu?.title) {
|
||||||
"Pasilleros" -> {
|
"Pasilleros" -> {
|
||||||
addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG)
|
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
|
addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
"Sacadores" -> {
|
"Sacadores" -> {
|
||||||
|
@ -99,7 +126,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
"Ajustes" -> {
|
"Ajustes" -> {
|
||||||
addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG)
|
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
|
addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,17 +144,28 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPasillerosItemClickListener(item: PasillerosItemVO) {
|
override fun onPasillerosItemClickListener(item: PasillerosItemVO) {
|
||||||
|
when (item.title){
|
||||||
|
"Consultar artículo" -> {
|
||||||
|
openFragment(ItemCardFragment(),"PASILLEROS")
|
||||||
|
}
|
||||||
|
}
|
||||||
Log.i("Item: ",item.title)
|
Log.i("Item: ",item.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
customDialog.setTitle("Error").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
|
|
||||||
customDialog.hide()
|
if (fm.backStackEntryCount > 0) {
|
||||||
finish()
|
super.onBackPressed()
|
||||||
}.setKoButton("Cancelar") {
|
} else {
|
||||||
customDialog.hide()
|
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
|
||||||
}.show()
|
customDialog.hide()
|
||||||
|
finish()
|
||||||
|
}.setKoButton("Cancelar") {
|
||||||
|
customDialog.hide()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentPasilleroBinding
|
import es.verdnatura.databinding.FragmentPasilleroBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
|
import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
|
||||||
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_pasillero.*
|
import kotlinx.android.synthetic.main.fragment_pasillero.*
|
||||||
|
|
||||||
class PasilleroFragment : BaseFragment<FragmentPasilleroBinding,PasilleroViewModel>(PasilleroViewModel::class){
|
class PasilleroFragment : BaseFragment<FragmentPasilleroBinding,PasilleroViewModel>(PasilleroViewModel::class){
|
||||||
|
@ -25,10 +28,16 @@ class PasilleroFragment : BaseFragment<FragmentPasilleroBinding,PasilleroViewMod
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_pasillero
|
override fun getLayoutId(): Int = R.layout.fragment_pasillero
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
viewModel.inititializeDefaultData()
|
activity!!.main_bottom_navigation.visibility = View.VISIBLE
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
viewModel.inititializeDefaultData()
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:centerY="40%"
|
||||||
|
android:type="linear"
|
||||||
|
android:startColor="@color/verdnatura_black"
|
||||||
|
android:centerColor="#AE000000"
|
||||||
|
android:endColor="@android:color/transparent" />
|
||||||
|
</shape>
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
>
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="viewModel"
|
||||||
|
type="es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/main_toolbar"
|
||||||
|
layout="@layout/toolbar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_itemFk"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/verdnatura_white"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:padding="@dimen/layout_margin_1"
|
||||||
|
android:textColor="@color/verdnatura_black"
|
||||||
|
android:textSize="@dimen/body1"
|
||||||
|
android:hint="Escanea o introduce item"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/main_toolbar" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/splash_progress"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@color/verdnatura_black_8_alpha_6"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||||
|
|
||||||
|
app:lottie_autoPlay="true"
|
||||||
|
app:lottie_loop="true"
|
||||||
|
app:lottie_rawRes="@raw/orange_loading"
|
||||||
|
app:lottie_speed="2" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/verdnatura_black">
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tool="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:background="@drawable/background_gradient">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/toolbar_title_separator"
|
||||||
|
android:layout_width="2dp"
|
||||||
|
android:layout_height="@dimen/toolbar_icon_height"
|
||||||
|
android:layout_marginTop="@dimen/default_layout_margin"
|
||||||
|
android:layout_marginBottom="@dimen/default_layout_margin"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:background="@color/verdnatura_pumpkin_orange" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbar_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/default_layout_margin"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/h6"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/toolbar_title_separator"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:text="ItemCard" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/toolbar_icons"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/layout_margin_1"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
</layout>
|
Loading…
Reference in New Issue