2017-01-08 20:07:19 +01:00
|
|
|
package eu.kanade.tachiyomi.widget
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import android.widget.LinearLayout
|
2020-01-29 04:47:57 +01:00
|
|
|
import androidx.annotation.StringRes
|
2017-01-08 20:07:19 +01:00
|
|
|
import eu.kanade.tachiyomi.R
|
2020-02-03 04:22:54 +01:00
|
|
|
import eu.kanade.tachiyomi.util.view.inflate
|
2020-01-29 04:47:57 +01:00
|
|
|
import kotlinx.android.synthetic.main.common_dialog_with_checkbox.view.checkbox_option
|
|
|
|
import kotlinx.android.synthetic.main.common_dialog_with_checkbox.view.description
|
2017-01-08 20:07:19 +01:00
|
|
|
|
|
|
|
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-05-25 12:16:58 +02:00
|
|
|
addView(inflate(R.layout.common_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
|
|
|
|
}
|
|
|
|
}
|