mirror of
https://github.com/mihonapp/mihon.git
synced 2024-10-31 21:20:59 -04:00
37 lines
1.1 KiB
Kotlin
37 lines
1.1 KiB
Kotlin
package eu.kanade.tachiyomi.widget
|
|
|
|
import android.content.Context
|
|
import android.util.AttributeSet
|
|
import android.view.View
|
|
import android.widget.RelativeLayout
|
|
import eu.kanade.tachiyomi.R
|
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
|
import kotlinx.android.synthetic.main.common_view_empty.view.image_view
|
|
import kotlinx.android.synthetic.main.common_view_empty.view.text_label
|
|
|
|
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
RelativeLayout(context, attrs) {
|
|
|
|
init {
|
|
inflate(context, R.layout.common_view_empty, this)
|
|
}
|
|
|
|
/**
|
|
* Hide the information view
|
|
*/
|
|
fun hide() {
|
|
this.visibility = View.GONE
|
|
}
|
|
|
|
/**
|
|
* Show the information view
|
|
* @param drawable icon of information view
|
|
* @param textResource text of information view
|
|
*/
|
|
fun show(drawable: Int, textResource: Int) {
|
|
image_view.setVectorCompat(drawable, context.getResourceColor(android.R.attr.textColorHint))
|
|
text_label.text = context.getString(textResource)
|
|
this.visibility = View.VISIBLE
|
|
}
|
|
}
|