Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcc3a7c9 authored by Mill Chen's avatar Mill Chen
Browse files

Make ValuePreference not clickable by default

Explicitly set itemView.isClickable to false for ValuePreference.
Additionally, only set OnClickListener on the value containers if
onValueClickListener is not null, preventing them from becoming
clickable when no action is defined.

Bug: 435609855
Test: manual test with sample app
Flag: EXEMPT bugfix
Change-Id: I7df7af5bb865959668a0c9789120a085c798d9a1
parent ff2ccbae
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -103,14 +103,22 @@ constructor(
        super.onBindViewHolder(holder)
        holder.isDividerAllowedAbove = false
        holder.isDividerAllowedBelow = false
        // ValuePreference should be not clickable
        holder.itemView.isClickable = false

        holder.findViewById(R.id.value_container_1)?.apply {
            // Prevent setting clickable to true when invoking setOnClickListener
            if (onValueClickListener != null) {
                setOnClickListener { onValueClickListener?.onValueClick(FIRST_ITEM) }
            }
            contentDescription = firstContentDescription
        }
        holder.findViewById(R.id.value_container_2)?.apply {
            if (secondaryContainerVisibility) {
                // Prevent setting clickable to true when invoking setOnClickListener
                if (onValueClickListener != null) {
                    setOnClickListener { onValueClickListener?.onValueClick(SECOND_ITEM) }
                }
                visibility = VISIBLE
                contentDescription = secondaryContentDescription
            } else {