2017-01-08 14:07:19 -05: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 14:14:33 -05:00
|
|
|
import eu.kanade.tachiyomi.util.inflate
|
2017-05-25 06:16:58 -04:00
|
|
|
import kotlinx.android.synthetic.main.common_dialog_with_checkbox.view.*
|
2017-01-08 14:07:19 -05:00
|
|
|
|
|
|
|
class DialogCheckboxView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
|
|
LinearLayout(context, attrs) {
|
2017-02-03 14:14:33 -05:00
|
|
|
|
2017-01-08 14:07:19 -05:00
|
|
|
init {
|
2017-05-25 06:16:58 -04:00
|
|
|
addView(inflate(R.layout.common_dialog_with_checkbox))
|
2017-01-08 14:07:19 -05: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
|
|
|
|
}
|
|
|
|
}
|