Commit bb6016cf by Paktalin

Minor refactoring

parent f33592da
...@@ -18,8 +18,8 @@ class AddWordFragment : WordFragment() { ...@@ -18,8 +18,8 @@ class AddWordFragment : WordFragment() {
override fun saveToFirestore(wordPojo: WordItem.Pojo, vocabularyId: String) { override fun saveToFirestore(wordPojo: WordItem.Pojo, vocabularyId: String) {
ConfiguredFirestore.instance ConfiguredFirestore.instance
.collection(VOCABULARIES).document(vocabularyId) .collection(vocabularies).document(vocabularyId)
.collection(WORDS).add(wordPojo) .collection(words).add(wordPojo)
.addOnSuccessListener { .addOnSuccessListener {
Log.i(TAG, "Successfully added a new word") Log.i(TAG, "Successfully added a new word")
clearFields() clearFields()
......
...@@ -53,8 +53,8 @@ class EditWordFragment : WordFragment() { ...@@ -53,8 +53,8 @@ class EditWordFragment : WordFragment() {
override fun saveToFirestore(wordPojo: WordItem.Pojo, vocabularyId: String) { override fun saveToFirestore(wordPojo: WordItem.Pojo, vocabularyId: String) {
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)
.addOnSuccessListener { .addOnSuccessListener {
Log.i(TAG, "Successfully updated the word") Log.i(TAG, "Successfully updated the word")
hideSubmitButton() hideSubmitButton()
...@@ -71,5 +71,4 @@ class EditWordFragment : WordFragment() { ...@@ -71,5 +71,4 @@ class EditWordFragment : WordFragment() {
} }
companion object { private val TAG = "VN/" + EditWordFragment::class.java.simpleName } companion object { private val TAG = "VN/" + EditWordFragment::class.java.simpleName }
} }
\ No newline at end of file
...@@ -12,8 +12,8 @@ import com.paktalin.vocabularynotebook.WordItem ...@@ -12,8 +12,8 @@ import com.paktalin.vocabularynotebook.WordItem
import kotlinx.android.synthetic.main.fragment_new_word.* import kotlinx.android.synthetic.main.fragment_new_word.*
abstract class WordFragment : Fragment() { abstract class WordFragment : Fragment() {
protected val VOCABULARIES = "vocabularies" protected val vocabularies = "vocabularies"
protected val WORDS = "words" protected val words = "words"
private var wordEmpty: Boolean = true private var wordEmpty: Boolean = true
set(value) { field = value; updateButtons() } set(value) { field = value; updateButtons() }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment