mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 07:57:30 +00:00
Minor ConversationList scrolling optimization.
This commit is contained in:
parent
34c885f08d
commit
b860aeff85
@ -24,6 +24,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.CursorAdapter;
|
||||
|
||||
import org.whispersystems.textsecure.crypto.MasterCipher;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
@ -40,7 +41,8 @@ import java.util.Set;
|
||||
*/
|
||||
public class ConversationListAdapter extends CursorAdapter implements AbsListView.RecyclerListener {
|
||||
|
||||
private final MasterSecret masterSecret;
|
||||
private final ThreadDatabase threadDatabase;
|
||||
private final MasterCipher masterCipher;
|
||||
private final Context context;
|
||||
private final LayoutInflater inflater;
|
||||
|
||||
@ -49,8 +51,12 @@ public class ConversationListAdapter extends CursorAdapter implements AbsListVie
|
||||
|
||||
public ConversationListAdapter(Context context, Cursor cursor, MasterSecret masterSecret) {
|
||||
super(context, cursor);
|
||||
this.masterSecret = masterSecret;
|
||||
|
||||
if (masterSecret != null) this.masterCipher = new MasterCipher(masterSecret);
|
||||
else this.masterCipher = null;
|
||||
|
||||
this.context = context;
|
||||
this.threadDatabase = DatabaseFactory.getThreadDatabase(context);
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@ -61,8 +67,8 @@ public class ConversationListAdapter extends CursorAdapter implements AbsListVie
|
||||
|
||||
@Override
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
if (masterSecret != null) {
|
||||
ThreadDatabase.Reader reader = DatabaseFactory.getThreadDatabase(context).readerFor(cursor, masterSecret);
|
||||
if (masterCipher != null) {
|
||||
ThreadDatabase.Reader reader = threadDatabase.readerFor(cursor, masterCipher);
|
||||
ThreadRecord record = reader.getCurrent();
|
||||
|
||||
((ConversationListItem)view).set(record, batchSet, batchMode);
|
||||
|
@ -399,8 +399,8 @@ public class ThreadDatabase extends Database {
|
||||
public void onProgress(int complete, int total);
|
||||
}
|
||||
|
||||
public Reader readerFor(Cursor cursor, MasterSecret masterSecret) {
|
||||
return new Reader(cursor, masterSecret);
|
||||
public Reader readerFor(Cursor cursor, MasterCipher masterCipher) {
|
||||
return new Reader(cursor, masterCipher);
|
||||
}
|
||||
|
||||
public static class DistributionTypes {
|
||||
@ -414,11 +414,9 @@ public class ThreadDatabase extends Database {
|
||||
private final Cursor cursor;
|
||||
private final MasterCipher masterCipher;
|
||||
|
||||
public Reader(Cursor cursor, MasterSecret masterSecret) {
|
||||
public Reader(Cursor cursor, MasterCipher masterCipher) {
|
||||
this.cursor = cursor;
|
||||
|
||||
if (masterSecret != null) this.masterCipher = new MasterCipher(masterSecret);
|
||||
else this.masterCipher = null;
|
||||
this.masterCipher = masterCipher;
|
||||
}
|
||||
|
||||
public ThreadRecord getNext() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user