Sha256: 9bf2c7bfce862361695e6eb686675e3bc9c93a79ac6b94f14bbde3d47f4079b6

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

// Taken from https://github.com/wordpress-mobile/WordPress-Android/blob/trunk/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ActionCardViewHolder.kt
import android.view.ViewGroup
import androidx.core.text.HtmlCompat
import org.wordpress.android.databinding.StatsBlockListActionCardBinding
import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemActionCard
import org.wordpress.android.util.extensions.viewBinding

class ActionCardViewHolder(
    val parent: ViewGroup,
    val binding: StatsBlockListActionCardBinding = parent.viewBinding(StatsBlockListActionCardBinding::inflate)
) : BlockListItemViewHolder(binding.root) {
    fun bind(
        item: ListItemActionCard
    ) = with(binding) {
        actionTitle.text = parent.context.getString(item.titleResource)
        actionMessage.text = HtmlCompat.fromHtml(parent.context.getString(item.text), HtmlCompat.FROM_HTML_MODE_LEGACY)
        buttonPositive.setText(item.positiveButtonText)
        buttonPositive.setOnClickListener { item.positiveAction.click() }
        buttonNegative.setText(item.negativeButtonText)
        buttonNegative.setOnClickListener { item.negativeAction.click() }
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
danger-dangermattic-1.2.2 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.2.1 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.2.0 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.1.2 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.0.2 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.0.1 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
danger-dangermattic-1.0.0 spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt