2017-01-08 20:07:19 +01:00
|
|
|
package eu.kanade.tachiyomi.widget
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.support.annotation.StringRes
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import android.widget.LinearLayout
|
|
|
|
import eu.kanade.tachiyomi.R
|
2017-02-03 20:14:33 +01:00
|
|
|
import eu.kanade.tachiyomi.util.inflate
|
2017-01-08 20:07:19 +01:00
|
|
|
import kotlinx.android.synthetic.main.dialog_with_checkbox.view.*
|
|
|
|
|
|
|
|
class DialogCheckboxView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
|
|
LinearLayout(context, attrs) {
|
2017-02-03 20:14:33 +01:00
|
|
|
|
2017-01-08 20:07:19 +01:00
|
|
|
init {
|
2017-02-03 20:14:33 +01:00
|
|
|
addView(inflate(R.layout.dialog_with_checkbox))
|
2017-01-08 20:07:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|