add empty screen message

This commit is contained in:
Konrad Pozniak 2019-12-30 21:01:38 +01:00
parent 75378e5284
commit b66faab71c
3 changed files with 9 additions and 2 deletions

View File

@ -64,7 +64,12 @@ class ScheduledTootActivity : BaseActivity(), ScheduledTootAction, Injectable {
Status.SUCCESS -> {
progressBar.hide()
swipeRefreshLayout.isRefreshing = false
errorMessageView.hide()
if(viewModel.data.value?.loadedCount == 0) {
errorMessageView.setup(R.drawable.elephant_friend_empty, R.string.no_scheduled_status)
errorMessageView.show()
} else {
errorMessageView.hide()
}
}
Status.RUNNING -> {
errorMessageView.hide()

View File

@ -37,7 +37,7 @@ class BackgroundMessageView @JvmOverloads constructor(
* If [clickListener] is `null` then the button will be hidden.
*/
fun setup(@DrawableRes imageRes: Int, @StringRes messageRes: Int,
clickListener: ((v: View) -> Unit)?) {
clickListener: ((v: View) -> Unit)? = null) {
messageTextView.setText(messageRes)
messageTextView.setCompoundDrawablesWithIntrinsicBounds(0, imageRes, 0, 0)
button.setOnClickListener(clickListener)

View File

@ -545,4 +545,6 @@
<string name="edit_poll">Edit</string>
<string name="post_lookup_error_format">Error looking up post %s</string>
<string name="no_scheduled_status">You don\'t have any scheduled statuses.</string>
</resources>