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
db2e8c72
Commit
db2e8c72
authored
Nov 12, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change database to be prepared to add folders
parent
7b22d50a
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
190 additions
and
46 deletions
+190
-46
build.gradle
app/build.gradle
+4
-2
ArchivedNoesListFragment.java
...nuFeatures/AllArchivedNotes/ArchivedNoesListFragment.java
+10
-4
DateOrNote.java
...ArchivedNotes/MyArchivedNotesRecyclerView/DateOrNote.java
+9
-1
MyArchivedAdaptor.java
...dNotes/MyArchivedNotesRecyclerView/MyArchivedAdaptor.java
+2
-2
AllNotesListFragment.java
...mynotepad/MenuFeatures/AllNotes/AllNotesListFragment.java
+7
-2
Converters.java
.../mynotepad/MenuFeatures/AllNotes/DataBase/Converters.java
+23
-0
DateEntity.java
.../mynotepad/MenuFeatures/AllNotes/DataBase/DateEntity.java
+11
-1
DateNoreDAO.java
...mynotepad/MenuFeatures/AllNotes/DataBase/DateNoreDAO.java
+3
-2
Note.java
...xample/mynotepad/MenuFeatures/AllNotes/DataBase/Note.java
+10
-1
NoteDAO.java
...ple/mynotepad/MenuFeatures/AllNotes/DataBase/NoteDAO.java
+3
-2
NoteDataBase.java
...ynotepad/MenuFeatures/AllNotes/DataBase/NoteDataBase.java
+2
-0
MyNote.java
...epad/MenuFeatures/AllNotes/MyNoteRecyclerView/MyNote.java
+10
-2
NoteFragment.java
...le/mynotepad/MenuFeatures/AllNotes/Note/NoteFragment.java
+10
-6
CalenderNotesListFragment.java
...epad/MenuFeatures/Calender/CalenderNotesListFragment.java
+5
-2
MyDate.java
...es/Calender/MyCalenderRecyclerView/TimePicker/MyDate.java
+10
-2
TimePickerFragment.java
...MyCalenderRecyclerView/TimePicker/TimePickerFragment.java
+24
-1
CustomToolbarOption.java
...m/example/mynotepad/MenuFeatures/CustomToolbarOption.java
+20
-13
CustomToolbarOptionListener.java
...e/mynotepad/MenuFeatures/CustomToolbarOptionListener.java
+1
-0
AudioListFragment.java
...notepad/MenuFeatures/VoiceMassages/AudioListFragment.java
+6
-0
custom_toolbar_options.xml
app/src/main/res/layout/custom_toolbar_options.xml
+16
-3
build.gradle
build.gradle
+4
-0
No files found.
app/build.gradle
View file @
db2e8c72
...
...
@@ -25,7 +25,7 @@ android {
dependencies
{
implementation
fileTree
(
dir:
"libs"
,
include:
[
"*.jar"
])
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'androidx.constraintlayout:constraintlayout:2.0.
2
'
implementation
'androidx.constraintlayout:constraintlayout:2.0.
4
'
implementation
'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation
'junit:junit:4.13.1'
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
...
...
@@ -34,9 +34,11 @@ dependencies {
implementation
'androidx.navigation:navigation-ui:2.3.1'
implementation
'com.alirezaafkar:sundatepicker:2.0.4'
implementation
"androidx.room:room-runtime:2.2.5"
annotationProcessor
"androidx.room:room-compiler:2.2.5"
implementation
"android.arch.persistence.room:runtime:1.1.1"
annotationProcessor
"android.arch.persistence.room:compiler:1.1.1"
implementation
'com.google.code.gson:gson:2.8.5'
//i added these parts just for voice recorder
def
nav_version
=
"2.3.1"
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllArchivedNotes/ArchivedNoesListFragment.java
View file @
db2e8c72
...
...
@@ -135,6 +135,7 @@ public class ArchivedNoesListFragment extends Fragment {
chosenDateOrNote
=
item
;
customToolbarOption
.
setVisibility
(
View
.
VISIBLE
);
customToolbarOption
.
hideRecycleBin
();
customToolbarOption
.
hideFolder
();
allNoteToolBar
.
setVisibility
(
View
.
GONE
);
}
});
...
...
@@ -159,15 +160,20 @@ public class ArchivedNoesListFragment extends Fragment {
public
void
onCloseClicked
()
{
closeClicked
(
customToolbarOption
);
}
@Override
public
void
onFolderClicked
()
{
}
});
}
private
void
updateToUnarchiveInDataBase
()
{
if
(
chosenDateOrNote
.
getType
().
equals
(
"note"
))
{
noteDataBase
.
noteDao
().
updateNote
(
chosenDateOrNote
.
getTitle
(),
chosenDateOrNote
.
getDescription
(),
false
,
chosenDateOrNote
.
getId
());
noteDataBase
.
noteDao
().
updateNote
(
chosenDateOrNote
.
getTitle
(),
chosenDateOrNote
.
getDescription
(),
false
,
chosenDateOrNote
.
getId
()
,
chosenDateOrNote
.
getFolders
()
);
}
else
if
(
chosenDateOrNote
.
getType
().
equals
(
"date"
))
{
noteDataBase
.
dateNoreDAO
().
updateDate
(
chosenDateOrNote
.
getTitle
(),
chosenDateOrNote
.
getDescription
(),
false
,
chosenDateOrNote
.
getId
());
noteDataBase
.
dateNoreDAO
().
updateDate
(
chosenDateOrNote
.
getTitle
(),
chosenDateOrNote
.
getDescription
(),
false
,
chosenDateOrNote
.
getId
()
,
chosenDateOrNote
.
getFolders
()
);
}
}
...
...
@@ -176,7 +182,7 @@ public class ArchivedNoesListFragment extends Fragment {
entityNotes
=
noteDataBase
.
noteDao
().
getAll
();
myNotes
=
new
ArrayList
<>();
for
(
Note
note
:
entityNotes
)
{
MyNote
myNote
=
new
MyNote
(
note
.
getTitle
(),
note
.
getDescription
(),
note
.
isarchived
(),
note
.
getID
());
MyNote
myNote
=
new
MyNote
(
note
.
getTitle
(),
note
.
getDescription
(),
note
.
isarchived
(),
note
.
getID
()
,
note
.
getFolders
()
);
myNotes
.
add
(
myNote
);
}
}
...
...
@@ -186,7 +192,7 @@ public class ArchivedNoesListFragment extends Fragment {
entityDates
=
noteDataBase
.
dateNoreDAO
().
getAllDateNotes
();
myDates
=
new
ArrayList
<>();
for
(
DateEntity
dateEntity
:
entityDates
)
{
MyDate
myDate
=
new
MyDate
(
dateEntity
.
getDate
(),
dateEntity
.
getDescription
(),
dateEntity
.
isarchived
(),
dateEntity
.
getID
());
MyDate
myDate
=
new
MyDate
(
dateEntity
.
getDate
(),
dateEntity
.
getDescription
(),
dateEntity
.
isarchived
(),
dateEntity
.
getID
()
,
dateEntity
.
getFolders
()
);
myDates
.
add
(
myDate
);
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllArchivedNotes/MyArchivedNotesRecyclerView/DateOrNote.java
View file @
db2e8c72
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllArchivedNotes
.
MyArchivedNotesRecyclerView
;
import
java.util.ArrayList
;
public
class
DateOrNote
{
private
int
id
;
private
String
type
;
private
String
title
;
private
String
description
;
private
ArrayList
<
String
>
folders
;
public
DateOrNote
(
int
id
,
String
type
,
String
title
,
String
description
)
{
public
DateOrNote
(
int
id
,
String
type
,
String
title
,
String
description
,
ArrayList
<
String
>
folders
)
{
this
.
id
=
id
;
this
.
type
=
type
;
this
.
title
=
title
;
this
.
description
=
description
;
this
.
folders
=
folders
;
}
public
int
getId
()
{
...
...
@@ -28,4 +32,8 @@ public class DateOrNote {
public
String
getDescription
()
{
return
description
;
}
public
ArrayList
<
String
>
getFolders
()
{
return
folders
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/AllArchivedNotes/MyArchivedNotesRecyclerView/MyArchivedAdaptor.java
View file @
db2e8c72
...
...
@@ -34,7 +34,7 @@ public class MyArchivedAdaptor extends RecyclerView.Adapter<MyArchivedAdaptor.Vi
private
void
setDates
()
{
for
(
MyDate
myDate
:
dates
)
{
if
(
myDate
.
isArchived
())
{
DateOrNote
date
=
new
DateOrNote
(
myDate
.
getId
(),
"date"
,
myDate
.
getDate
(),
myDate
.
getDescription
());
DateOrNote
date
=
new
DateOrNote
(
myDate
.
getId
(),
"date"
,
myDate
.
getDate
(),
myDate
.
getDescription
()
,
myDate
.
getFolders
()
);
dateOrNoteList
.
add
(
date
);
}
}
...
...
@@ -43,7 +43,7 @@ public class MyArchivedAdaptor extends RecyclerView.Adapter<MyArchivedAdaptor.Vi
private
void
setNotes
()
{
for
(
MyNote
myNote
:
notes
)
{
if
(
myNote
.
isArchived
())
{
DateOrNote
note
=
new
DateOrNote
(
myNote
.
getId
(),
"note"
,
myNote
.
getTitle
(),
myNote
.
getDescription
());
DateOrNote
note
=
new
DateOrNote
(
myNote
.
getId
(),
"note"
,
myNote
.
getTitle
(),
myNote
.
getDescription
()
,
myNote
.
getFolders
()
);
dateOrNoteList
.
add
(
note
);
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/AllNotesListFragment.java
View file @
db2e8c72
...
...
@@ -151,6 +151,11 @@ public class AllNotesListFragment extends Fragment {
public
void
onCloseClicked
()
{
closeClicked
(
customToolbarOption
);
}
@Override
public
void
onFolderClicked
()
{
}
});
}
...
...
@@ -195,7 +200,7 @@ public class AllNotesListFragment extends Fragment {
private
void
updatearchivedNotesInDataBase
()
{
noteDataBase
.
noteDao
().
updateNote
(
myChosenNote
.
getTitle
(),
myChosenNote
.
getDescription
()
,
myChosenNote
.
isArchived
(),
myChosenNote
.
getId
());
,
myChosenNote
.
isArchived
(),
myChosenNote
.
getId
()
,
myChosenNote
.
getFolders
()
);
}
...
...
@@ -229,7 +234,7 @@ public class AllNotesListFragment extends Fragment {
entityNotes
=
noteDataBase
.
noteDao
().
getAll
();
myNotes
=
new
ArrayList
<>();
for
(
Note
note
:
entityNotes
)
{
MyNote
myNote
=
new
MyNote
(
note
.
getTitle
(),
note
.
getDescription
(),
note
.
isarchived
(),
note
.
getID
());
MyNote
myNote
=
new
MyNote
(
note
.
getTitle
(),
note
.
getDescription
(),
note
.
isarchived
(),
note
.
getID
()
,
note
.
getFolders
()
);
myNotes
.
add
(
myNote
);
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/Converters.java
0 → 100644
View file @
db2e8c72
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
DataBase
;
import
androidx.room.TypeConverter
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
public
class
Converters
{
@TypeConverter
public
static
ArrayList
<
String
>
fromString
(
String
value
)
{
Type
listType
=
new
TypeToken
<
ArrayList
<
String
>>()
{}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
}
@TypeConverter
public
static
String
fromArrayList
(
ArrayList
<
String
>
list
)
{
Gson
gson
=
new
Gson
();
String
json
=
gson
.
toJson
(
list
);
return
json
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/DateEntity.java
View file @
db2e8c72
...
...
@@ -3,6 +3,9 @@ package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import
androidx.room.ColumnInfo
;
import
androidx.room.Entity
;
import
androidx.room.PrimaryKey
;
import
java.util.ArrayList
;
@Entity
public
class
DateEntity
{
@PrimaryKey
(
autoGenerate
=
true
)
...
...
@@ -13,11 +16,14 @@ public class DateEntity {
String
description
;
@ColumnInfo
(
name
=
"archived"
)
boolean
isarchived
;
@ColumnInfo
(
name
=
"folders"
)
ArrayList
<
String
>
folders
;
public
DateEntity
(
String
date
,
String
description
,
boolean
isarchived
){
public
DateEntity
(
String
date
,
String
description
,
boolean
isarchived
,
ArrayList
<
String
>
folders
){
this
.
date
=
date
;
this
.
description
=
description
;
this
.
isarchived
=
isarchived
;
this
.
folders
=
folders
;
}
...
...
@@ -36,4 +42,8 @@ public class DateEntity {
public
boolean
isarchived
(){
return
isarchived
;
}
public
ArrayList
<
String
>
getFolders
()
{
return
folders
;
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/DateNoreDAO.java
View file @
db2e8c72
...
...
@@ -6,6 +6,7 @@ import androidx.room.Insert;
import
androidx.room.Query
;
import
androidx.room.Update
;
import
java.util.ArrayList
;
import
java.util.List
;
@Dao
...
...
@@ -25,6 +26,6 @@ public interface DateNoreDAO {
//update data
@Query
(
"UPDATE DateEntity SET date = :date , description = :description ,archived = :isarchived Where ID = :id"
)
void
updateDate
(
String
date
,
String
description
,
boolean
isarchived
,
int
id
);
@Query
(
"UPDATE DateEntity SET date = :date , description = :description ,archived = :isarchived
,folders =:folders
Where ID = :id"
)
void
updateDate
(
String
date
,
String
description
,
boolean
isarchived
,
int
id
,
ArrayList
<
String
>
folders
);
}
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/Note.java
View file @
db2e8c72
...
...
@@ -4,6 +4,8 @@ import androidx.room.ColumnInfo;
import
androidx.room.Entity
;
import
androidx.room.PrimaryKey
;
import
java.util.ArrayList
;
@Entity
public
class
Note
{
@PrimaryKey
(
autoGenerate
=
true
)
...
...
@@ -14,11 +16,14 @@ public class Note {
String
txtBody
;
@ColumnInfo
(
name
=
"archived"
)
boolean
isarchived
;
@ColumnInfo
(
name
=
"folders"
)
ArrayList
<
String
>
folders
;
public
Note
(
String
title
,
String
txtBody
,
boolean
isarchived
)
{
public
Note
(
String
title
,
String
txtBody
,
boolean
isarchived
,
ArrayList
<
String
>
folders
)
{
this
.
title
=
title
;
this
.
txtBody
=
txtBody
;
this
.
isarchived
=
isarchived
;
this
.
folders
=
folders
;
}
...
...
@@ -37,4 +42,8 @@ public class Note {
public
boolean
isarchived
()
{
return
isarchived
;
}
public
ArrayList
<
String
>
getFolders
()
{
return
folders
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/NoteDAO.java
View file @
db2e8c72
...
...
@@ -6,6 +6,7 @@ import androidx.room.Insert;
import
androidx.room.Query
;
import
androidx.room.Update
;
import
java.util.ArrayList
;
import
java.util.List
;
@Dao
...
...
@@ -22,6 +23,6 @@ public interface NoteDAO {
@Delete
void
deleteNote
(
Note
myNote
);
@Query
(
"UPDATE Note SET title = :title , description = :description ,archived = :isarchived Where ID = :id"
)
void
updateNote
(
String
title
,
String
description
,
boolean
isarchived
,
int
id
);
@Query
(
"UPDATE Note SET title = :title , description = :description ,archived = :isarchived
, folders =:folders
Where ID = :id"
)
void
updateNote
(
String
title
,
String
description
,
boolean
isarchived
,
int
id
,
ArrayList
<
String
>
folders
);
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/DataBase/NoteDataBase.java
View file @
db2e8c72
...
...
@@ -2,8 +2,10 @@ package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import
androidx.room.Database
;
import
androidx.room.RoomDatabase
;
import
androidx.room.TypeConverters
;
@Database
(
entities
=
{
Note
.
class
,
DateEntity
.
class
,
PicsEntity
.
class
},
version
=
1
)
@TypeConverters
({
Converters
.
class
})
public
abstract
class
NoteDataBase
extends
RoomDatabase
{
public
abstract
NoteDAO
noteDao
();
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/MyNoteRecyclerView/MyNote.java
View file @
db2e8c72
package
com
.
example
.
mynotepad
.
MenuFeatures
.
AllNotes
.
MyNoteRecyclerView
;
import
java.util.ArrayList
;
public
class
MyNote
{
private
String
title
,
description
;
private
boolean
isarchived
;
int
id
;
private
int
id
;
private
ArrayList
<
String
>
folders
;
public
MyNote
(
String
title
,
String
description
,
boolean
isarchived
,
int
id
)
{
public
MyNote
(
String
title
,
String
description
,
boolean
isarchived
,
int
id
,
ArrayList
<
String
>
folders
)
{
this
.
title
=
title
;
this
.
description
=
description
;
this
.
isarchived
=
isarchived
;
this
.
id
=
id
;
this
.
folders
=
folders
;
}
public
String
getTitle
()
{
...
...
@@ -32,4 +36,8 @@ public class MyNote {
public
int
getId
()
{
return
id
;
}
public
ArrayList
<
String
>
getFolders
()
{
return
folders
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/Note/NoteFragment.java
View file @
db2e8c72
...
...
@@ -101,9 +101,11 @@ public class NoteFragment extends Fragment {
else
if
(
type
.
equals
(
"noteDate"
))
{
System
.
out
.
println
(
"+++++++++++++++++++++++++++++++++++++++++++++++++++++"
);
if
(
noteDateType
.
equals
(
"note"
))
{
noteDataBase
.
noteDao
().
updateNote
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
true
,
ArchivedNoesListFragment
.
chosenDateOrNote
.
getId
());
noteDataBase
.
noteDao
().
updateNote
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
true
,
ArchivedNoesListFragment
.
chosenDateOrNote
.
getId
()
,
null
);
//todo ooooooooooooooooooooooo
}
else
if
(
noteDateType
.
equals
(
"date"
))
{
noteDataBase
.
dateNoreDAO
().
updateDate
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
true
,
ArchivedNoesListFragment
.
chosenDateOrNote
.
getId
());
noteDataBase
.
dateNoreDAO
().
updateDate
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
true
,
ArchivedNoesListFragment
.
chosenDateOrNote
.
getId
()
,
ArchivedNoesListFragment
.
chosenDateOrNote
.
getFolders
());
}
}
if
(
getActivity
()
!=
null
)
...
...
@@ -120,11 +122,12 @@ public class NoteFragment extends Fragment {
private
void
saveNote
()
{
if
(
isAnewNote
)
{
note
=
new
Note
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
false
);
note
=
new
Note
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
false
,
null
);
//todo oooooooooooooooooooo add folders
noteDataBase
.
noteDao
().
insertNote
(
note
);
Toast
.
makeText
(
getActivity
(),
"saved"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
noteDataBase
.
noteDao
().
updateNote
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
AllNotesListFragment
.
myChosenNote
.
isArchived
(),
AllNotesListFragment
.
myChosenNote
.
getId
());
noteDataBase
.
noteDao
().
updateNote
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
AllNotesListFragment
.
myChosenNote
.
isArchived
(),
AllNotesListFragment
.
myChosenNote
.
getId
()
,
AllNotesListFragment
.
myChosenNote
.
getFolders
());
Toast
.
makeText
(
getActivity
(),
"updated"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
...
...
@@ -132,11 +135,12 @@ public class NoteFragment extends Fragment {
private
void
saveCalenderNote
()
{
if
(
isAnewNote
)
{
dateEntity
=
new
DateEntity
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
false
);
dateEntity
=
new
DateEntity
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
false
,
null
);
// todo ooooooooooooooooooooooooooo add foldesr==rs
noteDataBase
.
dateNoreDAO
().
insertDateNote
(
dateEntity
);
Toast
.
makeText
(
getActivity
(),
"saved"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
noteDataBase
.
dateNoreDAO
().
updateDate
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
CalenderNotesListFragment
.
myChosenDateNote
.
isArchived
(),
CalenderNotesListFragment
.
myChosenDateNote
.
getId
());
noteDataBase
.
dateNoreDAO
().
updateDate
(
titleTxt
.
getText
().
toString
(),
bodyTxt
.
getText
().
toString
(),
CalenderNotesListFragment
.
myChosenDateNote
.
isArchived
(),
CalenderNotesListFragment
.
myChosenDateNote
.
getId
()
,
CalenderNotesListFragment
.
myChosenDateNote
.
getFolders
()
);
Toast
.
makeText
(
getActivity
(),
"updated"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/CalenderNotesListFragment.java
View file @
db2e8c72
...
...
@@ -160,6 +160,9 @@ public class CalenderNotesListFragment extends Fragment {
public
void
onCloseClicked
()
{
closeClicked
();
}
@Override
public
void
onFolderClicked
()
{
}
});
}
...
...
@@ -206,7 +209,7 @@ public class CalenderNotesListFragment extends Fragment {
}
private
void
updatearchivedDatesInDataBase
()
{
noteDataBase
.
dateNoreDAO
().
updateDate
(
myChosenDateNote
.
getDate
(),
myChosenDateNote
.
getDescription
(),
myChosenDateNote
.
isArchived
(),
myChosenDateNote
.
getId
());
noteDataBase
.
dateNoreDAO
().
updateDate
(
myChosenDateNote
.
getDate
(),
myChosenDateNote
.
getDescription
(),
myChosenDateNote
.
isArchived
(),
myChosenDateNote
.
getId
()
,
myChosenDateNote
.
getFolders
()
);
}
...
...
@@ -215,7 +218,7 @@ public class CalenderNotesListFragment extends Fragment {
entityDates
=
noteDataBase
.
dateNoreDAO
().
getAllDateNotes
();
myDates
=
new
ArrayList
<>();
for
(
DateEntity
dateEntity
:
entityDates
)
{
MyDate
myDate
=
new
MyDate
(
dateEntity
.
getDate
(),
dateEntity
.
getDescription
(),
dateEntity
.
isarchived
(),
dateEntity
.
getID
());
MyDate
myDate
=
new
MyDate
(
dateEntity
.
getDate
(),
dateEntity
.
getDescription
(),
dateEntity
.
isarchived
(),
dateEntity
.
getID
()
,
dateEntity
.
getFolders
()
);
myDates
.
add
(
myDate
);
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/TimePicker/MyDate.java
View file @
db2e8c72
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Calender
.
MyCalenderRecyclerView
.
TimePicker
;
import
java.util.ArrayList
;
public
class
MyDate
{
private
String
date
,
description
;
private
boolean
isArchived
;
int
id
;
private
int
id
;
private
ArrayList
<
String
>
folders
;
public
MyDate
(
String
date
,
String
description
,
boolean
isarchived
,
int
id
)
{
public
MyDate
(
String
date
,
String
description
,
boolean
isarchived
,
int
id
,
ArrayList
<
String
>
folders
)
{
this
.
date
=
date
;
this
.
description
=
description
;
this
.
isArchived
=
isarchived
;
this
.
id
=
id
;
this
.
folders
=
folders
;
}
public
String
getDate
()
{
...
...
@@ -32,4 +36,8 @@ public class MyDate {
public
int
getId
()
{
return
id
;
}
public
ArrayList
<
String
>
getFolders
()
{
return
folders
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Calender/MyCalenderRecyclerView/TimePicker/TimePickerFragment.java
View file @
db2e8c72
...
...
@@ -2,11 +2,13 @@ package com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimeP
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.Fragment
;
import
android.view.LayoutInflater
;
...
...
@@ -20,6 +22,7 @@ import com.alirezaafkar.sundatepicker.DatePicker;
import
com.alirezaafkar.sundatepicker.interfaces.DateSetListener
;
import
com.example.mynotepad.MenuFeatures.AllNotes.DataBase.DateEntity
;
import
com.example.mynotepad.MenuFeatures.Calender.Date
;
import
com.example.mynotepad.MenuFeatures.Utils
;
import
com.example.mynotepad.R
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.android.material.snackbar.Snackbar
;
...
...
@@ -35,6 +38,7 @@ public class TimePickerFragment extends Fragment {
private
TextView
description
;
private
Date
mDate
;
private
FloatingActionButton
back
;
private
ConstraintLayout
allNotesListLayout
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
...
...
@@ -48,8 +52,19 @@ public class TimePickerFragment extends Fragment {
super
.
onViewCreated
(
view
,
savedInstanceState
);
init
(
view
);
showTimePicker
();
setBg
(
Utils
.
sTheme
);
}
private
void
setBg
(
String
sTheme
)
{
switch
(
sTheme
)
{
case
"dark"
:
allNotesListLayout
.
setBackgroundResource
(
R
.
drawable
.
main_bg_dark
);
break
;
case
"bright"
:
allNotesListLayout
.
setBackgroundResource
(
R
.
drawable
.
main_bg_bright
);
break
;
}
}
private
void
init
(
View
view
)
{
chosenDate
=
view
.
findViewById
(
R
.
id
.
myTitle
);
...
...
@@ -61,6 +76,14 @@ public class TimePickerFragment extends Fragment {
showAlert
(
view
);
}
});
allNotesListLayout
=
view
.
findViewById
(
R
.
id
.
noteLayout
);
chosenDate
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
showTimePicker
();
}
});
}
...
...
@@ -113,7 +136,7 @@ public class TimePickerFragment extends Fragment {
private
void
saveDateNote
()
{
//todo save in data base
dateEntity
=
new
DateEntity
(
chosenDate
.
getText
().
toString
(),
description
.
getText
().
toString
(),
false
);
dateEntity
=
new
DateEntity
(
chosenDate
.
getText
().
toString
(),
description
.
getText
().
toString
(),
false
,
null
);
//todo ooooooooo add folders
noteDataBase
.
dateNoreDAO
().
insertDateNote
(
dateEntity
);
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/CustomToolbarOption.java
View file @
db2e8c72
...
...
@@ -10,8 +10,7 @@ import android.widget.LinearLayout;
import
com.example.mynotepad.R
;
public
class
CustomToolbarOption
extends
LinearLayout
implements
View
.
OnClickListener
{
private
View
rootView
;
private
ImageView
blackStarImg
,
yellowStarImg
,
deleteImg
,
closeImg
;
private
ImageView
blackStarImg
,
yellowStarImg
,
deleteImg
,
closeImg
,
folderImg
;
private
CustomToolbarOptionListener
customToolbarOptionListener
;
public
CustomToolbarOption
(
Context
context
)
{
...
...
@@ -24,30 +23,33 @@ public class CustomToolbarOption extends LinearLayout implements View.OnClickLis
init
(
context
);
}
private
void
init
(
Context
context
){
rootView
=
inflate
(
context
,
R
.
layout
.
custom_toolbar_options
,
this
);
private
void
init
(
Context
context
)
{
View
rootView
=
inflate
(
context
,
R
.
layout
.
custom_toolbar_options
,
this
);
blackStarImg
=
findViewById
(
R
.
id
.
black_star
);
yellowStarImg
=
findViewById
(
R
.
id
.
yellow_star
);
deleteImg
=
findViewById
(
R
.
id
.
deleteImg
);
closeImg
=
findViewById
(
R
.
id
.
closeImg
);
folderImg
=
findViewById
(
R
.
id
.
folderImg
);
yellowStarImg
.
setOnClickListener
(
this
);
blackStarImg
.
setOnClickListener
(
this
);
deleteImg
.
setOnClickListener
(
this
);
closeImg
.
setOnClickListener
(
this
);
folderImg
.
setOnClickListener
(
this
);
}
@Override
public
void
onClick
(
View
view
)
{
if
(
customToolbarOptionListener
!=
null
){
if
(
customToolbarOptionListener
!=
null
)
{
if
(
view
.
getId
()
==
closeImg
.
getId
())
customToolbarOptionListener
.
onCloseClicked
();
if
(
view
.
getId
()
==
deleteImg
.
getId
())
customToolbarOptionListener
.
onDeleteClicked
();
if
(
view
.
getId
()
==
yellowStarImg
.
getId
()
||
view
.
getId
()
==
blackStarImg
.
getId
())
customToolbarOptionListener
.
onStarClicked
();
if
(
view
.
getId
()
==
folderImg
.
getId
())
customToolbarOptionListener
.
onFolderClicked
();
}
}
...
...
@@ -55,22 +57,27 @@ public class CustomToolbarOption extends LinearLayout implements View.OnClickLis
this
.
customToolbarOptionListener
=
customToolbarOptionListener
;
}
public
void
setYellowStar
(){
public
void
setYellowStar
()
{
yellowStarImg
.
setVisibility
(
VISIBLE
);
blackStarImg
.
setVisibility
(
GONE
);
}
public
void
setBlackStar
(){
public
void
setBlackStar
()
{
yellowStarImg
.
setVisibility
(
GONE
);
blackStarImg
.
setVisibility
(
VISIBLE
);
}
public
void
hideRecycleBin
(){
public
void
hideRecycleBin
()
{
deleteImg
.
setVisibility
(
GONE
);
}
public
void
hideStar
(){
public
void
hideStar
()
{
yellowStarImg
.
setVisibility
(
GONE
);
blackStarImg
.
setVisibility
(
GONE
);
}
public
void
hideFolder
()
{
folderImg
.
setVisibility
(
GONE
);
folderImg
.
setVisibility
(
GONE
);
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/CustomToolbarOptionListener.java
View file @
db2e8c72
...
...
@@ -5,4 +5,5 @@ public interface CustomToolbarOptionListener {
void
onStarClicked
();
void
onDeleteClicked
();
void
onCloseClicked
();
void
onFolderClicked
();
}
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/AudioListFragment.java
View file @
db2e8c72
...
...
@@ -125,6 +125,7 @@ public class AudioListFragment extends Fragment {
public
void
onItemLongClicked
(
MyVoice
item
)
{
customToolbarOption
.
setVisibility
(
View
.
VISIBLE
);
customToolbarOption
.
hideStar
();
customToolbarOption
.
hideFolder
();
myChosenVoice
=
item
;
}
});
...
...
@@ -144,6 +145,11 @@ public class AudioListFragment extends Fragment {
public
void
onCloseClicked
()
{
customToolbarOption
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onFolderClicked
()
{
}
});
}
...
...
app/src/main/res/layout/custom_toolbar_options.xml
View file @
db2e8c72
...
...
@@ -2,6 +2,7 @@
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:background=
"?colorPrimary"
android:orientation=
"horizontal"
>
...
...
@@ -12,20 +13,21 @@
android:layout_height=
"match_parent"
android:layout_alignParentRight=
"true"
android:layout_marginRight=
"20dp"
app:tint=
"?android:textColorPrimary"
android:src=
"@drawable/close"
/>
<FrameLayout
android:id=
"@+id/star"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_alignRight=
"@+id/
close
Img"
android:layout_alignRight=
"@+id/
folder
Img"
android:layout_marginRight=
"40dp"
>
<ImageView
android:id=
"@+id/black_star"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
app:tint=
"?android:textColorPrimary"
android:src=
"@drawable/ic_black_star"
/>
<ImageView
...
...
@@ -34,14 +36,25 @@
android:layout_height=
"match_parent"
android:src=
"@drawable/ic_yellow_star"
/>
</FrameLayout>
<ImageView
android:id=
"@+id/folderImg"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
app:tint=
"?android:textColorPrimary"
android:layout_alignRight=
"@id/deleteImg"
android:layout_marginRight=
"40dp"
android:src=
"@drawable/folder"
/>
<ImageView
android:id=
"@+id/deleteImg"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_alignRight=
"@id/
star
"
android:layout_alignRight=
"@id/
closeImg
"
android:layout_marginRight=
"40dp"
app:tint=
"?android:textColorPrimary"
android:src=
"@drawable/ic_bin"
/>
...
...
build.gradle
View file @
db2e8c72
...
...
@@ -3,6 +3,10 @@ buildscript {
repositories
{
maven
{
url
'http://maven.google.com'
}
jcenter
()
maven
{
url
"https://jitpack.io"
}
}
dependencies
{
classpath
"com.android.tools.build:gradle:4.0.1"
...
...
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