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
3134bda9
authored
Sep 12, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with WordItem's time
parent
9b814d03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
app/src/main/java/com/paktalin/vocabularynotebook/firestoreitems/WordItem.kt
app/src/main/java/com/paktalin/vocabularynotebook/firestoreitems/WordItem.kt
0 → 100644
View file @
3134bda9
package
com.paktalin.vocabularynotebook.firestoreitems
import
android.util.Log
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
java.io.Serializable
import
java.util.Date
class
WordItem
(
word
:
String
,
translation
:
String
,
time
:
Date
?,
var
id
:
String
,
private
val
vocabularyId
:
String
)
:
Serializable
{
var
pojo
:
Pojo
=
Pojo
(
word
,
translation
,
time
)
class
Pojo
(
var
word
:
String
,
var
translation
:
String
,
var
time
:
Date
?)
:
Serializable
{
init
{
if
(
time
==
null
)
time
=
Date
(
System
.
currentTimeMillis
())
}
fun
print
():
String
{
return
"word: $word; translation: $translation; time: $time"
}
}
constructor
(
pojo
:
Pojo
,
id
:
String
,
vocabularyId
:
String
)
:
this
(
pojo
.
word
,
pojo
.
translation
,
pojo
.
time
,
id
,
vocabularyId
)
fun
delete
()
{
ConfiguredFirestore
.
instance
.
collection
(
"vocabularies"
).
document
(
vocabularyId
)
.
collection
(
"words"
).
document
(
id
).
delete
()
.
addOnSuccessListener
{
Log
.
i
(
TAG
,
"Successfully deleted word with id $id"
)
}
.
addOnFailureListener
{
e
->
Log
.
w
(
TAG
,
"deleteWordWithId $id:failure"
,
e
.
fillInStackTrace
())
}
}
companion
object
{
private
val
TAG
=
"VN/"
+
WordItem
::
class
.
java
.
simpleName
}
}
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