mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Add support for granular conversation data changes.
This commit is contained in:
@@ -27,7 +27,7 @@ import okhttp3.Response;
|
||||
/**
|
||||
* Data source for GiphyImages.
|
||||
*/
|
||||
final class GiphyMp4PagedDataSource implements PagedDataSource<GiphyImage> {
|
||||
final class GiphyMp4PagedDataSource implements PagedDataSource<String, GiphyImage> {
|
||||
|
||||
private static final Uri BASE_GIPHY_URI = Uri.parse("https://api.giphy.com/v1/gifs/")
|
||||
.buildUpon()
|
||||
@@ -76,6 +76,16 @@ final class GiphyMp4PagedDataSource implements PagedDataSource<GiphyImage> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey(@NonNull GiphyImage giphyImage) {
|
||||
return giphyImage.getGifUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable GiphyImage load(String url) {
|
||||
throw new UnsupportedOperationException("Not implemented!");
|
||||
}
|
||||
|
||||
private @NonNull GiphyResponse performFetch(int start, int length) throws IOException {
|
||||
String url;
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ import java.util.Objects;
|
||||
*/
|
||||
public final class GiphyMp4ViewModel extends ViewModel {
|
||||
|
||||
private final GiphyMp4Repository repository;
|
||||
private final MutableLiveData<PagedData<GiphyImage>> pagedData;
|
||||
private final LiveData<List<GiphyImage>> images;
|
||||
private final LiveData<PagingController> pagingController;
|
||||
private final SingleLiveEvent<GiphyMp4SaveResult> saveResultEvents;
|
||||
private final boolean isForMms;
|
||||
private final GiphyMp4Repository repository;
|
||||
private final MutableLiveData<PagedData<String, GiphyImage>> pagedData;
|
||||
private final LiveData<List<GiphyImage>> images;
|
||||
private final LiveData<PagingController<String>> pagingController;
|
||||
private final SingleLiveEvent<GiphyMp4SaveResult> saveResultEvents;
|
||||
private final boolean isForMms;
|
||||
|
||||
private String query;
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class GiphyMp4ViewModel extends ViewModel {
|
||||
.toList()));
|
||||
}
|
||||
|
||||
LiveData<PagedData<GiphyImage>> getPagedData() {
|
||||
LiveData<PagedData<String, GiphyImage>> getPagedData() {
|
||||
return pagedData;
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ public final class GiphyMp4ViewModel extends ViewModel {
|
||||
return images;
|
||||
}
|
||||
|
||||
public @NonNull LiveData<PagingController> getPagingController() {
|
||||
public @NonNull LiveData<PagingController<String>> getPagingController() {
|
||||
return pagingController;
|
||||
}
|
||||
|
||||
private PagedData<GiphyImage> getGiphyImagePagedData(@Nullable String query) {
|
||||
private PagedData<String, GiphyImage> getGiphyImagePagedData(@Nullable String query) {
|
||||
return PagedData.create(new GiphyMp4PagedDataSource(query),
|
||||
new PagingConfig.Builder().setPageSize(20)
|
||||
.setBufferPages(1)
|
||||
|
||||
Reference in New Issue
Block a user