Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
My notepad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731301
My notepad
Commits
b9db25b6
Commit
b9db25b6
authored
4 years ago
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ArchivedAdaptor
parent
9fedf74e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
0 deletions
+112
-0
MyArchivedAdaptor.java
...dNotes/MyArchivedNotesRecyclerView/MyArchivedAdaptor.java
+105
-0
simple_color.xml
app/src/main/res/drawable/simple_color.xml
+7
-0
No files found.
app/src/main/java/com/example/mynotepad/MenuFeatures/AllArchivedNotes/MyArchivedNotesRecyclerView/MyArchivedAdaptor.java
0 → 100644
View file @
b9db25b6
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllArchivedNotes
.
MyArchivedNotesRecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote
;
import
com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.MyDate
;
import
com.example.mynotepad.R
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MyArchivedAdaptor
extends
RecyclerView
.
Adapter
<
MyArchivedAdaptor
.
ViewHolder
>
{
private
List
<
MyNote
>
notes
;
private
List
<
MyDate
>
dates
;
private
ArrayList
<
DateOrNote
>
dateOrNoteList
;
private
OnArchivedItemClickListener
onArchivedItemClickListener
;
public
MyArchivedAdaptor
(
List
<
MyNote
>
notes
,
List
<
MyDate
>
dates
)
{
this
.
notes
=
notes
;
this
.
dates
=
dates
;
dateOrNoteList
=
new
ArrayList
<>();
setarchivedNotesAndDates
();
}
private
void
setarchivedNotesAndDates
()
{
setNotes
();
setDates
();
}
private
void
setDates
()
{
for
(
MyDate
myDate
:
dates
)
{
if
(
myDate
.
isarchived
())
{
DateOrNote
date
=
new
DateOrNote
(
myDate
.
getId
(),
"date"
,
myDate
.
getDate
(),
myDate
.
getDescription
());
dateOrNoteList
.
add
(
date
);
}
}
}
private
void
setNotes
()
{
for
(
MyNote
myNote
:
notes
)
{
if
(
myNote
.
isarchived
())
{
DateOrNote
note
=
new
DateOrNote
(
myNote
.
getId
(),
"note"
,
myNote
.
getTitle
(),
myNote
.
getDescription
());
dateOrNoteList
.
add
(
note
);
}
}
}
public
void
setOnArchivedItemClickListener
(
OnArchivedItemClickListener
onArchivedItemClickListener
)
{
this
.
onArchivedItemClickListener
=
onArchivedItemClickListener
;
}
@NonNull
@Override
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
return
new
ViewHolder
(
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
custom_allnotes_item
,
parent
,
false
));
}
@Override
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
holder
.
titleTV
.
setText
(
dateOrNoteList
.
get
(
position
).
getTitle
());
holder
.
descriptionTV
.
setText
(
dateOrNoteList
.
get
(
position
).
getDescription
());
}
@Override
public
int
getItemCount
()
{
return
dateOrNoteList
.
size
();
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnClickListener
,
View
.
OnLongClickListener
{
protected
TextView
titleTV
,
descriptionTV
;
protected
boolean
isarchived
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
titleTV
=
itemView
.
findViewById
(
R
.
id
.
titleTv
);
descriptionTV
=
itemView
.
findViewById
(
R
.
id
.
descriptionTv
);
isarchived
=
false
;
itemView
.
setOnClickListener
(
this
);
itemView
.
setOnLongClickListener
(
this
);
}
@Override
public
void
onClick
(
View
view
)
{
if
(
onArchivedItemClickListener
!=
null
)
{
onArchivedItemClickListener
.
onItemClicked
(
dateOrNoteList
.
get
(
getAdapterPosition
()));
}
}
@Override
public
boolean
onLongClick
(
View
view
)
{
if
(
onArchivedItemClickListener
!=
null
)
onArchivedItemClickListener
.
onItemLongClicked
(
dateOrNoteList
.
get
(
getAdapterPosition
()));
return
true
;
}
}
public
ArrayList
<
DateOrNote
>
getDateOrNoteList
()
{
return
dateOrNoteList
;
}
}
This diff is collapsed.
Click to expand it.
app/src/main/res/drawable/simple_color.xml
0 → 100644
View file @
b9db25b6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#4883B5DD"
>
</solid>
</shape>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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