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

31 lines
923 B
Kotlin
Raw Normal View History

package eu.kanade.tachiyomi.widget
import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
2020-01-28 22:47:57 -05:00
import androidx.annotation.StringRes
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.inflate
2020-01-28 22:47:57 -05:00
import kotlinx.android.synthetic.main.common_dialog_with_checkbox.view.checkbox_option
import kotlinx.android.synthetic.main.common_dialog_with_checkbox.view.description
class DialogCheckboxView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
LinearLayout(context, attrs) {
init {
2017-05-25 06:16:58 -04:00
addView(inflate(R.layout.common_dialog_with_checkbox))
}
fun setDescription(@StringRes id: Int){
description.text = context.getString(id)
}
fun setOptionDescription(@StringRes id: Int){
checkbox_option.text = context.getString(id)
}
fun isChecked(): Boolean {
return checkbox_option.isChecked
}
}