itemCard
This commit is contained in:
parent
a56613525b
commit
b6ccae0f91
|
@ -1,6 +1,9 @@
|
||||||
package es.verdnatura.presentation.base
|
package es.verdnatura.presentation.base
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
|
@ -30,4 +33,9 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
||||||
binding.lifecycleOwner = this
|
binding.lifecycleOwner = this
|
||||||
addBindingVariables()
|
addBindingVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hideKeyboard(view: View){
|
||||||
|
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.common
|
package es.verdnatura.presentation.common
|
||||||
|
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
interface OnPasillerosItemClickListener {
|
interface OnPasillerosItemClickListener {
|
||||||
|
@ -10,3 +11,8 @@ interface OnPasillerosItemClickListener {
|
||||||
interface OnAjustesItemClickListener {
|
interface OnAjustesItemClickListener {
|
||||||
fun onAjustesItemClickListener(item: AjustesItemVO)
|
fun onAjustesItemClickListener(item: AjustesItemVO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface OnItemCardRowClickListener {
|
||||||
|
fun onItemCardRowClickListener(item: ItemCardRowVO)
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
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.DialogInterface
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -16,7 +15,6 @@ 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 es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
|
|
||||||
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.*
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.articulo.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.ItemAjustesRowBinding
|
||||||
|
import es.verdnatura.databinding.ItemCardRowBinding
|
||||||
|
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
||||||
|
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
|
|
||||||
|
class ItemCardAdapter (
|
||||||
|
private val items: List<ItemCardRowVO>,
|
||||||
|
private val onItemCardRowClickListener: OnItemCardRowClickListener
|
||||||
|
): RecyclerView.Adapter<ItemCardAdapter.ItemHolder> () {
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
|
return ItemHolder(
|
||||||
|
ItemCardRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() =items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
if (items[position].isEditable){
|
||||||
|
holder.binding.root.setOnClickListener {
|
||||||
|
onItemCardRowClickListener.onItemCardRowClickListener(items[position])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ItemHolder(
|
||||||
|
val binding: ItemCardRowBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root){
|
||||||
|
private val res = binding.root.context.resources
|
||||||
|
fun bind(item: ItemCardRowVO) {
|
||||||
|
binding.apply {
|
||||||
|
if (item.barcodes.isNotEmpty()){
|
||||||
|
item.barcodes.forEach {
|
||||||
|
item.value = item.value + it.code + "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.item = item
|
||||||
|
if (item.isEditable){
|
||||||
|
itemImage.visibility = View.VISIBLE
|
||||||
|
}else{
|
||||||
|
itemImage.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,17 +3,24 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
||||||
|
import es.verdnatura.presentation.common.addFragment
|
||||||
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
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.articulo.adapter.ItemCardAdapter
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_item_card.*
|
import kotlinx.android.synthetic.main.fragment_item_card.*
|
||||||
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
|
||||||
class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>(ItemCardViewModel::class) {
|
class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>(ItemCardViewModel::class) {
|
||||||
|
|
||||||
|
@ -25,8 +32,10 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
itemcard_layout.visibility = View.GONE
|
||||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||||
setEvents()
|
setEvents()
|
||||||
|
toolbar_title.text = "ItemCard"
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
@ -35,11 +44,18 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
||||||
edit_itemFk.requestFocus()
|
edit_itemFk.requestFocus()
|
||||||
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
if (!edit_itemFk.text.toString().isNullOrEmpty())
|
||||||
getItemCard(edit_itemFk.text.toString())
|
getItemCard(edit_itemFk.text.toString())
|
||||||
|
edit_itemFk.setText("")
|
||||||
|
(activity as MainActivity).hideKeyboard(edit_itemFk)
|
||||||
return@setOnEditorActionListener true
|
return@setOnEditorActionListener true
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backButton.setOnClickListener {
|
||||||
|
activity!!.onBackPressed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getItemCard(itemFk:String){
|
private fun getItemCard(itemFk:String){
|
||||||
|
@ -56,17 +72,67 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
||||||
itemcard.observe(viewLifecycleOwner, Observer {
|
itemcard.observe(viewLifecycleOwner, Observer {
|
||||||
splash_progress.visibility = View.GONE
|
splash_progress.visibility = View.GONE
|
||||||
if (it.isError){
|
if (it.isError){
|
||||||
|
itemcard_layout.visibility = View.GONE
|
||||||
|
toolbar_title.text = "ItemCard"
|
||||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||||
customDialog.hide()
|
customDialog.hide()
|
||||||
}.show()
|
}.show()
|
||||||
}else{
|
}else{
|
||||||
customDialog.setTitle("Perfecto!!!").setDescription("Tenemos datos para itemFk: "+it.id).setOkButton("Cerrar"){
|
if (it.id != "0"){
|
||||||
|
itemcard_layout.visibility = View.VISIBLE
|
||||||
|
setItemCard(it)
|
||||||
|
}else{
|
||||||
|
itemcard_layout.visibility = View.GONE
|
||||||
|
toolbar_title.text = "ItemCard"
|
||||||
|
customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){
|
||||||
customDialog.hide()
|
customDialog.hide()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setItemCard(itemInfo:ItemCardVO){
|
||||||
|
toolbar_title.text = itemInfo.id+"-"+itemInfo.longName
|
||||||
|
itemcard_image.loadUrl(itemInfo.urlImage200)
|
||||||
|
itemcard_tag1.text = itemInfo.size
|
||||||
|
itemcard_tag2.text = itemInfo.value5
|
||||||
|
itemcard_tag3.text = itemInfo.value6
|
||||||
|
itemcard_tag4.text = itemInfo.value7 + " " + itemInfo.origin
|
||||||
|
val listItemsRow:ArrayList<ItemCardRowVO> = ArrayList()
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "Total",value = itemInfo.total,isEditable = false))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "Disponible",value = itemInfo.available,isEditable = false))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "Ubicado",value = itemInfo.enAltillo,isEditable = false))
|
||||||
|
//EDITABLES
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "SIN UBICAR",value = itemInfo.enNicho,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "NICHO",value = itemInfo.nicho,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "GROUPING",value = itemInfo.grouping,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "PACKING",value = itemInfo.packing,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "MINIMO",value = itemInfo.min,isEditable = true))
|
||||||
|
listItemsRow.add(ItemCardRowVO(title = "BARCODE",barcodes = itemInfo.barcodes,isEditable = true))
|
||||||
|
|
||||||
|
itemcard_recyclerview.adapter = ItemCardAdapter(listItemsRow,object: OnItemCardRowClickListener{
|
||||||
|
override fun onItemCardRowClickListener(item: ItemCardRowVO) {
|
||||||
|
customDialog.setTitle(item.title!!).setDescription(item.value!!).setOkButton("Cerrar"){
|
||||||
|
customDialog.hide()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
scroll_view.post(Runnable {
|
||||||
|
val position:IntArray = IntArray(2)
|
||||||
|
itemcard_image.getLocationInWindow(position)
|
||||||
|
scroll_view.scrollTo(0, position[1])
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package es.verdnatura.presentation.view.feature.articulo.model
|
||||||
|
|
||||||
class ItemCardVO (
|
class ItemCardVO (
|
||||||
var id:String = "0",
|
var id:String = "0",
|
||||||
var longNameString:String = "0",
|
var longName:String = "0",
|
||||||
var value5:String = "",
|
var value5:String = "",
|
||||||
var value6:String = "0",
|
var value6:String = "0",
|
||||||
var value7:String = "0",
|
var value7:String = "0",
|
||||||
|
@ -22,10 +22,25 @@ class ItemCardVO (
|
||||||
var min:String = "0",
|
var min:String = "0",
|
||||||
var grouping:String = "0",
|
var grouping:String = "0",
|
||||||
var packing:String = "0",
|
var packing:String = "0",
|
||||||
var barcodes:List<String> = listOf(),
|
var barcodes:List<BarcodeVO> = listOf(),
|
||||||
var tag5:String = "",
|
var tag5:String = "",
|
||||||
var tag6:String = "",
|
var tag6:String = "",
|
||||||
var tag7:String = "",
|
var tag7:String = "",
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage:String = ""
|
var errorMessage:String = "",
|
||||||
|
var urlImage200:String = "",
|
||||||
|
var urlImage:String = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class ItemCardRowVO (
|
||||||
|
var title:String? = "",
|
||||||
|
var value:String? = "",
|
||||||
|
var isEditable:Boolean = true,
|
||||||
|
var action:String = "",
|
||||||
|
var barcodes: List<BarcodeVO> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
class BarcodeVO(
|
||||||
|
var code:String? = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.main.activity
|
||||||
import android.content.SharedPreferences
|
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 androidx.fragment.app.FragmentManager
|
||||||
|
@ -30,19 +29,17 @@ 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
|
var firstItem : ItemMenuVO? = null
|
||||||
|
var fm = 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()
|
||||||
if(haveSector()) addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG)
|
if(haveSector()) addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, PasilleroFragment.TAG,false)
|
||||||
else addFragment(PasilleroFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG)
|
else addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun haveSector() : Boolean{
|
private fun haveSector() : Boolean{
|
||||||
|
@ -51,13 +48,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
return sectorFk != -1
|
return sectorFk != -1
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openFragment(fragment: Fragment,tagname:String) {
|
|
||||||
val transaction = supportFragmentManager.beginTransaction()
|
|
||||||
transaction.replace(R.id.main_frame_layout, fragment)
|
|
||||||
transaction.addToBackStack(tagname)
|
|
||||||
transaction.commit()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setBottomMenu(){
|
private fun setBottomMenu(){
|
||||||
val bottomMenu = main_bottom_navigation
|
val bottomMenu = main_bottom_navigation
|
||||||
bottomMenu.itemIconTintList = null
|
bottomMenu.itemIconTintList = null
|
||||||
|
@ -88,9 +78,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
|
|
||||||
if(haveSector()){
|
if(haveSector()){
|
||||||
// Select first item by default
|
// Select first item by default
|
||||||
val firstItem = bottomMenuItems.first()
|
firstItem = bottomMenuItems.first()
|
||||||
bottomMenu.selectedItemId = firstItem.id
|
bottomMenu.selectedItemId = firstItem!!.id
|
||||||
bottomMenu.menu.findItem(firstItem.id).icon = firstItem.selectedImage
|
bottomMenu.menu.findItem(firstItem!!.id).icon = firstItem!!.selectedImage
|
||||||
lastBottomMenuItemSelected = firstItem
|
lastBottomMenuItemSelected = firstItem
|
||||||
}else{
|
}else{
|
||||||
// Select last item by default
|
// Select last item by default
|
||||||
|
@ -111,6 +101,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
lastBottomMenuItemSelected?.defaultImage
|
lastBottomMenuItemSelected?.defaultImage
|
||||||
lastBottomMenuItemSelected = selectedItemMenu
|
lastBottomMenuItemSelected = selectedItemMenu
|
||||||
|
|
||||||
|
|
||||||
when (selectedItemMenu?.title) {
|
when (selectedItemMenu?.title) {
|
||||||
"Pasilleros" -> {
|
"Pasilleros" -> {
|
||||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
|
@ -128,7 +119,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
"Ajustes" -> {
|
"Ajustes" -> {
|
||||||
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
addFragment(AjustesFragment.newInstance(),R.id.main_frame_layout, AjustesFragment.TAG,false)
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +127,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
bottomMenu.setOnNavigationItemReselectedListener {
|
bottomMenu!!.setOnNavigationItemReselectedListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,17 +136,26 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
||||||
override fun onPasillerosItemClickListener(item: PasillerosItemVO) {
|
override fun onPasillerosItemClickListener(item: PasillerosItemVO) {
|
||||||
when (item.title){
|
when (item.title){
|
||||||
"Consultar artículo" -> {
|
"Consultar artículo" -> {
|
||||||
openFragment(ItemCardFragment(),"PASILLEROS")
|
addFragmentOnTop(ItemCardFragment.newInstance())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.i("Item: ",item.title)
|
Log.i("Item: ",item.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addFragmentOnTop(fragment: Fragment?) {
|
||||||
|
supportFragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.main_frame_layout, fragment!!)
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
|
||||||
if (fm.backStackEntryCount > 0) {
|
if (fm.backStackEntryCount > 0) {
|
||||||
super.onBackPressed()
|
fm.popBackStackImmediate()
|
||||||
}else {
|
}else {
|
||||||
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
|
customDialog.setTitle("Cerrar sesión").setDescription("¿Estás seguro de cerrar la sesión?").setOkButton("Salir"){
|
||||||
customDialog.hide()
|
customDialog.hide()
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||||
|
</vector>
|
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -14,6 +15,179 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scroll_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/textinputlayout_username"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColorHint="@android:color/darker_gray"
|
||||||
|
android:layout_marginTop="@dimen/toolbar_height">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/edit_itemFk"
|
||||||
|
style="@style/InputLineTextSearch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:backgroundTint="@android:color/white"
|
||||||
|
android:hint="Escanea etiqueta"
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/itemcard_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/itemcard_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/itemcard_image_height"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/loadphoto" />
|
||||||
|
<!-- TAGS ======================================================================================================= -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="@dimen/layout_margin_min"
|
||||||
|
android:layout_marginBottom="@dimen/layout_margin_min">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_weight="1">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Tamaño: "
|
||||||
|
android:textColor="@color/verdnatura_brown_grey"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/itemcard_tag1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Longitud: "
|
||||||
|
android:textColor="@color/verdnatura_brown_grey"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/itemcard_tag2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_weight="1">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Color: "
|
||||||
|
android:textColor="@color/verdnatura_brown_grey"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/itemcard_tag3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Origen: "
|
||||||
|
android:textColor="@color/verdnatura_brown_grey"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/itemcard_tag4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- VALORES ================================================================================================== -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:descendantFocusability="blocksDescendants">
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/itemcard_recyclerview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
tools:listitem="@layout/item_card_row"/>
|
||||||
|
</RelativeLayout>>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/main_toolbar"
|
android:id="@+id/main_toolbar"
|
||||||
layout="@layout/toolbar"
|
layout="@layout/toolbar"
|
||||||
|
@ -22,20 +196,6 @@
|
||||||
app:layout_constraintTop_toTopOf="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
|
<LinearLayout
|
||||||
android:id="@+id/splash_progress"
|
android:id="@+id/splash_progress"
|
||||||
|
@ -63,5 +223,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="item"
|
||||||
|
type="es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO" />
|
||||||
|
</data>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/item_row_layout"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/verdnatura_black_5"
|
||||||
|
android:padding="@dimen/pasilleros_margin_main_menu">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{item.title}"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/h7"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
|
||||||
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_selected"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{item.value}"
|
||||||
|
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||||
|
android:textSize="@dimen/h7"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||||
|
android:id="@+id/item_image"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="27dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/ic_chevron_right_black_24dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/verdnatura_black_9"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
|
@ -9,48 +9,47 @@
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:background="@drawable/background_gradient">
|
android:background="@drawable/background_gradient">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/backButton"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/ic_arrow_back_black_24dp" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/toolbar_title_separator"
|
android:id="@+id/toolbar_title_separator"
|
||||||
android:layout_width="2dp"
|
android:layout_width="2dp"
|
||||||
android:layout_height="@dimen/toolbar_icon_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="@dimen/default_layout_margin"
|
android:layout_marginTop="@dimen/default_layout_margin"
|
||||||
android:layout_marginBottom="@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" />
|
android:background="@color/verdnatura_pumpkin_orange" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/toolbar_title"
|
android:id="@+id/toolbar_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/default_layout_margin"
|
android:layout_weight="1"
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/h6"
|
android:textSize="@dimen/h8"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:text="Title fragment"
|
||||||
app:layout_constraintStart_toEndOf="@id/toolbar_title_separator"
|
android:layout_marginLeft="@dimen/layout_margin_1"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:gravity="center_vertical"/>
|
||||||
android:text="ItemCard" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/toolbar_icons"
|
android:id="@+id/toolbar_icons"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/layout_margin_1"
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<dimen name="h5">24sp</dimen>
|
<dimen name="h5">24sp</dimen>
|
||||||
<dimen name="h6">20sp</dimen>
|
<dimen name="h6">20sp</dimen>
|
||||||
<dimen name="h7">18sp</dimen>
|
<dimen name="h7">18sp</dimen>
|
||||||
|
<dimen name="h8">16sp</dimen>
|
||||||
<dimen name="subtitle1">16sp</dimen>
|
<dimen name="subtitle1">16sp</dimen>
|
||||||
<dimen name="subtitle2">14sp</dimen>
|
<dimen name="subtitle2">14sp</dimen>
|
||||||
<dimen name="body1">16sp</dimen>
|
<dimen name="body1">16sp</dimen>
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
|
|
||||||
<!--Pasilleros-->
|
<!--Pasilleros-->
|
||||||
<dimen name="pasilleros_margin_main_menu">15dp</dimen>
|
<dimen name="pasilleros_margin_main_menu">15dp</dimen>
|
||||||
|
<dimen name="itemcard_image_height">300dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,13 @@
|
||||||
<item name="android:textSize">16sp</item>
|
<item name="android:textSize">16sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!--Input Text Search-->
|
||||||
|
<style name="InputLineTextSearch" parent="android:Widget.EditText">
|
||||||
|
<item name="android:minWidth">280dp</item>
|
||||||
|
<item name="android:layout_height">50dp</item>
|
||||||
|
<item name="android:textSize">16sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Full Screen Alert Dialog -->
|
<!-- Full Screen Alert Dialog -->
|
||||||
<style name="DialogTheme">
|
<style name="DialogTheme">
|
||||||
<item name="android:layout_width">280dp</item>
|
<item name="android:layout_width">280dp</item>
|
||||||
|
|
Loading…
Reference in New Issue