@@ -35,7 +35,7 @@ public abstract class FirestorePagingAdapter<T, VH extends RecyclerView.ViewHold
35
35
LiveData created via Transformation do not have a value until an Observer is attached.
36
36
We attach this empty observer so that our getValue() calls return non-null later.
37
37
*/
38
- private final Observer <FirestoreDataSource > mPagingSourceObserver = new Observer <FirestoreDataSource >() {
38
+ private final Observer <FirestoreDataSource > mDataSourceObserver = new Observer <FirestoreDataSource >() {
39
39
@ Override
40
40
public void onChanged (@ Nullable FirestoreDataSource source ) {
41
41
@@ -100,8 +100,8 @@ private void init() {
100
100
new Function <PagedList <DocumentSnapshot >, LiveData <LoadingState >>() {
101
101
@ Override
102
102
public LiveData <LoadingState > apply (PagedList <DocumentSnapshot > input ) {
103
- FirestoreDataSource pagingSource = (FirestoreDataSource ) input .getDataSource ();
104
- return pagingSource .getLoadingState ();
103
+ FirestoreDataSource dataSource = (FirestoreDataSource ) input .getDataSource ();
104
+ return dataSource .getLoadingState ();
105
105
}
106
106
});
107
107
@@ -117,8 +117,8 @@ public FirestoreDataSource apply(PagedList<DocumentSnapshot> input) {
117
117
new Function <PagedList <DocumentSnapshot >, LiveData <Exception >>() {
118
118
@ Override
119
119
public LiveData <Exception > apply (PagedList <DocumentSnapshot > input ) {
120
- FirestoreDataSource pagingSource = (FirestoreDataSource ) input .getDataSource ();
121
- return pagingSource .getLastError ();
120
+ FirestoreDataSource dataSource = (FirestoreDataSource ) input .getDataSource ();
121
+ return dataSource .getLastError ();
122
122
}
123
123
});
124
124
@@ -134,24 +134,24 @@ public LiveData<Exception> apply(PagedList<DocumentSnapshot> input) {
134
134
* attempt to retry the most recent failure.
135
135
*/
136
136
public void retry () {
137
- PagedList < DocumentSnapshot > pagedList = mSnapshots .getValue ();
138
- if (pagedList == null ) {
139
- Log .w (TAG , "Called retry() when PagedList is null!" );
137
+ FirestoreDataSource source = mDataSource .getValue ();
138
+ if (source == null ) {
139
+ Log .w (TAG , "Called retry() when FirestoreDataSource is null!" );
140
140
return ;
141
141
}
142
- pagedList .retry ();
142
+ source .retry ();
143
143
}
144
144
145
145
/**
146
146
* To attempt to refresh the list. It will reload the list from beginning.
147
147
*/
148
148
public void refresh () {
149
- FirestoreDataSource mFirebasePagingSource = mDataSource .getValue ();
150
- if (mFirebasePagingSource == null ) {
149
+ FirestoreDataSource mFirebaseDataSource = mDataSource .getValue ();
150
+ if (mFirebaseDataSource == null ) {
151
151
Log .w (TAG , "Called refresh() when FirestorePagingSource is null!" );
152
152
return ;
153
153
}
154
- mFirebasePagingSource .invalidate ();
154
+ mFirebaseDataSource .invalidate ();
155
155
}
156
156
157
157
/**
@@ -183,7 +183,7 @@ public void updateOptions(@NonNull FirestorePagingOptions<T> options) {
183
183
public void startListening () {
184
184
mSnapshots .observeForever (mDataObserver );
185
185
mLoadingState .observeForever (mStateObserver );
186
- mDataSource .observeForever (mPagingSourceObserver );
186
+ mDataSource .observeForever (mDataSourceObserver );
187
187
mException .observeForever (mErrorObserver );
188
188
}
189
189
@@ -195,7 +195,7 @@ public void startListening() {
195
195
public void stopListening () {
196
196
mSnapshots .removeObserver (mDataObserver );
197
197
mLoadingState .removeObserver (mStateObserver );
198
- mDataSource .removeObserver (mPagingSourceObserver );
198
+ mDataSource .removeObserver (mDataSourceObserver );
199
199
mException .removeObserver (mErrorObserver );
200
200
}
201
201
0 commit comments