mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 03:58:48 +00:00
Add sending and error states for story group replies.
This commit is contained in:
committed by
Alex Hart
parent
a29bc1da8c
commit
2a91c67c51
@@ -21,7 +21,7 @@ import java.util.concurrent.Executor;
|
||||
*/
|
||||
class FixedSizePagingController<Key, Data> implements PagingController<Key> {
|
||||
|
||||
private static final String TAG = FixedSizePagingController.class.getSimpleName();
|
||||
private static final String TAG = Log.tag(FixedSizePagingController.class);
|
||||
|
||||
private static final Executor FETCH_EXECUTOR = SignalExecutors.newCachedSingleThreadExecutor("signal-FixedSizePagingController");
|
||||
private static final boolean DEBUG = false;
|
||||
@@ -182,10 +182,15 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataItemInserted(Key key, int position) {
|
||||
if (DEBUG) Log.d(TAG, buildItemInsertedLog(key, position, ""));
|
||||
public void onDataItemInserted(Key key, int inputPosition) {
|
||||
if (DEBUG) Log.d(TAG, buildItemInsertedLog(key, inputPosition, ""));
|
||||
|
||||
FETCH_EXECUTOR.execute(() -> {
|
||||
int position = inputPosition;
|
||||
if (position == POSITION_END) {
|
||||
position = data.size();
|
||||
}
|
||||
|
||||
if (keyToPosition.containsKey(key)) {
|
||||
Log.w(TAG, "Notified of key " + key + " being inserted at " + position + ", but the item already exists!");
|
||||
return;
|
||||
@@ -245,6 +250,6 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
|
||||
}
|
||||
|
||||
private String buildItemChangedLog(Key key, String message) {
|
||||
return "[onDataItemInserted(" + key + "), size: " + loadState.size() + "] " + message;
|
||||
return "[onDataItemChanged(" + key + "), size: " + loadState.size() + "] " + message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.signal.paging;
|
||||
|
||||
|
||||
public interface PagingController<Key> {
|
||||
int POSITION_END = -1;
|
||||
|
||||
void onDataNeededAroundIndex(int aroundIndex);
|
||||
void onDataInvalidated();
|
||||
void onDataItemChanged(Key key);
|
||||
|
||||
Reference in New Issue
Block a user