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
0b611673
Commit
0b611673
authored
Oct 10, 2022
by
Chathura IT19243986
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
9a0de744
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
0 deletions
+103
-0
NotificationsAdapter.java
NotificationsAdapter.java
+103
-0
No files found.
NotificationsAdapter.java
0 → 100644
View file @
0b611673
package
com.example.peopluz1.Adapters
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Filter
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.example.peopluz1.Model.Notification
;
import
com.example.peopluz1.R
;
import
java.util.ArrayList
;
public
class
NotificationsAdapter
extends
RecyclerView
.
Adapter
<
NotificationsAdapter
.
NotificationViewHolder
>{
public
ArrayList
<
Notification
>
ulist
;
public
ArrayList
<
Notification
>
filteredList
;
private
Context
context
;
public
static
class
NotificationViewHolder
extends
RecyclerView
.
ViewHolder
{
// public ImageView mimage;
public
TextView
date
;
public
NotificationViewHolder
(
View
itemView
){
super
(
itemView
);
date
=
itemView
.
findViewById
(
R
.
id
.
header
);
}
}
public
NotificationsAdapter
(
ArrayList
<
Notification
>
list
){
ulist
=
list
;
this
.
filteredList
=
ulist
;
}
@NonNull
@Override
public
NotificationViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
v
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
notification_item
,
parent
,
false
);
return
new
NotificationsAdapter
.
NotificationViewHolder
(
v
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
NotificationViewHolder
holder
,
int
position
)
{
Notification
current
=
filteredList
.
get
(
position
);
holder
.
date
.
setText
(
String
.
valueOf
(
current
.
getDatetime
()));
//holder.Glocation.setText(String.valueOf(current.getLocation()));
// holder.Gdescription.setText(String.valueOf(current.getDescription()));
//Picasso.get().load(current.getImageUrl()).into(holder.mimage);
holder
.
itemView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
}
});
}
@Override
public
int
getItemCount
()
{
return
filteredList
.
size
();
}
//search data
public
Filter
getFilter
(){
return
new
Filter
()
{
@Override
protected
FilterResults
performFiltering
(
CharSequence
constraint
)
{
String
key
=
constraint
.
toString
();
if
(
key
.
isEmpty
()){
filteredList
=
ulist
;
}
else
{
ArrayList
<
Notification
>
isfiltered
=
new
ArrayList
<>();
for
(
Notification
row:
ulist
){
if
(
row
.
getDatetime
().
toLowerCase
().
contains
(
key
.
toLowerCase
())){
isfiltered
.
add
(
row
);
}
}
filteredList
=
isfiltered
;
}
FilterResults
filterResults
=
new
FilterResults
();
filterResults
.
values
=
filteredList
;
return
filterResults
;
}
@Override
protected
void
publishResults
(
CharSequence
constraint
,
FilterResults
filterResults
)
{
filteredList
=
(
ArrayList
<
Notification
>)
filterResults
.
values
;
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