From b66faab71cd33aa055a352186a7553006ea3ed4d Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 30 Dec 2019 21:01:38 +0100 Subject: [PATCH] add empty screen message --- .../tusky/components/scheduled/ScheduledTootActivity.kt | 7 ++++++- .../com/keylesspalace/tusky/view/BackgroundMessageView.kt | 2 +- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledTootActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledTootActivity.kt index 7456c473f..0ec59cec4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledTootActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/scheduled/ScheduledTootActivity.kt @@ -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() diff --git a/app/src/main/java/com/keylesspalace/tusky/view/BackgroundMessageView.kt b/app/src/main/java/com/keylesspalace/tusky/view/BackgroundMessageView.kt index 1b73e6f7a..e39566f4b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/BackgroundMessageView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/view/BackgroundMessageView.kt @@ -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) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1ede742d5..fb3dc5ef1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -545,4 +545,6 @@ Edit Error looking up post %s + You don\'t have any scheduled statuses. +