feat: refs#8182 CliclableZone

This commit is contained in:
Sergio De la torre 2025-02-24 07:29:33 +01:00
parent 1ab7280d66
commit 1689d100d5
6 changed files with 30 additions and 40 deletions

View File

@ -1,28 +1,31 @@
package es.verdnatura.presentation.view.feature.collection.adapter package es.verdnatura.presentation.view.feature.collection.adapter
import android.content.Context import android.content.Context
import android.graphics.Paint
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.ItemPlacementRowBinding import es.verdnatura.databinding.ItemPlacementRowBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
class PlacementAdapter ( class PlacementAdapter(
private val items: List<PlacementVO>, private val items: List<PlacementVO>,
private val onPasillerosItemClickListener: OnPasillerosItemClickListener private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
): RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder> () { private val type: String? = null
) : RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder>() {
var context: Context? = null var context: Context? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
this.context = parent.context this.context = parent.context
return AjustesItemHolder( return AjustesItemHolder(
ItemPlacementRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) ItemPlacementRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
) )
} }
override fun getItemCount() =items.size override fun getItemCount() = items.size
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) { override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
holder.bind(items[position]) holder.bind(items[position])
@ -30,19 +33,26 @@ class PlacementAdapter (
inner class AjustesItemHolder( inner class AjustesItemHolder(
val binding: ItemPlacementRowBinding val binding: ItemPlacementRowBinding
) : RecyclerView.ViewHolder(binding.root){ ) : RecyclerView.ViewHolder(binding.root) {
fun bind(placement: PlacementVO) { fun bind(placement: PlacementVO) {
binding.apply { binding.apply {
if (placement.placement.isNullOrEmpty()) if (placement.placement.isNullOrEmpty()) placement.placement = placement.parking
placement.placement = placement.parking if (placement.visible.isNullOrEmpty()) placement.visible =
if (placement.visible.isNullOrEmpty()) "(" + placement.stockTotal + ")"
placement.visible = "("+placement.stockTotal+")"
this.item = placement this.item = placement
itemRootLayout.setOnClickListener { itemRootLayout.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = onPasillerosItemClickListener.onPasillerosItemClickListener(
R.string.titleUbicator),placement.shelving) PasillerosItemVO(
title = R.string.titleUbicator
), placement.shelving
)
} }
if (type == CONTROLADOR) {
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
}
} }
} }
} }

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.collection.adapter
import android.content.Context import android.content.Context
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.graphics.Color import android.graphics.Color
import android.graphics.Paint
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -84,7 +85,7 @@ class SaleAdapter(
itemArticlePlacements.apply { itemArticlePlacements.apply {
layoutManager = childLayoutManager layoutManager = childLayoutManager
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener) adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener, type)
} }
//CLICK EVENTS //CLICK EVENTS
@ -422,13 +423,15 @@ class SaleAdapter(
itemTicketColor.setOnClickListener { itemTicketColor.setOnClickListener {
onTicketColorClickListener?.onTicketColorListener(sale) onTicketColorClickListener?.onTicketColorListener(sale)
} }
if (type == SACADOR || type == CONTROLADOR) { if (type == CONTROLADOR) {
itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor) itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor)
ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
itemArticleItemFk.paintFlags =
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
} }
/* ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
itemArticleItemFk.paintFlags =
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG*/
this.sale = sale this.sale = sale

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M320,550L399,440L569,440L320,244L320,550ZM551,880L406,568L240,800L240,80L800,520L516,520L660,829L551,880ZM399,440L399,440L399,440L399,440Z" />
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/black"
android:pathData="M320,550L399,440L569,440L320,244L320,550ZM551,880L406,568L240,800L240,80L800,520L516,520L660,829L551,880ZM399,440L399,440L399,440L399,440Z" />
</vector>

View File

@ -82,7 +82,6 @@
android:textColor="@color/verdnatura_black" android:textColor="@color/verdnatura_black"
android:textSize="@dimen/h8" android:textSize="@dimen/h8"
android:textStyle="bold" /> android:textStyle="bold" />
<!-- app:drawableEndCompat="@drawable/ic_click_black"-->
<TextView <TextView
android:id="@+id/parkingCode" android:id="@+id/parkingCode"
@ -200,7 +199,6 @@
app:layout_constraintStart_toEndOf="@+id/linearLayout3" app:layout_constraintStart_toEndOf="@+id/linearLayout3"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tool:text="85478" /> tool:text="85478" />
<!--app:drawableEndCompat="@drawable/ic_click"-->
<TextView <TextView
android:id="@+id/item_article_quantity_pickedOld" android:id="@+id/item_article_quantity_pickedOld"

View File

@ -43,7 +43,6 @@
android:textSize="@dimen/h8" android:textSize="@dimen/h8"
android:textStyle="bold" android:textStyle="bold"
tool:text="YIC" /> tool:text="YIC" />
<!-- app:drawableEndCompat="@drawable/ic_click"-->
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout