Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
vocabulary_notebook
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0608c4c0
authored
Sep 13, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with overwriting time
parent
c4329ccd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
app/src/main/java/com/paktalin/vocabularynotebook/ui/AddWordFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/EditWordFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/VocabularyFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/WordFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/AddWordFragment.kt
View file @
0608c4c0
...
@@ -7,8 +7,8 @@ import com.paktalin.vocabularynotebook.firestoreitems.WordItem
...
@@ -7,8 +7,8 @@ import com.paktalin.vocabularynotebook.firestoreitems.WordItem
class
AddWordFragment
:
WordFragment
()
{
class
AddWordFragment
:
WordFragment
()
{
override
fun
saveToFirestore
(
word
Pojo
:
WordItem
.
Pojo
,
vocabularyId
:
String
)
{
override
fun
saveToFirestore
(
word
:
String
,
translation
:
String
,
vocabularyId
:
String
)
{
mainActivity
.
showProgressBar
(
)
val
wordPojo
=
WordItem
.
Pojo
(
word
,
translation
,
null
)
ConfiguredFirestore
.
instance
ConfiguredFirestore
.
instance
.
collection
(
VOCABULARIES
).
document
(
vocabularyId
)
.
collection
(
VOCABULARIES
).
document
(
vocabularyId
)
.
collection
(
WORDS
).
add
(
wordPojo
)
.
collection
(
WORDS
).
add
(
wordPojo
)
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/EditWordFragment.kt
View file @
0608c4c0
...
@@ -49,8 +49,8 @@ class EditWordFragment : WordFragment() {
...
@@ -49,8 +49,8 @@ class EditWordFragment : WordFragment() {
}
}
}
}
override
fun
saveToFirestore
(
word
Pojo
:
WordItem
.
Pojo
,
vocabularyId
:
String
)
{
override
fun
saveToFirestore
(
word
:
String
,
translation
:
String
,
vocabularyId
:
String
)
{
mainActivity
.
showProgressBar
(
)
val
wordPojo
=
WordItem
.
Pojo
(
word
,
translation
,
wordItem
.
pojo
.
time
)
ConfiguredFirestore
.
instance
ConfiguredFirestore
.
instance
.
collection
(
VOCABULARIES
).
document
(
vocabularyId
)
.
collection
(
VOCABULARIES
).
document
(
vocabularyId
)
.
collection
(
WORDS
).
document
(
wordItem
.
id
).
set
(
wordPojo
)
.
collection
(
WORDS
).
document
(
wordItem
.
id
).
set
(
wordPojo
)
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/VocabularyFragment.kt
View file @
0608c4c0
...
@@ -76,11 +76,11 @@ class VocabularyFragment : Fragment() {
...
@@ -76,11 +76,11 @@ class VocabularyFragment : Fragment() {
recyclerView
.
adapter
=
adapter
recyclerView
.
adapter
=
adapter
}
}
fun
addWordItem
(
newWord
Item
:
WordItem
)
{
fun
addWordItem
(
newWord
:
WordItem
)
{
(
recyclerView
.
adapter
as
VocabularyAdapter
).
addWord
(
newWord
Item
)
(
recyclerView
.
adapter
as
VocabularyAdapter
).
addWord
(
newWord
)
}
}
fun
updateWordItem
(
updatedWord
Item
:
WordItem
)
{
fun
updateWordItem
(
updatedWord
:
WordItem
)
{
(
recyclerView
.
adapter
as
VocabularyAdapter
).
updateWord
(
updatedWord
Item
)
(
recyclerView
.
adapter
as
VocabularyAdapter
).
updateWord
(
updatedWord
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/paktalin/vocabularynotebook/ui/WordFragment.kt
View file @
0608c4c0
...
@@ -78,9 +78,8 @@ abstract class WordFragment : Fragment() {
...
@@ -78,9 +78,8 @@ abstract class WordFragment : Fragment() {
val
word
=
word
.
text
.
toString
()
val
word
=
word
.
text
.
toString
()
val
translation
=
translation
.
text
.
toString
()
val
translation
=
translation
.
text
.
toString
()
val
vocabularyId
=
mainActivity
.
vocabularyId
val
vocabularyId
=
mainActivity
.
vocabularyId
val
wordPojo
=
WordItem
.
Pojo
(
word
,
translation
,
null
)
mainActivity
.
showProgressBar
()
saveToFirestore
(
word
,
translation
,
vocabularyId
)
saveToFirestore
(
wordPojo
,
vocabularyId
)
return
return
}
}
...
@@ -89,6 +88,6 @@ abstract class WordFragment : Fragment() {
...
@@ -89,6 +88,6 @@ abstract class WordFragment : Fragment() {
translation
.
text
.
clear
()
translation
.
text
.
clear
()
}
}
protected
abstract
fun
saveToFirestore
(
word
Pojo
:
WordItem
.
Pojo
,
vocabularyId
:
String
)
protected
abstract
fun
saveToFirestore
(
word
:
String
,
translation
:
String
,
vocabularyId
:
String
)
protected
abstract
fun
updateRecycleView
(
wordItem
:
WordItem
)
protected
abstract
fun
updateRecycleView
(
wordItem
:
WordItem
)
}
}
\ 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