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
9b814d03
authored
Sep 12, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with WordItem's time
parent
548c2ee9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
app/src/main/java/com/paktalin/vocabularynotebook/VocabularyAdapter.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/VocabularyAdapter.kt
View file @
9b814d03
...
@@ -84,9 +84,7 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
...
@@ -84,9 +84,7 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
private
fun
sortByTime
()
{
private
fun
sortByTime
()
{
wordItems
.
sortWith
(
Comparator
{
item1
,
item2
->
wordItems
.
sortWith
(
Comparator
{
item1
,
item2
->
-
item1
.
pojo
.
time
!!
.
compareTo
(
item2
.
pojo
.
time
)
-
item1
.
pojo
.
time
!!
.
compareTo
(
item2
.
pojo
.
time
)
})
})
wordItems
.
forEach
{
item
->
Log
.
d
(
TAG
,
item
.
pojo
.
print
())}
}
}
fun
sort
()
{
fun
sort
()
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/EditWordFragment.kt
View file @
9b814d03
...
@@ -32,8 +32,8 @@ class EditWordFragment : WordFragment() {
...
@@ -32,8 +32,8 @@ class EditWordFragment : WordFragment() {
}
}
private
fun
setWordItemData
()
{
private
fun
setWordItemData
()
{
word
.
setText
(
wordItem
.
pojo
!!
.
word
)
word
.
setText
(
wordItem
.
pojo
.
word
)
translation
.
setText
(
wordItem
.
pojo
!!
.
translation
)
translation
.
setText
(
wordItem
.
pojo
.
translation
)
}
}
private
fun
setFocusOnWord
()
{
private
fun
setFocusOnWord
()
{
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/VocabularyFragment.kt
View file @
9b814d03
...
@@ -7,6 +7,7 @@ import android.util.Log
...
@@ -7,6 +7,7 @@ import android.util.Log
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
com.google.firebase.Timestamp
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.auth.FirebaseAuth
import
com.google.firebase.firestore.DocumentSnapshot
import
com.google.firebase.firestore.DocumentSnapshot
import
com.google.firebase.firestore.Query
import
com.google.firebase.firestore.Query
...
@@ -14,6 +15,7 @@ import com.paktalin.vocabularynotebook.*
...
@@ -14,6 +15,7 @@ import com.paktalin.vocabularynotebook.*
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
import
com.paktalin.vocabularynotebook.firestoreitems.WordItem
import
com.paktalin.vocabularynotebook.firestoreitems.WordItem
import
kotlinx.android.synthetic.main.fragment_vocabulary.*
import
kotlinx.android.synthetic.main.fragment_vocabulary.*
import
java.util.*
class
VocabularyFragment
:
Fragment
()
{
class
VocabularyFragment
:
Fragment
()
{
companion
object
{
companion
object
{
...
@@ -64,9 +66,10 @@ class VocabularyFragment : Fragment() {
...
@@ -64,9 +66,10 @@ class VocabularyFragment : Fragment() {
val
wordItems
:
MutableList
<
WordItem
>
=
mutableListOf
()
val
wordItems
:
MutableList
<
WordItem
>
=
mutableListOf
()
for
(
ref
in
documents
)
{
for
(
ref
in
documents
)
{
val
word
=
ref
.
get
(
"word"
).
toString
()
val
word
=
ref
[
"word"
].
toString
()
val
translation
=
ref
.
get
(
"translation"
).
toString
()
val
translation
=
ref
[
"translation"
].
toString
()
wordItems
.
add
(
WordItem
(
word
,
translation
,
ref
.
id
,
vocabularyId
))
val
time
=
ref
[
"time"
]
as
Timestamp
wordItems
.
add
(
WordItem
(
word
,
translation
,
time
.
toDate
(),
ref
.
id
,
vocabularyId
))
}
}
val
adapter
=
VocabularyAdapter
(
wordItems
,
activity
!!
)
val
adapter
=
VocabularyAdapter
(
wordItems
,
activity
!!
)
...
...
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