Commit 7fb927f7 by Paktalin

Fixed the bug with starting tag state when being in edit mode

parent f0081656
......@@ -136,7 +136,8 @@ class MainActivity : AppCompatActivity() {
private fun whenSelectionChanges(selection: Selection<Long>) {
vocabularyAdapter?.let {
if (!selection.isEmpty && it.state.notAddOrEdit()) {
if (it.state.notAddOrEdit()) {
if (!selection.isEmpty) {
vocabularyAdapter?.state = State.TAG
tagFragment.setSelection(selection.toList())
addFragment(supportFragmentManager, tagFragment, R.id.main_activity_container)
......@@ -146,6 +147,7 @@ class MainActivity : AppCompatActivity() {
}
}
}
}
override fun onPause() {
super.onPause()
......
......@@ -22,6 +22,7 @@ class SubmitEditedFragment : SubmitFragment() {
scrollToPositionWithOffset(recyclerViewPosition, 2)
isScrollEnabled = false
}
mainActivity.vocabularyAdapter?.state = State.EDIT
gone(clickableView)
wordEt.requestFocus()
......
package com.paktalin.vocabularynotebook.ui.recycler_view
import com.paktalin.vocabularynotebook.ui.activities.MainActivity
enum class State {
EDIT, ADD, TAG, NONE;
fun notAddOrEdit(): Boolean {
return this != ADD && this != EDIT
}
companion object {
private val TAGG = "VN/" + MainActivity::class.simpleName
}
}
\ No newline at end of file
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