kopia lustrzana https://github.com/ryukoposting/Signal-Android
rodzic
b262efc24c
commit
66f2668326
|
@ -141,7 +141,7 @@ class ConversationListAdapter extends PagedListAdapter<Conversation, RecyclerVie
|
|||
|
||||
casted.getConversationListItem().bind(conversation.getThreadRecord(),
|
||||
glideRequests,
|
||||
conversation.getLocale(),
|
||||
Locale.getDefault(),
|
||||
typingSet,
|
||||
getBatchSelectionIds(),
|
||||
batchMode);
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.util.paging.SizeFixResult;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
abstract class ConversationListDataSource extends PositionalDataSource<Conversation> {
|
||||
|
@ -60,14 +59,13 @@ abstract class ConversationListDataSource extends PositionalDataSource<Conversat
|
|||
long start = System.currentTimeMillis();
|
||||
|
||||
List<Conversation> conversations = new ArrayList<>(params.requestedLoadSize);
|
||||
Locale locale = Locale.getDefault();
|
||||
int totalCount = getTotalCount();
|
||||
int effectiveCount = params.requestedStartPosition;
|
||||
|
||||
try (ThreadDatabase.Reader reader = threadDatabase.readerFor(getCursor(params.requestedStartPosition, params.requestedLoadSize))) {
|
||||
ThreadRecord record;
|
||||
while ((record = reader.getNext()) != null && effectiveCount < totalCount && !isInvalid()) {
|
||||
conversations.add(new Conversation(record, locale));
|
||||
conversations.add(new Conversation(record));
|
||||
effectiveCount++;
|
||||
}
|
||||
}
|
||||
|
@ -86,12 +84,11 @@ abstract class ConversationListDataSource extends PositionalDataSource<Conversat
|
|||
long start = System.currentTimeMillis();
|
||||
|
||||
List<Conversation> conversations = new ArrayList<>(params.loadSize);
|
||||
Locale locale = Locale.getDefault();
|
||||
|
||||
try (ThreadDatabase.Reader reader = threadDatabase.readerFor(getCursor(params.startPosition, params.loadSize))) {
|
||||
ThreadRecord record;
|
||||
while ((record = reader.getNext()) != null && !isInvalid()) {
|
||||
conversations.add(new Conversation(record, locale));
|
||||
conversations.add(new Conversation(record));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,37 +4,27 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Conversation {
|
||||
private final ThreadRecord threadRecord;
|
||||
private final Locale locale;
|
||||
|
||||
public Conversation(@NonNull ThreadRecord threadRecord, @NonNull Locale locale) {
|
||||
public Conversation(@NonNull ThreadRecord threadRecord) {
|
||||
this.threadRecord = threadRecord;
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
public @NonNull ThreadRecord getThreadRecord() {
|
||||
return threadRecord;
|
||||
}
|
||||
|
||||
public @NonNull Locale getLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Conversation that = (Conversation) o;
|
||||
return threadRecord.equals(that.threadRecord) &&
|
||||
locale.equals(that.locale);
|
||||
return threadRecord.equals(that.threadRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(threadRecord, locale);
|
||||
return threadRecord.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue