Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-005
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-005
2022-005
Commits
522316cb
Commit
522316cb
authored
Oct 10, 2022
by
Chathura IT19243986
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
0856a0b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
Notification.java
Notification.java
+64
-0
No files found.
Notification.java
0 → 100644
View file @
522316cb
package
com.example.peopluz1.fragments
;
import
android.os.Bundle
;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.example.peopluz1.Adapters.NotificationsAdapter
;
import
com.example.peopluz1.R
;
import
com.google.android.gms.tasks.OnSuccessListener
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.firestore.DocumentSnapshot
;
import
com.google.firebase.firestore.FirebaseFirestore
;
import
com.google.firebase.firestore.QuerySnapshot
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Notification
extends
Fragment
{
private
FirebaseFirestore
db
;
FirebaseAuth
auth
;
public
RecyclerView
mRecycleView
;
public
NotificationsAdapter
mAdapter
;
public
RecyclerView
.
LayoutManager
mManager
;
ArrayList
<
Notification
>
list
=
new
ArrayList
<>();
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
db
=
FirebaseFirestore
.
getInstance
();
return
inflater
.
inflate
(
R
.
layout
.
fragment_notification
,
container
,
false
);
}
public
void
getNotifications
(){
db
.
collection
(
"users"
).
document
(
auth
.
getCurrentUser
().
getUid
())
.
collection
(
"trip"
).
get
()
.
addOnSuccessListener
(
new
OnSuccessListener
<
QuerySnapshot
>()
{
@Override
public
void
onSuccess
(
QuerySnapshot
queryDocumentSnapshots
)
{
if
(!
queryDocumentSnapshots
.
isEmpty
()){
List
<
DocumentSnapshot
>
clist
=
queryDocumentSnapshots
.
getDocuments
();
for
(
DocumentSnapshot
d
:
clist
){
Notification
p
=
d
.
toObject
(
Notification
.
class
);
list
.
add
(
p
);
}
mAdapter
.
notifyDataSetChanged
();
}
}
});
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment