mihon/app/src/main/java/eu/kanade/tachiyomi/widget/DialogCheckboxView.kt

32 lines
936 B
Kotlin
Raw Normal View History

package eu.kanade.tachiyomi.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
2020-01-28 22:47:57 -05:00
import androidx.annotation.StringRes
import eu.kanade.tachiyomi.databinding.CommonDialogWithCheckboxBinding
class DialogCheckboxView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
2020-04-25 14:24:45 -04:00
LinearLayout(context, attrs) {
private val binding: CommonDialogWithCheckboxBinding
init {
binding = CommonDialogWithCheckboxBinding.inflate(LayoutInflater.from(context), this, false)
addView(binding.root)
}
fun setDescription(@StringRes id: Int) {
binding.description.text = context.getString(id)
}
fun setOptionDescription(@StringRes id: Int) {
binding.checkboxOption.text = context.getString(id)
}
fun isChecked(): Boolean {
return binding.checkboxOption.isChecked
}
}