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
This commit is contained in:
parent
9d65b2ace1
commit
bec1ce8b09
|
@ -20,7 +20,6 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
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.db.TootEntity;
|
||||||
import com.keylesspalace.tusky.di.Injectable;
|
import com.keylesspalace.tusky.di.Injectable;
|
||||||
import com.keylesspalace.tusky.util.SaveTootHelper;
|
import com.keylesspalace.tusky.util.SaveTootHelper;
|
||||||
|
import com.keylesspalace.tusky.view.BackgroundMessageView;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
@ -60,7 +60,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
private SavedTootAdapter adapter;
|
private SavedTootAdapter adapter;
|
||||||
private TextView noContent;
|
private BackgroundMessageView errorMessageView;
|
||||||
|
|
||||||
private List<TootEntity> toots = new ArrayList<>();
|
private List<TootEntity> toots = new ArrayList<>();
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -95,7 +95,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
|
||||||
}
|
}
|
||||||
|
|
||||||
RecyclerView recyclerView = findViewById(R.id.recyclerView);
|
RecyclerView recyclerView = findViewById(R.id.recyclerView);
|
||||||
noContent = findViewById(R.id.no_content);
|
errorMessageView = findViewById(R.id.errorMessageView);
|
||||||
recyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||||
recyclerView.setLayoutManager(layoutManager);
|
recyclerView.setLayoutManager(layoutManager);
|
||||||
|
@ -136,9 +136,10 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
|
||||||
|
|
||||||
private void setNoContent(int size) {
|
private void setNoContent(int size) {
|
||||||
if (size == 0) {
|
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 {
|
} else {
|
||||||
noContent.setVisibility(View.INVISIBLE);
|
errorMessageView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,21 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/no_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:text="@string/no_content"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<com.keylesspalace.tusky.view.BackgroundMessageView
|
||||||
|
android:id="@+id/errorMessageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@android:color/transparent"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:src="@drawable/elephant_error"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -306,8 +306,6 @@
|
||||||
|
|
||||||
<string name="state_follow_requested">Follow requested</string>
|
<string name="state_follow_requested">Follow requested</string>
|
||||||
|
|
||||||
<string name="no_content">no content</string>
|
|
||||||
|
|
||||||
<!--These are for timestamps on statuses. For example: "16s" or "2d"-->
|
<!--These are for timestamps on statuses. For example: "16s" or "2d"-->
|
||||||
<string name="abbreviated_in_years">in %dy</string>
|
<string name="abbreviated_in_years">in %dy</string>
|
||||||
<string name="abbreviated_in_days">in %dd</string>
|
<string name="abbreviated_in_days">in %dd</string>
|
||||||
|
@ -546,6 +544,7 @@
|
||||||
<string name="edit_poll">Edit</string>
|
<string name="edit_poll">Edit</string>
|
||||||
<string name="post_lookup_error_format">Error looking up post %s</string>
|
<string name="post_lookup_error_format">Error looking up post %s</string>
|
||||||
|
|
||||||
|
<string name="no_saved_status">You don\'t have any drafts.</string>
|
||||||
<string name="no_scheduled_status">You don\'t have any scheduled statuses.</string>
|
<string name="no_scheduled_status">You don\'t have any scheduled statuses.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue