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
fc7aee34
Commit
fc7aee34
authored
Sep 25, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add recyclerView for calender and some changes in ui
parent
ee81816f
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
434 additions
and
96 deletions
+434
-96
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-1
AllNotesActivity.java
...ple/mynotepad/MenuFeatures/AllNotes/AllNotesActivity.java
+7
-6
MyAllNotesAdaptor.java
...atures/AllNotes/MyNoteRecyclerView/MyAllNotesAdaptor.java
+6
-8
OnAllNotesItemClickListener.java
...Notes/MyNoteRecyclerView/OnAllNotesItemClickListener.java
+1
-1
CustomCalenderToolbarOptionListener.java
...eatures/Calender/CustomCalenderToolbarOptionListener.java
+0
-4
Date.java
...ava/com/example/mynotepad/MenuFeatures/Calender/Date.java
+1
-1
MyCalenderActivity.java
...e/mynotepad/MenuFeatures/Calender/MyCalenderActivity.java
+70
-25
DateEntity.java
.../MenuFeatures/Calender/MyCalenderDataBase/DateEntity.java
+4
-0
MyCalenderAdaptor.java
...es/Calender/MyCalenderRecyclerView/MyCalenderAdaptor.java
+76
-0
OnCalenderItemClickListener.java
...r/MyCalenderRecyclerView/OnCalenderItemClickListener.java
+9
-0
DatePickerActivity.java
...MyCalenderRecyclerView/TimePicker/DatePickerActivity.java
+101
-0
MyDate.java
...es/Calender/MyCalenderRecyclerView/TimePicker/MyDate.java
+29
-0
CustomToolbarOption.java
...m/example/mynotepad/MenuFeatures/CustomToolbarOption.java
+2
-3
CustomToolbarOptionListener.java
...e/mynotepad/MenuFeatures/CustomToolbarOptionListener.java
+2
-2
description_backgroung.xml
app/src/main/res/drawable/description_backgroung.xml
+10
-0
title_background.xml
app/src/main/res/drawable/title_background.xml
+10
-0
activity_all_notes.xml
app/src/main/res/layout/activity_all_notes.xml
+1
-1
activity_date_picker.xml
app/src/main/res/layout/activity_date_picker.xml
+84
-0
activity_my_calender.xml
app/src/main/res/layout/activity_my_calender.xml
+7
-13
custom_allnotes_item.xml
app/src/main/res/layout/custom_allnotes_item.xml
+1
-0
custom_calender_item.xml
app/src/main/res/layout/custom_calender_item.xml
+0
-25
fragment_note.xml
app/src/main/res/layout/fragment_note.xml
+10
-6
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
fc7aee34
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".MenuFeatures.Calender.MyCalenderActivity"
></activity>
<activity
android:name=
".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity"
></activity>
<activity
android:name=
".MenuFeatures.Calender.MyCalenderActivity"
/>
<activity
android:name=
".MenuFeatures.VoiceMassages.VoiceMassages"
/>
<activity
android:name=
".MenuFeatures.VoiceMassages.VoiceMassages"
/>
<activity
android:name=
".MenuFeatures.AllNotes.AllNotesActivity"
/>
<activity
android:name=
".MenuFeatures.AllNotes.AllNotesActivity"
/>
<activity
android:name=
".MenuFeatures.AllAchievedNotes.AchivedNotesActivity"
/>
<activity
android:name=
".MenuFeatures.AllAchievedNotes.AchivedNotesActivity"
/>
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/AllNotesActivity.java
View file @
fc7aee34
...
@@ -15,13 +15,14 @@ import android.widget.FrameLayout;
...
@@ -15,13 +15,14 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyAdaptor
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyA
llNotesA
daptor
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.OnItemClickListener
;
import
com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.On
AllNotes
ItemClickListener
;
import
com.example.mynotepad.MenuFeatures.AllNotes.Note.NoteFragment
;
import
com.example.mynotepad.MenuFeatures.AllNotes.Note.NoteFragment
;
import
com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.Note
;
import
com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.Note
;
import
com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.NoteDataBase
;
import
com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.NoteDataBase
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener
;
import
com.example.mynotepad.R
;
import
com.example.mynotepad.R
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
...
@@ -37,7 +38,7 @@ public class AllNotesActivity extends AppCompatActivity {
...
@@ -37,7 +38,7 @@ public class AllNotesActivity extends AppCompatActivity {
private
CustomToolbarOption
customToolbarOption
;
private
CustomToolbarOption
customToolbarOption
;
private
FrameLayout
allNoteToolBar
;
private
FrameLayout
allNoteToolBar
;
private
RecyclerView
recyclerView
;
private
RecyclerView
recyclerView
;
private
MyAdaptor
myAdaptor
;
private
MyA
llNotesA
daptor
myAdaptor
;
private
List
<
Note
>
notes
;
private
List
<
Note
>
notes
;
private
List
<
MyNote
>
myNotes
;
private
List
<
MyNote
>
myNotes
;
public
static
MyNote
myChosenNote
;
public
static
MyNote
myChosenNote
;
...
@@ -69,7 +70,7 @@ public class AllNotesActivity extends AppCompatActivity {
...
@@ -69,7 +70,7 @@ public class AllNotesActivity extends AppCompatActivity {
// show list with recycler view
// show list with recycler view
recyclerView
=
findViewById
(
R
.
id
.
recyclerView
);
recyclerView
=
findViewById
(
R
.
id
.
recyclerView
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
myAdaptor
=
new
MyAdaptor
(
myNotes
);
myAdaptor
=
new
MyA
llNotesA
daptor
(
myNotes
);
recyclerView
.
setAdapter
(
myAdaptor
);
recyclerView
.
setAdapter
(
myAdaptor
);
recyclerView
.
setLayoutManager
(
linearLayoutManager
);
recyclerView
.
setLayoutManager
(
linearLayoutManager
);
...
@@ -88,7 +89,7 @@ public class AllNotesActivity extends AppCompatActivity {
...
@@ -88,7 +89,7 @@ public class AllNotesActivity extends AppCompatActivity {
});
});
// add listener to recyclerView
// add listener to recyclerView
myAdaptor
.
setOnItemClickListener
(
new
OnItemClickListener
()
{
myAdaptor
.
setOnItemClickListener
(
new
On
AllNotes
ItemClickListener
()
{
@Override
@Override
public
void
onItemClicked
(
MyNote
myNote
)
{
public
void
onItemClicked
(
MyNote
myNote
)
{
myChosenNote
=
myNote
;
myChosenNote
=
myNote
;
...
@@ -115,7 +116,7 @@ public class AllNotesActivity extends AppCompatActivity {
...
@@ -115,7 +116,7 @@ public class AllNotesActivity extends AppCompatActivity {
});
});
//add listener to custom toolbar option and set being achieved or not to be saved in database
//add listener to custom toolbar option and set being achieved or not to be saved in database
customToolbarOption
.
setCustomToolbarOptionListener
(
new
Custom
AllNotes
ToolbarOptionListener
()
{
customToolbarOption
.
setCustomToolbarOptionListener
(
new
CustomToolbarOptionListener
()
{
@Override
@Override
public
void
onStarClicked
(
ImageView
yellowS
,
ImageView
blackS
)
{
public
void
onStarClicked
(
ImageView
yellowS
,
ImageView
blackS
)
{
if
(
yellowS
.
getVisibility
()
==
View
.
VISIBLE
){
if
(
yellowS
.
getVisibility
()
==
View
.
VISIBLE
){
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/MyNoteRecyclerView/MyAdaptor.java
→
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/MyNoteRecyclerView/MyA
llNotesA
daptor.java
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
MyNoteRecyclerView
;
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
MyNoteRecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -13,16 +12,15 @@ import com.example.mynotepad.R;
...
@@ -13,16 +12,15 @@ import com.example.mynotepad.R;
import
java.util.List
;
import
java.util.List
;
public
class
MyA
daptor
extends
RecyclerView
.
Adapter
<
My
Adaptor
.
ViewHolder
>
{
public
class
MyA
llNotesAdaptor
extends
RecyclerView
.
Adapter
<
MyAllNotes
Adaptor
.
ViewHolder
>
{
private
List
<
MyNote
>
notes
;
private
List
<
MyNote
>
notes
;
private
OnItemClickListener
onItemClickListener
;
private
On
AllNotes
ItemClickListener
onItemClickListener
;
public
MyAdaptor
(
List
<
MyNote
>
notes
)
{
public
MyA
llNotesA
daptor
(
List
<
MyNote
>
notes
)
{
this
.
notes
=
notes
;
this
.
notes
=
notes
;
}
}
@NonNull
@NonNull
@Override
@Override
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
...
@@ -42,7 +40,7 @@ public class MyAdaptor extends RecyclerView.Adapter<MyAdaptor.ViewHolder> {
...
@@ -42,7 +40,7 @@ public class MyAdaptor extends RecyclerView.Adapter<MyAdaptor.ViewHolder> {
return
notes
.
size
();
return
notes
.
size
();
}
}
public
void
setOnItemClickListener
(
OnItemClickListener
onItemClickListener
)
{
public
void
setOnItemClickListener
(
On
AllNotes
ItemClickListener
onItemClickListener
)
{
this
.
onItemClickListener
=
onItemClickListener
;
this
.
onItemClickListener
=
onItemClickListener
;
}
}
...
@@ -61,7 +59,7 @@ public class MyAdaptor extends RecyclerView.Adapter<MyAdaptor.ViewHolder> {
...
@@ -61,7 +59,7 @@ public class MyAdaptor extends RecyclerView.Adapter<MyAdaptor.ViewHolder> {
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
if
(
onItemClickListener
!=
null
){
if
(
onItemClickListener
!=
null
)
{
onItemClickListener
.
onItemClicked
(
notes
.
get
(
getAdapterPosition
()));
onItemClickListener
.
onItemClicked
(
notes
.
get
(
getAdapterPosition
()));
}
}
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/MyNoteRecyclerView/OnItemClickListener.java
→
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/MyNoteRecyclerView/On
AllNotes
ItemClickListener.java
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
MyNoteRecyclerView
;
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
MyNoteRecyclerView
;
public
interface
OnItemClickListener
{
public
interface
On
AllNotes
ItemClickListener
{
void
onItemClicked
(
MyNote
item
);
void
onItemClicked
(
MyNote
item
);
void
onItemLongClicked
(
MyNote
item
);
void
onItemLongClicked
(
MyNote
item
);
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/CustomCalenderToolbarOptionListener.java
deleted
100644 → 0
View file @
ee81816f
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
;
public
interface
CustomCalenderToolbarOptionListener
{
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/Date.java
View file @
fc7aee34
...
@@ -7,7 +7,7 @@ import java.util.Calendar;
...
@@ -7,7 +7,7 @@ import java.util.Calendar;
import
java.util.Locale
;
import
java.util.Locale
;
public
class
Date
extends
DateItem
{
public
class
Date
extends
DateItem
{
String
getDate
()
{
public
String
getDate
()
{
Calendar
calendar
=
getCalendar
();
Calendar
calendar
=
getCalendar
();
return
String
.
format
(
Locale
.
US
,
return
String
.
format
(
Locale
.
US
,
"%d/%d/%d"
,
"%d/%d/%d"
,
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderActivity.java
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
;
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.widget.TextView
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
com.alirezaafkar.sundatepicker.DatePicker
;
import
com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.MyCalenderAdaptor
;
import
com.alirezaafkar.sundatepicker.interfaces.DateSetListener
;
import
com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity
;
import
com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.MyDate
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.R
;
import
com.example.mynotepad.R
;
import
java.util.Calendar
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
public
class
MyCalenderActivity
extends
AppCompatActivity
{
import
java.util.ArrayList
;
import
java.util.List
;
Date
mDate
;
public
class
MyCalenderActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
TextView
tvDatePersion
;
private
FloatingActionButton
addDateBtn
;
private
CustomToolbarOption
customToolbarOption
;
private
FrameLayout
calenderToolbar
;
private
LinearLayout
allDateListAndTitle
;
private
FrameLayout
fragPlace
;
private
RecyclerView
recyclerView
;
private
MyCalenderAdaptor
myAdaptor
;
private
List
<
MyDate
>
myDates
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -23,22 +39,51 @@ public class MyCalenderActivity extends AppCompatActivity {
...
@@ -23,22 +39,51 @@ public class MyCalenderActivity extends AppCompatActivity {
}
}
private
void
init
()
{
private
void
init
()
{
tvDatePersion
=
findViewById
(
R
.
id
.
dateTv
);
DatePicker
.
Builder
builder
=
new
DatePicker
setAllNoteListAndTitles
();
.
Builder
()
addDateBtn
=
findViewById
(
R
.
id
.
addDateButton
);
.
theme
(
R
.
style
.
DialogTheme
)
.
future
(
true
);
customToolbarOption
=
findViewById
(
R
.
id
.
calenderCustomToolbarOption
);
mDate
=
new
Date
();
customToolbarOption
.
setVisibility
(
View
.
GONE
);
builder
.
date
(
mDate
.
getDay
(),
mDate
.
getMonth
(),
mDate
.
getYear
());
calenderToolbar
=
findViewById
(
R
.
id
.
calenderToolbar
);
builder
.
build
(
new
DateSetListener
()
{
calenderToolbar
.
setEnabled
(
false
);
addDateBtn
=
findViewById
(
R
.
id
.
addDateButton
);
allDateListAndTitle
=
findViewById
(
R
.
id
.
allDateListAndTitle
);
fragPlace
=
findViewById
(
R
.
id
.
fragmentPlace_calender
);
fragPlace
.
setVisibility
(
View
.
GONE
);
// show list with recycler view
recyclerView
=
findViewById
(
R
.
id
.
calenderRecyclerView
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
myAdaptor
=
new
MyCalenderAdaptor
(
myDates
);
recyclerView
.
setAdapter
(
myAdaptor
);
recyclerView
.
setLayoutManager
(
linearLayoutManager
);
addListeners
();
}
private
void
addListeners
()
{
addDateBtn
.
setOnClickListener
(
this
);
}
@Override
@Override
public
void
onDateSet
(
int
id
,
@Nullable
Calendar
calendar
,
int
day
,
int
month
,
int
year
)
{
public
void
onClick
(
View
view
)
{
mDate
.
setDate
(
day
,
month
,
year
);
if
(
view
.
getId
()
==
addDateBtn
.
getId
())
{
addNewDateAndDescription
();
}
//textView
}
tvDatePersion
.
setText
(
mDate
.
getDate
());
private
void
addNewDateAndDescription
()
{
Intent
intent
=
new
Intent
(
MyCalenderActivity
.
this
,
DatePickerActivity
.
class
);
startActivity
(
intent
);
}
}
}).
show
(
getSupportFragmentManager
(),
""
);
private
void
setAllNoteListAndTitles
()
{
myDates
=
new
ArrayList
<>();
//todo get data from database
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderDataBase/DateEntity.java
0 → 100644
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderDataBase
;
public
class
DateEntity
{
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/MyCalenderAdaptor.java
0 → 100644
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderRecyclerView
;
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.Calender.MyCalenderRecyclerView.TimePicker.MyDate
;
import
com.example.mynotepad.R
;
import
java.util.List
;
public
class
MyCalenderAdaptor
extends
RecyclerView
.
Adapter
<
MyCalenderAdaptor
.
CalenderViewHolder
>
{
private
List
<
MyDate
>
dates
;
private
OnCalenderItemClickListener
onCalenderItemClickListener
;
public
MyCalenderAdaptor
(
List
<
MyDate
>
dates
){
this
.
dates
=
dates
;
}
@NonNull
@Override
public
CalenderViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
custom_allnotes_item
,
parent
,
false
);
return
new
CalenderViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
CalenderViewHolder
holder
,
int
position
)
{
holder
.
dateTV
.
setText
(
dates
.
get
(
position
).
getDate
());
holder
.
descriptionTV
.
setText
(
dates
.
get
(
position
).
getDescription
());
holder
.
isAchieved
=
dates
.
get
(
position
).
isAchieved
();
}
@Override
public
int
getItemCount
()
{
return
dates
.
size
();
}
public
void
setOnCalenderItemClickListener
(
OnCalenderItemClickListener
onCalenderItemClickListener
)
{
this
.
onCalenderItemClickListener
=
onCalenderItemClickListener
;
}
class
CalenderViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnClickListener
,
View
.
OnLongClickListener
{
protected
TextView
dateTV
,
descriptionTV
;
protected
boolean
isAchieved
;
public
CalenderViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
dates
=
itemView
.
findViewById
(
R
.
id
.
titleTv
);
descriptionTV
=
itemView
.
findViewById
(
R
.
id
.
descriptionTv
);
isAchieved
=
false
;
itemView
.
setOnClickListener
(
this
);
itemView
.
setOnLongClickListener
(
this
);
}
@Override
public
void
onClick
(
View
view
)
{
if
(
onCalenderItemClickListener
!=
null
)
{
onCalenderItemClickListener
.
onItemClicked
(
dates
.
get
(
getAdapterPosition
()));
}
}
@Override
public
boolean
onLongClick
(
View
view
)
{
if
(
onCalenderItemClickListener
!=
null
)
onCalenderItemClickListener
.
onItemLongClicked
(
dates
.
get
(
getAdapterPosition
()));
return
true
;
}
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/OnCalenderItemClickListener.java
0 → 100644
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderRecyclerView
;
import
com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.MyDate
;
public
interface
OnCalenderItemClickListener
{
void
onItemClicked
(
MyDate
item
);
void
onItemLongClicked
(
MyDate
item
);
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/TimePicker/DatePickerActivity.java
0 → 100644
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderRecyclerView
.
TimePicker
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.alirezaafkar.sundatepicker.DatePicker
;
import
com.alirezaafkar.sundatepicker.interfaces.DateSetListener
;
import
com.example.mynotepad.MenuFeatures.Calender.Date
;
import
com.example.mynotepad.R
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.android.material.snackbar.Snackbar
;
import
java.util.Calendar
;
public
class
DatePickerActivity
extends
AppCompatActivity
{
TextView
chosenDate
,
description
;
Date
mDate
;
private
FloatingActionButton
back
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_date_picker
);
init
();
showTimePicker
();
}
private
void
init
()
{
chosenDate
=
findViewById
(
R
.
id
.
chosenDate
);
description
=
findViewById
(
R
.
id
.
description
);
back
=
findViewById
(
R
.
id
.
calenderBackBtn
);
back
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
showAlert
(
view
);
}
});
}
private
void
showTimePicker
()
{
DatePicker
.
Builder
builder
=
new
DatePicker
.
Builder
()
.
theme
(
R
.
style
.
DialogTheme
)
.
future
(
true
);
mDate
=
new
Date
();
builder
.
date
(
mDate
.
getDay
(),
mDate
.
getMonth
(),
mDate
.
getYear
());
builder
.
build
(
new
DateSetListener
()
{
@Override
public
void
onDateSet
(
int
id
,
@Nullable
Calendar
calendar
,
int
day
,
int
month
,
int
year
)
{
mDate
.
setDate
(
day
,
month
,
year
);
chosenDate
.
setText
(
mDate
.
getDate
());
}
}).
show
(
getSupportFragmentManager
(),
""
);
}
private
void
showAlert
(
View
view
)
{
if
(
chosenDate
.
getText
().
length
()
!=
0
)
{
final
AlertDialog
.
Builder
alert
=
new
AlertDialog
.
Builder
(
this
);
alert
.
setTitle
(
"new note :"
);
alert
.
setMessage
(
"Do you want to save the note ?"
);
alert
.
setCancelable
(
true
);
alert
.
setPositiveButton
(
"yes"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
saveNote
();
Toast
.
makeText
(
DatePickerActivity
.
this
,
"saved"
,
Toast
.
LENGTH_SHORT
).
show
();
finish
();
}
});
alert
.
setNegativeButton
(
"no"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialogInterface
.
cancel
();
finish
();
}
});
alert
.
show
();
}
else
if
(
description
.
getText
().
length
()
!=
0
){
Snackbar
.
make
(
view
,
"note did not save ! you should pick a date ! "
,
Snackbar
.
LENGTH_LONG
).
setAction
(
"Action"
,
null
).
show
();
finish
();
}
else
{
finish
();
}
}
private
void
saveNote
()
{
//todo save in data base
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/TimePicker/MyDate.java
0 → 100644
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderRecyclerView
.
TimePicker
;
public
class
MyDate
{
private
String
date
,
description
;
private
boolean
isAchieved
;
public
MyDate
(
String
date
,
String
description
,
boolean
isAchieved
)
{
this
.
date
=
date
;
this
.
description
=
description
;
this
.
isAchieved
=
isAchieved
;
}
public
String
getDate
()
{
return
date
;
}
public
String
getDescription
()
{
return
description
;
}
public
boolean
isAchieved
()
{
return
isAchieved
;
}
public
void
setAchieved
(
boolean
achieved
)
{
isAchieved
=
achieved
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/CustomToolbarOption.java
View file @
fc7aee34
...
@@ -7,13 +7,12 @@ import android.widget.ImageView;
...
@@ -7,13 +7,12 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
com.example.mynotepad.MenuFeatures.AllNotes.CustomAllNotesToolbarOptionListener
;
import
com.example.mynotepad.R
;
import
com.example.mynotepad.R
;
public
class
CustomToolbarOption
extends
LinearLayout
implements
View
.
OnClickListener
{
public
class
CustomToolbarOption
extends
LinearLayout
implements
View
.
OnClickListener
{
private
View
rootView
;
private
View
rootView
;
private
ImageView
blackStarImg
,
yellowStarImg
,
deleteImg
,
closeImg
;
private
ImageView
blackStarImg
,
yellowStarImg
,
deleteImg
,
closeImg
;
private
Custom
AllNotes
ToolbarOptionListener
customToolbarOptionListener
;
private
CustomToolbarOptionListener
customToolbarOptionListener
;
public
CustomToolbarOption
(
Context
context
)
{
public
CustomToolbarOption
(
Context
context
)
{
super
(
context
);
super
(
context
);
...
@@ -63,7 +62,7 @@ public class CustomToolbarOption extends LinearLayout implements View.OnClickLis
...
@@ -63,7 +62,7 @@ public class CustomToolbarOption extends LinearLayout implements View.OnClickLis
}
}
}
}
public
void
setCustomToolbarOptionListener
(
Custom
AllNotes
ToolbarOptionListener
customToolbarOptionListener
)
{
public
void
setCustomToolbarOptionListener
(
CustomToolbarOptionListener
customToolbarOptionListener
)
{
this
.
customToolbarOptionListener
=
customToolbarOptionListener
;
this
.
customToolbarOptionListener
=
customToolbarOptionListener
;
}
}
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/
AllNotes/CustomAllNotes
ToolbarOptionListener.java
→
app/src/main/java/com/example/mynotepad/MenuFeatures/
Custom
ToolbarOptionListener.java
View file @
fc7aee34
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
;
package
com
.
example
.
mynotepad
.
MenuFeatures
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
public
interface
Custom
AllNotes
ToolbarOptionListener
{
public
interface
CustomToolbarOptionListener
{
void
onStarClicked
(
ImageView
yellowS
,
ImageView
blackS
);
void
onStarClicked
(
ImageView
yellowS
,
ImageView
blackS
);
void
onDeleteClicked
(
ImageView
imageView
);
void
onDeleteClicked
(
ImageView
imageView
);
void
onCloseClicked
(
ImageView
imageView
);
void
onCloseClicked
(
ImageView
imageView
);
...
...
app/src/main/res/drawable/description_backgroung.xml
0 → 100644
View file @
fc7aee34
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
android:shape="rectangle">
<solid
android:color=
"#2DCADCEC"
/>
<stroke
android:width=
"10dp"
android:color=
"#F0CADCEC"
/>
<corners
android:radius=
"0dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/title_background.xml
0 → 100644
View file @
fc7aee34
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
android:shape="rectangle">
<solid
android:color=
"#45C0D7EA"
/>
<stroke
android:width=
"5dp"
android:color=
"#CADCEC"
/>
<corners
android:radius=
"0dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_all_notes.xml
View file @
fc7aee34
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
android:enabled=
"false"
android:enabled=
"false"
android:text=
"@string/all_notes"
android:text=
"@string/all_notes"
android:textColor=
"#02091E"
android:textColor=
"#02091E"
android:textSize=
"
30
dp"
/>
android:textSize=
"
26
dp"
/>
</FrameLayout>
</FrameLayout>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
...
...
app/src/main/res/layout/activity_date_picker.xml
0 → 100644
View file @
fc7aee34
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity"
>
<ImageView
android:id=
"@+id/img"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginTop=
"0dp"
android:scaleType=
"fitXY"
app:srcCompat=
"@drawable/index"
/>
<TextView
android:id=
"@+id/date1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/img"
android:layout_marginStart=
"50dp"
android:layout_marginLeft=
"50dp"
android:layout_marginTop=
"60dp"
android:enabled=
"false"
android:text=
"@string/date"
android:textSize=
"30dp"
android:textColor=
"#000000"
android:background=
"@drawable/background"
/>
<TextView
android:id=
"@+id/chosenDate"
android:layout_width=
"219dp"
android:layout_height=
"wrap_content"
android:layout_alignBottom=
"@+id/date1"
android:layout_marginLeft=
"20dp"
android:layout_marginBottom=
"0dp"
android:layout_toRightOf=
"@+id/date1"
android:background=
"@drawable/title_background"
android:enabled=
"false"
android:textColor=
"#000000"
android:lines=
"1"
android:gravity=
"center"
android:textSize=
"30dp"
/>
<TextView
android:id=
"@+id/date2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/chosenDate"
android:layout_marginStart=
"50dp"
android:layout_marginLeft=
"50dp"
android:layout_marginTop=
"60dp"
android:enabled=
"false"
android:text=
"@string/description"
android:textSize=
"30dp"
android:textColor=
"#000000"
android:background=
"@drawable/background"
/>
<TextView
android:id=
"@+id/description"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/date2"
android:layout_centerHorizontal=
"true"
android:layout_marginLeft=
"50dp"
android:layout_marginTop=
"21dp"
android:background=
"@drawable/title_background"
android:lines=
"9"
android:enabled=
"true"
android:textColor=
"#000000"
android:textSize=
"20dp"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/calenderBackBtn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"330dp"
android:layout_marginTop=
"520dp"
android:src=
"@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint=
"#DF4141"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/activity_my_calender.xml
View file @
fc7aee34
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
tools:context=
".MenuFeatures.Calender.MyCalenderActivity"
>
tools:context=
".MenuFeatures.Calender.MyCalenderActivity"
>
<FrameLayout
<FrameLayout
android:id=
"@+id/fragmentPlace"
android:id=
"@+id/fragmentPlace
_calender
"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
<LinearLayout
<LinearLayout
android:id=
"@+id/all
No
teListAndTitle"
android:id=
"@+id/all
Da
teListAndTitle"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<FrameLayout
<FrameLayout
android:id=
"@+id/calenderToolbar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
...
@@ -41,11 +42,11 @@
...
@@ -41,11 +42,11 @@
android:enabled=
"false"
android:enabled=
"false"
android:text=
"@string/calender"
android:text=
"@string/calender"
android:textColor=
"#02091E"
android:textColor=
"#02091E"
android:textSize=
"
30
dp"
/>
android:textSize=
"
26
dp"
/>
</FrameLayout>
</FrameLayout>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id=
"@+id/customToolbarOption"
android:id=
"@+id/c
alenderC
ustomToolbarOption"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
/>
android:layout_height=
"50dp"
/>
</FrameLayout>
</FrameLayout>
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/
r
ecyclerView"
android:id=
"@+id/
calenderR
ecyclerView"
android:layout_width=
"409dp"
android:layout_width=
"409dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#4883B5DD"
android:background=
"#4883B5DD"
...
@@ -63,7 +64,7 @@
...
@@ -63,7 +64,7 @@
tools:layout_editor_absoluteY=
"1dp"
/>
tools:layout_editor_absoluteY=
"1dp"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/add
No
teButton"
android:id=
"@+id/add
Da
teButton"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"330dp"
android:layout_marginLeft=
"330dp"
...
@@ -74,12 +75,5 @@
...
@@ -74,12 +75,5 @@
tools:layout_editor_absoluteX=
"310dp"
tools:layout_editor_absoluteX=
"310dp"
tools:layout_editor_absoluteY=
"612dp"
/>
tools:layout_editor_absoluteY=
"612dp"
/>
</FrameLayout>
</FrameLayout>
<TextView
android:id=
"@+id/dateTv"
android:layout_width=
"153dp"
android:layout_height=
"40dp"
tools:layout_editor_absoluteX=
"132dp"
tools:layout_editor_absoluteY=
"466dp"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
app/src/main/res/layout/custom_allnotes_item.xml
View file @
fc7aee34
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<TextView
<TextView
android:id=
"@+id/descriptionTv"
android:id=
"@+id/descriptionTv"
android:layout_marginTop=
"2dp"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"3"
android:layout_weight=
"3"
...
...
app/src/main/res/layout/custom_calender_item.xml
deleted
100644 → 0
View file @
ee81816f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:orientation=
"horizontal"
android:background=
"@drawable/row_bg"
>
<TextView
android:id=
"@+id/dateTextView"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:text=
"@string/date"
android:textSize=
"28dp"
android:gravity=
"center"
/>
<TextView
android:id=
"@+id/descriptionTextView"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_weight=
"6"
android:text=
"@string/description"
android:textSize=
"25dp"
android:gravity=
"center_vertical"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_note.xml
View file @
fc7aee34
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:
hint=
"title
"
android:
layout_marginTop=
"5dp
"
android:
textSize=
"24
dp"
android:
layout_marginLeft=
"10
dp"
android:layout_marginRight=
"50dp"
android:layout_marginRight=
"50dp"
android:layout_marginLeft=
"10dp"
/>
android:hint=
" title"
android:textSize=
"24dp"
android:background=
"@drawable/title_background"
/>
<FrameLayout
<FrameLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -29,10 +30,13 @@
...
@@ -29,10 +30,13 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_alignTop=
"@+id/title"
android:layout_alignTop=
"@+id/title"
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"3dp"
android:layout_marginBottom=
"3dp"
android:background=
"@drawable/description_backgroung"
android:gravity=
"top"
android:gravity=
"top"
android:hint=
"..."
android:hint=
"
..."
android:lines=
"20"
/>
android:lines=
"20"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
...
@@ -40,7 +44,7 @@
...
@@ -40,7 +44,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"330dp"
android:layout_marginLeft=
"330dp"
android:layout_marginTop=
"4
4
0dp"
android:layout_marginTop=
"4
8
0dp"
android:src=
"@drawable/ic_baseline_keyboard_backspace_24"
android:src=
"@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint=
"#DF4141"
/>
app:backgroundTint=
"#DF4141"
/>
</FrameLayout>
</FrameLayout>
...
...
app/src/main/res/values/strings.xml
View file @
fc7aee34
...
@@ -10,4 +10,5 @@
...
@@ -10,4 +10,5 @@
<string
name=
"calender"
>
calender
</string>
<string
name=
"calender"
>
calender
</string>
<string
name=
"description"
>
description
</string>
<string
name=
"description"
>
description
</string>
<string
name=
"date"
>
date
</string>
<string
name=
"date"
>
date
</string>
<string
name=
"chosendate"
>
chosenDate
</string>
</resources>
</resources>
\ 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