Commit a419bbf5 by Paktalin

Refactoring

parent c882a289
...@@ -28,7 +28,6 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi ...@@ -28,7 +28,6 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi
private lateinit var recyclerView: RecyclerView private lateinit var recyclerView: RecyclerView
private lateinit var viewHolder: ViewHolder private lateinit var viewHolder: ViewHolder
private var tracker: SelectionTracker<Long>? = null private var tracker: SelectionTracker<Long>? = null
private var menu = true
init { init {
setHasStableIds(true) setHasStableIds(true)
...@@ -68,7 +67,6 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi ...@@ -68,7 +67,6 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi
} }
private fun showPopupMenu(v: View, position: Int) { private fun showPopupMenu(v: View, position: Int) {
if (menu) {
val popup = PopupMenu(mainActivity, v) val popup = PopupMenu(mainActivity, v)
popup.menuInflater.inflate(R.menu.word_item_menu, popup.menu) popup.menuInflater.inflate(R.menu.word_item_menu, popup.menu)
popup.setOnMenuItemClickListener { popup.setOnMenuItemClickListener {
...@@ -83,18 +81,9 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi ...@@ -83,18 +81,9 @@ class VocabularyAdapter(private val vocabulary: VocabSet, private val mainActivi
// if not edit mode, then start EditFragment // if not edit mode, then start EditFragment
if (mainActivity.supportFragmentManager.findFragmentByTag("edit_fragment") == null) if (mainActivity.supportFragmentManager.findFragmentByTag("edit_fragment") == null)
popup.show() popup.show()
} else {
Log.d(TAG, "not menu!")
}
} }
fun refresh() { fun refresh() {}
/*displayedVocabulary.clear()
FirestoreManager().extractVocabulary { documents ->
displayedVocabulary.addWordsAsDocuments(documents)
this.notifyDataSetChanged()
}*/
}
private fun deleteWord(wordPojo: WordPojo, position: Int) { private fun deleteWord(wordPojo: WordPojo, position: Int) {
vocabulary.deleteWord(wordPojo) vocabulary.deleteWord(wordPojo)
......
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