blob: bd4172a1e5bf850c89673d7617732186fdcaf1f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package com.mapswithme.maps.bookmarks.data;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mapswithme.maps.content.DataSource;
public class CategoryDataSource extends RecyclerView.AdapterDataObserver implements
DataSource<BookmarkCategory>
{
@NonNull
private BookmarkCategory mCategory;
public CategoryDataSource(@NonNull BookmarkCategory category)
{
mCategory = category;
}
@NonNull
@Override
public BookmarkCategory getData()
{
return mCategory;
}
@Override
public void onChanged()
{
super.onChanged();
AbstractCategoriesSnapshot.Default snapshot =
BookmarkManager.INSTANCE.getCategoriesSnapshot(mCategory.getType().getFilterStrategy());
int index = snapshot.indexOfOrThrow(mCategory);
mCategory = snapshot.getItems().get(index);
}
}
|