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
97b5eba8
authored
Sep 08, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retrieves real vocabulary data
parent
254957f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
app/src/main/java/com/paktalin/vocabularynotebook/activities/VocabularyFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/activities/VocabularyFragment.kt
View file @
97b5eba8
...
@@ -75,22 +75,7 @@ class VocabularyFragment : Fragment() {
...
@@ -75,22 +75,7 @@ class VocabularyFragment : Fragment() {
val
vocabularyTitle
=
task
.
get
(
"title"
).
toString
()
val
vocabularyTitle
=
task
.
get
(
"title"
).
toString
()
tvUserData
.
append
(
"\n\nvocabularies:\n$vocabularyTitle"
)
tvUserData
.
append
(
"\n\nvocabularies:\n$vocabularyTitle"
)
}
}
val
mLayoutManager
=
LinearLayoutManager
(
activity
)
retrieveWordsFromVocabulary
()
recyclerView
.
layoutManager
=
mLayoutManager
recyclerView
.
setHasFixedSize
(
true
)
val
items
:
List
<
WordItemPojo
>
=
Arrays
.
asList
(
WordItemPojo
(
"uno"
,
"one"
),
WordItemPojo
(
"due"
,
"two"
),
WordItemPojo
(
"tre"
,
"three"
))
val
adapter
=
VocabularyAdapter
(
items
)
recyclerView
.
adapter
=
adapter
/*vocabulary.collection(WORDS).get().addOnSuccessListener {
val items: List<String> = Arrays.asList("one", "two", "three")
val adapter = VocabularyAdapter(items)
recyclerView.adapter = adapter
}*/
}
}
private
fun
addWord
()
{
private
fun
addWord
()
{
...
@@ -100,6 +85,21 @@ class VocabularyFragment : Fragment() {
...
@@ -100,6 +85,21 @@ class VocabularyFragment : Fragment() {
}
}
private
fun
retrieveWordsFromVocabulary
()
{
private
fun
retrieveWordsFromVocabulary
()
{
val
mLayoutManager
=
LinearLayoutManager
(
activity
)
recyclerView
.
layoutManager
=
mLayoutManager
recyclerView
.
setHasFixedSize
(
true
)
vocabulary
.
collection
(
WORDS
).
get
().
addOnSuccessListener
{
val
wordItems
:
MutableList
<
WordItemPojo
>
=
mutableListOf
()
for
(
ref
in
it
.
documents
)
{
val
word
=
ref
.
get
(
"word"
).
toString
()
val
translation
=
ref
.
get
(
"translation"
).
toString
()
wordItems
.
add
(
WordItemPojo
(
word
,
translation
))
}
val
adapter
=
VocabularyAdapter
(
wordItems
)
recyclerView
.
adapter
=
adapter
}
}
}
}
}
\ 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