@@ -77,21 +77,21 @@ live query updates:
77
77
78
78
``` java
79
79
query. addSnapshotListener(new EventListener<QuerySnapshot > () {
80
- @Override
81
- public void onEvent (@Nullable QuerySnapshot snapshot ,
82
- @Nullable FirebaseFirestoreException e ) {
83
- if (e != null ) {
84
- // Handle error
85
- // ...
86
- return ;
87
- }
88
-
89
- // Convert query snapshot to a list of chats
90
- List<Chat > chats = snapshot. toObjects(Chat . class);
91
-
92
- // Update UI
93
- // ...
80
+ @Override
81
+ public void onEvent (@Nullable QuerySnapshot snapshot ,
82
+ @Nullable FirebaseFirestoreException e ) {
83
+ if (e != null ) {
84
+ // Handle error
85
+ // ...
86
+ return ;
94
87
}
88
+
89
+ // Convert query snapshot to a list of chats
90
+ List<Chat > chats = snapshot. toObjects(Chat . class);
91
+
92
+ // Update UI
93
+ // ...
94
+ }
95
95
});
96
96
```
97
97
@@ -186,24 +186,22 @@ methods of the adapter:
186
186
187
187
``` java
188
188
FirestoreRecyclerAdapter adapter = new FirestoreRecyclerAdapter<Chat , ChatHolder > (options) {
189
-
190
- // ...
189
+ // ...
191
190
192
- @Override
193
- public void onDataChanged () {
194
- // Called each time there is a new query snapshot. You may want to use this method
195
- // to hide a loading spinner or check for the "no documents" state and update your UI.
196
- // ...
197
- }
198
-
199
- @Override
200
- public void onError (FirebaseFirestoreException e ) {
201
- // Called when there is an error getting a query snapshot. You may want to update
202
- // your UI to display an error message to the user.
203
- // ...
204
- }
191
+ @Override
192
+ public void onDataChanged () {
193
+ // Called each time there is a new query snapshot. You may want to use this method
194
+ // to hide a loading spinner or check for the "no documents" state and update your UI.
195
+ // ...
196
+ }
205
197
206
- }
198
+ @Override
199
+ public void onError (FirebaseFirestoreException e ) {
200
+ // Called when there is an error getting a query snapshot. You may want to update
201
+ // your UI to display an error message to the user.
202
+ // ...
203
+ }
204
+ };
207
205
```
208
206
209
207
0 commit comments