From bec1ce8b09fa5bd124a78a0e8b75f4f775bdae96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lanie=20Chauvel=20=28ariasuni=29?= Date: Mon, 6 Jan 2020 18:24:54 +0100 Subject: [PATCH] Display Elephant with better message in Drafts screen when there are none (#1619) * Display Elephant with better message in Drafts screen when there are none * Remove unused import --- .../tusky/SavedTootActivity.java | 11 +++++----- .../main/res/layout/activity_saved_toot.xml | 20 ++++++++++--------- app/src/main/res/values/strings.xml | 3 +-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java index c40639c2d..21cc9399e 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java @@ -20,7 +20,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.view.MenuItem; import android.view.View; -import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; @@ -41,6 +40,7 @@ import com.keylesspalace.tusky.db.TootDao; import com.keylesspalace.tusky.db.TootEntity; import com.keylesspalace.tusky.di.Injectable; import com.keylesspalace.tusky.util.SaveTootHelper; +import com.keylesspalace.tusky.view.BackgroundMessageView; import java.lang.ref.WeakReference; import java.lang.reflect.Type; @@ -60,7 +60,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd // ui private SavedTootAdapter adapter; - private TextView noContent; + private BackgroundMessageView errorMessageView; private List toots = new ArrayList<>(); @Nullable @@ -95,7 +95,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd } RecyclerView recyclerView = findViewById(R.id.recyclerView); - noContent = findViewById(R.id.no_content); + errorMessageView = findViewById(R.id.errorMessageView); recyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); @@ -136,9 +136,10 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd private void setNoContent(int size) { if (size == 0) { - noContent.setVisibility(View.VISIBLE); + errorMessageView.setup(R.drawable.elephant_friend_empty, R.string.no_saved_status, null); + errorMessageView.setVisibility(View.VISIBLE); } else { - noContent.setVisibility(View.INVISIBLE); + errorMessageView.setVisibility(View.GONE); } } diff --git a/app/src/main/res/layout/activity_saved_toot.xml b/app/src/main/res/layout/activity_saved_toot.xml index 67bd5762f..1771135e7 100644 --- a/app/src/main/res/layout/activity_saved_toot.xml +++ b/app/src/main/res/layout/activity_saved_toot.xml @@ -14,19 +14,21 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - + + - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d8efafcd..21bd1e3ea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -306,8 +306,6 @@ Follow requested - no content - in %dy in %dd @@ -546,6 +544,7 @@ Edit Error looking up post %s + You don\'t have any drafts. You don\'t have any scheduled statuses.