Replaced if & else with when

This commit is contained in:
Rajnish 2020-10-07 10:58:02 +03:00
parent b54f819cd4
commit ff37485f50

View File

@ -103,12 +103,11 @@ class TableDrawerAdapter constructor(private val listener: TableClickListener) :
override fun bind(item: String) { override fun bind(item: String) {
val context = itemView.context val context = itemView.context
titleText.typeface = Typeface.DEFAULT_BOLD titleText.typeface = Typeface.DEFAULT_BOLD
if (item.isNotEmpty()) titleText.text = item titleText.text = when {
else { item.isNotEmpty() -> item
if (context is WebViewProvider) { context is WebViewProvider -> context.getCurrentWebView()?.title
titleText.text = ?: context.getString(R.string.no_section_info)
context.getCurrentWebView()?.title ?: context.getString(R.string.no_section_info) else -> context.getString(R.string.no_section_info)
} else titleText.text = context.getString(R.string.no_section_info)
} }
} }
} }