add empty screen message

main
Konrad Pozniak 5 years ago
parent 42d2a4798f
commit 7c3f19a07e
  1. 7
      app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledTootActivity.kt
  2. 2
      app/src/main/java/com/keylesspalace/tusky/view/BackgroundMessageView.kt
  3. 2
      app/src/main/res/values/strings.xml

@ -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()

@ -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)

@ -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>

Loading…
Cancel
Save