All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amrdeveloper.easyadapter.compiler.data.bind.BindLottieAssetData.kt Maven / Gradle / Ivy

Go to download

Android Annotation Processor library to generate adapter class easily from your model with a lot of customization.

The newest version!
package com.amrdeveloper.easyadapter.compiler.data.bind

import com.amrdeveloper.easyadapter.compiler.utils.ViewTable
import com.amrdeveloper.easyadapter.option.ViewSetterType
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.FunSpec

data class BindLottieAssetData (
    override var fieldName: String,
    override var viewId: String,
    override var condition: String,
    override var bindType: BindType = BindType.LOTTIE_ASSET,
    override var viewClassType: String = "com.airbnb.lottie.LottieAnimationView",
    override var viewClassSetter: String = "setAnimation",
    override var viewSetterType: ViewSetterType = ViewSetterType.METHOD,
) : BindingData() {
    override fun generateFieldBinding(builder: FunSpec.Builder, table: ViewTable, rClass: ClassName) {
        val variableName = declareViewVariableIfNotExists(builder, table, rClass)
        val bindingStatement = "$variableName.${getBindingValueSetter()}"
        val statement = if (condition.isEmpty()) bindingStatement else "if ($condition) $bindingStatement"
        builder.addStatement (statement)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy