mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-30 05:47:57 +01:00
UI tweaks
This commit is contained in:
36
app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt
Normal file
36
app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt
Normal file
@@ -0,0 +1,36 @@
|
||||
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.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.setVectorCompat
|
||||
import kotlinx.android.synthetic.main.view_empty.view.*
|
||||
|
||||
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
RelativeLayout (context, attrs) {
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.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.theme.getResourceColor(android.R.attr.textColorHint))
|
||||
text_label.text = context.getString(textResource)
|
||||
this.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user