mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Add an empty state for archived
This commit is contained in:
parent
bb878f8a67
commit
9c50057909
BIN
res/drawable-hdpi/inbox_zero.png
Normal file
BIN
res/drawable-hdpi/inbox_zero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
res/drawable-mdpi/inbox_zero.png
Normal file
BIN
res/drawable-mdpi/inbox_zero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
res/drawable-xhdpi/inbox_zero.png
Normal file
BIN
res/drawable-xhdpi/inbox_zero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
res/drawable-xxhdpi/inbox_zero.png
Normal file
BIN
res/drawable-xxhdpi/inbox_zero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
res/drawable-xxxhdpi/inbox_zero.png
Normal file
BIN
res/drawable-xxxhdpi/inbox_zero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
31
res/layout/conversation_list_item_inbox_zero.xml
Normal file
31
res/layout/conversation_list_item_inbox_zero.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<org.thoughtcrime.securesms.ConversationListItemInboxZero
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="30dp">
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/conversation_list_item_inbox_zero__inbox_zeeerrro"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/inbox_zero"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView android:id="@+id/description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/conversation_list_item_inbox_zero__zip_zilch_zero_nada_nyou_re_all_caught_up"/>
|
||||||
|
|
||||||
|
</org.thoughtcrime.securesms.ConversationListItemInboxZero>
|
@ -1491,6 +1491,8 @@
|
|||||||
<string name="registration_activity__verify_your_number">Verify Your Number</string>
|
<string name="registration_activity__verify_your_number">Verify Your Number</string>
|
||||||
<string name="registration_activity__please_enter_your_mobile_number_to_receive_a_verification_code_carrier_rates_may_apply">Please enter your mobile number to receive a verification code. Carrier rates may apply.</string>
|
<string name="registration_activity__please_enter_your_mobile_number_to_receive_a_verification_code_carrier_rates_may_apply">Please enter your mobile number to receive a verification code. Carrier rates may apply.</string>
|
||||||
<string name="conversation_list_fragment__give_your_inbox_something_to_write_home_about_get_started_by_messaging_a_friend">Give your inbox something to write home about. Get started by messaging a friend.</string>
|
<string name="conversation_list_fragment__give_your_inbox_something_to_write_home_about_get_started_by_messaging_a_friend">Give your inbox something to write home about. Get started by messaging a friend.</string>
|
||||||
|
<string name="conversation_list_item_inbox_zero__inbox_zeeerrro">Inbox zeeerrro</string>
|
||||||
|
<string name="conversation_list_item_inbox_zero__zip_zilch_zero_nada_nyou_re_all_caught_up">Zip. Zilch. Zero. Nada. You\'re all caught up!</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- EOF -->
|
<!-- EOF -->
|
||||||
|
@ -50,6 +50,7 @@ class ConversationListAdapter extends CursorRecyclerViewAdapter<ConversationList
|
|||||||
|
|
||||||
private static final int MESSAGE_TYPE_SWITCH_ARCHIVE = 1;
|
private static final int MESSAGE_TYPE_SWITCH_ARCHIVE = 1;
|
||||||
private static final int MESSAGE_TYPE_THREAD = 2;
|
private static final int MESSAGE_TYPE_THREAD = 2;
|
||||||
|
private static final int MESSAGE_TYPE_INBOX_ZERO = 3;
|
||||||
|
|
||||||
private final @NonNull ThreadDatabase threadDatabase;
|
private final @NonNull ThreadDatabase threadDatabase;
|
||||||
private final @NonNull MasterSecret masterSecret;
|
private final @NonNull MasterSecret masterSecret;
|
||||||
@ -115,6 +116,8 @@ class ConversationListAdapter extends CursorRecyclerViewAdapter<ConversationList
|
|||||||
});
|
});
|
||||||
|
|
||||||
return new ViewHolder(action);
|
return new ViewHolder(action);
|
||||||
|
} else if (viewType == MESSAGE_TYPE_INBOX_ZERO) {
|
||||||
|
return new ViewHolder((ConversationListItemInboxZero)inflater.inflate(R.layout.conversation_list_item_inbox_zero, parent, false));
|
||||||
} else {
|
} else {
|
||||||
final ConversationListItem item = (ConversationListItem)inflater.inflate(R.layout.conversation_list_item_view,
|
final ConversationListItem item = (ConversationListItem)inflater.inflate(R.layout.conversation_list_item_view,
|
||||||
parent, false);
|
parent, false);
|
||||||
@ -148,6 +151,8 @@ class ConversationListAdapter extends CursorRecyclerViewAdapter<ConversationList
|
|||||||
|
|
||||||
if (threadRecord.getDistributionType() == ThreadDatabase.DistributionTypes.ARCHIVE) {
|
if (threadRecord.getDistributionType() == ThreadDatabase.DistributionTypes.ARCHIVE) {
|
||||||
return MESSAGE_TYPE_SWITCH_ARCHIVE;
|
return MESSAGE_TYPE_SWITCH_ARCHIVE;
|
||||||
|
} else if (threadRecord.getDistributionType() == ThreadDatabase.DistributionTypes.INBOX_ZERO) {
|
||||||
|
return MESSAGE_TYPE_INBOX_ZERO;
|
||||||
} else {
|
} else {
|
||||||
return MESSAGE_TYPE_THREAD;
|
return MESSAGE_TYPE_THREAD;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ConversationListItemInboxZero extends LinearLayout implements BindableConversationListItem{
|
||||||
|
public ConversationListItemInboxZero(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConversationListItemInboxZero(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConversationListItemInboxZero(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public ConversationListItemInboxZero(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unbind() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bind(@NonNull MasterSecret masterSecret, @NonNull ThreadRecord thread, @NonNull GlideRequests glideRequests, @NonNull Locale locale, @NonNull Set<Long> selectedThreads, boolean batchMode) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -608,6 +608,7 @@ public class ThreadDatabase extends Database {
|
|||||||
public static final int BROADCAST = 1;
|
public static final int BROADCAST = 1;
|
||||||
public static final int CONVERSATION = 2;
|
public static final int CONVERSATION = 2;
|
||||||
public static final int ARCHIVE = 3;
|
public static final int ARCHIVE = 3;
|
||||||
|
public static final int INBOX_ZERO = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Reader {
|
public class Reader {
|
||||||
@ -635,7 +636,7 @@ public class ThreadDatabase extends Database {
|
|||||||
Optional<RecipientSettings> settings;
|
Optional<RecipientSettings> settings;
|
||||||
Optional<GroupRecord> groupRecord;
|
Optional<GroupRecord> groupRecord;
|
||||||
|
|
||||||
if (distributionType != DistributionTypes.ARCHIVE) {
|
if (distributionType != DistributionTypes.ARCHIVE && distributionType != DistributionTypes.INBOX_ZERO) {
|
||||||
settings = DatabaseFactory.getRecipientDatabase(context).getRecipientSettings(cursor);
|
settings = DatabaseFactory.getRecipientDatabase(context).getRecipientSettings(cursor);
|
||||||
groupRecord = DatabaseFactory.getGroupDatabase(context).getGroup(cursor);
|
groupRecord = DatabaseFactory.getGroupDatabase(context).getGroup(cursor);
|
||||||
} else {
|
} else {
|
||||||
|
@ -47,6 +47,13 @@ public class ConversationListLoader extends AbstractCursorLoader {
|
|||||||
ThreadDatabase.ARCHIVED, ThreadDatabase.STATUS, ThreadDatabase.DELIVERY_RECEIPT_COUNT,
|
ThreadDatabase.ARCHIVED, ThreadDatabase.STATUS, ThreadDatabase.DELIVERY_RECEIPT_COUNT,
|
||||||
ThreadDatabase.EXPIRES_IN, ThreadDatabase.LAST_SEEN, ThreadDatabase.READ_RECEIPT_COUNT}, 1);
|
ThreadDatabase.EXPIRES_IN, ThreadDatabase.LAST_SEEN, ThreadDatabase.READ_RECEIPT_COUNT}, 1);
|
||||||
|
|
||||||
|
|
||||||
|
if (cursorList.get(0).getCount() <= 0) {
|
||||||
|
switchToArchiveCursor.addRow(new Object[] {-1L, System.currentTimeMillis(), archivedCount,
|
||||||
|
"-1", null, 1, ThreadDatabase.DistributionTypes.INBOX_ZERO,
|
||||||
|
0, null, 0, -1, 0, 0, 0, -1});
|
||||||
|
}
|
||||||
|
|
||||||
switchToArchiveCursor.addRow(new Object[] {-1L, System.currentTimeMillis(), archivedCount,
|
switchToArchiveCursor.addRow(new Object[] {-1L, System.currentTimeMillis(), archivedCount,
|
||||||
"-1", null, 1, ThreadDatabase.DistributionTypes.ARCHIVE,
|
"-1", null, 1, ThreadDatabase.DistributionTypes.ARCHIVE,
|
||||||
0, null, 0, -1, 0, 0, 0, -1});
|
0, null, 0, -1, 0, 0, 0, -1});
|
||||||
|
Loading…
Reference in New Issue
Block a user