Show correct message for empty archived screen.

This commit is contained in:
Sagar
2025-04-18 01:24:42 +05:30
committed by Cody Henthorne
parent 6ce01c6b0e
commit 050dcb3eb1
5 changed files with 34 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ class ConversationListAdapter extends ListAdapter<Conversation, RecyclerView.Vie
private static final int TYPE_CLEAR_FILTER_FOOTER = 6;
private static final int TYPE_CLEAR_FILTER_EMPTY = 7;
private static final int TYPE_CHAT_FOLDER_EMPTY = 8;
private static final int TYPE_EMPTY_ARCHIVED = 9;
private enum Payload {
TYPING_INDICATOR,
@@ -113,6 +114,9 @@ class ConversationListAdapter extends ListAdapter<Conversation, RecyclerView.Vie
} else if (viewType == TYPE_HEADER) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.dsl_section_header, parent, false);
return new HeaderViewHolder(v);
} else if (viewType == TYPE_EMPTY_ARCHIVED) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.conversation_list_archived_empty_state, parent, false);
return new HeaderViewHolder(v);
} else if (viewType == TYPE_EMPTY) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.conversation_list_empty_state, parent, false);
return new HeaderViewHolder(v);
@@ -240,6 +244,8 @@ class ConversationListAdapter extends ListAdapter<Conversation, RecyclerView.Vie
return TYPE_CHAT_FOLDER_EMPTY;
case THREAD:
return TYPE_THREAD;
case ARCHIVED_EMPTY:
return TYPE_EMPTY_ARCHIVED;
case EMPTY:
return TYPE_EMPTY;
default:

View File

@@ -115,6 +115,8 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
return Collections.singletonList(new Conversation(ConversationReader.buildThreadRecordForType(Conversation.Type.CONVERSATION_FILTER_EMPTY,
0,
showConversationFooterTip)));
} else if (this instanceof ArchivedConversationListDataSource) {
return Collections.singletonList(new Conversation(ConversationReader.buildThreadRecordForType(Conversation.Type.ARCHIVED_EMPTY, 0, false)));
} else if (chatFolder.getFolderType() != ChatFolderRecord.FolderType.ALL) {
return Collections.singletonList(new Conversation(ConversationReader.buildThreadRecordForType(Conversation.Type.CHAT_FOLDER_EMPTY, 0, false)));
} else {

View File

@@ -46,6 +46,7 @@ public class Conversation {
CONVERSATION_FILTER_FOOTER,
CONVERSATION_FILTER_EMPTY,
CHAT_FOLDER_EMPTY,
EMPTY
ARCHIVED_EMPTY,
EMPTY,
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/empty_state"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="32dp"
android:orientation="vertical"
tools:viewBindingIgnore="true">
<TextView
style="@style/Signal.Text.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="@string/conversation_list_fragment__archived_chats_will_appear_here" />
</LinearLayout>

View File

@@ -4366,6 +4366,8 @@
<string name="conversation_list_fragment__fab_content_description">New chat</string>
<string name="conversation_list_fragment__open_camera_description">Open Camera</string>
<string name="conversation_list_fragment__no_chats_yet_get_started_by_messaging_a_friend">No chats yet.\nGet started by messaging a friend.</string>
<!-- Message shown when there are no archived chats to display -->
<string name="conversation_list_fragment__archived_chats_will_appear_here">Archived chats will appear here.</string>
<!-- Message shown when there are no chats in the chat folder to display -->
<string name="conversation_list_fragment__no_chats_to_display">No chats to display</string>
<!-- Button text that will open up chat folder settings -->